aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/super.c
diff options
context:
space:
mode:
authorSunil Mushran <sunil.mushran@oracle.com>2007-12-20 17:58:11 -0500
committerMark Fasheh <mark.fasheh@oracle.com>2008-01-25 18:05:43 -0500
commit2fbe8d1ebe004425b4f7b8bba345623d2280be82 (patch)
tree7620954c7a364c41306a3becc0046dd1e235158f /fs/ocfs2/super.c
parentd147b3d630edef1d34de6ea819787a1ac1b8603b (diff)
ocfs2: Local alloc window size changeable via mount option
Local alloc is a performance optimization in ocfs2 in which a node takes a window of bits from the global bitmap and then uses that for all small local allocations. This window size is fixed to 8MB currently. This patch allows users to specify the window size in MB including disabling it by passing in 0. If the number specified is too large, the fs will use the default value of 8MB. mount -o localalloc=X /dev/sdX /mntpoint Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com> Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
Diffstat (limited to 'fs/ocfs2/super.c')
-rw-r--r--fs/ocfs2/super.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index 8044ed97d362..1104f14c3183 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -87,6 +87,7 @@ struct mount_options
87 unsigned long mount_opt; 87 unsigned long mount_opt;
88 unsigned int atime_quantum; 88 unsigned int atime_quantum;
89 signed short slot; 89 signed short slot;
90 unsigned int localalloc_opt;
90}; 91};
91 92
92static int ocfs2_parse_options(struct super_block *sb, char *options, 93static int ocfs2_parse_options(struct super_block *sb, char *options,
@@ -151,6 +152,7 @@ enum {
151 Opt_atime_quantum, 152 Opt_atime_quantum,
152 Opt_slot, 153 Opt_slot,
153 Opt_commit, 154 Opt_commit,
155 Opt_localalloc,
154 Opt_err, 156 Opt_err,
155}; 157};
156 158
@@ -167,6 +169,7 @@ static match_table_t tokens = {
167 {Opt_atime_quantum, "atime_quantum=%u"}, 169 {Opt_atime_quantum, "atime_quantum=%u"},
168 {Opt_slot, "preferred_slot=%u"}, 170 {Opt_slot, "preferred_slot=%u"},
169 {Opt_commit, "commit=%u"}, 171 {Opt_commit, "commit=%u"},
172 {Opt_localalloc, "localalloc=%d"},
170 {Opt_err, NULL} 173 {Opt_err, NULL}
171}; 174};
172 175
@@ -602,6 +605,7 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent)
602 osb->s_atime_quantum = parsed_options.atime_quantum; 605 osb->s_atime_quantum = parsed_options.atime_quantum;
603 osb->preferred_slot = parsed_options.slot; 606 osb->preferred_slot = parsed_options.slot;
604 osb->osb_commit_interval = parsed_options.commit_interval; 607 osb->osb_commit_interval = parsed_options.commit_interval;
608 osb->local_alloc_size = parsed_options.localalloc_opt;
605 609
606 sb->s_magic = OCFS2_SUPER_MAGIC; 610 sb->s_magic = OCFS2_SUPER_MAGIC;
607 611
@@ -756,6 +760,7 @@ static int ocfs2_parse_options(struct super_block *sb,
756 mopt->mount_opt = 0; 760 mopt->mount_opt = 0;
757 mopt->atime_quantum = OCFS2_DEFAULT_ATIME_QUANTUM; 761 mopt->atime_quantum = OCFS2_DEFAULT_ATIME_QUANTUM;
758 mopt->slot = OCFS2_INVALID_SLOT; 762 mopt->slot = OCFS2_INVALID_SLOT;
763 mopt->localalloc_opt = OCFS2_DEFAULT_LOCAL_ALLOC_SIZE;
759 764
760 if (!options) { 765 if (!options) {
761 status = 1; 766 status = 1;
@@ -834,6 +839,15 @@ static int ocfs2_parse_options(struct super_block *sb,
834 option = JBD_DEFAULT_MAX_COMMIT_AGE; 839 option = JBD_DEFAULT_MAX_COMMIT_AGE;
835 mopt->commit_interval = HZ * option; 840 mopt->commit_interval = HZ * option;
836 break; 841 break;
842 case Opt_localalloc:
843 option = 0;
844 if (match_int(&args[0], &option)) {
845 status = 0;
846 goto bail;
847 }
848 if (option >= 0 && (option <= ocfs2_local_alloc_size(sb) * 8))
849 mopt->localalloc_opt = option;
850 break;
837 default: 851 default:
838 mlog(ML_ERROR, 852 mlog(ML_ERROR,
839 "Unrecognized mount option \"%s\" " 853 "Unrecognized mount option \"%s\" "
@@ -886,6 +900,9 @@ static int ocfs2_show_options(struct seq_file *s, struct vfsmount *mnt)
886 seq_printf(s, ",commit=%u", 900 seq_printf(s, ",commit=%u",
887 (unsigned) (osb->osb_commit_interval / HZ)); 901 (unsigned) (osb->osb_commit_interval / HZ));
888 902
903 if (osb->local_alloc_size != OCFS2_DEFAULT_LOCAL_ALLOC_SIZE)
904 seq_printf(s, ",localalloc=%d", osb->local_alloc_size);
905
889 return 0; 906 return 0;
890} 907}
891 908