aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext3/super.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext3/super.c')
-rw-r--r--fs/ext3/super.c37
1 files changed, 27 insertions, 10 deletions
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index 9630fbfdc24a..b4b3e8a39131 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -589,7 +589,7 @@ enum {
589 Opt_commit, Opt_journal_update, Opt_journal_inum, 589 Opt_commit, Opt_journal_update, Opt_journal_inum,
590 Opt_abort, Opt_data_journal, Opt_data_ordered, Opt_data_writeback, 590 Opt_abort, Opt_data_journal, Opt_data_ordered, Opt_data_writeback,
591 Opt_usrjquota, Opt_grpjquota, Opt_offusrjquota, Opt_offgrpjquota, 591 Opt_usrjquota, Opt_grpjquota, Opt_offusrjquota, Opt_offgrpjquota,
592 Opt_jqfmt_vfsold, Opt_jqfmt_vfsv0, 592 Opt_jqfmt_vfsold, Opt_jqfmt_vfsv0, Opt_quota, Opt_noquota,
593 Opt_ignore, Opt_barrier, Opt_err, Opt_resize, 593 Opt_ignore, Opt_barrier, Opt_err, Opt_resize,
594}; 594};
595 595
@@ -634,10 +634,10 @@ static match_table_t tokens = {
634 {Opt_grpjquota, "grpjquota=%s"}, 634 {Opt_grpjquota, "grpjquota=%s"},
635 {Opt_jqfmt_vfsold, "jqfmt=vfsold"}, 635 {Opt_jqfmt_vfsold, "jqfmt=vfsold"},
636 {Opt_jqfmt_vfsv0, "jqfmt=vfsv0"}, 636 {Opt_jqfmt_vfsv0, "jqfmt=vfsv0"},
637 {Opt_ignore, "grpquota"}, 637 {Opt_quota, "grpquota"},
638 {Opt_ignore, "noquota"}, 638 {Opt_noquota, "noquota"},
639 {Opt_ignore, "quota"}, 639 {Opt_quota, "quota"},
640 {Opt_ignore, "usrquota"}, 640 {Opt_quota, "usrquota"},
641 {Opt_barrier, "barrier=%u"}, 641 {Opt_barrier, "barrier=%u"},
642 {Opt_err, NULL}, 642 {Opt_err, NULL},
643 {Opt_resize, "resize"}, 643 {Opt_resize, "resize"},
@@ -876,6 +876,7 @@ set_qf_name:
876 sbi->s_qf_names[qtype] = NULL; 876 sbi->s_qf_names[qtype] = NULL;
877 return 0; 877 return 0;
878 } 878 }
879 set_opt(sbi->s_mount_opt, QUOTA);
879 break; 880 break;
880 case Opt_offusrjquota: 881 case Opt_offusrjquota:
881 qtype = USRQUOTA; 882 qtype = USRQUOTA;
@@ -898,6 +899,17 @@ clear_qf_name:
898 case Opt_jqfmt_vfsv0: 899 case Opt_jqfmt_vfsv0:
899 sbi->s_jquota_fmt = QFMT_VFS_V0; 900 sbi->s_jquota_fmt = QFMT_VFS_V0;
900 break; 901 break;
902 case Opt_quota:
903 set_opt(sbi->s_mount_opt, QUOTA);
904 break;
905 case Opt_noquota:
906 if (sb_any_quota_enabled(sb)) {
907 printk(KERN_ERR "EXT3-fs: Cannot change quota "
908 "options when quota turned on.\n");
909 return 0;
910 }
911 clear_opt(sbi->s_mount_opt, QUOTA);
912 break;
901#else 913#else
902 case Opt_usrjquota: 914 case Opt_usrjquota:
903 case Opt_grpjquota: 915 case Opt_grpjquota:
@@ -909,6 +921,9 @@ clear_qf_name:
909 "EXT3-fs: journalled quota options not " 921 "EXT3-fs: journalled quota options not "
910 "supported.\n"); 922 "supported.\n");
911 break; 923 break;
924 case Opt_quota:
925 case Opt_noquota:
926 break;
912#endif 927#endif
913 case Opt_abort: 928 case Opt_abort:
914 set_opt(sbi->s_mount_opt, ABORT); 929 set_opt(sbi->s_mount_opt, ABORT);
@@ -2238,7 +2253,7 @@ static int ext3_dquot_initialize(struct inode *inode, int type)
2238 int ret, err; 2253 int ret, err;
2239 2254
2240 /* We may create quota structure so we need to reserve enough blocks */ 2255 /* We may create quota structure so we need to reserve enough blocks */
2241 handle = ext3_journal_start(inode, 2*EXT3_QUOTA_INIT_BLOCKS); 2256 handle = ext3_journal_start(inode, 2*EXT3_QUOTA_INIT_BLOCKS(inode->i_sb));
2242 if (IS_ERR(handle)) 2257 if (IS_ERR(handle))
2243 return PTR_ERR(handle); 2258 return PTR_ERR(handle);
2244 ret = dquot_initialize(inode, type); 2259 ret = dquot_initialize(inode, type);
@@ -2254,7 +2269,7 @@ static int ext3_dquot_drop(struct inode *inode)
2254 int ret, err; 2269 int ret, err;
2255 2270
2256 /* We may delete quota structure so we need to reserve enough blocks */ 2271 /* We may delete quota structure so we need to reserve enough blocks */
2257 handle = ext3_journal_start(inode, 2*EXT3_QUOTA_INIT_BLOCKS); 2272 handle = ext3_journal_start(inode, 2*EXT3_QUOTA_DEL_BLOCKS(inode->i_sb));
2258 if (IS_ERR(handle)) 2273 if (IS_ERR(handle))
2259 return PTR_ERR(handle); 2274 return PTR_ERR(handle);
2260 ret = dquot_drop(inode); 2275 ret = dquot_drop(inode);
@@ -2272,7 +2287,7 @@ static int ext3_write_dquot(struct dquot *dquot)
2272 2287
2273 inode = dquot_to_inode(dquot); 2288 inode = dquot_to_inode(dquot);
2274 handle = ext3_journal_start(inode, 2289 handle = ext3_journal_start(inode,
2275 EXT3_QUOTA_TRANS_BLOCKS); 2290 EXT3_QUOTA_TRANS_BLOCKS(dquot->dq_sb));
2276 if (IS_ERR(handle)) 2291 if (IS_ERR(handle))
2277 return PTR_ERR(handle); 2292 return PTR_ERR(handle);
2278 ret = dquot_commit(dquot); 2293 ret = dquot_commit(dquot);
@@ -2288,7 +2303,7 @@ static int ext3_acquire_dquot(struct dquot *dquot)
2288 handle_t *handle; 2303 handle_t *handle;
2289 2304
2290 handle = ext3_journal_start(dquot_to_inode(dquot), 2305 handle = ext3_journal_start(dquot_to_inode(dquot),
2291 EXT3_QUOTA_INIT_BLOCKS); 2306 EXT3_QUOTA_INIT_BLOCKS(dquot->dq_sb));
2292 if (IS_ERR(handle)) 2307 if (IS_ERR(handle))
2293 return PTR_ERR(handle); 2308 return PTR_ERR(handle);
2294 ret = dquot_acquire(dquot); 2309 ret = dquot_acquire(dquot);
@@ -2304,7 +2319,7 @@ static int ext3_release_dquot(struct dquot *dquot)
2304 handle_t *handle; 2319 handle_t *handle;
2305 2320
2306 handle = ext3_journal_start(dquot_to_inode(dquot), 2321 handle = ext3_journal_start(dquot_to_inode(dquot),
2307 EXT3_QUOTA_INIT_BLOCKS); 2322 EXT3_QUOTA_DEL_BLOCKS(dquot->dq_sb));
2308 if (IS_ERR(handle)) 2323 if (IS_ERR(handle))
2309 return PTR_ERR(handle); 2324 return PTR_ERR(handle);
2310 ret = dquot_release(dquot); 2325 ret = dquot_release(dquot);
@@ -2361,6 +2376,8 @@ static int ext3_quota_on(struct super_block *sb, int type, int format_id,
2361 int err; 2376 int err;
2362 struct nameidata nd; 2377 struct nameidata nd;
2363 2378
2379 if (!test_opt(sb, QUOTA))
2380 return -EINVAL;
2364 /* Not journalling quota? */ 2381 /* Not journalling quota? */
2365 if (!EXT3_SB(sb)->s_qf_names[USRQUOTA] && 2382 if (!EXT3_SB(sb)->s_qf_names[USRQUOTA] &&
2366 !EXT3_SB(sb)->s_qf_names[GRPQUOTA]) 2383 !EXT3_SB(sb)->s_qf_names[GRPQUOTA])