On Sat 20-02-10 06:51:05, Christoph Hellwig wrote: > Get rid of the transfer dquot operation - it is now always called from > the filesystem and if a filesystem really needs it's own (which none > currently does) it can just call into it's own routine directly. > > Rename the now static low-level dquot_transfer helper to __dquot_transfer > and vfs_dq_transfer to dquot_transfer to have a consistent namespace, > and make the new dquot_transfer return a normal negative errno value > which all callers expect. Looks good. I just wonder - if you made dquot_transfer() return error code, shouldn't also dquot_alloc_inode, dquot_alloc_space and similar return error code instead of 1? It would seem more consistent. Hmm, I guess I'll just go and modify your patches to do it. Honza > > Signed-off-by: Christoph Hellwig <hch@xxxxxx> > > Index: linux-2.6/Documentation/filesystems/Locking > =================================================================== > --- linux-2.6.orig/Documentation/filesystems/Locking 2010-02-20 11:48:48.624253837 +0100 > +++ linux-2.6/Documentation/filesystems/Locking 2010-02-20 11:55:53.694023148 +0100 > @@ -462,7 +462,6 @@ in sys_read() and friends. > prototypes: > int (*initialize) (struct inode *, int); > int (*drop) (struct inode *); > - int (*transfer) (struct inode *, struct iattr *); > int (*write_dquot) (struct dquot *); > int (*acquire_dquot) (struct dquot *); > int (*release_dquot) (struct dquot *); > @@ -477,7 +476,6 @@ What filesystem should expect from the g > FS recursion Held locks when called > initialize: yes maybe dqonoff_sem > drop: yes - > -transfer: yes - > write_dquot: yes dqonoff_sem or dqptr_sem > acquire_dquot: yes dqonoff_sem or dqptr_sem > release_dquot: yes dqonoff_sem or dqptr_sem > Index: linux-2.6/fs/ext3/super.c > =================================================================== > --- linux-2.6.orig/fs/ext3/super.c 2010-02-20 11:48:48.626253697 +0100 > +++ linux-2.6/fs/ext3/super.c 2010-02-20 11:55:53.695023428 +0100 > @@ -752,7 +752,6 @@ static ssize_t ext3_quota_write(struct s > static const struct dquot_operations ext3_quota_operations = { > .initialize = dquot_initialize, > .drop = dquot_drop, > - .transfer = dquot_transfer, > .write_dquot = ext3_write_dquot, > .acquire_dquot = ext3_acquire_dquot, > .release_dquot = ext3_release_dquot, > Index: linux-2.6/fs/ext4/super.c > =================================================================== > --- linux-2.6.orig/fs/ext4/super.c 2010-02-20 11:48:48.633253627 +0100 > +++ linux-2.6/fs/ext4/super.c 2010-02-20 11:55:53.706254954 +0100 > @@ -1017,7 +1017,6 @@ static const struct dquot_operations ext > #ifdef CONFIG_QUOTA > .get_reserved_space = ext4_get_reserved_space, > #endif > - .transfer = dquot_transfer, > .write_dquot = ext4_write_dquot, > .acquire_dquot = ext4_acquire_dquot, > .release_dquot = ext4_release_dquot, > Index: linux-2.6/fs/ocfs2/quota_global.c > =================================================================== > --- linux-2.6.orig/fs/ocfs2/quota_global.c 2010-02-20 11:48:48.666256212 +0100 > +++ linux-2.6/fs/ocfs2/quota_global.c 2010-02-20 11:55:53.733255653 +0100 > @@ -853,7 +853,6 @@ static void ocfs2_destroy_dquot(struct d > const struct dquot_operations ocfs2_quota_operations = { > .initialize = dquot_initialize, > .drop = dquot_drop, > - .transfer = dquot_transfer, > .write_dquot = ocfs2_write_dquot, > .acquire_dquot = ocfs2_acquire_dquot, > .release_dquot = ocfs2_release_dquot, > Index: linux-2.6/fs/quota/dquot.c > =================================================================== > --- linux-2.6.orig/fs/quota/dquot.c 2010-02-20 11:50:33.509255304 +0100 > +++ linux-2.6/fs/quota/dquot.c 2010-02-20 11:55:53.742255234 +0100 > @@ -1669,7 +1669,7 @@ EXPORT_SYMBOL(dquot_free_inode); > * This operation can block, but only after everything is updated > * A transaction must be started when entering this function. > */ > -int dquot_transfer(struct inode *inode, qid_t *chid, unsigned long mask) > +static int __dquot_transfer(struct inode *inode, qid_t *chid, unsigned long mask) > { > qsize_t space, cur_space; > qsize_t rsv_space = 0; > @@ -1766,12 +1766,11 @@ over_quota: > ret = NO_QUOTA; > goto warn_put_all; > } > -EXPORT_SYMBOL(dquot_transfer); > > /* Wrapper for transferring ownership of an inode for uid/gid only > * Called from FSXXX_setattr() > */ > -int vfs_dq_transfer(struct inode *inode, struct iattr *iattr) > +int dquot_transfer(struct inode *inode, struct iattr *iattr) > { > qid_t chid[MAXQUOTAS]; > unsigned long mask = 0; > @@ -1786,12 +1785,12 @@ int vfs_dq_transfer(struct inode *inode, > } > if (sb_any_quota_active(inode->i_sb) && !IS_NOQUOTA(inode)) { > vfs_dq_init(inode); > - if (inode->i_sb->dq_op->transfer(inode, chid, mask) == NO_QUOTA) > - return 1; > + if (__dquot_transfer(inode, chid, mask) == NO_QUOTA) > + return -EDQUOT; > } > return 0; > } > -EXPORT_SYMBOL(vfs_dq_transfer); > +EXPORT_SYMBOL(dquot_transfer); > > /* > * Write info of quota file to disk > @@ -1814,7 +1813,6 @@ EXPORT_SYMBOL(dquot_commit_info); > const struct dquot_operations dquot_operations = { > .initialize = dquot_initialize, > .drop = dquot_drop, > - .transfer = dquot_transfer, > .write_dquot = dquot_commit, > .acquire_dquot = dquot_acquire, > .release_dquot = dquot_release, > Index: linux-2.6/fs/reiserfs/super.c > =================================================================== > --- linux-2.6.orig/fs/reiserfs/super.c 2010-02-20 11:48:48.691005897 +0100 > +++ linux-2.6/fs/reiserfs/super.c 2010-02-20 11:55:53.756256212 +0100 > @@ -618,7 +618,6 @@ static int reiserfs_quota_on(struct supe > static const struct dquot_operations reiserfs_quota_operations = { > .initialize = dquot_initialize, > .drop = dquot_drop, > - .transfer = dquot_transfer, > .write_dquot = reiserfs_write_dquot, > .acquire_dquot = reiserfs_acquire_dquot, > .release_dquot = reiserfs_release_dquot, > Index: linux-2.6/include/linux/quota.h > =================================================================== > --- linux-2.6.orig/include/linux/quota.h 2010-02-20 11:48:48.696005828 +0100 > +++ linux-2.6/include/linux/quota.h 2010-02-20 11:55:53.761255862 +0100 > @@ -297,7 +297,6 @@ struct quota_format_ops { > struct dquot_operations { > int (*initialize) (struct inode *, int); > int (*drop) (struct inode *); > - int (*transfer) (struct inode *, qid_t *, unsigned long); > int (*write_dquot) (struct dquot *); /* Ordinary dquot write */ > struct dquot *(*alloc_dquot)(struct super_block *, int); /* Allocate memory for new dquot */ > void (*destroy_dquot)(struct dquot *); /* Free memory for dquot */ > Index: linux-2.6/include/linux/quotaops.h > =================================================================== > --- linux-2.6.orig/include/linux/quotaops.h 2010-02-20 11:48:48.698006456 +0100 > +++ linux-2.6/include/linux/quotaops.h 2010-02-20 11:55:53.763255583 +0100 > @@ -42,7 +42,6 @@ int dquot_alloc_inode(const struct inode > int dquot_claim_space_nodirty(struct inode *inode, qsize_t number); > void dquot_free_inode(const struct inode *inode); > > -int dquot_transfer(struct inode *inode, qid_t *chid, unsigned long mask); > int dquot_commit(struct dquot *dquot); > int dquot_acquire(struct dquot *dquot); > int dquot_release(struct dquot *dquot); > @@ -66,7 +65,7 @@ int vfs_get_dqblk(struct super_block *sb > int vfs_set_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di); > > void vfs_dq_drop(struct inode *inode); > -int vfs_dq_transfer(struct inode *inode, struct iattr *iattr); > +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) > @@ -234,7 +233,7 @@ static inline int vfs_dq_quota_on_remoun > return 0; > } > > -static inline int vfs_dq_transfer(struct inode *inode, struct iattr *iattr) > +static inline int dquot_transfer(struct inode *inode, struct iattr *iattr) > { > return 0; > } > Index: linux-2.6/drivers/staging/pohmelfs/inode.c > =================================================================== > --- linux-2.6.orig/drivers/staging/pohmelfs/inode.c 2010-02-20 11:40:49.947004081 +0100 > +++ linux-2.6/drivers/staging/pohmelfs/inode.c 2010-02-20 11:55:53.767255443 +0100 > @@ -969,7 +969,7 @@ int pohmelfs_setattr_raw(struct inode *i > > if ((attr->ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) || > (attr->ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) { > - err = vfs_dq_transfer(inode, attr) ? -EDQUOT : 0; > + err = dquot_transfer(inode, attr); > if (err) > goto err_out_exit; > } > Index: linux-2.6/fs/ext2/inode.c > =================================================================== > --- linux-2.6.orig/fs/ext2/inode.c 2010-02-20 11:40:49.886253766 +0100 > +++ linux-2.6/fs/ext2/inode.c 2010-02-20 11:55:53.772255862 +0100 > @@ -1459,7 +1459,7 @@ int ext2_setattr(struct dentry *dentry, > return error; > if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) || > (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) { > - error = vfs_dq_transfer(inode, iattr) ? -EDQUOT : 0; > + error = dquot_transfer(inode, iattr); > if (error) > return error; > } > Index: linux-2.6/fs/ext3/inode.c > =================================================================== > --- linux-2.6.orig/fs/ext3/inode.c 2010-02-20 11:46:29.838255793 +0100 > +++ linux-2.6/fs/ext3/inode.c 2010-02-20 11:55:53.781265570 +0100 > @@ -3152,7 +3152,7 @@ int ext3_setattr(struct dentry *dentry, > error = PTR_ERR(handle); > goto err_out; > } > - error = vfs_dq_transfer(inode, attr) ? -EDQUOT : 0; > + error = dquot_transfer(inode, attr); > if (error) { > ext3_journal_stop(handle); > return error; > Index: linux-2.6/fs/ext4/inode.c > =================================================================== > --- linux-2.6.orig/fs/ext4/inode.c 2010-02-20 11:46:29.854255514 +0100 > +++ linux-2.6/fs/ext4/inode.c 2010-02-20 11:55:53.804005688 +0100 > @@ -5261,7 +5261,7 @@ int ext4_setattr(struct dentry *dentry, > error = PTR_ERR(handle); > goto err_out; > } > - error = vfs_dq_transfer(inode, attr) ? -EDQUOT : 0; > + error = dquot_transfer(inode, attr); > if (error) { > ext4_journal_stop(handle); > return error; > Index: linux-2.6/fs/ocfs2/file.c > =================================================================== > --- linux-2.6.orig/fs/ocfs2/file.c 2010-02-20 11:46:30.009005758 +0100 > +++ linux-2.6/fs/ocfs2/file.c 2010-02-20 11:55:53.836005270 +0100 > @@ -1021,7 +1021,7 @@ int ocfs2_setattr(struct dentry *dentry, > /* > * Gather pointers to quota structures so that allocation / > * freeing of quota structures happens here and not inside > - * vfs_dq_transfer() where we have problems with lock ordering > + * dquot_transfer() where we have problems with lock ordering > */ > if (attr->ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid > && OCFS2_HAS_RO_COMPAT_FEATURE(sb, > @@ -1054,7 +1054,7 @@ int ocfs2_setattr(struct dentry *dentry, > mlog_errno(status); > goto bail_unlock; > } > - status = vfs_dq_transfer(inode, attr) ? -EDQUOT : 0; > + status = dquot_transfer(inode, attr); > if (status < 0) > goto bail_commit; > } else { > Index: linux-2.6/fs/reiserfs/inode.c > =================================================================== > --- linux-2.6.orig/fs/reiserfs/inode.c 2010-02-20 11:48:48.735005688 +0100 > +++ linux-2.6/fs/reiserfs/inode.c 2010-02-20 11:55:53.847006037 +0100 > @@ -3135,8 +3135,7 @@ int reiserfs_setattr(struct dentry *dent > jbegin_count); > if (error) > goto out; > - error = > - vfs_dq_transfer(inode, attr) ? -EDQUOT : 0; > + error = dquot_transfer(inode, attr); > if (error) { > journal_end(&th, inode->i_sb, > jbegin_count); > Index: linux-2.6/fs/ufs/truncate.c > =================================================================== > --- linux-2.6.orig/fs/ufs/truncate.c 2010-02-20 11:53:51.125252859 +0100 > +++ linux-2.6/fs/ufs/truncate.c 2010-02-20 11:55:53.855009459 +0100 > @@ -520,7 +520,7 @@ static int ufs_setattr(struct dentry *de > > if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) || > (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) { > - error = vfs_dq_transfer(inode, attr) ? -EDQUOT : 0; > + error = dquot_transfer(inode, attr); > if (error) > return error; > } > Index: linux-2.6/fs/jfs/file.c > =================================================================== > --- linux-2.6.orig/fs/jfs/file.c 2010-02-20 11:53:51.132291971 +0100 > +++ linux-2.6/fs/jfs/file.c 2010-02-20 11:55:53.857256072 +0100 > @@ -100,8 +100,9 @@ int jfs_setattr(struct dentry *dentry, s > > if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) || > (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) { > - if (vfs_dq_transfer(inode, iattr)) > - return -EDQUOT; > + rc = dquot_transfer(inode, iattr); > + if (rc) > + return rc; > } > > rc = inode_setattr(inode, iattr); > -- Jan Kara <jack@xxxxxxx> SUSE Labs, CR -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html