aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2010-03-03 09:05:03 -0500
committerJan Kara <jack@suse.cz>2010-03-04 18:20:29 -0500
commitb43fa8284d7790d9cca32c9c55e24f29be2fa33b (patch)
treeacb7f205fe2a1ae324e0e11c50f43baaa6b8dfab
parent759bfee658beab14af7b357156461d0eb852be2c (diff)
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>
-rw-r--r--Documentation/filesystems/Locking2
-rw-r--r--drivers/staging/pohmelfs/inode.c2
-rw-r--r--fs/ext2/inode.c2
-rw-r--r--fs/ext3/inode.c2
-rw-r--r--fs/ext3/super.c1
-rw-r--r--fs/ext4/inode.c2
-rw-r--r--fs/ext4/super.c1
-rw-r--r--fs/jfs/file.c5
-rw-r--r--fs/ocfs2/file.c4
-rw-r--r--fs/ocfs2/quota_global.c1
-rw-r--r--fs/quota/dquot.c12
-rw-r--r--fs/reiserfs/inode.c3
-rw-r--r--fs/reiserfs/super.c1
-rw-r--r--fs/udf/file.c2
-rw-r--r--fs/ufs/truncate.c2
-rw-r--r--include/linux/quota.h1
-rw-r--r--include/linux/quotaops.h5
17 files changed, 19 insertions, 29 deletions
diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking
index 4428f55f2131..4574e0272bdd 100644
--- a/Documentation/filesystems/Locking
+++ b/Documentation/filesystems/Locking
@@ -462,7 +462,6 @@ in sys_read() and friends.
462prototypes: 462prototypes:
463 int (*initialize) (struct inode *, int); 463 int (*initialize) (struct inode *, int);
464 int (*drop) (struct inode *); 464 int (*drop) (struct inode *);
465 int (*transfer) (struct inode *, struct iattr *);
466 int (*write_dquot) (struct dquot *); 465 int (*write_dquot) (struct dquot *);
467 int (*acquire_dquot) (struct dquot *); 466 int (*acquire_dquot) (struct dquot *);
468 int (*release_dquot) (struct dquot *); 467 int (*release_dquot) (struct dquot *);
@@ -477,7 +476,6 @@ What filesystem should expect from the generic quota functions:
477 FS recursion Held locks when called 476 FS recursion Held locks when called
478initialize: yes maybe dqonoff_sem 477initialize: yes maybe dqonoff_sem
479drop: yes - 478drop: yes -
480transfer: yes -
481write_dquot: yes dqonoff_sem or dqptr_sem 479write_dquot: yes dqonoff_sem or dqptr_sem
482acquire_dquot: yes dqonoff_sem or dqptr_sem 480acquire_dquot: yes dqonoff_sem or dqptr_sem
483release_dquot: yes dqonoff_sem or dqptr_sem 481release_dquot: yes dqonoff_sem or dqptr_sem
diff --git a/drivers/staging/pohmelfs/inode.c b/drivers/staging/pohmelfs/inode.c
index f69b7783027f..11fc4d5c43e1 100644
--- a/drivers/staging/pohmelfs/inode.c
+++ b/drivers/staging/pohmelfs/inode.c
@@ -969,7 +969,7 @@ int pohmelfs_setattr_raw(struct inode *inode, struct iattr *attr)
969 969
970 if ((attr->ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) || 970 if ((attr->ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) ||
971 (attr->ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) { 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 if (err) 973 if (err)
974 goto err_out_exit; 974 goto err_out_exit;
975 } 975 }
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
index 71b032c65a02..3cfcfd9a131a 100644
--- a/fs/ext2/inode.c
+++ b/fs/ext2/inode.c
@@ -1459,7 +1459,7 @@ int ext2_setattr(struct dentry *dentry, struct iattr *iattr)
1459 return error; 1459 return error;
1460 if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) || 1460 if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) ||
1461 (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) { 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 if (error) 1463 if (error)
1464 return error; 1464 return error;
1465 } 1465 }
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
index 20f02d69365c..14d40a4dd6f0 100644
--- a/fs/ext3/inode.c
+++ b/fs/ext3/inode.c
@@ -3160,7 +3160,7 @@ int ext3_setattr(struct dentry *dentry, struct iattr *attr)
3160 error = PTR_ERR(handle); 3160 error = PTR_ERR(handle);
3161 goto err_out; 3161 goto err_out;
3162 } 3162 }
3163 error = vfs_dq_transfer(inode, attr) ? -EDQUOT : 0; 3163 error = dquot_transfer(inode, attr);
3164 if (error) { 3164 if (error) {
3165 ext3_journal_stop(handle); 3165 ext3_journal_stop(handle);
3166 return error; 3166 return error;
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index 8b8bc4f9cb14..f7d4a2c19dee 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -752,7 +752,6 @@ static ssize_t ext3_quota_write(struct super_block *sb, int type,
752static const struct dquot_operations ext3_quota_operations = { 752static const struct dquot_operations ext3_quota_operations = {
753 .initialize = dquot_initialize, 753 .initialize = dquot_initialize,
754 .drop = dquot_drop, 754 .drop = dquot_drop,
755 .transfer = dquot_transfer,
756 .write_dquot = ext3_write_dquot, 755 .write_dquot = ext3_write_dquot,
757 .acquire_dquot = ext3_acquire_dquot, 756 .acquire_dquot = ext3_acquire_dquot,
758 .release_dquot = ext3_release_dquot, 757 .release_dquot = ext3_release_dquot,
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 9f607ea411c8..6a002a6d0624 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -5263,7 +5263,7 @@ int ext4_setattr(struct dentry *dentry, struct iattr *attr)
5263 error = PTR_ERR(handle); 5263 error = PTR_ERR(handle);
5264 goto err_out; 5264 goto err_out;
5265 } 5265 }
5266 error = vfs_dq_transfer(inode, attr) ? -EDQUOT : 0; 5266 error = dquot_transfer(inode, attr);
5267 if (error) { 5267 if (error) {
5268 ext4_journal_stop(handle); 5268 ext4_journal_stop(handle);
5269 return error; 5269 return error;
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index d231da8798e3..b4253fb7bab6 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1017,7 +1017,6 @@ static const struct dquot_operations ext4_quota_operations = {
1017#ifdef CONFIG_QUOTA 1017#ifdef CONFIG_QUOTA
1018 .get_reserved_space = ext4_get_reserved_space, 1018 .get_reserved_space = ext4_get_reserved_space,
1019#endif 1019#endif
1020 .transfer = dquot_transfer,
1021 .write_dquot = ext4_write_dquot, 1020 .write_dquot = ext4_write_dquot,
1022 .acquire_dquot = ext4_acquire_dquot, 1021 .acquire_dquot = ext4_acquire_dquot,
1023 .release_dquot = ext4_release_dquot, 1022 .release_dquot = ext4_release_dquot,
diff --git a/fs/jfs/file.c b/fs/jfs/file.c
index a4229e49330e..2c201783836f 100644
--- a/fs/jfs/file.c
+++ b/fs/jfs/file.c
@@ -100,8 +100,9 @@ int jfs_setattr(struct dentry *dentry, struct iattr *iattr)
100 100
101 if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) || 101 if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) ||
102 (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) { 102 (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) {
103 if (vfs_dq_transfer(inode, iattr)) 103 rc = dquot_transfer(inode, iattr);
104 return -EDQUOT; 104 if (rc)
105 return rc;
105 } 106 }
106 107
107 rc = inode_setattr(inode, iattr); 108 rc = inode_setattr(inode, iattr);
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index 6cf3d8d18369..472e8f8bc892 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -1020,7 +1020,7 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr)
1020 /* 1020 /*
1021 * Gather pointers to quota structures so that allocation / 1021 * Gather pointers to quota structures so that allocation /
1022 * freeing of quota structures happens here and not inside 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 if (attr->ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid 1025 if (attr->ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid
1026 && OCFS2_HAS_RO_COMPAT_FEATURE(sb, 1026 && OCFS2_HAS_RO_COMPAT_FEATURE(sb,
@@ -1053,7 +1053,7 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr)
1053 mlog_errno(status); 1053 mlog_errno(status);
1054 goto bail_unlock; 1054 goto bail_unlock;
1055 } 1055 }
1056 status = vfs_dq_transfer(inode, attr) ? -EDQUOT : 0; 1056 status = dquot_transfer(inode, attr);
1057 if (status < 0) 1057 if (status < 0)
1058 goto bail_commit; 1058 goto bail_commit;
1059 } else { 1059 } else {
diff --git a/fs/ocfs2/quota_global.c b/fs/ocfs2/quota_global.c
index ed96b3eeb13c..b654bd103b6f 100644
--- a/fs/ocfs2/quota_global.c
+++ b/fs/ocfs2/quota_global.c
@@ -853,7 +853,6 @@ static void ocfs2_destroy_dquot(struct dquot *dquot)
853const struct dquot_operations ocfs2_quota_operations = { 853const struct dquot_operations ocfs2_quota_operations = {
854 .initialize = dquot_initialize, 854 .initialize = dquot_initialize,
855 .drop = dquot_drop, 855 .drop = dquot_drop,
856 .transfer = dquot_transfer,
857 .write_dquot = ocfs2_write_dquot, 856 .write_dquot = ocfs2_write_dquot,
858 .acquire_dquot = ocfs2_acquire_dquot, 857 .acquire_dquot = ocfs2_acquire_dquot,
859 .release_dquot = ocfs2_release_dquot, 858 .release_dquot = ocfs2_release_dquot,
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index ed131318b849..78ce4c48ad77 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -1669,7 +1669,7 @@ EXPORT_SYMBOL(dquot_free_inode);
1669 * This operation can block, but only after everything is updated 1669 * This operation can block, but only after everything is updated
1670 * A transaction must be started when entering this function. 1670 * A transaction must be started when entering this function.
1671 */ 1671 */
1672int dquot_transfer(struct inode *inode, qid_t *chid, unsigned long mask) 1672static int __dquot_transfer(struct inode *inode, qid_t *chid, unsigned long mask)
1673{ 1673{
1674 qsize_t space, cur_space; 1674 qsize_t space, cur_space;
1675 qsize_t rsv_space = 0; 1675 qsize_t rsv_space = 0;
@@ -1766,12 +1766,11 @@ over_quota:
1766 ret = NO_QUOTA; 1766 ret = NO_QUOTA;
1767 goto warn_put_all; 1767 goto warn_put_all;
1768} 1768}
1769EXPORT_SYMBOL(dquot_transfer);
1770 1769
1771/* Wrapper for transferring ownership of an inode for uid/gid only 1770/* Wrapper for transferring ownership of an inode for uid/gid only
1772 * Called from FSXXX_setattr() 1771 * Called from FSXXX_setattr()
1773 */ 1772 */
1774int vfs_dq_transfer(struct inode *inode, struct iattr *iattr) 1773int dquot_transfer(struct inode *inode, struct iattr *iattr)
1775{ 1774{
1776 qid_t chid[MAXQUOTAS]; 1775 qid_t chid[MAXQUOTAS];
1777 unsigned long mask = 0; 1776 unsigned long mask = 0;
@@ -1786,12 +1785,12 @@ int vfs_dq_transfer(struct inode *inode, struct iattr *iattr)
1786 } 1785 }
1787 if (sb_any_quota_active(inode->i_sb) && !IS_NOQUOTA(inode)) { 1786 if (sb_any_quota_active(inode->i_sb) && !IS_NOQUOTA(inode)) {
1788 vfs_dq_init(inode); 1787 vfs_dq_init(inode);
1789 if (inode->i_sb->dq_op->transfer(inode, chid, mask) == NO_QUOTA) 1788 if (__dquot_transfer(inode, chid, mask) == NO_QUOTA)
1790 return 1; 1789 return -EDQUOT;
1791 } 1790 }
1792 return 0; 1791 return 0;
1793} 1792}
1794EXPORT_SYMBOL(vfs_dq_transfer); 1793EXPORT_SYMBOL(dquot_transfer);
1795 1794
1796/* 1795/*
1797 * Write info of quota file to disk 1796 * Write info of quota file to disk
@@ -1814,7 +1813,6 @@ EXPORT_SYMBOL(dquot_commit_info);
1814const struct dquot_operations dquot_operations = { 1813const struct dquot_operations dquot_operations = {
1815 .initialize = dquot_initialize, 1814 .initialize = dquot_initialize,
1816 .drop = dquot_drop, 1815 .drop = dquot_drop,
1817 .transfer = dquot_transfer,
1818 .write_dquot = dquot_commit, 1816 .write_dquot = dquot_commit,
1819 .acquire_dquot = dquot_acquire, 1817 .acquire_dquot = dquot_acquire,
1820 .release_dquot = dquot_release, 1818 .release_dquot = dquot_release,
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
index f56a3d2e6497..99a5e5a8ab5a 100644
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -3134,8 +3134,7 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr)
3134 jbegin_count); 3134 jbegin_count);
3135 if (error) 3135 if (error)
3136 goto out; 3136 goto out;
3137 error = 3137 error = dquot_transfer(inode, attr);
3138 vfs_dq_transfer(inode, attr) ? -EDQUOT : 0;
3139 if (error) { 3138 if (error) {
3140 journal_end(&th, inode->i_sb, 3139 journal_end(&th, inode->i_sb,
3141 jbegin_count); 3140 jbegin_count);
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index e942ceecf2b8..97c3e8ed7db6 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -618,7 +618,6 @@ static int reiserfs_quota_on(struct super_block *, int, int, char *, int);
618static const struct dquot_operations reiserfs_quota_operations = { 618static const struct dquot_operations reiserfs_quota_operations = {
619 .initialize = dquot_initialize, 619 .initialize = dquot_initialize,
620 .drop = dquot_drop, 620 .drop = dquot_drop,
621 .transfer = dquot_transfer,
622 .write_dquot = reiserfs_write_dquot, 621 .write_dquot = reiserfs_write_dquot,
623 .acquire_dquot = reiserfs_acquire_dquot, 622 .acquire_dquot = reiserfs_acquire_dquot,
624 .release_dquot = reiserfs_release_dquot, 623 .release_dquot = reiserfs_release_dquot,
diff --git a/fs/udf/file.c b/fs/udf/file.c
index 35ca47281faa..2df7fcb677b3 100644
--- a/fs/udf/file.c
+++ b/fs/udf/file.c
@@ -229,7 +229,7 @@ static int udf_setattr(struct dentry *dentry, struct iattr *iattr)
229 229
230 if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) || 230 if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) ||
231 (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) { 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 if (error) 233 if (error)
234 return error; 234 return error;
235 } 235 }
diff --git a/fs/ufs/truncate.c b/fs/ufs/truncate.c
index 56ab31f00bd0..87bbab685901 100644
--- a/fs/ufs/truncate.c
+++ b/fs/ufs/truncate.c
@@ -520,7 +520,7 @@ static int ufs_setattr(struct dentry *dentry, struct iattr *attr)
520 520
521 if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) || 521 if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) ||
522 (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) { 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 if (error) 524 if (error)
525 return error; 525 return error;
526 } 526 }
diff --git a/include/linux/quota.h b/include/linux/quota.h
index e3b07895d327..422e6aa78edc 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -297,7 +297,6 @@ struct quota_format_ops {
297struct dquot_operations { 297struct dquot_operations {
298 int (*initialize) (struct inode *, int); 298 int (*initialize) (struct inode *, int);
299 int (*drop) (struct inode *); 299 int (*drop) (struct inode *);
300 int (*transfer) (struct inode *, qid_t *, unsigned long);
301 int (*write_dquot) (struct dquot *); /* Ordinary dquot write */ 300 int (*write_dquot) (struct dquot *); /* Ordinary dquot write */
302 struct dquot *(*alloc_dquot)(struct super_block *, int); /* Allocate memory for new dquot */ 301 struct dquot *(*alloc_dquot)(struct super_block *, int); /* Allocate memory for new dquot */
303 void (*destroy_dquot)(struct dquot *); /* Free memory for dquot */ 302 void (*destroy_dquot)(struct dquot *); /* Free memory for dquot */
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
index 9ce7f051a4ba..fa27b7218c82 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -42,7 +42,6 @@ int dquot_alloc_inode(const struct inode *inode);
42int dquot_claim_space_nodirty(struct inode *inode, qsize_t number); 42int dquot_claim_space_nodirty(struct inode *inode, qsize_t number);
43void dquot_free_inode(const struct inode *inode); 43void dquot_free_inode(const struct inode *inode);
44 44
45int dquot_transfer(struct inode *inode, qid_t *chid, unsigned long mask);
46int dquot_commit(struct dquot *dquot); 45int dquot_commit(struct dquot *dquot);
47int dquot_acquire(struct dquot *dquot); 46int dquot_acquire(struct dquot *dquot);
48int dquot_release(struct dquot *dquot); 47int 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
66int vfs_set_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di); 65int vfs_set_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di);
67 66
68void vfs_dq_drop(struct inode *inode); 67void vfs_dq_drop(struct inode *inode);
69int vfs_dq_transfer(struct inode *inode, struct iattr *iattr); 68int dquot_transfer(struct inode *inode, struct iattr *iattr);
70int vfs_dq_quota_on_remount(struct super_block *sb); 69int vfs_dq_quota_on_remount(struct super_block *sb);
71 70
72static inline struct mem_dqinfo *sb_dqinfo(struct super_block *sb, int type) 71static 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)
234 return 0; 233 return 0;
235} 234}
236 235
237static inline int vfs_dq_transfer(struct inode *inode, struct iattr *iattr) 236static inline int dquot_transfer(struct inode *inode, struct iattr *iattr)
238{ 237{
239 return 0; 238 return 0;
240} 239}