Commit b43fa8284d7790d9cca32c9c55e24f29be2fa33b
Committed by
Jan Kara
1 parent
759bfee658
Exists in
master
and in
7 other branches
dquot: cleanup dquot transfer routine
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>
Showing 17 changed files with 19 additions and 29 deletions Side-by-side Diff
- 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
Documentation/filesystems/Locking
... | ... | @@ -462,7 +462,6 @@ |
462 | 462 | prototypes: |
463 | 463 | int (*initialize) (struct inode *, int); |
464 | 464 | int (*drop) (struct inode *); |
465 | - int (*transfer) (struct inode *, struct iattr *); | |
466 | 465 | int (*write_dquot) (struct dquot *); |
467 | 466 | int (*acquire_dquot) (struct dquot *); |
468 | 467 | int (*release_dquot) (struct dquot *); |
... | ... | @@ -477,7 +476,6 @@ |
477 | 476 | FS recursion Held locks when called |
478 | 477 | initialize: yes maybe dqonoff_sem |
479 | 478 | drop: yes - |
480 | -transfer: yes - | |
481 | 479 | write_dquot: yes dqonoff_sem or dqptr_sem |
482 | 480 | acquire_dquot: yes dqonoff_sem or dqptr_sem |
483 | 481 | release_dquot: yes dqonoff_sem or dqptr_sem |
drivers/staging/pohmelfs/inode.c
... | ... | @@ -969,7 +969,7 @@ |
969 | 969 | |
970 | 970 | if ((attr->ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) || |
971 | 971 | (attr->ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) { |
972 | - err = vfs_dq_transfer(inode, attr) ? -EDQUOT : 0; | |
972 | + err = dquot_transfer(inode, attr); | |
973 | 973 | if (err) |
974 | 974 | goto err_out_exit; |
975 | 975 | } |
fs/ext2/inode.c
... | ... | @@ -1459,7 +1459,7 @@ |
1459 | 1459 | return error; |
1460 | 1460 | if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) || |
1461 | 1461 | (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) { |
1462 | - error = vfs_dq_transfer(inode, iattr) ? -EDQUOT : 0; | |
1462 | + error = dquot_transfer(inode, iattr); | |
1463 | 1463 | if (error) |
1464 | 1464 | return error; |
1465 | 1465 | } |
fs/ext3/inode.c
fs/ext3/super.c
... | ... | @@ -752,7 +752,6 @@ |
752 | 752 | static const struct dquot_operations ext3_quota_operations = { |
753 | 753 | .initialize = dquot_initialize, |
754 | 754 | .drop = dquot_drop, |
755 | - .transfer = dquot_transfer, | |
756 | 755 | .write_dquot = ext3_write_dquot, |
757 | 756 | .acquire_dquot = ext3_acquire_dquot, |
758 | 757 | .release_dquot = ext3_release_dquot, |
fs/ext4/inode.c
fs/ext4/super.c
... | ... | @@ -1017,7 +1017,6 @@ |
1017 | 1017 | #ifdef CONFIG_QUOTA |
1018 | 1018 | .get_reserved_space = ext4_get_reserved_space, |
1019 | 1019 | #endif |
1020 | - .transfer = dquot_transfer, | |
1021 | 1020 | .write_dquot = ext4_write_dquot, |
1022 | 1021 | .acquire_dquot = ext4_acquire_dquot, |
1023 | 1022 | .release_dquot = ext4_release_dquot, |
fs/jfs/file.c
... | ... | @@ -100,8 +100,9 @@ |
100 | 100 | |
101 | 101 | if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) || |
102 | 102 | (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) { |
103 | - if (vfs_dq_transfer(inode, iattr)) | |
104 | - return -EDQUOT; | |
103 | + rc = dquot_transfer(inode, iattr); | |
104 | + if (rc) | |
105 | + return rc; | |
105 | 106 | } |
106 | 107 | |
107 | 108 | rc = inode_setattr(inode, iattr); |
fs/ocfs2/file.c
... | ... | @@ -1020,7 +1020,7 @@ |
1020 | 1020 | /* |
1021 | 1021 | * Gather pointers to quota structures so that allocation / |
1022 | 1022 | * freeing of quota structures happens here and not inside |
1023 | - * vfs_dq_transfer() where we have problems with lock ordering | |
1023 | + * dquot_transfer() where we have problems with lock ordering | |
1024 | 1024 | */ |
1025 | 1025 | if (attr->ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid |
1026 | 1026 | && OCFS2_HAS_RO_COMPAT_FEATURE(sb, |
... | ... | @@ -1053,7 +1053,7 @@ |
1053 | 1053 | mlog_errno(status); |
1054 | 1054 | goto bail_unlock; |
1055 | 1055 | } |
1056 | - status = vfs_dq_transfer(inode, attr) ? -EDQUOT : 0; | |
1056 | + status = dquot_transfer(inode, attr); | |
1057 | 1057 | if (status < 0) |
1058 | 1058 | goto bail_commit; |
1059 | 1059 | } else { |
fs/ocfs2/quota_global.c
... | ... | @@ -853,7 +853,6 @@ |
853 | 853 | const struct dquot_operations ocfs2_quota_operations = { |
854 | 854 | .initialize = dquot_initialize, |
855 | 855 | .drop = dquot_drop, |
856 | - .transfer = dquot_transfer, | |
857 | 856 | .write_dquot = ocfs2_write_dquot, |
858 | 857 | .acquire_dquot = ocfs2_acquire_dquot, |
859 | 858 | .release_dquot = ocfs2_release_dquot, |
fs/quota/dquot.c
... | ... | @@ -1669,7 +1669,7 @@ |
1669 | 1669 | * This operation can block, but only after everything is updated |
1670 | 1670 | * A transaction must be started when entering this function. |
1671 | 1671 | */ |
1672 | -int dquot_transfer(struct inode *inode, qid_t *chid, unsigned long mask) | |
1672 | +static int __dquot_transfer(struct inode *inode, qid_t *chid, unsigned long mask) | |
1673 | 1673 | { |
1674 | 1674 | qsize_t space, cur_space; |
1675 | 1675 | qsize_t rsv_space = 0; |
1676 | 1676 | |
... | ... | @@ -1766,12 +1766,11 @@ |
1766 | 1766 | ret = NO_QUOTA; |
1767 | 1767 | goto warn_put_all; |
1768 | 1768 | } |
1769 | -EXPORT_SYMBOL(dquot_transfer); | |
1770 | 1769 | |
1771 | 1770 | /* Wrapper for transferring ownership of an inode for uid/gid only |
1772 | 1771 | * Called from FSXXX_setattr() |
1773 | 1772 | */ |
1774 | -int vfs_dq_transfer(struct inode *inode, struct iattr *iattr) | |
1773 | +int dquot_transfer(struct inode *inode, struct iattr *iattr) | |
1775 | 1774 | { |
1776 | 1775 | qid_t chid[MAXQUOTAS]; |
1777 | 1776 | unsigned long mask = 0; |
1778 | 1777 | |
... | ... | @@ -1786,12 +1785,12 @@ |
1786 | 1785 | } |
1787 | 1786 | if (sb_any_quota_active(inode->i_sb) && !IS_NOQUOTA(inode)) { |
1788 | 1787 | vfs_dq_init(inode); |
1789 | - if (inode->i_sb->dq_op->transfer(inode, chid, mask) == NO_QUOTA) | |
1790 | - return 1; | |
1788 | + if (__dquot_transfer(inode, chid, mask) == NO_QUOTA) | |
1789 | + return -EDQUOT; | |
1791 | 1790 | } |
1792 | 1791 | return 0; |
1793 | 1792 | } |
1794 | -EXPORT_SYMBOL(vfs_dq_transfer); | |
1793 | +EXPORT_SYMBOL(dquot_transfer); | |
1795 | 1794 | |
1796 | 1795 | /* |
1797 | 1796 | * Write info of quota file to disk |
... | ... | @@ -1814,7 +1813,6 @@ |
1814 | 1813 | const struct dquot_operations dquot_operations = { |
1815 | 1814 | .initialize = dquot_initialize, |
1816 | 1815 | .drop = dquot_drop, |
1817 | - .transfer = dquot_transfer, | |
1818 | 1816 | .write_dquot = dquot_commit, |
1819 | 1817 | .acquire_dquot = dquot_acquire, |
1820 | 1818 | .release_dquot = dquot_release, |
fs/reiserfs/inode.c
fs/reiserfs/super.c
... | ... | @@ -618,7 +618,6 @@ |
618 | 618 | static const struct dquot_operations reiserfs_quota_operations = { |
619 | 619 | .initialize = dquot_initialize, |
620 | 620 | .drop = dquot_drop, |
621 | - .transfer = dquot_transfer, | |
622 | 621 | .write_dquot = reiserfs_write_dquot, |
623 | 622 | .acquire_dquot = reiserfs_acquire_dquot, |
624 | 623 | .release_dquot = reiserfs_release_dquot, |
fs/udf/file.c
... | ... | @@ -229,7 +229,7 @@ |
229 | 229 | |
230 | 230 | if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) || |
231 | 231 | (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) { |
232 | - error = vfs_dq_transfer(inode, iattr) ? -EDQUOT : 0; | |
232 | + error = dquot_transfer(inode, iattr); | |
233 | 233 | if (error) |
234 | 234 | return error; |
235 | 235 | } |
fs/ufs/truncate.c
... | ... | @@ -520,7 +520,7 @@ |
520 | 520 | |
521 | 521 | if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) || |
522 | 522 | (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) { |
523 | - error = vfs_dq_transfer(inode, attr) ? -EDQUOT : 0; | |
523 | + error = dquot_transfer(inode, attr); | |
524 | 524 | if (error) |
525 | 525 | return error; |
526 | 526 | } |
include/linux/quota.h
... | ... | @@ -297,7 +297,6 @@ |
297 | 297 | struct dquot_operations { |
298 | 298 | int (*initialize) (struct inode *, int); |
299 | 299 | int (*drop) (struct inode *); |
300 | - int (*transfer) (struct inode *, qid_t *, unsigned long); | |
301 | 300 | int (*write_dquot) (struct dquot *); /* Ordinary dquot write */ |
302 | 301 | struct dquot *(*alloc_dquot)(struct super_block *, int); /* Allocate memory for new dquot */ |
303 | 302 | void (*destroy_dquot)(struct dquot *); /* Free memory for dquot */ |
include/linux/quotaops.h
... | ... | @@ -42,7 +42,6 @@ |
42 | 42 | int dquot_claim_space_nodirty(struct inode *inode, qsize_t number); |
43 | 43 | void dquot_free_inode(const struct inode *inode); |
44 | 44 | |
45 | -int dquot_transfer(struct inode *inode, qid_t *chid, unsigned long mask); | |
46 | 45 | int dquot_commit(struct dquot *dquot); |
47 | 46 | int dquot_acquire(struct dquot *dquot); |
48 | 47 | int dquot_release(struct dquot *dquot); |
... | ... | @@ -66,7 +65,7 @@ |
66 | 65 | int vfs_set_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di); |
67 | 66 | |
68 | 67 | void vfs_dq_drop(struct inode *inode); |
69 | -int vfs_dq_transfer(struct inode *inode, struct iattr *iattr); | |
68 | +int dquot_transfer(struct inode *inode, struct iattr *iattr); | |
70 | 69 | int vfs_dq_quota_on_remount(struct super_block *sb); |
71 | 70 | |
72 | 71 | static inline struct mem_dqinfo *sb_dqinfo(struct super_block *sb, int type) |
... | ... | @@ -234,7 +233,7 @@ |
234 | 233 | return 0; |
235 | 234 | } |
236 | 235 | |
237 | -static inline int vfs_dq_transfer(struct inode *inode, struct iattr *iattr) | |
236 | +static inline int dquot_transfer(struct inode *inode, struct iattr *iattr) | |
238 | 237 | { |
239 | 238 | return 0; |
240 | 239 | } |