diff options
author | Mark Fasheh <mfasheh@suse.com> | 2010-04-05 21:17:16 -0400 |
---|---|---|
committer | Joel Becker <joel.becker@oracle.com> | 2010-05-05 21:18:07 -0400 |
commit | 83f92318fa33cc084e14e64dc903e605f75884c1 (patch) | |
tree | c7466c64019fb050c69cab27b4388e3a86d58b1a /fs/ocfs2/super.c | |
parent | b07f8f24dfe54da0f074b78949044842e8df881f (diff) |
ocfs2: Add dir_resv_level mount option
The default behavior for directory reservations stays the same, but we add a
mount option so people can tweak the size of directory reservations
according to their workloads.
Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Diffstat (limited to 'fs/ocfs2/super.c')
-rw-r--r-- | fs/ocfs2/super.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index 5745682eb1c0..79d7d4cf45b1 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c | |||
@@ -96,6 +96,7 @@ struct mount_options | |||
96 | signed short slot; | 96 | signed short slot; |
97 | int localalloc_opt; | 97 | int localalloc_opt; |
98 | unsigned int resv_level; | 98 | unsigned int resv_level; |
99 | int dir_resv_level; | ||
99 | char cluster_stack[OCFS2_STACK_LABEL_LEN + 1]; | 100 | char cluster_stack[OCFS2_STACK_LABEL_LEN + 1]; |
100 | }; | 101 | }; |
101 | 102 | ||
@@ -178,6 +179,7 @@ enum { | |||
178 | Opt_usrquota, | 179 | Opt_usrquota, |
179 | Opt_grpquota, | 180 | Opt_grpquota, |
180 | Opt_resv_level, | 181 | Opt_resv_level, |
182 | Opt_dir_resv_level, | ||
181 | Opt_err, | 183 | Opt_err, |
182 | }; | 184 | }; |
183 | 185 | ||
@@ -205,6 +207,7 @@ static const match_table_t tokens = { | |||
205 | {Opt_usrquota, "usrquota"}, | 207 | {Opt_usrquota, "usrquota"}, |
206 | {Opt_grpquota, "grpquota"}, | 208 | {Opt_grpquota, "grpquota"}, |
207 | {Opt_resv_level, "resv_level=%u"}, | 209 | {Opt_resv_level, "resv_level=%u"}, |
210 | {Opt_dir_resv_level, "dir_resv_level=%u"}, | ||
208 | {Opt_err, NULL} | 211 | {Opt_err, NULL} |
209 | }; | 212 | }; |
210 | 213 | ||
@@ -1034,6 +1037,11 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) | |||
1034 | 1037 | ||
1035 | ocfs2_la_set_sizes(osb, parsed_options.localalloc_opt); | 1038 | ocfs2_la_set_sizes(osb, parsed_options.localalloc_opt); |
1036 | osb->osb_resv_level = parsed_options.resv_level; | 1039 | osb->osb_resv_level = parsed_options.resv_level; |
1040 | osb->osb_dir_resv_level = parsed_options.resv_level; | ||
1041 | if (parsed_options.dir_resv_level == -1) | ||
1042 | osb->osb_dir_resv_level = parsed_options.resv_level; | ||
1043 | else | ||
1044 | osb->osb_dir_resv_level = parsed_options.dir_resv_level; | ||
1037 | 1045 | ||
1038 | status = ocfs2_verify_userspace_stack(osb, &parsed_options); | 1046 | status = ocfs2_verify_userspace_stack(osb, &parsed_options); |
1039 | if (status) | 1047 | if (status) |
@@ -1295,6 +1303,7 @@ static int ocfs2_parse_options(struct super_block *sb, | |||
1295 | mopt->localalloc_opt = -1; | 1303 | mopt->localalloc_opt = -1; |
1296 | mopt->cluster_stack[0] = '\0'; | 1304 | mopt->cluster_stack[0] = '\0'; |
1297 | mopt->resv_level = OCFS2_DEFAULT_RESV_LEVEL; | 1305 | mopt->resv_level = OCFS2_DEFAULT_RESV_LEVEL; |
1306 | mopt->dir_resv_level = -1; | ||
1298 | 1307 | ||
1299 | if (!options) { | 1308 | if (!options) { |
1300 | status = 1; | 1309 | status = 1; |
@@ -1449,6 +1458,17 @@ static int ocfs2_parse_options(struct super_block *sb, | |||
1449 | option < OCFS2_MAX_RESV_LEVEL) | 1458 | option < OCFS2_MAX_RESV_LEVEL) |
1450 | mopt->resv_level = option; | 1459 | mopt->resv_level = option; |
1451 | break; | 1460 | break; |
1461 | case Opt_dir_resv_level: | ||
1462 | if (is_remount) | ||
1463 | break; | ||
1464 | if (match_int(&args[0], &option)) { | ||
1465 | status = 0; | ||
1466 | goto bail; | ||
1467 | } | ||
1468 | if (option >= OCFS2_MIN_RESV_LEVEL && | ||
1469 | option < OCFS2_MAX_RESV_LEVEL) | ||
1470 | mopt->dir_resv_level = option; | ||
1471 | break; | ||
1452 | default: | 1472 | default: |
1453 | mlog(ML_ERROR, | 1473 | mlog(ML_ERROR, |
1454 | "Unrecognized mount option \"%s\" " | 1474 | "Unrecognized mount option \"%s\" " |
@@ -1533,6 +1553,9 @@ static int ocfs2_show_options(struct seq_file *s, struct vfsmount *mnt) | |||
1533 | if (osb->osb_resv_level != OCFS2_DEFAULT_RESV_LEVEL) | 1553 | if (osb->osb_resv_level != OCFS2_DEFAULT_RESV_LEVEL) |
1534 | seq_printf(s, ",resv_level=%d", osb->osb_resv_level); | 1554 | seq_printf(s, ",resv_level=%d", osb->osb_resv_level); |
1535 | 1555 | ||
1556 | if (osb->osb_dir_resv_level != osb->osb_resv_level) | ||
1557 | seq_printf(s, ",dir_resv_level=%d", osb->osb_resv_level); | ||
1558 | |||
1536 | return 0; | 1559 | return 0; |
1537 | } | 1560 | } |
1538 | 1561 | ||