dquot: cleanup dquot transfer routine
authorChristoph Hellwig <hch@infradead.org>
Wed, 3 Mar 2010 14:05:03 +0000 (09:05 -0500)
committerJan Kara <jack@suse.cz>
Thu, 4 Mar 2010 23:20:29 +0000 (00:20 +0100)
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.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jan Kara <jack@suse.cz>
17 files changed:
Documentation/filesystems/Locking
drivers/staging/pohmelfs/inode.c
fs/ext2/inode.c
fs/ext3/inode.c
fs/ext3/super.c
fs/ext4/inode.c
fs/ext4/super.c
fs/jfs/file.c
fs/ocfs2/file.c
fs/ocfs2/quota_global.c
fs/quota/dquot.c
fs/reiserfs/inode.c
fs/reiserfs/super.c
fs/udf/file.c
fs/ufs/truncate.c
include/linux/quota.h
include/linux/quotaops.h

index 4428f55f21318043bc50bbc2dc88421274b1c1f5..4574e0272bddf0a6124846ffc6c3db8b7d406800 100644 (file)
@@ -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 generic quota functions:
                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 f69b7783027fdc165a8cd4d3b6e9bb1668bc71a8..11fc4d5c43e14bb57fc65bdd06f15b18a2dd5603 100644 (file)
@@ -969,7 +969,7 @@ int pohmelfs_setattr_raw(struct inode *inode, struct iattr *attr)
 
        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 71b032c65a0220d6e9e6cea12d4621b61acca89b..3cfcfd9a131acefd31bd9b8aedd5578042fb2422 100644 (file)
@@ -1459,7 +1459,7 @@ int ext2_setattr(struct dentry *dentry, struct iattr *iattr)
                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 20f02d69365c2cb120c92b77dc0431c3e5f97876..14d40a4dd6f037d40a8ccec4412dc3ddd03a5652 100644 (file)
@@ -3160,7 +3160,7 @@ int ext3_setattr(struct dentry *dentry, struct iattr *attr)
                        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 8b8bc4f9cb14be7714d706fad0132c355cf0151e..f7d4a2c19dee0f8a25f50b09194bb2f9a73cab53 100644 (file)
@@ -752,7 +752,6 @@ static ssize_t ext3_quota_write(struct super_block *sb, int type,
 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 9f607ea411c8a251e968022adf69b58fafae3d0b..6a002a6d062436f1a4abb3c38cb935fe4e13e12e 100644 (file)
@@ -5263,7 +5263,7 @@ int ext4_setattr(struct dentry *dentry, struct iattr *attr)
                        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 d231da8798e34144951f9b845b8cca1945fa4cd2..b4253fb7bab6b7e094b24b0f4c7c616ebf9b3399 100644 (file)
@@ -1017,7 +1017,6 @@ static const struct dquot_operations ext4_quota_operations = {
 #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 a4229e49330ea9570685cf7721f6b39f689f19e2..2c201783836f0fe9ff2eb2c711ada8e1b5a635ff 100644 (file)
@@ -100,8 +100,9 @@ int jfs_setattr(struct dentry *dentry, struct iattr *iattr)
 
        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);
index 6cf3d8d18369a3b3e7c13b9c763b522f9641a731..472e8f8bc8925ebb51dfdf44ab9bf91ab4ffc4a7 100644 (file)
@@ -1020,7 +1020,7 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr)
                /*
                 * 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,
@@ -1053,7 +1053,7 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr)
                        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 ed96b3eeb13c7d43d88c415e35eca34eae22b142..b654bd103b6f648e8aa8cecd02054c506948d0af 100644 (file)
@@ -853,7 +853,6 @@ static void ocfs2_destroy_dquot(struct dquot *dquot)
 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 ed131318b8490ce32d8b454f9d7e4a6dc4e77e7e..78ce4c48ad77335647b3b9be8e0e04b60a4f387f 100644 (file)
@@ -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, struct iattr *iattr)
        }
        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 f56a3d2e64974037b4321390da1b34833d493645..99a5e5a8ab5a4930f251f88c4f506a90f21edfd7 100644 (file)
@@ -3134,8 +3134,7 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr)
                                                  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 e942ceecf2b85731445143d3b244e79674cac329..97c3e8ed7db692476bb4081ca69a197ddc6cc829 100644 (file)
@@ -618,7 +618,6 @@ static int reiserfs_quota_on(struct super_block *, int, int, char *, int);
 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 35ca47281faab34af157255c38a1959ba4d40ff6..2df7fcb677b39c62805651597d69d86f084df017 100644 (file)
@@ -229,7 +229,7 @@ static int udf_setattr(struct dentry *dentry, struct iattr *iattr)
 
        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 56ab31f00bd0f96feba40c8a91ac8fe90e2685dd..87bbab68590169b85ef37d9c8de52abbe0f2e0be 100644 (file)
@@ -520,7 +520,7 @@ static int ufs_setattr(struct dentry *dentry, struct iattr *attr)
 
        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 e3b07895d3274790c8d2dce9609bf4dba06b5f4f..422e6aa78edc48a2f03c264cd7ef684d2e8b3191 100644 (file)
@@ -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 9ce7f051a4baa2e9133f08897a29cd8adcbd0c91..fa27b7218c822635d13610378f936db40bfed547 100644 (file)
@@ -42,7 +42,6 @@ int dquot_alloc_inode(const struct inode *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 type, qid_t id, struct if_dqblk *d
 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_remount(struct super_block *sb)
        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;
 }