diff options
Diffstat (limited to 'fs/ocfs2/super.c')
-rw-r--r-- | fs/ocfs2/super.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index 86b559c7dce9..3a5a1ed09ac9 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c | |||
@@ -82,7 +82,8 @@ MODULE_AUTHOR("Oracle"); | |||
82 | MODULE_LICENSE("GPL"); | 82 | MODULE_LICENSE("GPL"); |
83 | 83 | ||
84 | static int ocfs2_parse_options(struct super_block *sb, char *options, | 84 | static int ocfs2_parse_options(struct super_block *sb, char *options, |
85 | unsigned long *mount_opt, int is_remount); | 85 | unsigned long *mount_opt, s16 *slot, |
86 | int is_remount); | ||
86 | static void ocfs2_put_super(struct super_block *sb); | 87 | static void ocfs2_put_super(struct super_block *sb); |
87 | static int ocfs2_mount_volume(struct super_block *sb); | 88 | static int ocfs2_mount_volume(struct super_block *sb); |
88 | static int ocfs2_remount(struct super_block *sb, int *flags, char *data); | 89 | static int ocfs2_remount(struct super_block *sb, int *flags, char *data); |
@@ -114,8 +115,6 @@ static void ocfs2_write_super(struct super_block *sb); | |||
114 | static struct inode *ocfs2_alloc_inode(struct super_block *sb); | 115 | static struct inode *ocfs2_alloc_inode(struct super_block *sb); |
115 | static void ocfs2_destroy_inode(struct inode *inode); | 116 | static void ocfs2_destroy_inode(struct inode *inode); |
116 | 117 | ||
117 | static unsigned long long ocfs2_max_file_offset(unsigned int blockshift); | ||
118 | |||
119 | static const struct super_operations ocfs2_sops = { | 118 | static const struct super_operations ocfs2_sops = { |
120 | .statfs = ocfs2_statfs, | 119 | .statfs = ocfs2_statfs, |
121 | .alloc_inode = ocfs2_alloc_inode, | 120 | .alloc_inode = ocfs2_alloc_inode, |
@@ -140,6 +139,7 @@ enum { | |||
140 | Opt_data_ordered, | 139 | Opt_data_ordered, |
141 | Opt_data_writeback, | 140 | Opt_data_writeback, |
142 | Opt_atime_quantum, | 141 | Opt_atime_quantum, |
142 | Opt_slot, | ||
143 | Opt_err, | 143 | Opt_err, |
144 | }; | 144 | }; |
145 | 145 | ||
@@ -154,6 +154,7 @@ static match_table_t tokens = { | |||
154 | {Opt_data_ordered, "data=ordered"}, | 154 | {Opt_data_ordered, "data=ordered"}, |
155 | {Opt_data_writeback, "data=writeback"}, | 155 | {Opt_data_writeback, "data=writeback"}, |
156 | {Opt_atime_quantum, "atime_quantum=%u"}, | 156 | {Opt_atime_quantum, "atime_quantum=%u"}, |
157 | {Opt_slot, "preferred_slot=%u"}, | ||
157 | {Opt_err, NULL} | 158 | {Opt_err, NULL} |
158 | }; | 159 | }; |
159 | 160 | ||
@@ -318,7 +319,7 @@ static void ocfs2_destroy_inode(struct inode *inode) | |||
318 | /* From xfs_super.c:xfs_max_file_offset | 319 | /* From xfs_super.c:xfs_max_file_offset |
319 | * Copyright (c) 2000-2004 Silicon Graphics, Inc. | 320 | * Copyright (c) 2000-2004 Silicon Graphics, Inc. |
320 | */ | 321 | */ |
321 | static unsigned long long ocfs2_max_file_offset(unsigned int blockshift) | 322 | unsigned long long ocfs2_max_file_offset(unsigned int blockshift) |
322 | { | 323 | { |
323 | unsigned int pagefactor = 1; | 324 | unsigned int pagefactor = 1; |
324 | unsigned int bitshift = BITS_PER_LONG - 1; | 325 | unsigned int bitshift = BITS_PER_LONG - 1; |
@@ -355,9 +356,10 @@ static int ocfs2_remount(struct super_block *sb, int *flags, char *data) | |||
355 | int incompat_features; | 356 | int incompat_features; |
356 | int ret = 0; | 357 | int ret = 0; |
357 | unsigned long parsed_options; | 358 | unsigned long parsed_options; |
359 | s16 slot; | ||
358 | struct ocfs2_super *osb = OCFS2_SB(sb); | 360 | struct ocfs2_super *osb = OCFS2_SB(sb); |
359 | 361 | ||
360 | if (!ocfs2_parse_options(sb, data, &parsed_options, 1)) { | 362 | if (!ocfs2_parse_options(sb, data, &parsed_options, &slot, 1)) { |
361 | ret = -EINVAL; | 363 | ret = -EINVAL; |
362 | goto out; | 364 | goto out; |
363 | } | 365 | } |
@@ -534,6 +536,7 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) | |||
534 | struct dentry *root; | 536 | struct dentry *root; |
535 | int status, sector_size; | 537 | int status, sector_size; |
536 | unsigned long parsed_opt; | 538 | unsigned long parsed_opt; |
539 | s16 slot; | ||
537 | struct inode *inode = NULL; | 540 | struct inode *inode = NULL; |
538 | struct ocfs2_super *osb = NULL; | 541 | struct ocfs2_super *osb = NULL; |
539 | struct buffer_head *bh = NULL; | 542 | struct buffer_head *bh = NULL; |
@@ -541,7 +544,7 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) | |||
541 | 544 | ||
542 | mlog_entry("%p, %p, %i", sb, data, silent); | 545 | mlog_entry("%p, %p, %i", sb, data, silent); |
543 | 546 | ||
544 | if (!ocfs2_parse_options(sb, data, &parsed_opt, 0)) { | 547 | if (!ocfs2_parse_options(sb, data, &parsed_opt, &slot, 0)) { |
545 | status = -EINVAL; | 548 | status = -EINVAL; |
546 | goto read_super_error; | 549 | goto read_super_error; |
547 | } | 550 | } |
@@ -571,6 +574,7 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) | |||
571 | brelse(bh); | 574 | brelse(bh); |
572 | bh = NULL; | 575 | bh = NULL; |
573 | osb->s_mount_opt = parsed_opt; | 576 | osb->s_mount_opt = parsed_opt; |
577 | osb->preferred_slot = slot; | ||
574 | 578 | ||
575 | sb->s_magic = OCFS2_SUPER_MAGIC; | 579 | sb->s_magic = OCFS2_SUPER_MAGIC; |
576 | 580 | ||
@@ -713,6 +717,7 @@ static struct file_system_type ocfs2_fs_type = { | |||
713 | static int ocfs2_parse_options(struct super_block *sb, | 717 | static int ocfs2_parse_options(struct super_block *sb, |
714 | char *options, | 718 | char *options, |
715 | unsigned long *mount_opt, | 719 | unsigned long *mount_opt, |
720 | s16 *slot, | ||
716 | int is_remount) | 721 | int is_remount) |
717 | { | 722 | { |
718 | int status; | 723 | int status; |
@@ -722,6 +727,7 @@ static int ocfs2_parse_options(struct super_block *sb, | |||
722 | options ? options : "(none)"); | 727 | options ? options : "(none)"); |
723 | 728 | ||
724 | *mount_opt = 0; | 729 | *mount_opt = 0; |
730 | *slot = OCFS2_INVALID_SLOT; | ||
725 | 731 | ||
726 | if (!options) { | 732 | if (!options) { |
727 | status = 1; | 733 | status = 1; |
@@ -782,6 +788,15 @@ static int ocfs2_parse_options(struct super_block *sb, | |||
782 | else | 788 | else |
783 | osb->s_atime_quantum = OCFS2_DEFAULT_ATIME_QUANTUM; | 789 | osb->s_atime_quantum = OCFS2_DEFAULT_ATIME_QUANTUM; |
784 | break; | 790 | break; |
791 | case Opt_slot: | ||
792 | option = 0; | ||
793 | if (match_int(&args[0], &option)) { | ||
794 | status = 0; | ||
795 | goto bail; | ||
796 | } | ||
797 | if (option) | ||
798 | *slot = (s16)option; | ||
799 | break; | ||
785 | default: | 800 | default: |
786 | mlog(ML_ERROR, | 801 | mlog(ML_ERROR, |
787 | "Unrecognized mount option \"%s\" " | 802 | "Unrecognized mount option \"%s\" " |