more quota cleanups
Subsystems (7)
cover more quota cleanups
Detangle the remount/umount path and make sure the VFS quota code is nicely self-countained and consistenly named.
PATCH 1/6 dquot: move remount handling into the filesystem
Currently do_remount_sb calls into the dquot code to tell it about going from rw to ro and ro to rw. Move this code into the filesystem to not depend on the dquot code in the VFS - note ocfs2 already ignores these calls and handles remount by itself. This gets rif of overloading the quotactl calls and allows to unify the VFS and XFS codepathes in that area later.
fs/ext2/super.c +15 -0
@@ -1191,6 +1191,7 @@ static int ext2_remount (struct super_blunsigned long old_mount_opt = sbi->s_mount_opt;struct ext2_mount_options old_opts;unsigned long old_sb_flags; +int enable_quota =0 ;int err;spin_lock (&sbi->s_lock);
@@ -1241,6 +1242,7 @@ static int ext2_remount (struct super_blspin_unlock (&sbi->s_lock);return 0 ; } +/* * OK, we are remounting a valid rw partition rdonly, so set * the rdonly flag and then mark the partition as valid again.
@@ -1248,6 +1250,14 @@ static int ext2_remount (struct super_bl es->s_state =cpu_to_le16 (sbi->s_mount_state); es->s_mtime =cpu_to_le32 (get_seconds ());spin_unlock (&sbi->s_lock); + + err =vfs_dq_off (sb,1 ); +if (err <0 && err != -ENOSYS ) { + err = -EBUSY ; +spin_lock (&sbi->s_lock); + goto restore_opts; + } +ext2_sync_super (sb, es,1 ); }else { __le32 ret = EXT2_HAS_RO_COMPAT_FEATURE(sb,
@@ -1269,8 +1279,13 @@ static int ext2_remount (struct super_blif (!ext2_setup_super (sb, es,0 )) sb->s_flags &= ~MS_RDONLY ;spin_unlock (&sbi->s_lock); +ext2_write_super (sb); + enable_quota =1 ; } + +if (enable_quota) +vfs_dq_quota_on_remount (sb);return 0 ; restore_opts: sbi->s_mount_opt = old_opts.s_mount_opt;
fs/ext3/super.c +11 -0
@@ -2551,6 +2551,7 @@ static int ext3_remount (struct super_blext3_fsblk_t n_blocks_count =0 ;unsigned long old_sb_flags;struct ext3_mount_options old_opts; +int enable_quota =0 ;int err;#ifdef CONFIG_QUOTA int i;
@@ -2597,6 +2598,12 @@ static int ext3_remount (struct super_bl }if (*flags &MS_RDONLY ) { + err =vfs_dq_off (sb,1 ); +if (err <0 && err != -ENOSYS ) { + err = -EBUSY ; + goto restore_opts; + } +/* * First of all, the unconditional stuff we have to do * to disable replay of the journal when we next remount
@@ -2651,6 +2658,7 @@ static int ext3_remount (struct super_bl goto restore_opts;if (!ext3_setup_super (sb, es,0 )) sb->s_flags &= ~MS_RDONLY ; + enable_quota =1 ; } }#ifdef CONFIG_QUOTA
@@ -2662,6 +2670,9 @@ static int ext3_remount (struct super_bl#endif unlock_super (sb);unlock_kernel (); + +if (enable_quota) +vfs_dq_quota_on_remount (sb);return 0 ; restore_opts: sb->s_flags = old_sb_flags;
fs/ext4/super.c +10 -0
@@ -3574,6 +3574,7 @@ static int ext4_remount(struct super_bloext4_fsblk_t n_blocks_count =0 ;unsigned long old_sb_flags;struct ext4_mount_options old_opts; +int enable_quota =0 ;ext4_group_t g;unsigned int journal_ioprio =DEFAULT_JOURNAL_IOPRIO ;int err;
@@ -3630,6 +3631,12 @@ static int ext4_remount(struct super_blo }if (*flags &MS_RDONLY ) { + err =vfs_dq_off (sb,1 ); +if (err <0 && err != -ENOSYS ) { + err = -EBUSY ; + goto restore_opts; + } +/* * First of all, the unconditional stuff we have to do * to disable replay of the journal when we next remount
@@ -3698,6 +3705,7 @@ static int ext4_remount(struct super_blo goto restore_opts;if (!ext4_setup_super (sb, es,0 )) sb->s_flags &= ~MS_RDONLY ; + enable_quota =1 ; } }ext4_setup_system_zone (sb);
@@ -3713,6 +3721,8 @@ static int ext4_remount(struct super_blo#endif unlock_super (sb);unlock_kernel (); +if (enable_quota) +vfs_dq_quota_on_remount (sb);return 0 ; restore_opts:
fs/jfs/super.c +6 -0
@@ -397,9 +397,15 @@ static int jfs_remount(struct super_blocJFS_SBI (sb)->flag = flag; ret =jfs_mount_rw (sb,1 );unlock_kernel (); +vfs_dq_quota_on_remount (sb);return ret; }if ((!(sb->s_flags &MS_RDONLY )) && (*flags &MS_RDONLY )) { + rc =vfs_dq_off (sb,1 ); +if (rc <0 && rc != -ENOSYS ) { +unlock_kernel (); +return -EBUSY ; + } rc =jfs_umount_rw (sb);JFS_SBI (sb)->flag = flag;unlock_kernel ();
fs/reiserfs/super.c +8 -0
@@ -1242,6 +1242,13 @@ static int reiserfs_remount(struct superif (s->s_flags &MS_RDONLY )/* it is read-only already */ goto out_ok; + + err =vfs_dq_off (s,1 ); +if (err <0 && err != -ENOSYS ) { + err = -EBUSY ; + goto out_err; + } +/* try to remount file system with read-only permissions */ if (sb_umount_state (rs) ==REISERFS_VALID_FS ||REISERFS_SB (s)->s_mount_state !=REISERFS_VALID_FS ) {
@@ -1297,6 +1304,7 @@ static int reiserfs_remount(struct superif (!(*mount_flags &MS_RDONLY )) {finish_unfinished (s);reiserfs_xattr_init (s, *mount_flags); +vfs_dq_quota_on_remount (s); } out_ok:
fs/ufs/super.c +12 -0
@@ -1248,7 +1248,9 @@ static int ufs_remount (struct super_blostruct ufs_super_block_first * usb1;struct ufs_super_block_third * usb3;unsigned new_mount_opt, ufstype; +int enable_quota =0 ;unsigned flags; +int err;lock_kernel ();lock_super (sb);
@@ -1289,6 +1291,13 @@ static int ufs_remount (struct super_blo* fs was mouted as rw, remounting ro */ if (*mount_flags &MS_RDONLY ) { + err =vfs_dq_off (sb,1 ); +if (err <0 && err != -ENOSYS ) { +unlock_super (sb); +unlock_kernel (); +return -EBUSY ; + } +ufs_put_super_internal (sb); usb1->fs_time =cpu_to_fs32 (sb,get_seconds ()); if ((flags & UFS_ST_MASK) == UFS_ST_SUN
@@ -1327,11 +1336,14 @@ static int ufs_remount (struct super_blo return -EPERM; } sb->s_flags &= ~MS_RDONLY ; + enable_quota =1 ;#endif }UFS_SB (sb)->s_mount_opt = new_mount_opt;unlock_super (sb);unlock_kernel (); +if (enable_quota) +vfs_dq_quota_on_remount (sb);return 0 ; }
fs/super.c +2 -7
@@ -569,7 +569,7 @@ out:int do_remount_sb (struct super_block *sb,int flags,void *data,int force) {int retval; -int remount_rw, remount_ro; +int remount_ro;if (sb->s_frozen !=SB_UNFROZEN )return -EBUSY ;
@@ -585,7 +585,6 @@ int do_remount_sb(struct super_block *sbsync_filesystem (sb); remount_ro = (flags &MS_RDONLY ) && !(sb->s_flags &MS_RDONLY ); - remount_rw = !(flags &MS_RDONLY ) && (sb->s_flags &MS_RDONLY );/* If we are remounting RDONLY and current sb is read/write, make sure there are no rw files opened */
@@ -594,9 +593,6 @@ int do_remount_sb(struct super_block *sbmark_files_ro (sb); else if (!fs_may_remount_ro(sb)) return -EBUSY; - retval =vfs_dq_off (sb,1 ); -if (retval <0 && retval != -ENOSYS ) -return -EBUSY ; }if (sb->s_op->remount_fs) {
@@ -605,8 +601,7 @@ int do_remount_sb(struct super_block *sbreturn retval; } sb->s_flags = (sb->s_flags & ~MS_RMT_MASK ) | (flags &MS_RMT_MASK ); -if (remount_rw) -vfs_dq_quota_on_remount (sb); +/* * Some filesystems modify their metadata via some other path than the * bdev buffer cache (eg. use a private mapping, or directories in
Jan Kara
reviewerRe: [PATCH 1/6] dquot: move remount handling into the filesystem
Quoted 9 lines · Christoph Hellwig
Currently
do_remount_sbcalls into the dquot code to tell it about going from rw to ro and ro to rw. Move this code into the filesystem to not depend on the dquot code in the VFS - note ocfs2 already ignores these calls and handles remount by itself. This gets rif of overloading the quotactl calls and allows to unify the VFS and XFS codepathes in that area later.Signed-off-by Christoph Hellwig <[email protected]>
It seems you have missed out UDF from the conversion (maybe you could
setup a checklist of filesystem to convert? :) OTOH looking at it more in detail quota support for UDF is broken (i.e. quotaon returns EINVAL because .quota_write is not set) for several years now and noone has complained so I'm starting to wonder whether fixing it is worth the effort.
Also I'm slightly concerned that previous vfs_dq_quota_on_remount was
called only after
sb->s_flags = (sb->s_flags & ~MS_RMT_MASK) | (flags & MS_RMT_MASK);
so in particular MS_RDONLY has been cleared. Now it is called before so some filesystem could possibly barf when it sees writes from quota system before MS_RDONLY gets cleared. I've checked and only JFS could have this problem since others already clear MS_RDONLY inside their foo_remount() functions but still...
Quoted 36 lines
Index:
linux-2.6/fs/ext2/super.c
===================================================================fs/ext2/super.c +10
-0@@ -1191,6 +1191,7 @@ static int ext2_remount (struct super_blunsigned long old_mount_opt = sbi->s_mount_opt;struct ext2_mount_options old_opts;unsigned long old_sb_flags; +int enable_quota =0 ;int err;spin_lock (&sbi->s_lock);@@ -1241,6 +1242,7 @@ static int ext2_remount (struct super_blspin_unlock (&sbi->s_lock);return 0 ; } +/* * OK, we are remounting a valid rw partition rdonly, so set * the rdonly flag and then mark the partition as valid again. @@ -1248,6 +1250,14 @@ static int ext2_remount (struct super_bl es->s_state =cpu_to_le16 (sbi->s_mount_state); es->s_mtime =cpu_to_le32 (get_seconds ());spin_unlock (&sbi->s_lock); + + err =vfs_dq_off (sb,1 ); +if (err <0 && err != -ENOSYS ) { + err = -EBUSY ; +spin_lock (&sbi->s_lock); + goto restore_opts; + } +ext2_sync_super (sb, es,1 ); }else { __le32 ret = EXT2_HAS_RO_COMPAT_FEATURE(sb,
fs/ext2/super.c static int ext2_remount (struct super_bl · line 1288
Quoted 10 lines
fs/ext2/super.c +5
-0@@ -1269,8 +1279,13 @@ static int ext2_remount (struct super_blif (!ext2_setup_super (sb, es,0 )) sb->s_flags &= ~MS_RDONLY ;spin_unlock (&sbi->s_lock); +ext2_write_super (sb); + enable_quota =1 ; } + +if (enable_quota) +vfs_dq_quota_on_remount (sb);
I kind of miss the purpose of "enable_quota" in the above...
Also the ENOSYS check was there only for filesystems which do not support quotas. Since all the filesystems that call vfs_dq_off now obviously do support quotas, you can just drop it.
Honza
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
Re: [PATCH 1/6] dquot: move remount handling into the filesystem
Quoted 5 lines · Jan Kara
It seems you have missed out UDF from the conversion (maybe you could
setup a checklist of filesystem to convert? :) OTOH looking at it more in detail quota support for UDF is broken (i.e. quotaon returns EINVAL because .quota_write is not set) for several years now and noone has complained so I'm starting to wonder whether fixing it is worth the effort.
It's probably not worth it. Given that quota is not part of the UDF spec, and the linux quota formats are non-portable is's probably rather worthless. The same applies to UFS which has also beend disabled for long. Do you want me to send patches to remove UDF and UFS quota support?
Quoted 8 lines
Also I'm slightly concerned that previous
vfs_dq_quota_on_remountwas
called only after
sb->s_flags= (sb->s_flags& ~MS_RMT_MASK) | (flags &MS_RMT_MASK);
so in particularMS_RDONLYhas been cleared. Now it is called before so some filesystem could possibly barf when it sees writes from quota system beforeMS_RDONLYgets cleared. I've checked and only JFS could have this problem since others already clearMS_RDONLYinside theirfoo_remount()functions but still...
I've added explicit clears of MS_RDONLY to the next revision of the patch in jfs and udf.
Quoted 4 lines
Quoted 4 lines
fs/ext2/super.c +2
-0spin_unlock (&sbi->s_lock); +ext2_write_super (sb); + enable_quota =1 ;
Quoted 8 lines
fs/ext2/super.c static int ext2_remount (struct super_bl · line 1288
Quoted 4 lines
fs/ext2/super.c +3
-0} + +if (enable_quota) +vfs_dq_quota_on_remount (sb);I kind of miss the purpose of "
enable_quota" in the above...
Also the ENOSYS check was there only for filesystems which do not support quotas. Since all the filesystems that callvfs_dq_offnow obviously do support quotas, you can just drop it.
Indeed. It was left over from an earlier version of the patch that had locking constrainst that made it nessecary. I've removed it for the next version.
Jan Kara
reviewerRe: [PATCH 1/6] dquot: move remount handling into the filesystem
Quoted 7 lines · Christoph Hellwig
Quoted 5 lines · Jan Kara
It seems you have missed out UDF from the conversion (maybe you could
setup a checklist of filesystem to convert? :) OTOH looking at it more in detail quota support for UDF is broken (i.e. quotaon returns EINVAL because .quota_write is not set) for several years now and noone has complained so I'm starting to wonder whether fixing it is worth the effort.
Quoted 5 lines
It's probably not worth it. Given that quota is not part of the UDF spec, and the linux quota formats are non-portable is's probably rather worthless. The same applies to UFS which has also beend disabled for long. Do you want me to send patches to remove UDF and UFS quota support?
It's OK, I'll nuke it myself. I love removing code ;)
Honza
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
PATCH 2/6 quota: kill the vfs_dq_off and vfs_dq_quota_on_remount wrappers
In reply to Christoph HellwigInstead of having wrappers in the VFS namespace export the dquot_suspend and dquot_resume helpers directly. Also rename vfs_quota_disable to dquot_disable while we're at it.
fs/quota/dquot.c +40 -43
@@ -1875,7 +1875,7 @@ EXPORT_SYMBOL(dquot_file_open);/* * Turn quota off on a device. type == -1 ==> quotaoff for all types (umount) */ -int vfs_quota_disable (struct super_block *sb,int type,unsigned int flags) +int dquot_disable (struct super_block *sb,int type,unsigned int flags) {int cnt, ret =0 ;struct quota_info *dqopt =sb_dqopt (sb);
@@ -2005,14 +2005,16 @@ put_inodes: }return ret; } -EXPORT_SYMBOL (vfs_quota_disable); +EXPORT_SYMBOL (dquot_disable);int vfs_quota_off (struct super_block *sb,int type,int remount) { -return vfs_quota_disable (sb, type, remount ?DQUOT_SUSPENDED : - (DQUOT_USAGE_ENABLED |DQUOT_LIMITS_ENABLED )); +BUG_ON (remount); +return dquot_disable (sb, type, +DQUOT_USAGE_ENABLED |DQUOT_LIMITS_ENABLED ); }EXPORT_SYMBOL (vfs_quota_off); +/* * Turn quotas on on a device */
@@ -2129,35 +2131,48 @@ out_fmt:return error; } +/* Suspend quotas on remount RO */ +int dquot_suspend (struct super_block *sb,int type) +{ +return dquot_disable (sb, type,DQUOT_SUSPENDED ); +} +/* Reenable quotas on remount RW */ -static int vfs_quota_on_remount (struct super_block *sb,int type) +int dquot_resume (struct super_block *sb,int type) {struct quota_info *dqopt =sb_dqopt (sb);struct inode *inode; -int ret; +int ret =0 , cnt;unsigned int flags; -mutex_lock (&dqopt->dqonoff_mutex); -if (!sb_has_quota_suspended (sb, type)) { +for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) { +if (type !=-1 && cnt != type) +continue ; + +mutex_lock (&dqopt->dqonoff_mutex); +if (!sb_has_quota_suspended (sb, cnt)) { +mutex_unlock (&dqopt->dqonoff_mutex); +continue ; + } + inode = dqopt->files[cnt]; + dqopt->files[cnt] =NULL ; +spin_lock (&dq_state_lock); + flags = dqopt->flags &dquot_state_flag (DQUOT_USAGE_ENABLED | +DQUOT_LIMITS_ENABLED , + cnt); + dqopt->flags &= ~dquot_state_flag (DQUOT_STATE_FLAGS , cnt); +spin_unlock (&dq_state_lock);mutex_unlock (&dqopt->dqonoff_mutex); -return 0 ; - } - inode = dqopt->files[type]; - dqopt->files[type] =NULL ; -spin_lock (&dq_state_lock); - flags = dqopt->flags &dquot_state_flag (DQUOT_USAGE_ENABLED | -DQUOT_LIMITS_ENABLED , type); - dqopt->flags &= ~dquot_state_flag (DQUOT_STATE_FLAGS , type); -spin_unlock (&dq_state_lock); -mutex_unlock (&dqopt->dqonoff_mutex); - flags =dquot_generic_flag (flags, type); - ret =vfs_load_quota_inode (inode, type, dqopt->info[type].dqi_fmt_id, - flags); -iput (inode); + flags =dquot_generic_flag (flags, cnt); + ret =vfs_load_quota_inode (inode, cnt, + dqopt->info[cnt].dqi_fmt_id, flags); +iput (inode); + }return ret; } +EXPORT_SYMBOL (dquot_resume);int vfs_quota_on_path (struct super_block *sb,int type,int format_id,struct path *path)
@@ -2182,8 +2197,7 @@ int vfs_quota_on(struct super_block *sb,struct path path;int error; -if (remount) -return vfs_quota_on_remount (sb, type); +BUG_ON (remount); error =kern_path (name,LOOKUP_FOLLOW , &path);if (!error) {
@@ -2206,8 +2220,8 @@ int vfs_quota_enable(struct inode *inodestruct quota_info *dqopt =sb_dqopt (sb);/* Just unsuspend quotas? */ -if (flags &DQUOT_SUSPENDED ) -return vfs_quota_on_remount (sb, type); +BUG_ON (flags &DQUOT_SUSPENDED ); +if (!flags)return 0 ;/* Just updating flags needed? */
@@ -2273,23 +2287,6 @@ out: }EXPORT_SYMBOL (vfs_quota_on_mount); -/* Wrapper to turn on quotas when remounting rw */ -int vfs_dq_quota_on_remount (struct super_block *sb) -{ -int cnt; -int ret =0 , err; - -if (!sb->s_qcop || !sb->s_qcop->quota_on) -return -ENOSYS ; -for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) { - err = sb->s_qcop->quota_on (sb, cnt,0 ,NULL ,1 ); -if (err <0 && !ret) - ret = err; - } -return ret; -} -EXPORT_SYMBOL (vfs_dq_quota_on_remount); -static inline qsize_t qbtos (qsize_t blocks) {return blocks <<QIF_DQBLKSIZE_BITS ;
fs/ext2/super.c +3 -4
@@ -1251,9 +1251,8 @@ static int ext2_remount (struct super_bl es->s_mtime =cpu_to_le32 (get_seconds ());spin_unlock (&sbi->s_lock); - err =vfs_dq_off (sb,1 ); -if (err <0 && err != -ENOSYS ) { - err = -EBUSY ; + err =dquot_suspend (sb,-1 ); +if (err <0 ) {spin_lock (&sbi->s_lock); goto restore_opts; }
@@ -1285,7 +1284,7 @@ static int ext2_remount (struct super_bl }if (enable_quota) -vfs_dq_quota_on_remount (sb); +dquot_resume (sb,-1 );return 0 ; restore_opts: sbi->s_mount_opt = old_opts.s_mount_opt;
fs/ext3/super.c +3 -5
@@ -2598,11 +2598,9 @@ static int ext3_remount (struct super_bl }if (*flags &MS_RDONLY ) { - err =vfs_dq_off (sb,1 ); -if (err <0 && err != -ENOSYS ) { - err = -EBUSY ; + err =dquot_suspend (sb,-1 ); +if (err <0 ) goto restore_opts; - }/* * First of all, the unconditional stuff we have to do
@@ -2672,7 +2670,7 @@ static int ext3_remount (struct super_blunlock_kernel ();if (enable_quota) -vfs_dq_quota_on_remount (sb); +dquot_resume (sb,-1 );return 0 ; restore_opts: sb->s_flags = old_sb_flags;
fs/ext4/super.c +3 -5
@@ -3631,11 +3631,9 @@ static int ext4_remount(struct super_blo }if (*flags &MS_RDONLY ) { - err =vfs_dq_off (sb,1 ); -if (err <0 && err != -ENOSYS ) { - err = -EBUSY ; + err =dquot_suspend (sb,-1 ); +if (err <0 ) goto restore_opts; - }/* * First of all, the unconditional stuff we have to do
@@ -3722,7 +3720,7 @@ static int ext4_remount(struct super_blounlock_super (sb);unlock_kernel ();if (enable_quota) -vfs_dq_quota_on_remount (sb); +dquot_resume (sb,-1 );return 0 ; restore_opts:
fs/jfs/super.c +4 -4
@@ -397,14 +397,14 @@ static int jfs_remount(struct super_blocJFS_SBI (sb)->flag = flag; ret =jfs_mount_rw (sb,1 );unlock_kernel (); -vfs_dq_quota_on_remount (sb); +dquot_resume (sb,-1 );return ret; }if ((!(sb->s_flags &MS_RDONLY )) && (*flags &MS_RDONLY )) { - rc =vfs_dq_off (sb,1 ); -if (rc <0 && rc != -ENOSYS ) { + rc =dquot_suspend (sb,-1 ); +if (rc <0 ) {unlock_kernel (); -return -EBUSY ; +return rc; } rc =jfs_umount_rw (sb);JFS_SBI (sb)->flag = flag;
fs/ocfs2/super.c +5 -9
@@ -873,13 +873,9 @@ static int ocfs2_susp_quotas(struct ocfsif (!OCFS2_HAS_RO_COMPAT_FEATURE (sb, feature[type]))continue ;if (unsuspend) - status =vfs_quota_enable ( -sb_dqopt (sb)->files[type], - type,QFMT_OCFS2 , -DQUOT_SUSPENDED ); + status =dquot_resume (sb, type);else - status =vfs_quota_disable (sb, type, -DQUOT_SUSPENDED ); + status =dquot_suspend (sb, type);if (status <0 )break ; }
@@ -942,8 +938,8 @@ static void ocfs2_disable_quotas(struct/* Turn off quotas. This will remove all dquot structures from * memory and so they will be automatically synced to global * quota files */ -vfs_quota_disable (sb, type,DQUOT_USAGE_ENABLED | -DQUOT_LIMITS_ENABLED ); +dquot_disable (sb, type,DQUOT_USAGE_ENABLED | +DQUOT_LIMITS_ENABLED );if (!inode)continue ;iput (inode);
@@ -973,7 +969,7 @@ static int ocfs2_quota_off(struct super_if (remount)return 0 ;/* Ignore now and handle later in * ocfs2_remount() */ -return vfs_quota_disable (sb, type,DQUOT_LIMITS_ENABLED ); +return dquot_disable (sb, type,DQUOT_LIMITS_ENABLED ); }static const struct quotactl_ops ocfs2_quotactl_ops = {
fs/reiserfs/super.c +3 -5
@@ -1243,11 +1243,9 @@ static int reiserfs_remount(struct super/* it is read-only already */ goto out_ok; - err =vfs_dq_off (s,1 ); -if (err <0 && err != -ENOSYS ) { - err = -EBUSY ; + err =dquot_suspend (s,-1 ); +if (err <0 ) goto out_err; - }/* try to remount file system with read-only permissions */ if (sb_umount_state(rs) == REISERFS_VALID_FS
@@ -1304,7 +1302,7 @@ static int reiserfs_remount(struct superif (!(*mount_flags &MS_RDONLY )) {finish_unfinished (s);reiserfs_xattr_init (s, *mount_flags); -vfs_dq_quota_on_remount (s); +dquot_resume (s,-1 ); } out_ok:
fs/ufs/super.c +4 -4
@@ -1291,11 +1291,11 @@ static int ufs_remount (struct super_blo* fs was mouted as rw, remounting ro */ if (*mount_flags &MS_RDONLY ) { - err =vfs_dq_off (sb,1 ); -if (err <0 && err != -ENOSYS ) { + err =dquot_suspend (sb,-1 ); +if (err <0 ) {unlock_super (sb);unlock_kernel (); -return -EBUSY ; +return err; }ufs_put_super_internal (sb);
@@ -1343,7 +1343,7 @@ static int ufs_remount (struct super_blounlock_super (sb);unlock_kernel ();if (enable_quota) -vfs_dq_quota_on_remount (sb); +dquot_resume (sb,-1 );return 0 ; }
include/linux/quotaops.h +20 -7
@@ -42,6 +42,10 @@ int dquot_alloc_inode(const struct inodeint dquot_claim_space_nodirty (struct inode *inode,qsize_t number);void dquot_free_inode (const struct inode *inode); +int dquot_disable (struct super_block *sb,int type,unsigned int flags); +int dquot_suspend (struct super_block *sb,int type); +int dquot_resume (struct super_block *sb,int type); +int dquot_commit (struct dquot *dquot);int dquot_acquire (struct dquot *dquot);int dquot_release (struct dquot *dquot);
@@ -59,7 +63,6 @@ int vfs_quota_on_path(struct super_blockint vfs_quota_on_mount (struct super_block *sb,char *qf_name,int format_id,int type);int vfs_quota_off (struct super_block *sb,int type,int remount); -int vfs_quota_disable (struct super_block *sb,int type,unsigned int flags);int vfs_quota_sync (struct super_block *sb,int type,int wait);int vfs_get_dqinfo (struct super_block *sb,int type,struct if_dqinfo *ii);int vfs_set_dqinfo (struct super_block *sb,int type,struct if_dqinfo *ii);
@@ -69,7 +72,6 @@ int vfs_set_dqblk(struct super_block *sb struct fs_disk_quota *di);int dquot_transfer (struct inode *inode,struct iattr *iattr); -int vfs_dq_quota_on_remount (struct super_block *sb);static inline struct mem_dqinfo *sb_dqinfo (struct super_block *sb,int type) {
@@ -222,11 +224,6 @@ static inline int vfs_dq_off(struct supereturn 0 ; } -static inline int vfs_dq_quota_on_remount (struct super_block *sb) -{ -return 0 ; -} -static inline int dquot_transfer (struct inode *inode,struct iattr *iattr) {return 0 ;
@@ -253,6 +250,22 @@ static inline int dquot_claim_space_nodi return 0; } +static inline int dquot_disable (struct super_block *sb,int type, +unsigned int flags) +{ +return 0 ; +} + +static inline int dquot_suspend (struct super_block *sb,int type) +{ +return 0 ; +} + +static inline int dquot_resume (struct super_block *sb,int type) +{ +return 0 ; +} +#define dquot_file_open generic_file_open#endif /* CONFIG_QUOTA */
Jan Kara
reviewerRe: [PATCH 2/6] quota: kill the vfs_dq_off and vfs_dq_quota_on_remount wrappers
Quoted 3 lines · Christoph Hellwig
Instead of having wrappers in the VFS namespace export the
dquot_suspendanddquot_resumehelpers directly. Also renamevfs_quota_disabletodquot_disablewhile we're at it.
This patch looks good.
Honza
Quoted 412 lines
Signed-off-by Christoph Hellwig <[email protected]>Index:
linux-2.6/fs/quota/dquot.c
===================================================================fs/quota/dquot.c +40
-43@@ -1875,7 +1875,7 @@ EXPORT_SYMBOL(dquot_file_open);/* * Turn quota off on a device. type == -1 ==> quotaoff for all types (umount) */ -int vfs_quota_disable (struct super_block *sb,int type,unsigned int flags) +int dquot_disable (struct super_block *sb,int type,unsigned int flags) {int cnt, ret =0 ;struct quota_info *dqopt =sb_dqopt (sb);@@ -2005,14 +2005,16 @@ put_inodes: }return ret; } -EXPORT_SYMBOL (vfs_quota_disable); +EXPORT_SYMBOL (dquot_disable);int vfs_quota_off (struct super_block *sb,int type,int remount) { -return vfs_quota_disable (sb, type, remount ?DQUOT_SUSPENDED : - (DQUOT_USAGE_ENABLED |DQUOT_LIMITS_ENABLED )); +BUG_ON (remount); +return dquot_disable (sb, type, +DQUOT_USAGE_ENABLED |DQUOT_LIMITS_ENABLED ); }EXPORT_SYMBOL (vfs_quota_off); +/* * Turn quotas on on a device */ @@ -2129,35 +2131,48 @@ out_fmt:return error; } +/* Suspend quotas on remount RO */ +int dquot_suspend (struct super_block *sb,int type) +{ +return dquot_disable (sb, type,DQUOT_SUSPENDED ); +} +/* Reenable quotas on remount RW */ -static int vfs_quota_on_remount (struct super_block *sb,int type) +int dquot_resume (struct super_block *sb,int type) {struct quota_info *dqopt =sb_dqopt (sb);struct inode *inode; -int ret; +int ret =0 , cnt;unsigned int flags; -mutex_lock (&dqopt->dqonoff_mutex); -if (!sb_has_quota_suspended (sb, type)) { +for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) { +if (type !=-1 && cnt != type) +continue ; + +mutex_lock (&dqopt->dqonoff_mutex); +if (!sb_has_quota_suspended (sb, cnt)) { +mutex_unlock (&dqopt->dqonoff_mutex); +continue ; + } + inode = dqopt->files[cnt]; + dqopt->files[cnt] =NULL ; +spin_lock (&dq_state_lock); + flags = dqopt->flags &dquot_state_flag (DQUOT_USAGE_ENABLED | +DQUOT_LIMITS_ENABLED , + cnt); + dqopt->flags &= ~dquot_state_flag (DQUOT_STATE_FLAGS , cnt); +spin_unlock (&dq_state_lock);mutex_unlock (&dqopt->dqonoff_mutex); -return 0 ; - } - inode = dqopt->files[type]; - dqopt->files[type] =NULL ; -spin_lock (&dq_state_lock); - flags = dqopt->flags &dquot_state_flag (DQUOT_USAGE_ENABLED | -DQUOT_LIMITS_ENABLED , type); - dqopt->flags &= ~dquot_state_flag (DQUOT_STATE_FLAGS , type); -spin_unlock (&dq_state_lock); -mutex_unlock (&dqopt->dqonoff_mutex); - flags =dquot_generic_flag (flags, type); - ret =vfs_load_quota_inode (inode, type, dqopt->info[type].dqi_fmt_id, - flags); -iput (inode); + flags =dquot_generic_flag (flags, cnt); + ret =vfs_load_quota_inode (inode, cnt, + dqopt->info[cnt].dqi_fmt_id, flags); +iput (inode); + }return ret; } +EXPORT_SYMBOL (dquot_resume);int vfs_quota_on_path (struct super_block *sb,int type,int format_id,struct path *path)@@ -2182,8 +2197,7 @@ int vfs_quota_on(struct super_block *sb,struct path path;int error; -if (remount) -return vfs_quota_on_remount (sb, type); +BUG_ON (remount); error =kern_path (name,LOOKUP_FOLLOW , &path);if (!error) {@@ -2206,8 +2220,8 @@ int vfs_quota_enable(struct inode *inodestruct quota_info *dqopt =sb_dqopt (sb);/* Just unsuspend quotas? */ -if (flags &DQUOT_SUSPENDED ) -return vfs_quota_on_remount (sb, type); +BUG_ON (flags &DQUOT_SUSPENDED ); +if (!flags)return 0 ;/* Just updating flags needed? */ @@ -2273,23 +2287,6 @@ out: }EXPORT_SYMBOL (vfs_quota_on_mount); -/* Wrapper to turn on quotas when remounting rw */ -int vfs_dq_quota_on_remount (struct super_block *sb) -{ -int cnt; -int ret =0 , err; - -if (!sb->s_qcop || !sb->s_qcop->quota_on) -return -ENOSYS ; -for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) { - err = sb->s_qcop->quota_on (sb, cnt,0 ,NULL ,1 ); -if (err <0 && !ret) - ret = err; - } -return ret; -} -EXPORT_SYMBOL (vfs_dq_quota_on_remount); -static inline qsize_t qbtos (qsize_t blocks) {return blocks <<QIF_DQBLKSIZE_BITS ;Index:
linux-2.6/fs/ext2/super.c
===================================================================fs/ext2/super.c +3
-4@@ -1251,9 +1251,8 @@ static int ext2_remount (struct super_bl es->s_mtime =cpu_to_le32 (get_seconds ());spin_unlock (&sbi->s_lock); - err =vfs_dq_off (sb,1 ); -if (err <0 && err != -ENOSYS ) { - err = -EBUSY ; + err =dquot_suspend (sb,-1 ); +if (err <0 ) {spin_lock (&sbi->s_lock); goto restore_opts; }@@ -1285,7 +1284,7 @@ static int ext2_remount (struct super_bl }if (enable_quota) -vfs_dq_quota_on_remount (sb); +dquot_resume (sb,-1 );return 0 ; restore_opts: sbi->s_mount_opt = old_opts.s_mount_opt;Index:
linux-2.6/fs/ext3/super.c
===================================================================fs/ext3/super.c +3
-5@@ -2598,11 +2598,9 @@ static int ext3_remount (struct super_bl }if (*flags &MS_RDONLY ) { - err =vfs_dq_off (sb,1 ); -if (err <0 && err != -ENOSYS ) { - err = -EBUSY ; + err =dquot_suspend (sb,-1 ); +if (err <0 ) goto restore_opts; - }/* * First of all, the unconditional stuff we have to do @@ -2672,7 +2670,7 @@ static int ext3_remount (struct super_blunlock_kernel ();if (enable_quota) -vfs_dq_quota_on_remount (sb); +dquot_resume (sb,-1 );return 0 ; restore_opts: sb->s_flags = old_sb_flags;Index:
linux-2.6/fs/ext4/super.c
===================================================================fs/ext4/super.c +3
-5@@ -3631,11 +3631,9 @@ static int ext4_remount(struct super_blo }if (*flags &MS_RDONLY ) { - err =vfs_dq_off (sb,1 ); -if (err <0 && err != -ENOSYS ) { - err = -EBUSY ; + err =dquot_suspend (sb,-1 ); +if (err <0 ) goto restore_opts; - }/* * First of all, the unconditional stuff we have to do @@ -3722,7 +3720,7 @@ static int ext4_remount(struct super_blounlock_super (sb);unlock_kernel ();if (enable_quota) -vfs_dq_quota_on_remount (sb); +dquot_resume (sb,-1 );return 0 ; restore_opts:Index:
linux-2.6/fs/jfs/super.c
===================================================================fs/jfs/super.c +4
-4@@ -397,14 +397,14 @@ static int jfs_remount(struct super_blocJFS_SBI (sb)->flag = flag; ret =jfs_mount_rw (sb,1 );unlock_kernel (); -vfs_dq_quota_on_remount (sb); +dquot_resume (sb,-1 );return ret; }if ((!(sb->s_flags &MS_RDONLY )) && (*flags &MS_RDONLY )) { - rc =vfs_dq_off (sb,1 ); -if (rc <0 && rc != -ENOSYS ) { + rc =dquot_suspend (sb,-1 ); +if (rc <0 ) {unlock_kernel (); -return -EBUSY ; +return rc; } rc =jfs_umount_rw (sb);JFS_SBI (sb)->flag = flag;Index:
linux-2.6/fs/ocfs2/super.c
===================================================================fs/ocfs2/super.c +5
-9@@ -873,13 +873,9 @@ static int ocfs2_susp_quotas(struct ocfsif (!OCFS2_HAS_RO_COMPAT_FEATURE (sb, feature[type]))continue ;if (unsuspend) - status =vfs_quota_enable ( -sb_dqopt (sb)->files[type], - type,QFMT_OCFS2 , -DQUOT_SUSPENDED ); + status =dquot_resume (sb, type);else - status =vfs_quota_disable (sb, type, -DQUOT_SUSPENDED ); + status =dquot_suspend (sb, type);if (status <0 )break ; }@@ -942,8 +938,8 @@ static void ocfs2_disable_quotas(struct/* Turn off quotas. This will remove all dquot structures from * memory and so they will be automatically synced to global * quota files */ -vfs_quota_disable (sb, type,DQUOT_USAGE_ENABLED | -DQUOT_LIMITS_ENABLED ); +dquot_disable (sb, type,DQUOT_USAGE_ENABLED | +DQUOT_LIMITS_ENABLED );if (!inode)continue ;iput (inode);@@ -973,7 +969,7 @@ static int ocfs2_quota_off(struct super_if (remount)return 0 ;/* Ignore now and handle later in * ocfs2_remount() */ -return vfs_quota_disable (sb, type,DQUOT_LIMITS_ENABLED ); +return dquot_disable (sb, type,DQUOT_LIMITS_ENABLED ); }static const struct quotactl_ops ocfs2_quotactl_ops = {Index:
linux-2.6/fs/reiserfs/super.c
===================================================================fs/reiserfs/super.c +3
-5@@ -1243,11 +1243,9 @@ static int reiserfs_remount(struct super/* it is read-only already */ goto out_ok; - err =vfs_dq_off (s,1 ); -if (err <0 && err != -ENOSYS ) { - err = -EBUSY ; + err =dquot_suspend (s,-1 ); +if (err <0 ) goto out_err; - }/* try to remount file system with read-only permissions */ if (sb_umount_state(rs) == REISERFS_VALID_FS@@ -1304,7 +1302,7 @@ static int reiserfs_remount(struct superif (!(*mount_flags &MS_RDONLY )) {finish_unfinished (s);reiserfs_xattr_init (s, *mount_flags); -vfs_dq_quota_on_remount (s); +dquot_resume (s,-1 ); } out_ok:Index:
linux-2.6/fs/ufs/super.c
===================================================================fs/ufs/super.c +4
-4@@ -1291,11 +1291,11 @@ static int ufs_remount (struct super_blo* fs was mouted as rw, remounting ro */ if (*mount_flags &MS_RDONLY ) { - err =vfs_dq_off (sb,1 ); -if (err <0 && err != -ENOSYS ) { + err =dquot_suspend (sb,-1 ); +if (err <0 ) {unlock_super (sb);unlock_kernel (); -return -EBUSY ; +return err; }ufs_put_super_internal (sb);@@ -1343,7 +1343,7 @@ static int ufs_remount (struct super_blounlock_super (sb);unlock_kernel ();if (enable_quota) -vfs_dq_quota_on_remount (sb); +dquot_resume (sb,-1 );return 0 ; }Index:
linux-2.6/include/linux/quotaops.h
===================================================================include/linux/quotaops.h +20
-7@@ -42,6 +42,10 @@ int dquot_alloc_inode(const struct inodeint dquot_claim_space_nodirty (struct inode *inode,qsize_t number);void dquot_free_inode (const struct inode *inode); +int dquot_disable (struct super_block *sb,int type,unsigned int flags); +int dquot_suspend (struct super_block *sb,int type); +int dquot_resume (struct super_block *sb,int type); +int dquot_commit (struct dquot *dquot);int dquot_acquire (struct dquot *dquot);int dquot_release (struct dquot *dquot);@@ -59,7 +63,6 @@ int vfs_quota_on_path(struct super_blockint vfs_quota_on_mount (struct super_block *sb,char *qf_name,int format_id,int type);int vfs_quota_off (struct super_block *sb,int type,int remount); -int vfs_quota_disable (struct super_block *sb,int type,unsigned int flags);int vfs_quota_sync (struct super_block *sb,int type,int wait);int vfs_get_dqinfo (struct super_block *sb,int type,struct if_dqinfo *ii);int vfs_set_dqinfo (struct super_block *sb,int type,struct if_dqinfo *ii);@@ -69,7 +72,6 @@ int vfs_set_dqblk(struct super_block *sb struct fs_disk_quota *di);int dquot_transfer (struct inode *inode,struct iattr *iattr); -int vfs_dq_quota_on_remount (struct super_block *sb);static inline struct mem_dqinfo *sb_dqinfo (struct super_block *sb,int type) {@@ -222,11 +224,6 @@ static inline int vfs_dq_off(struct supereturn 0 ; } -static inline int vfs_dq_quota_on_remount (struct super_block *sb) -{ -return 0 ; -} -static inline int dquot_transfer (struct inode *inode,struct iattr *iattr) {return 0 ;@@ -253,6 +250,22 @@ static inline int dquot_claim_space_nodi return 0; } +static inline int dquot_disable (struct super_block *sb,int type, +unsigned int flags) +{ +return 0 ; +} + +static inline int dquot_suspend (struct super_block *sb,int type) +{ +return 0 ; +} + +static inline int dquot_resume (struct super_block *sb,int type) +{ +return 0 ; +} +#define dquot_file_open generic_file_open#endif /* CONFIG_QUOTA */
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
PATCH 3/6 dquot: move unmount handling into the filesystem
In reply to Christoph HellwigCurrently the VFS calls into the quotactl interface for unmounting filesystems. This means filesystems with their own quota handling can't easily distinguish between user-space originating quotaoff and an unount. Instead move the responsibily of the unmount handling into the filesystem to be consistent with all other dquot handling.
Note that we do call dquot_disable a lot later now, e.g. after a sync_filesystem. But this is fine as the quota code takes care of writing out the quota file by itself.
fs/ext2/super.c +2 -0
@@ -119,6 +119,8 @@ static void ext2_put_super (struct superint i;struct ext2_sb_info *sbi =EXT2_SB (sb); +dquot_disable (sb,-1 ,DQUOT_USAGE_ENABLED |DQUOT_LIMITS_ENABLED ); +if (sb->s_dirt)ext2_write_super (sb);
fs/ext3/super.c +2 -0
@@ -410,6 +410,8 @@ static void ext3_put_super (struct superstruct ext3_super_block *es = sbi->s_es;int i, err; +dquot_disable (sb,-1 ,DQUOT_USAGE_ENABLED |DQUOT_LIMITS_ENABLED ); +lock_kernel ();ext3_xattr_put_super (sb);
fs/ext4/super.c +2 -0
@@ -645,6 +645,8 @@ static void ext4_put_super(struct super_struct ext4_super_block *es = sbi->s_es;int i, err; +dquot_disable (sb,-1 ,DQUOT_USAGE_ENABLED |DQUOT_LIMITS_ENABLED ); +flush_workqueue (sbi->dio_unwritten_wq);destroy_workqueue (sbi->dio_unwritten_wq);
fs/jfs/super.c +2 -0
@@ -179,6 +179,8 @@ static void jfs_put_super(struct super_bjfs_info ("In jfs_put_super" ); +dquot_disable (sb,-1 ,DQUOT_USAGE_ENABLED |DQUOT_LIMITS_ENABLED ); +lock_kernel (); rc =jfs_umount (sb);
fs/ocfs2/super.c +2 -0
@@ -1595,6 +1595,8 @@ static void ocfs2_put_super(struct super {mlog_entry ("(0x%p)\n" , sb); +dquot_disable (sb,-1 ,DQUOT_LIMITS_ENABLED ); +lock_kernel ();ocfs2_sync_blockdev (sb);
fs/reiserfs/super.c +2 -0
@@ -466,6 +466,8 @@ static void reiserfs_put_super(struct sustruct reiserfs_transaction_handle th; th.t_trans_id =0 ; +dquot_disable (s,-1 ,DQUOT_USAGE_ENABLED |DQUOT_LIMITS_ENABLED ); +reiserfs_write_lock (s);if (s->s_dirt)
fs/super.c +0 -2
@@ -192,7 +190,6 @@ void deactivate_super(struct super_blockif (atomic_dec_and_lock (&s->s_active, &sb_lock)) { s->s_count -=S_BIAS -1 ;spin_unlock (&sb_lock); -vfs_dq_off (s,0 );down_write (&s->s_umount); fs->kill_sb (s);put_filesystem (fs);
@@ -219,7 +216,6 @@ void deactivate_locked_super(struct supeif (atomic_dec_and_lock (&s->s_active, &sb_lock)) { s->s_count -=S_BIAS -1 ;spin_unlock (&sb_lock); -vfs_dq_off (s,0 ); fs->kill_sb (s);put_filesystem (fs);put_super (s);
fs/ufs/super.c +2 -0
@@ -1227,6 +1227,8 @@ static void ufs_put_super(struct super_bUFSD ("ENTER\n" ); +dquot_disable (sb,-1 ,DQUOT_USAGE_ENABLED |DQUOT_LIMITS_ENABLED ); +if (sb->s_dirt)ufs_write_super (sb);
include/linux/quotaops.h +0 -15
@@ -143,16 +143,6 @@ extern const struct quotactl_ops vfs_quo#define sb_dquot_ops (&dquot_operations)#define sb_quotactl_ops (&vfs_quotactl_ops) -/* Cannot be called inside a transaction */ -static inline int vfs_dq_off (struct super_block *sb,int remount) -{ -int ret = -ENOSYS ; - -if (sb->s_qcop && sb->s_qcop->quota_off) - ret = sb->s_qcop->quota_off (sb,-1 , remount); -return ret; -} -#else static inline int sb_has_quota_usage_enabled (struct super_block *sb,int type)
@@ -219,11 +209,6 @@ static inline void dquot_free_inode(cons { } -static inline int vfs_dq_off (struct super_block *sb,int remount) -{ -return 0 ; -} -static inline int dquot_transfer (struct inode *inode,struct iattr *iattr) {return 0 ;
Jan Kara
reviewerRe: [PATCH 3/6] dquot: move unmount handling into the filesystem
Quoted 9 lines · Christoph Hellwig
Currently the VFS calls into the quotactl interface for unmounting filesystems. This means filesystems with their own quota handling can't easily distinguish between user-space originating quotaoff and an unount. Instead move the responsibily of the unmount handling into the filesystem to be consistent with all other dquot handling.
Note that we do call
dquot_disablea lot later now, e.g. after async_filesystem. But this is fine as the quota code takes care of writing out the quota file by itself.
Well, we don't really write quota file by ourselves but we do the writes
via blockdev's mapping and that is synced after put_super is called so you are right it should be fine.
fs/ocfs2/super.c static void ocfs2_put_super(struct super · line 1599
Quoted 10 lines
Index:
linux-2.6/fs/ocfs2/super.c
===================================================================fs/ocfs2/super.c +2
-0@@ -1595,6 +1595,8 @@ static void ocfs2_put_super(struct super {mlog_entry ("(0x%p)\n" , sb); +dquot_disable (sb,-1 ,DQUOT_LIMITS_ENABLED ); +
OCFS2 disables quotas completely on it's own slightly later inocfs2_dismount_volume so you can just remove this.
Otherwise the patch looks fine.
Honza
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
Re: [PATCH 3/6] dquot: move unmount handling into the filesystem
Quoted 8 lines · Jan Kara
Quoted 8 lines
Index:
linux-2.6/fs/ocfs2/super.c
===================================================================fs/ocfs2/super.c +0
-0@@ -1595,6 +1595,8 @@ static void ocfs2_put_super(struct super {mlog_entry ("(0x%p)\n" , sb);
Quoted 5 lines
fs/ocfs2/super.c static void ocfs2_put_super(struct super · line 1599
Quoted 2 lines
fs/ocfs2/super.c +2
-0+dquot_disable (sb,-1 ,DQUOT_LIMITS_ENABLED ); +OCFS2 disables quotas completely on it's own slightly later in
ocfs2_dismount_volumeso you can just remove this.
Otherwise the patch looks fine.
I'll leave it out for the next respin.
PATCH 4/6 quota: drop remount argument to ->quota_on and ->quota_off
In reply to Christoph HellwigRemount handling has fully moved into the filesystem, so all this is superflous now.
fs/ocfs2/super.c +2 -8
@@ -948,7 +948,7 @@ static void ocfs2_disable_quotas(struct/* Handle quota on quotactl */ static int ocfs2_quota_on (struct super_block *sb,int type,int format_id, -char *path,int remount) +char *path) {unsigned int feature[MAXQUOTAS ] = {OCFS2_FEATURE_RO_COMPAT_USRQUOTA ,OCFS2_FEATURE_RO_COMPAT_GRPQUOTA };
@@ -956,19 +956,13 @@ static int ocfs2_quota_on(struct super_bif (!OCFS2_HAS_RO_COMPAT_FEATURE (sb, feature[type]))return -EINVAL ; -if (remount) -return 0 ;/* Just ignore it has been handled in -* ocfs2_remount() */ return vfs_quota_enable (sb_dqopt (sb)->files[type], type, format_id,DQUOT_LIMITS_ENABLED ); }/* Handle quota off quotactl */ -static int ocfs2_quota_off (struct super_block *sb,int type,int remount) +static int ocfs2_quota_off (struct super_block *sb,int type) { -if (remount) -return 0 ;/* Ignore now and handle later in -* ocfs2_remount() */ return dquot_disable (sb, type,DQUOT_LIMITS_ENABLED ); }
fs/quota/dquot.c +2 -6
@@ -2007,9 +2007,8 @@ put_inodes: }EXPORT_SYMBOL (dquot_disable); -int vfs_quota_off (struct super_block *sb,int type,int remount) +int vfs_quota_off (struct super_block *sb,int type) { -BUG_ON (remount);return dquot_disable (sb, type,DQUOT_USAGE_ENABLED |DQUOT_LIMITS_ENABLED ); }
@@ -2191,14 +2190,11 @@ int vfs_quota_on_path(struct super_block }EXPORT_SYMBOL (vfs_quota_on_path); -int vfs_quota_on (struct super_block *sb,int type,int format_id,char *name, -int remount) +int vfs_quota_on (struct super_block *sb,int type,int format_id,char *name) {struct path path;int error; -BUG_ON (remount); - error =kern_path (name,LOOKUP_FOLLOW , &path);if (!error) { error =vfs_quota_on_path (sb, type, format_id, &path);
include/linux/quotaops.h +2 -2
@@ -55,14 +55,14 @@ int dquot_mark_dquot_dirty(struct dquotint dquot_file_open (struct inode *inode,struct file *file);int vfs_quota_on (struct super_block *sb,int type,int format_id, -char *path,int remount); +char *path);int vfs_quota_enable (struct inode *inode,int type,int format_id,unsigned int flags);int vfs_quota_on_path (struct super_block *sb,int type,int format_id,struct path *path);int vfs_quota_on_mount (struct super_block *sb,char *qf_name,int format_id,int type); -int vfs_quota_off (struct super_block *sb,int type,int remount); +int vfs_quota_off (struct super_block *sb,int type);int vfs_quota_sync (struct super_block *sb,int type,int wait);int vfs_get_dqinfo (struct super_block *sb,int type,struct if_dqinfo *ii);int vfs_set_dqinfo (struct super_block *sb,int type,struct if_dqinfo *ii);
fs/ext3/super.c +3 -6
@@ -750,7 +750,7 @@ static int ext3_release_dquot(struct dqustatic int ext3_mark_dquot_dirty (struct dquot *dquot);static int ext3_write_info (struct super_block *sb,int type);static int ext3_quota_on (struct super_block *sb,int type,int format_id, -char *path,int remount); +char *path);static int ext3_quota_on_mount (struct super_block *sb,int type);static ssize_t ext3_quota_read (struct super_block *sb,int type,char *data,size_t len,loff_t off);
@@ -1529,7 +1529,7 @@ static void ext3_orphan_cleanup (struct/* Turn quotas off */ for (i =0 ; i <MAXQUOTAS ; i++) {if (sb_dqopt (sb)->files[i]) -vfs_quota_off (sb, i,0 ); +vfs_quota_off (sb, i); }#endif sb->s_flags = s_flags;/* Restore MS_RDONLY status */
@@ -2870,16 +2870,13 @@ static int ext3_quota_on_mount(struct su* Standard function to be called on quota_on */ static int ext3_quota_on (struct super_block *sb,int type,int format_id, -char *name,int remount) +char *name) {int err;struct path path;if (!test_opt (sb,QUOTA ))return -EINVAL ; -/* When remounting, no checks are needed and in fact, name is NULL */ -if (remount) -return vfs_quota_on (sb, type, format_id, name, remount); err =kern_path (name,LOOKUP_FOLLOW , &path);if (err)
fs/ext4/super.c +3 -6
@@ -1061,7 +1061,7 @@ static int ext4_release_dquot(struct dqustatic int ext4_mark_dquot_dirty (struct dquot *dquot);static int ext4_write_info (struct super_block *sb,int type);static int ext4_quota_on (struct super_block *sb,int type,int format_id, -char *path,int remount); +char *path);static int ext4_quota_on_mount (struct super_block *sb,int type);static ssize_t ext4_quota_read (struct super_block *sb,int type,char *data,size_t len,loff_t off);
@@ -2053,7 +2053,7 @@ static void ext4_orphan_cleanup(struct s/* Turn quotas off */ for (i =0 ; i <MAXQUOTAS ; i++) {if (sb_dqopt (sb)->files[i]) -vfs_quota_off (sb, i,0 ); +vfs_quota_off (sb, i); }#endif sb->s_flags = s_flags;/* Restore MS_RDONLY status */
@@ -3924,16 +3924,13 @@ static int ext4_quota_on_mount(struct su* Standard function to be called on quota_on */ static int ext4_quota_on (struct super_block *sb,int type,int format_id, -char *name,int remount) +char *name) {int err;struct path path;if (!test_opt (sb,QUOTA ))return -EINVAL ; -/* When remounting, no checks are needed and in fact, name is NULL */ -if (remount) -return vfs_quota_on (sb, type, format_id, name, remount); err =kern_path (name,LOOKUP_FOLLOW , &path);if (err)
fs/quota/quota.c +2 -2
@@ -87,7 +87,7 @@ static int quota_quotaon(struct super_blif (IS_ERR (pathname))return PTR_ERR (pathname);if (sb->s_qcop->quota_on) - ret = sb->s_qcop->quota_on (sb, type, id, pathname,0 ); + ret = sb->s_qcop->quota_on (sb, type, id, pathname);putname (pathname);return ret; }
@@ -274,7 +274,7 @@ static int do_quotactl(struct super_bloccase Q_QUOTAOFF :if (!sb->s_qcop->quota_off)return -ENOSYS ; -return sb->s_qcop->quota_off (sb, type,0 ); +return sb->s_qcop->quota_off (sb, type);case Q_GETFMT :return quota_getfmt (sb, type, addr);case Q_GETINFO :
fs/reiserfs/super.c +4 -6
@@ -305,7 +305,7 @@ static int finish_unfinished(struct supe/* Turn quotas off */ for (i =0 ; i <MAXQUOTAS ; i++) {if (sb_dqopt (s)->files[i]) -vfs_quota_off (s, i,0 ); +vfs_quota_off (s, i); }if (ms_active_set)/* Restore the flag back */
@@ -622,7 +622,7 @@ static int reiserfs_acquire_dquot(structstatic int reiserfs_release_dquot (struct dquot *);static int reiserfs_mark_dquot_dirty (struct dquot *);static int reiserfs_write_info (struct super_block *,int ); -static int reiserfs_quota_on (struct super_block *,int ,int ,char *,int ); +static int reiserfs_quota_on (struct super_block *,int ,int ,char *);static const struct dquot_operations reiserfs_quota_operations = { .write_dquot = reiserfs_write_dquot,
@@ -2038,7 +2038,7 @@ static int reiserfs_quota_on_mount(struc* Standard function to be called on quota_on */ static int reiserfs_quota_on (struct super_block *sb,int type,int format_id, -char *name,int remount) +char *name) {int err;struct path path;
@@ -2047,9 +2047,7 @@ static int reiserfs_quota_on(struct supeif (!(REISERFS_SB (sb)->s_mount_opt & (1 <<REISERFS_QUOTA )))return -EINVAL ; -/* No more checks needed? Path and format_id are bogus anyway... */ -if (remount) -return vfs_quota_on (sb, type, format_id, name,1 ); + err =kern_path (name,LOOKUP_FOLLOW , &path);if (err)return err;
include/linux/quota.h +2 -2
@@ -332,8 +332,8 @@ struct dquot_operations {/* Operations handling requests from userspace */ struct quotactl_ops { -int (*quota_on)(struct super_block *,int ,int ,char *,int ); -int (*quota_off)(struct super_block *,int ,int ); +int (*quota_on)(struct super_block *,int ,int ,char *); +int (*quota_off)(struct super_block *,int );int (*quota_sync)(struct super_block *,int ,int );int (*get_info)(struct super_block *,int ,struct if_dqinfo *);int (*set_info)(struct super_block *,int ,struct if_dqinfo *);
Jan Kara
reviewerRe: [PATCH 4/6] quota: drop remount argument to ->quota_on and ->quota_off
Quoted 2 lines · Christoph Hellwig
Remount handling has fully moved into the filesystem, so all this is superflous now.
Looks good.
Honza
PATCH 5/6 quota: explicitly set ->dq_op and ->s_qcop
In reply to Christoph HellwigOnly set the quota operation vectors if the filesystem actually supports quota instead of doing it for all filesystems in alloc_super().
fs/super.c +0 -3
@@ -26,7 +26,6 @@#include <linux/smp_lock.h> #include <linux/acct.h> #include <linux/blkdev.h> -#include <linux/quotaops.h> #include <linux/namei.h> #include <linux/mount.h> #include <linux/security.h>
@@ -101,8 +100,6 @@ static struct super_block *alloc_super(sinit_rwsem (&s->s_dquot.dqptr_sem);init_waitqueue_head (&s->s_wait_unfrozen); s->s_maxbytes =MAX_NON_LFS ; - s->dq_op = sb_dquot_ops; - s->s_qcop = sb_quotactl_ops; s->s_op = &default_op; s->s_time_gran =1000000000 ; }
include/linux/quotaops.h +0 -9
@@ -140,9 +140,6 @@ static inline unsigned sb_any_quota_actiextern const struct dquot_operations dquot_operations;extern const struct quotactl_ops vfs_quotactl_ops; -#define sb_dquot_ops (&dquot_operations) -#define sb_quotactl_ops (&vfs_quotactl_ops) -#else static inline int sb_has_quota_usage_enabled (struct super_block *sb,int type)
@@ -186,12 +183,6 @@ static inline int sb_any_quota_active(streturn 0 ; } -/* -* NO-OP when quota not configured. -*/ -#define sb_dquot_ops (NULL) -#define sb_quotactl_ops (NULL) -static inline void dquot_initialize (struct inode *inode) { }
fs/jfs/super.c +4 -0
@@ -479,6 +479,10 @@ static int jfs_fill_super(struct super_b*/ sb->s_op = &jfs_super_operations; sb->s_export_op = &jfs_export_operations; +#ifdef CONFIG_QUOTA + sb->dq_op = &dquot_operations; + sb->s_qcop = &vfs_quotactl_ops; +#endif /* * Initialize direct-mapping inode/address-space
fs/udf/super.c +6 -1
@@ -56,6 +56,7 @@#include <linux/mount.h> #include <linux/seq_file.h> #include <linux/bitmap.h> +#include <linux/quotaops.h> #include <linux/crc-itu-t.h> #include <asm/byteorder.h>
@@ -1939,7 +1940,11 @@ static int udf_fill_super(struct super_b/* Fill in the rest of the superblock */ sb->s_op = &udf_sb_ops; sb->s_export_op = &udf_export_ops; - sb->dq_op =NULL ; +#ifdef CONFIG_QUOTA + sb->s_qcop = &vfs_quotactl_ops; + sb->dq_op =NULL ;/* &dquot_operations */ +#endif + sb->s_dirt =0 ; sb->s_magic =UDF_SUPER_MAGIC ; sb->s_time_gran =1000 ;
fs/ufs/super.c +5 -1
@@ -1045,7 +1045,11 @@ magic_found:*/ sb->s_op = &ufs_super_ops; sb->s_export_op = &ufs_export_ops; - sb->dq_op =NULL ;/***/ +#ifdef CONFIG_QUOTA + sb->s_qcop = &vfs_quotactl_ops; + sb->dq_op =NULL ;/* &dquot_operations */ +#endif + sb->s_magic =fs32_to_cpu (sb, usb3->fs_magic); uspi->s_sblkno =fs32_to_cpu (sb, usb1->fs_sblkno);
Jan Kara
reviewerRe: [PATCH 5/6] quota: explicitly set ->dq_op and ->s_qcop
Quoted 2 lines · Christoph Hellwig
Only set the quota operation vectors if the filesystem actually supports quota instead of doing it for all filesystems in
alloc_super().
Hmm, what about ext2? Otherwise the patch looks fine.
Honza
Quoted 108 lines
Signed-off-by Christoph Hellwig <[email protected]>Index:
linux-2.6/fs/super.c
===================================================================fs/super.c +0
-3@@ -26,7 +26,6 @@#include <linux/smp_lock.h> #include <linux/acct.h> #include <linux/blkdev.h> -#include <linux/quotaops.h> #include <linux/namei.h> #include <linux/mount.h> #include <linux/security.h> @@ -101,8 +100,6 @@ static struct super_block *alloc_super(sinit_rwsem (&s->s_dquot.dqptr_sem);init_waitqueue_head (&s->s_wait_unfrozen); s->s_maxbytes =MAX_NON_LFS ; - s->dq_op = sb_dquot_ops; - s->s_qcop = sb_quotactl_ops; s->s_op = &default_op; s->s_time_gran =1000000000 ; }Index:
linux-2.6/include/linux/quotaops.h
===================================================================include/linux/quotaops.h +0
-9@@ -140,9 +140,6 @@ static inline unsigned sb_any_quota_actiextern const struct dquot_operations dquot_operations;extern const struct quotactl_ops vfs_quotactl_ops; -#define sb_dquot_ops (&dquot_operations) -#define sb_quotactl_ops (&vfs_quotactl_ops) -#else static inline int sb_has_quota_usage_enabled (struct super_block *sb,int type)@@ -186,12 +183,6 @@ static inline int sb_any_quota_active(streturn 0 ; } -/* -* NO-OP when quota not configured. -*/ -#define sb_dquot_ops (NULL) -#define sb_quotactl_ops (NULL) -static inline void dquot_initialize (struct inode *inode) { }Index:
linux-2.6/fs/jfs/super.c
===================================================================fs/jfs/super.c +4
-0@@ -479,6 +479,10 @@ static int jfs_fill_super(struct super_b*/ sb->s_op = &jfs_super_operations; sb->s_export_op = &jfs_export_operations; +#ifdef CONFIG_QUOTA + sb->dq_op = &dquot_operations; + sb->s_qcop = &vfs_quotactl_ops; +#endif /* * Initialize direct-mapping inode/address-space Index:
linux-2.6/fs/udf/super.c
===================================================================fs/udf/super.c +6
-1@@ -56,6 +56,7 @@#include <linux/mount.h> #include <linux/seq_file.h> #include <linux/bitmap.h> +#include <linux/quotaops.h> #include <linux/crc-itu-t.h> #include <asm/byteorder.h> @@ -1939,7 +1940,11 @@ static int udf_fill_super(struct super_b/* Fill in the rest of the superblock */ sb->s_op = &udf_sb_ops; sb->s_export_op = &udf_export_ops; - sb->dq_op =NULL ; +#ifdef CONFIG_QUOTA + sb->s_qcop = &vfs_quotactl_ops; + sb->dq_op =NULL ;/* &dquot_operations */ +#endif + sb->s_dirt =0 ; sb->s_magic =UDF_SUPER_MAGIC ; sb->s_time_gran =1000 ;Index:
linux-2.6/fs/ufs/super.c
===================================================================fs/ufs/super.c +5
-1@@ -1045,7 +1045,11 @@ magic_found:*/ sb->s_op = &ufs_super_ops; sb->s_export_op = &ufs_export_ops; - sb->dq_op =NULL ;/***/ +#ifdef CONFIG_QUOTA + sb->s_qcop = &vfs_quotactl_ops; + sb->dq_op =NULL ;/* &dquot_operations */ +#endif + sb->s_magic =fs32_to_cpu (sb, usb3->fs_magic); uspi->s_sblkno =fs32_to_cpu (sb, usb1->fs_sblkno);
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
Re: [PATCH 5/6] quota: explicitly set ->dq_op and ->s_qcop
Quoted 4 lines · Jan Kara
Quoted 2 lines · Christoph Hellwig
Only set the quota operation vectors if the filesystem actually supports quota instead of doing it for all filesystems in
alloc_super().Hmm, what about ext2? Otherwise the patch looks fine.
Fixed for the next spin.
PATCH 6/6 quota: rename default quotactl methods to dqout_
In reply to Christoph HellwigFollow the dqout_* style used elsewhere in dquot.c.
fs/ext3/super.c +10 -10
@@ -769,12 +769,12 @@ static const struct dquot_operations extstatic const struct quotactl_ops ext3_qctl_operations = { .quota_on = ext3_quota_on, - .quota_off = vfs_quota_off, - .quota_sync = vfs_quota_sync, - .get_info = vfs_get_dqinfo, - .set_info = vfs_set_dqinfo, - .get_dqblk = vfs_get_dqblk, - .set_dqblk = vfs_set_dqblk + .quota_off = dquot_quota_off, + .quota_sync = dquot_quota_sync, + .get_info = dquot_get_dqinfo, + .set_info = dquot_set_dqinfo, + .get_dqblk = dquot_get_dqblk, + .set_dqblk = dquot_set_dqblk };#endif
@@ -1529,7 +1529,7 @@ static void ext3_orphan_cleanup (struct/* Turn quotas off */ for (i =0 ; i <MAXQUOTAS ; i++) {if (sb_dqopt (sb)->files[i]) -vfs_quota_off (sb, i); +dquot_quota_off (sb, i); }#endif sb->s_flags = s_flags;/* Restore MS_RDONLY status */
@@ -2862,8 +2862,8 @@ static int ext3_write_info(struct super_*/ static int ext3_quota_on_mount (struct super_block *sb,int type) { -return vfs_quota_on_mount (sb,EXT3_SB (sb)->s_qf_names[type], -EXT3_SB (sb)->s_jquota_fmt, type); +return dquot_quota_on_mount (sb,EXT3_SB (sb)->s_qf_names[type], +EXT3_SB (sb)->s_jquota_fmt, type); }/*
@@ -2914,7 +2914,7 @@ static int ext3_quota_on(struct super_bl } } - err =vfs_quota_on_path (sb, type, format_id, &path); + err =dquot_quota_on_path (sb, type, format_id, &path);path_put (&path);return err; }
fs/ext4/super.c +10 -10
@@ -1083,12 +1083,12 @@ static const struct dquot_operations extstatic const struct quotactl_ops ext4_qctl_operations = { .quota_on = ext4_quota_on, - .quota_off = vfs_quota_off, - .quota_sync = vfs_quota_sync, - .get_info = vfs_get_dqinfo, - .set_info = vfs_set_dqinfo, - .get_dqblk = vfs_get_dqblk, - .set_dqblk = vfs_set_dqblk + .quota_off = dquot_quota_off, + .quota_sync = dquot_quota_sync, + .get_info = dquot_get_dqinfo, + .set_info = dquot_set_dqinfo, + .get_dqblk = dquot_get_dqblk, + .set_dqblk = dquot_set_dqblk };#endif
@@ -2053,7 +2053,7 @@ static void ext4_orphan_cleanup(struct s/* Turn quotas off */ for (i =0 ; i <MAXQUOTAS ; i++) {if (sb_dqopt (sb)->files[i]) -vfs_quota_off (sb, i); +dquot_quota_off (sb, i); }#endif sb->s_flags = s_flags;/* Restore MS_RDONLY status */
@@ -3916,8 +3916,8 @@ static int ext4_write_info(struct super_*/ static int ext4_quota_on_mount (struct super_block *sb,int type) { -return vfs_quota_on_mount (sb,EXT4_SB (sb)->s_qf_names[type], -EXT4_SB (sb)->s_jquota_fmt, type); +return dquot_quota_on_mount (sb,EXT4_SB (sb)->s_qf_names[type], +EXT4_SB (sb)->s_jquota_fmt, type); }/*
@@ -3969,7 +3969,7 @@ static int ext4_quota_on(struct super_bl } } - err =vfs_quota_on_path (sb, type, format_id, &path); + err =dquot_quota_on_path (sb, type, format_id, &path);path_put (&path);return err; }
fs/jfs/super.c +1 -1
@@ -481,7 +481,7 @@ static int jfs_fill_super(struct super_b sb->s_export_op = &jfs_export_operations;#ifdef CONFIG_QUOTA sb->dq_op = &dquot_operations; - sb->s_qcop = &vfs_quotactl_ops; + sb->s_qcop = &dquot_quotactl_ops;#endif /*
fs/ocfs2/super.c +9 -9
@@ -906,8 +906,8 @@ static int ocfs2_enable_quotas(struct oc status = -ENOENT ; goto out_quota_off; } - status =vfs_quota_enable (inode[type], type,QFMT_OCFS2 , -DQUOT_USAGE_ENABLED ); + status =dquot_enable (inode[type], type,QFMT_OCFS2 , +DQUOT_USAGE_ENABLED );if (status <0 ) goto out_quota_off; }
@@ -956,8 +956,8 @@ static int ocfs2_quota_on(struct super_bif (!OCFS2_HAS_RO_COMPAT_FEATURE (sb, feature[type]))return -EINVAL ; -return vfs_quota_enable (sb_dqopt (sb)->files[type], type, - format_id,DQUOT_LIMITS_ENABLED ); +return dquot_enable (sb_dqopt (sb)->files[type], type, + format_id,DQUOT_LIMITS_ENABLED ); }/* Handle quota off quotactl */
@@ -969,11 +969,11 @@ static int ocfs2_quota_off(struct super_static const struct quotactl_ops ocfs2_quotactl_ops = { .quota_on = ocfs2_quota_on, .quota_off = ocfs2_quota_off, - .quota_sync = vfs_quota_sync, - .get_info = vfs_get_dqinfo, - .set_info = vfs_set_dqinfo, - .get_dqblk = vfs_get_dqblk, - .set_dqblk = vfs_set_dqblk, + .quota_sync = dquot_quota_sync, + .get_info = dquot_get_dqinfo, + .set_info = dquot_set_dqinfo, + .get_dqblk = dquot_get_dqblk, + .set_dqblk = dquot_set_dqblk, };static int ocfs2_fill_super (struct super_block *sb,void *data,int silent)
fs/quota/dquot.c +31 -31
170 lines not on this page · raw message
fs/reiserfs/super.c +10 -10
@@ -305,7 +305,7 @@ static int finish_unfinished(struct supe/* Turn quotas off */ for (i =0 ; i <MAXQUOTAS ; i++) {if (sb_dqopt (s)->files[i]) -vfs_quota_off (s, i); +dquot_quota_off (s, i); }if (ms_active_set)/* Restore the flag back */
@@ -636,12 +636,12 @@ static const struct dquot_operations reistatic const struct quotactl_ops reiserfs_qctl_operations = { .quota_on = reiserfs_quota_on, - .quota_off = vfs_quota_off, - .quota_sync = vfs_quota_sync, - .get_info = vfs_get_dqinfo, - .set_info = vfs_set_dqinfo, - .get_dqblk = vfs_get_dqblk, - .set_dqblk = vfs_set_dqblk, + .quota_off = dquot_quota_off, + .quota_sync = dquot_quota_sync, + .get_info = dquot_get_dqinfo, + .set_info = dquot_set_dqinfo, + .get_dqblk = dquot_get_dqblk, + .set_dqblk = dquot_set_dqblk, };#endif
@@ -2030,8 +2030,8 @@ static int reiserfs_write_info(struct su*/ static int reiserfs_quota_on_mount (struct super_block *sb,int type) { -return vfs_quota_on_mount (sb,REISERFS_SB (sb)->s_qf_names[type], -REISERFS_SB (sb)->s_jquota_fmt, type); +return dquot_quota_on_mount (sb,REISERFS_SB (sb)->s_qf_names[type], +REISERFS_SB (sb)->s_jquota_fmt, type); }/*
@@ -2091,7 +2091,7 @@ static int reiserfs_quota_on(struct supeif (err) goto out; } - err =vfs_quota_on_path (sb, type, format_id, &path); + err =dquot_quota_on_path (sb, type, format_id, &path); out:path_put (&path);return err;
fs/ufs/super.c +1 -1
@@ -1046,7 +1046,7 @@ magic_found: sb->s_op = &ufs_super_ops; sb->s_export_op = &ufs_export_ops;#ifdef CONFIG_QUOTA - sb->s_qcop = &vfs_quotactl_ops; + sb->s_qcop = &dquot_quotactl_ops; sb->dq_op =NULL ;/* &dquot_operations */ #endif
include/linux/quotaops.h +11 -11
@@ -54,21 +54,21 @@ int dquot_mark_dquot_dirty(struct dquotint dquot_file_open (struct inode *inode,struct file *file); -int vfs_quota_on (struct super_block *sb,int type,int format_id, +int dquot_quota_on (struct super_block *sb,int type,int format_id,char *path); -int vfs_quota_enable (struct inode *inode,int type,int format_id, +int dquot_enable (struct inode *inode,int type,int format_id,unsigned int flags); -int vfs_quota_on_path (struct super_block *sb,int type,int format_id, +int dquot_quota_on_path (struct super_block *sb,int type,int format_id,struct path *path); -int vfs_quota_on_mount (struct super_block *sb,char *qf_name, +int dquot_quota_on_mount (struct super_block *sb,char *qf_name,int format_id,int type); -int vfs_quota_off (struct super_block *sb,int type); -int vfs_quota_sync (struct super_block *sb,int type,int wait); -int vfs_get_dqinfo (struct super_block *sb,int type,struct if_dqinfo *ii); -int vfs_set_dqinfo (struct super_block *sb,int type,struct if_dqinfo *ii); -int vfs_get_dqblk (struct super_block *sb,int type,qid_t id, +int dquot_quota_off (struct super_block *sb,int type); +int dquot_quota_sync (struct super_block *sb,int type,int wait); +int dquot_get_dqinfo (struct super_block *sb,int type,struct if_dqinfo *ii); +int dquot_set_dqinfo (struct super_block *sb,int type,struct if_dqinfo *ii); +int dquot_get_dqblk (struct super_block *sb,int type,qid_t id,struct fs_disk_quota *di); -int vfs_set_dqblk (struct super_block *sb,int type,qid_t id, +int dquot_set_dqblk (struct super_block *sb,int type,qid_t id,struct fs_disk_quota *di);int dquot_transfer (struct inode *inode,struct iattr *iattr);
@@ -138,7 +138,7 @@ static inline unsigned sb_any_quota_acti* Operations supported for diskquotas. */ extern const struct dquot_operations dquot_operations; -extern const struct quotactl_ops vfs_quotactl_ops; +extern const struct quotactl_ops dquot_quotactl_ops;#else
fs/udf/super.c +1 -1
@@ -1941,7 +1941,7 @@ static int udf_fill_super(struct super_b sb->s_op = &udf_sb_ops; sb->s_export_op = &udf_export_ops;#ifdef CONFIG_QUOTA - sb->s_qcop = &vfs_quotactl_ops; + sb->s_qcop = &dquot_quotactl_ops; sb->dq_op =NULL ;/* &dquot_operations */ #endif
Jan Kara
reviewerRe: [PATCH 6/6] quota: rename default quotactl methods to dqout_
Quoted 1 line · Christoph Hellwig
Follow the dqout_* style used elsewhere in
dquot.c.
^^^^^ dquot
And we'll need ext2 conversion here as well...
Honza
Quoted 474 lines
Signed-off-by Christoph Hellwig <[email protected]>Index:
linux-2.6/fs/ext3/super.c
===================================================================fs/ext3/super.c +10
-10@@ -769,12 +769,12 @@ static const struct dquot_operations extstatic const struct quotactl_ops ext3_qctl_operations = { .quota_on = ext3_quota_on, - .quota_off = vfs_quota_off, - .quota_sync = vfs_quota_sync, - .get_info = vfs_get_dqinfo, - .set_info = vfs_set_dqinfo, - .get_dqblk = vfs_get_dqblk, - .set_dqblk = vfs_set_dqblk + .quota_off = dquot_quota_off, + .quota_sync = dquot_quota_sync, + .get_info = dquot_get_dqinfo, + .set_info = dquot_set_dqinfo, + .get_dqblk = dquot_get_dqblk, + .set_dqblk = dquot_set_dqblk };#endif @@ -1529,7 +1529,7 @@ static void ext3_orphan_cleanup (struct/* Turn quotas off */ for (i =0 ; i <MAXQUOTAS ; i++) {if (sb_dqopt (sb)->files[i]) -vfs_quota_off (sb, i); +dquot_quota_off (sb, i); }#endif sb->s_flags = s_flags;/* Restore MS_RDONLY status */ @@ -2862,8 +2862,8 @@ static int ext3_write_info(struct super_*/ static int ext3_quota_on_mount (struct super_block *sb,int type) { -return vfs_quota_on_mount (sb,EXT3_SB (sb)->s_qf_names[type], -EXT3_SB (sb)->s_jquota_fmt, type); +return dquot_quota_on_mount (sb,EXT3_SB (sb)->s_qf_names[type], +EXT3_SB (sb)->s_jquota_fmt, type); }/* @@ -2914,7 +2914,7 @@ static int ext3_quota_on(struct super_bl } } - err =vfs_quota_on_path (sb, type, format_id, &path); + err =dquot_quota_on_path (sb, type, format_id, &path);path_put (&path);return err; }Index:
linux-2.6/fs/ext4/super.c
===================================================================fs/ext4/super.c +10
-10@@ -1083,12 +1083,12 @@ static const struct dquot_operations extstatic const struct quotactl_ops ext4_qctl_operations = { .quota_on = ext4_quota_on, - .quota_off = vfs_quota_off, - .quota_sync = vfs_quota_sync, - .get_info = vfs_get_dqinfo, - .set_info = vfs_set_dqinfo, - .get_dqblk = vfs_get_dqblk, - .set_dqblk = vfs_set_dqblk + .quota_off = dquot_quota_off, + .quota_sync = dquot_quota_sync, + .get_info = dquot_get_dqinfo, + .set_info = dquot_set_dqinfo, + .get_dqblk = dquot_get_dqblk, + .set_dqblk = dquot_set_dqblk };#endif @@ -2053,7 +2053,7 @@ static void ext4_orphan_cleanup(struct s/* Turn quotas off */ for (i =0 ; i <MAXQUOTAS ; i++) {if (sb_dqopt (sb)->files[i]) -vfs_quota_off (sb, i); +dquot_quota_off (sb, i); }#endif sb->s_flags = s_flags;/* Restore MS_RDONLY status */ @@ -3916,8 +3916,8 @@ static int ext4_write_info(struct super_*/ static int ext4_quota_on_mount (struct super_block *sb,int type) { -return vfs_quota_on_mount (sb,EXT4_SB (sb)->s_qf_names[type], -EXT4_SB (sb)->s_jquota_fmt, type); +return dquot_quota_on_mount (sb,EXT4_SB (sb)->s_qf_names[type], +EXT4_SB (sb)->s_jquota_fmt, type); }/* @@ -3969,7 +3969,7 @@ static int ext4_quota_on(struct super_bl } } - err =vfs_quota_on_path (sb, type, format_id, &path); + err =dquot_quota_on_path (sb, type, format_id, &path);path_put (&path);return err; }Index:
linux-2.6/fs/jfs/super.c
===================================================================fs/jfs/super.c +1
-1@@ -481,7 +481,7 @@ static int jfs_fill_super(struct super_b sb->s_export_op = &jfs_export_operations;#ifdef CONFIG_QUOTA sb->dq_op = &dquot_operations; - sb->s_qcop = &vfs_quotactl_ops; + sb->s_qcop = &dquot_quotactl_ops;#endif /* Index:
linux-2.6/fs/ocfs2/super.c
===================================================================fs/ocfs2/super.c +9
-9@@ -906,8 +906,8 @@ static int ocfs2_enable_quotas(struct oc status = -ENOENT ; goto out_quota_off; } - status =vfs_quota_enable (inode[type], type,QFMT_OCFS2 , -DQUOT_USAGE_ENABLED ); + status =dquot_enable (inode[type], type,QFMT_OCFS2 , +DQUOT_USAGE_ENABLED );if (status <0 ) goto out_quota_off; }@@ -956,8 +956,8 @@ static int ocfs2_quota_on(struct super_bif (!OCFS2_HAS_RO_COMPAT_FEATURE (sb, feature[type]))return -EINVAL ; -return vfs_quota_enable (sb_dqopt (sb)->files[type], type, - format_id,DQUOT_LIMITS_ENABLED ); +return dquot_enable (sb_dqopt (sb)->files[type], type, + format_id,DQUOT_LIMITS_ENABLED ); }/* Handle quota off quotactl */ @@ -969,11 +969,11 @@ static int ocfs2_quota_off(struct super_static const struct quotactl_ops ocfs2_quotactl_ops = { .quota_on = ocfs2_quota_on, .quota_off = ocfs2_quota_off, - .quota_sync = vfs_quota_sync, - .get_info = vfs_get_dqinfo, - .set_info = vfs_set_dqinfo, - .get_dqblk = vfs_get_dqblk, - .set_dqblk = vfs_set_dqblk, + .quota_sync = dquot_quota_sync, + .get_info = dquot_get_dqinfo, + .set_info = dquot_set_dqinfo, + .get_dqblk = dquot_get_dqblk, + .set_dqblk = dquot_set_dqblk, };static int ocfs2_fill_super (struct super_block *sb,void *data,int silent)Index:
linux-2.6/fs/quota/dquot.c
===================================================================fs/quota/dquot.c +31
-31@@ -584,7 +584,7 @@ out: }EXPORT_SYMBOL (dquot_scan_active); -int vfs_quota_sync (struct super_block *sb,int type,int wait) +int dquot_quota_sync (struct super_block *sb,int type,int wait) {struct list_head *dirty;struct dquot *dquot;@@ -656,7 +656,7 @@ int vfs_quota_sync(struct super_block *sreturn 0 ; } -EXPORT_SYMBOL (vfs_quota_sync); +EXPORT_SYMBOL (dquot_quota_sync);/* Free unused dquots from cache */ static void prune_dqcache (int count)@@ -2007,12 +2007,12 @@ put_inodes: }EXPORT_SYMBOL (dquot_disable); -int vfs_quota_off (struct super_block *sb,int type) +int dquot_quota_off (struct super_block *sb,int type) {return dquot_disable (sb, type,DQUOT_USAGE_ENABLED |DQUOT_LIMITS_ENABLED ); } -EXPORT_SYMBOL (vfs_quota_off); +EXPORT_SYMBOL (dquot_quota_off);/* * Turn quotas on on a device @@ -2173,7 +2173,7 @@ int dquot_resume(struct super_block *sb, }EXPORT_SYMBOL (dquot_resume); -int vfs_quota_on_path (struct super_block *sb,int type,int format_id, +int dquot_quota_on_path (struct super_block *sb,int type,int format_id,struct path *path) {int error =security_quota_on (path->dentry);@@ -2188,28 +2188,28 @@ int vfs_quota_on_path(struct super_block DQUOT_LIMITS_ENABLED);return error; } -EXPORT_SYMBOL (vfs_quota_on_path); +EXPORT_SYMBOL (dquot_quota_on_path); -int vfs_quota_on (struct super_block *sb,int type,int format_id,char *name) +int dquot_quota_on (struct super_block *sb,int type,int format_id,char *name) {struct path path;int error; error =kern_path (name,LOOKUP_FOLLOW , &path);if (!error) { - error =vfs_quota_on_path (sb, type, format_id, &path); + error =dquot_quota_on_path (sb, type, format_id, &path);path_put (&path); }return error; } -EXPORT_SYMBOL (vfs_quota_on); +EXPORT_SYMBOL (dquot_quota_on);/* * More powerful function for turning on quotas allowing setting * of individual quota flags */ -int vfs_quota_enable (struct inode *inode,int type,int format_id, -unsigned int flags) +int dquot_enable (struct inode *inode,int type,int format_id, +unsigned int flags) {int ret =0 ;struct super_block *sb = inode->i_sb;@@ -2249,13 +2249,13 @@ out_lock: load_quota:return vfs_load_quota_inode (inode, type, format_id, flags); } -EXPORT_SYMBOL (vfs_quota_enable); +EXPORT_SYMBOL (dquot_enable);/* * This function is used when filesystem needs to initialize quotas * during mount time. */ -int vfs_quota_on_mount (struct super_block *sb,char *qf_name, +int dquot_quota_on_mount (struct super_block *sb,char *qf_name,int format_id,int type) {struct dentry *dentry;@@ -2281,7 +2281,7 @@ out:dput (dentry);return error; } -EXPORT_SYMBOL (vfs_quota_on_mount); +EXPORT_SYMBOL (dquot_quota_on_mount);static inline qsize_t qbtos (qsize_t blocks) {@@ -2316,8 +2316,8 @@ static void do_get_dqblk(struct dquot *dspin_unlock (&dq_data_lock); } -int vfs_get_dqblk (struct super_block *sb,int type,qid_t id, -struct fs_disk_quota *di) +int dquot_get_dqblk (struct super_block *sb,int type,qid_t id, +struct fs_disk_quota *di) {struct dquot *dquot;@@ -2329,7 +2329,7 @@ int vfs_get_dqblk(struct super_block *sbreturn 0 ; } -EXPORT_SYMBOL (vfs_get_dqblk); +EXPORT_SYMBOL (dquot_get_dqblk);#define VFS_FS_DQ_MASK \ (FS_DQ_BCOUNT | FS_DQ_BSOFT | FS_DQ_BHARD | \@@ -2428,7 +2428,7 @@ static int do_set_dqblk(struct dquot *dqreturn 0 ; } -int vfs_set_dqblk (struct super_block *sb,int type,qid_t id, +int dquot_set_dqblk (struct super_block *sb,int type,qid_t id,struct fs_disk_quota *di) {struct dquot *dquot;@@ -2444,10 +2444,10 @@ int vfs_set_dqblk(struct super_block *sb out:return rc; } -EXPORT_SYMBOL (vfs_set_dqblk); +EXPORT_SYMBOL (dquot_set_dqblk);/* Generic routine for getting common part of quota file information */ -int vfs_get_dqinfo (struct super_block *sb,int type,struct if_dqinfo *ii) +int dquot_get_dqinfo (struct super_block *sb,int type,struct if_dqinfo *ii) {struct mem_dqinfo *mi;@@ -2466,10 +2466,10 @@ int vfs_get_dqinfo(struct super_block *smutex_unlock (&sb_dqopt (sb)->dqonoff_mutex);return 0 ; } -EXPORT_SYMBOL (vfs_get_dqinfo); +EXPORT_SYMBOL (dquot_get_dqinfo);/* Generic routine for setting common part of quota file information */ -int vfs_set_dqinfo (struct super_block *sb,int type,struct if_dqinfo *ii) +int dquot_set_dqinfo (struct super_block *sb,int type,struct if_dqinfo *ii) {struct mem_dqinfo *mi;int err =0 ;@@ -2496,16 +2496,16 @@ out:mutex_unlock (&sb_dqopt (sb)->dqonoff_mutex);return err; } -EXPORT_SYMBOL (vfs_set_dqinfo); +EXPORT_SYMBOL (dquot_set_dqinfo); -const struct quotactl_ops vfs_quotactl_ops = { - .quota_on = vfs_quota_on, - .quota_off = vfs_quota_off, - .quota_sync = vfs_quota_sync, - .get_info = vfs_get_dqinfo, - .set_info = vfs_set_dqinfo, - .get_dqblk = vfs_get_dqblk, - .set_dqblk = vfs_set_dqblk +const struct quotactl_ops dquot_quotactl_ops = { + .quota_on = dquot_quota_on, + .quota_off = dquot_quota_off, + .quota_sync = dquot_quota_sync, + .get_info = dquot_get_dqinfo, + .set_info = dquot_set_dqinfo, + .get_dqblk = dquot_get_dqblk, + .set_dqblk = dquot_set_dqblk };Index:
linux-2.6/fs/reiserfs/super.c
===================================================================fs/reiserfs/super.c +10
-10@@ -305,7 +305,7 @@ static int finish_unfinished(struct supe/* Turn quotas off */ for (i =0 ; i <MAXQUOTAS ; i++) {if (sb_dqopt (s)->files[i]) -vfs_quota_off (s, i); +dquot_quota_off (s, i); }if (ms_active_set)/* Restore the flag back */ @@ -636,12 +636,12 @@ static const struct dquot_operations reistatic const struct quotactl_ops reiserfs_qctl_operations = { .quota_on = reiserfs_quota_on, - .quota_off = vfs_quota_off, - .quota_sync = vfs_quota_sync, - .get_info = vfs_get_dqinfo, - .set_info = vfs_set_dqinfo, - .get_dqblk = vfs_get_dqblk, - .set_dqblk = vfs_set_dqblk, + .quota_off = dquot_quota_off, + .quota_sync = dquot_quota_sync, + .get_info = dquot_get_dqinfo, + .set_info = dquot_set_dqinfo, + .get_dqblk = dquot_get_dqblk, + .set_dqblk = dquot_set_dqblk, };#endif @@ -2030,8 +2030,8 @@ static int reiserfs_write_info(struct su*/ static int reiserfs_quota_on_mount (struct super_block *sb,int type) { -return vfs_quota_on_mount (sb,REISERFS_SB (sb)->s_qf_names[type], -REISERFS_SB (sb)->s_jquota_fmt, type); +return dquot_quota_on_mount (sb,REISERFS_SB (sb)->s_qf_names[type], +REISERFS_SB (sb)->s_jquota_fmt, type); }/* @@ -2091,7 +2091,7 @@ static int reiserfs_quota_on(struct supeif (err) goto out; } - err =vfs_quota_on_path (sb, type, format_id, &path); + err =dquot_quota_on_path (sb, type, format_id, &path); out:path_put (&path);return err;Index:
linux-2.6/fs/ufs/super.c
===================================================================fs/ufs/super.c +1
-1@@ -1046,7 +1046,7 @@ magic_found: sb->s_op = &ufs_super_ops; sb->s_export_op = &ufs_export_ops;#ifdef CONFIG_QUOTA - sb->s_qcop = &vfs_quotactl_ops; + sb->s_qcop = &dquot_quotactl_ops; sb->dq_op =NULL ;/* &dquot_operations */ #endif Index:
linux-2.6/include/linux/quotaops.h
===================================================================include/linux/quotaops.h +11
-11@@ -54,21 +54,21 @@ int dquot_mark_dquot_dirty(struct dquotint dquot_file_open (struct inode *inode,struct file *file); -int vfs_quota_on (struct super_block *sb,int type,int format_id, +int dquot_quota_on (struct super_block *sb,int type,int format_id,char *path); -int vfs_quota_enable (struct inode *inode,int type,int format_id, +int dquot_enable (struct inode *inode,int type,int format_id,unsigned int flags); -int vfs_quota_on_path (struct super_block *sb,int type,int format_id, +int dquot_quota_on_path (struct super_block *sb,int type,int format_id,struct path *path); -int vfs_quota_on_mount (struct super_block *sb,char *qf_name, +int dquot_quota_on_mount (struct super_block *sb,char *qf_name,int format_id,int type); -int vfs_quota_off (struct super_block *sb,int type); -int vfs_quota_sync (struct super_block *sb,int type,int wait); -int vfs_get_dqinfo (struct super_block *sb,int type,struct if_dqinfo *ii); -int vfs_set_dqinfo (struct super_block *sb,int type,struct if_dqinfo *ii); -int vfs_get_dqblk (struct super_block *sb,int type,qid_t id, +int dquot_quota_off (struct super_block *sb,int type); +int dquot_quota_sync (struct super_block *sb,int type,int wait); +int dquot_get_dqinfo (struct super_block *sb,int type,struct if_dqinfo *ii); +int dquot_set_dqinfo (struct super_block *sb,int type,struct if_dqinfo *ii); +int dquot_get_dqblk (struct super_block *sb,int type,qid_t id,struct fs_disk_quota *di); -int vfs_set_dqblk (struct super_block *sb,int type,qid_t id, +int dquot_set_dqblk (struct super_block *sb,int type,qid_t id,struct fs_disk_quota *di);int dquot_transfer (struct inode *inode,struct iattr *iattr);@@ -138,7 +138,7 @@ static inline unsigned sb_any_quota_acti* Operations supported for diskquotas. */ extern const struct dquot_operations dquot_operations; -extern const struct quotactl_ops vfs_quotactl_ops; +extern const struct quotactl_ops dquot_quotactl_ops;#else Index:
linux-2.6/fs/udf/super.c
===================================================================fs/udf/super.c +1
-1@@ -1941,7 +1941,7 @@ static int udf_fill_super(struct super_b sb->s_op = &udf_sb_ops; sb->s_export_op = &udf_export_ops;#ifdef CONFIG_QUOTA - sb->s_qcop = &vfs_quotactl_ops; + sb->s_qcop = &dquot_quotactl_ops; sb->dq_op =NULL ;/* &dquot_operations */ #endif
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
Re: [PATCH 6/6] quota: rename default quotactl methods to dqout_
Quoted 4 lines · Jan Kara
Quoted 1 line · Christoph Hellwig
Follow the dqout_* style used elsewhere in
dquot.c.^^^^^ dquotAnd we'll need ext2 conversion here as well...
ext2 uses the default quota ops, so nothing to rename there.