aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2010-03-03 09:05:05 -0500
committerJan Kara <jack@suse.cz>2010-03-04 18:20:30 -0500
commit9f7547580263d4a55efe06ce5cfd567f568be6e8 (patch)
tree6f926a075eeed815d0a6680c06f235da0e5ea6d9 /fs
parent257ba15cedf1288f0c96118d7e63947231d27278 (diff)
dquot: cleanup dquot drop routine
Get rid of the drop 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_drop helper to __dquot_drop and vfs_dq_drop to dquot_drop to have a consistent namespace. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs')
-rw-r--r--fs/ext2/ialloc.c4
-rw-r--r--fs/ext2/super.c2
-rw-r--r--fs/ext3/ialloc.c4
-rw-r--r--fs/ext3/super.c3
-rw-r--r--fs/ext4/ialloc.c4
-rw-r--r--fs/ext4/super.c3
-rw-r--r--fs/jfs/inode.c2
-rw-r--r--fs/jfs/jfs_inode.c2
-rw-r--r--fs/jfs/super.c2
-rw-r--r--fs/ocfs2/inode.c2
-rw-r--r--fs/ocfs2/quota_global.c1
-rw-r--r--fs/quota/dquot.c52
-rw-r--r--fs/reiserfs/inode.c2
-rw-r--r--fs/reiserfs/namei.c2
-rw-r--r--fs/reiserfs/super.c3
-rw-r--r--fs/udf/ialloc.c4
-rw-r--r--fs/udf/inode.c2
-rw-r--r--fs/ufs/ialloc.c4
-rw-r--r--fs/ufs/super.c2
19 files changed, 47 insertions, 53 deletions
diff --git a/fs/ext2/ialloc.c b/fs/ext2/ialloc.c
index d12f9809559c..88b71972c626 100644
--- a/fs/ext2/ialloc.c
+++ b/fs/ext2/ialloc.c
@@ -122,7 +122,7 @@ void ext2_free_inode (struct inode * inode)
122 /* Quota is already initialized in iput() */ 122 /* Quota is already initialized in iput() */
123 ext2_xattr_delete_inode(inode); 123 ext2_xattr_delete_inode(inode);
124 dquot_free_inode(inode); 124 dquot_free_inode(inode);
125 vfs_dq_drop(inode); 125 dquot_drop(inode);
126 } 126 }
127 127
128 es = EXT2_SB(sb)->s_es; 128 es = EXT2_SB(sb)->s_es;
@@ -608,7 +608,7 @@ fail_free_drop:
608 dquot_free_inode(inode); 608 dquot_free_inode(inode);
609 609
610fail_drop: 610fail_drop:
611 vfs_dq_drop(inode); 611 dquot_drop(inode);
612 inode->i_flags |= S_NOQUOTA; 612 inode->i_flags |= S_NOQUOTA;
613 inode->i_nlink = 0; 613 inode->i_nlink = 0;
614 unlock_new_inode(inode); 614 unlock_new_inode(inode);
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index 98815d2a5664..42e4a303b675 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -195,7 +195,7 @@ static void ext2_clear_inode(struct inode *inode)
195{ 195{
196 struct ext2_block_alloc_info *rsv = EXT2_I(inode)->i_block_alloc_info; 196 struct ext2_block_alloc_info *rsv = EXT2_I(inode)->i_block_alloc_info;
197 197
198 vfs_dq_drop(inode); 198 dquot_drop(inode);
199 ext2_discard_reservation(inode); 199 ext2_discard_reservation(inode);
200 EXT2_I(inode)->i_block_alloc_info = NULL; 200 EXT2_I(inode)->i_block_alloc_info = NULL;
201 if (unlikely(rsv)) 201 if (unlikely(rsv))
diff --git a/fs/ext3/ialloc.c b/fs/ext3/ialloc.c
index 8bf00e997c38..7d7238f9f6f3 100644
--- a/fs/ext3/ialloc.c
+++ b/fs/ext3/ialloc.c
@@ -126,7 +126,7 @@ void ext3_free_inode (handle_t *handle, struct inode * inode)
126 vfs_dq_init(inode); 126 vfs_dq_init(inode);
127 ext3_xattr_delete_inode(handle, inode); 127 ext3_xattr_delete_inode(handle, inode);
128 dquot_free_inode(inode); 128 dquot_free_inode(inode);
129 vfs_dq_drop(inode); 129 dquot_drop(inode);
130 130
131 is_directory = S_ISDIR(inode->i_mode); 131 is_directory = S_ISDIR(inode->i_mode);
132 132
@@ -622,7 +622,7 @@ fail_free_drop:
622 dquot_free_inode(inode); 622 dquot_free_inode(inode);
623 623
624fail_drop: 624fail_drop:
625 vfs_dq_drop(inode); 625 dquot_drop(inode);
626 inode->i_flags |= S_NOQUOTA; 626 inode->i_flags |= S_NOQUOTA;
627 inode->i_nlink = 0; 627 inode->i_nlink = 0;
628 unlock_new_inode(inode); 628 unlock_new_inode(inode);
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index 2277b1a98e62..0163d0dae124 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -529,7 +529,7 @@ static void ext3_clear_inode(struct inode *inode)
529{ 529{
530 struct ext3_block_alloc_info *rsv = EXT3_I(inode)->i_block_alloc_info; 530 struct ext3_block_alloc_info *rsv = EXT3_I(inode)->i_block_alloc_info;
531 531
532 vfs_dq_drop(inode); 532 dquot_drop(inode);
533 ext3_discard_reservation(inode); 533 ext3_discard_reservation(inode);
534 EXT3_I(inode)->i_block_alloc_info = NULL; 534 EXT3_I(inode)->i_block_alloc_info = NULL;
535 if (unlikely(rsv)) 535 if (unlikely(rsv))
@@ -753,7 +753,6 @@ static ssize_t ext3_quota_write(struct super_block *sb, int type,
753 753
754static const struct dquot_operations ext3_quota_operations = { 754static const struct dquot_operations ext3_quota_operations = {
755 .initialize = dquot_initialize, 755 .initialize = dquot_initialize,
756 .drop = dquot_drop,
757 .write_dquot = ext3_write_dquot, 756 .write_dquot = ext3_write_dquot,
758 .acquire_dquot = ext3_acquire_dquot, 757 .acquire_dquot = ext3_acquire_dquot,
759 .release_dquot = ext3_release_dquot, 758 .release_dquot = ext3_release_dquot,
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
index b0d744cf8b95..ca8986e4b528 100644
--- a/fs/ext4/ialloc.c
+++ b/fs/ext4/ialloc.c
@@ -220,7 +220,7 @@ void ext4_free_inode(handle_t *handle, struct inode *inode)
220 vfs_dq_init(inode); 220 vfs_dq_init(inode);
221 ext4_xattr_delete_inode(handle, inode); 221 ext4_xattr_delete_inode(handle, inode);
222 dquot_free_inode(inode); 222 dquot_free_inode(inode);
223 vfs_dq_drop(inode); 223 dquot_drop(inode);
224 224
225 is_directory = S_ISDIR(inode->i_mode); 225 is_directory = S_ISDIR(inode->i_mode);
226 226
@@ -1077,7 +1077,7 @@ fail_free_drop:
1077 dquot_free_inode(inode); 1077 dquot_free_inode(inode);
1078 1078
1079fail_drop: 1079fail_drop:
1080 vfs_dq_drop(inode); 1080 dquot_drop(inode);
1081 inode->i_flags |= S_NOQUOTA; 1081 inode->i_flags |= S_NOQUOTA;
1082 inode->i_nlink = 0; 1082 inode->i_nlink = 0;
1083 unlock_new_inode(inode); 1083 unlock_new_inode(inode);
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 56554c8850ec..035516c80df2 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -761,7 +761,7 @@ static void destroy_inodecache(void)
761 761
762static void ext4_clear_inode(struct inode *inode) 762static void ext4_clear_inode(struct inode *inode)
763{ 763{
764 vfs_dq_drop(inode); 764 dquot_drop(inode);
765 ext4_discard_preallocations(inode); 765 ext4_discard_preallocations(inode);
766 if (EXT4_JOURNAL(inode)) 766 if (EXT4_JOURNAL(inode))
767 jbd2_journal_release_jbd_inode(EXT4_SB(inode->i_sb)->s_journal, 767 jbd2_journal_release_jbd_inode(EXT4_SB(inode->i_sb)->s_journal,
@@ -1014,7 +1014,6 @@ static ssize_t ext4_quota_write(struct super_block *sb, int type,
1014 1014
1015static const struct dquot_operations ext4_quota_operations = { 1015static const struct dquot_operations ext4_quota_operations = {
1016 .initialize = dquot_initialize, 1016 .initialize = dquot_initialize,
1017 .drop = dquot_drop,
1018#ifdef CONFIG_QUOTA 1017#ifdef CONFIG_QUOTA
1019 .get_reserved_space = ext4_get_reserved_space, 1018 .get_reserved_space = ext4_get_reserved_space,
1020#endif 1019#endif
diff --git a/fs/jfs/inode.c b/fs/jfs/inode.c
index 2562d18988f7..22fa412c5289 100644
--- a/fs/jfs/inode.c
+++ b/fs/jfs/inode.c
@@ -160,7 +160,7 @@ void jfs_delete_inode(struct inode *inode)
160 */ 160 */
161 vfs_dq_init(inode); 161 vfs_dq_init(inode);
162 dquot_free_inode(inode); 162 dquot_free_inode(inode);
163 vfs_dq_drop(inode); 163 dquot_drop(inode);
164 } 164 }
165 165
166 clear_inode(inode); 166 clear_inode(inode);
diff --git a/fs/jfs/jfs_inode.c b/fs/jfs/jfs_inode.c
index 7762f33e062b..72b30895422c 100644
--- a/fs/jfs/jfs_inode.c
+++ b/fs/jfs/jfs_inode.c
@@ -162,7 +162,7 @@ struct inode *ialloc(struct inode *parent, umode_t mode)
162 return inode; 162 return inode;
163 163
164fail_drop: 164fail_drop:
165 vfs_dq_drop(inode); 165 dquot_drop(inode);
166 inode->i_flags |= S_NOQUOTA; 166 inode->i_flags |= S_NOQUOTA;
167fail_unlock: 167fail_unlock:
168 inode->i_nlink = 0; 168 inode->i_nlink = 0;
diff --git a/fs/jfs/super.c b/fs/jfs/super.c
index 4086fa593419..266699deb1c6 100644
--- a/fs/jfs/super.c
+++ b/fs/jfs/super.c
@@ -133,7 +133,7 @@ static void jfs_destroy_inode(struct inode *inode)
133 133
134static void jfs_clear_inode(struct inode *inode) 134static void jfs_clear_inode(struct inode *inode)
135{ 135{
136 vfs_dq_drop(inode); 136 dquot_drop(inode);
137} 137}
138 138
139static int jfs_statfs(struct dentry *dentry, struct kstatfs *buf) 139static int jfs_statfs(struct dentry *dentry, struct kstatfs *buf)
diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c
index 13eb5d467c40..00eb6a095e68 100644
--- a/fs/ocfs2/inode.c
+++ b/fs/ocfs2/inode.c
@@ -1087,7 +1087,7 @@ void ocfs2_clear_inode(struct inode *inode)
1087 mlog_bug_on_msg(OCFS2_SB(inode->i_sb) == NULL, 1087 mlog_bug_on_msg(OCFS2_SB(inode->i_sb) == NULL,
1088 "Inode=%lu\n", inode->i_ino); 1088 "Inode=%lu\n", inode->i_ino);
1089 1089
1090 vfs_dq_drop(inode); 1090 dquot_drop(inode);
1091 1091
1092 /* To preven remote deletes we hold open lock before, now it 1092 /* To preven remote deletes we hold open lock before, now it
1093 * is time to unlock PR and EX open locks. */ 1093 * is time to unlock PR and EX open locks. */
diff --git a/fs/ocfs2/quota_global.c b/fs/ocfs2/quota_global.c
index b654bd103b6f..4dca38f487cf 100644
--- a/fs/ocfs2/quota_global.c
+++ b/fs/ocfs2/quota_global.c
@@ -852,7 +852,6 @@ static void ocfs2_destroy_dquot(struct dquot *dquot)
852 852
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,
856 .write_dquot = ocfs2_write_dquot, 855 .write_dquot = ocfs2_write_dquot,
857 .acquire_dquot = ocfs2_acquire_dquot, 856 .acquire_dquot = ocfs2_acquire_dquot,
858 .release_dquot = ocfs2_release_dquot, 857 .release_dquot = ocfs2_release_dquot,
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index 78ce4c48ad77..cd83c5b871ba 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -1358,7 +1358,7 @@ EXPORT_SYMBOL(dquot_initialize);
1358/* 1358/*
1359 * Release all quotas referenced by inode 1359 * Release all quotas referenced by inode
1360 */ 1360 */
1361int dquot_drop(struct inode *inode) 1361static void __dquot_drop(struct inode *inode)
1362{ 1362{
1363 int cnt; 1363 int cnt;
1364 struct dquot *put[MAXQUOTAS]; 1364 struct dquot *put[MAXQUOTAS];
@@ -1370,32 +1370,31 @@ int dquot_drop(struct inode *inode)
1370 } 1370 }
1371 up_write(&sb_dqopt(inode->i_sb)->dqptr_sem); 1371 up_write(&sb_dqopt(inode->i_sb)->dqptr_sem);
1372 dqput_all(put); 1372 dqput_all(put);
1373 return 0;
1374} 1373}
1375EXPORT_SYMBOL(dquot_drop);
1376 1374
1377/* Wrapper to remove references to quota structures from inode */ 1375void dquot_drop(struct inode *inode)
1378void vfs_dq_drop(struct inode *inode) 1376{
1379{ 1377 int cnt;
1380 /* Here we can get arbitrary inode from clear_inode() so we have 1378
1381 * to be careful. OTOH we don't need locking as quota operations 1379 if (IS_NOQUOTA(inode))
1382 * are allowed to change only at mount time */ 1380 return;
1383 if (!IS_NOQUOTA(inode) && inode->i_sb && inode->i_sb->dq_op 1381
1384 && inode->i_sb->dq_op->drop) { 1382 /*
1385 int cnt; 1383 * Test before calling to rule out calls from proc and such
1386 /* Test before calling to rule out calls from proc and such 1384 * where we are not allowed to block. Note that this is
1387 * where we are not allowed to block. Note that this is 1385 * actually reliable test even without the lock - the caller
1388 * actually reliable test even without the lock - the caller 1386 * must assure that nobody can come after the DQUOT_DROP and
1389 * must assure that nobody can come after the DQUOT_DROP and 1387 * add quota pointers back anyway.
1390 * add quota pointers back anyway */ 1388 */
1391 for (cnt = 0; cnt < MAXQUOTAS; cnt++) 1389 for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
1392 if (inode->i_dquot[cnt]) 1390 if (inode->i_dquot[cnt])
1393 break; 1391 break;
1394 if (cnt < MAXQUOTAS) 1392 }
1395 inode->i_sb->dq_op->drop(inode); 1393
1396 } 1394 if (cnt < MAXQUOTAS)
1397} 1395 __dquot_drop(inode);
1398EXPORT_SYMBOL(vfs_dq_drop); 1396}
1397EXPORT_SYMBOL(dquot_drop);
1399 1398
1400/* 1399/*
1401 * inode_reserved_space is managed internally by quota, and protected by 1400 * inode_reserved_space is managed internally by quota, and protected by
@@ -1812,7 +1811,6 @@ EXPORT_SYMBOL(dquot_commit_info);
1812 */ 1811 */
1813const struct dquot_operations dquot_operations = { 1812const struct dquot_operations dquot_operations = {
1814 .initialize = dquot_initialize, 1813 .initialize = dquot_initialize,
1815 .drop = dquot_drop,
1816 .write_dquot = dquot_commit, 1814 .write_dquot = dquot_commit,
1817 .acquire_dquot = dquot_acquire, 1815 .acquire_dquot = dquot_acquire,
1818 .release_dquot = dquot_release, 1816 .release_dquot = dquot_release,
@@ -2029,7 +2027,7 @@ static int vfs_load_quota_inode(struct inode *inode, int type, int format_id,
2029 * When S_NOQUOTA is set, remove dquot references as no more 2027 * When S_NOQUOTA is set, remove dquot references as no more
2030 * references can be added 2028 * references can be added
2031 */ 2029 */
2032 sb->dq_op->drop(inode); 2030 __dquot_drop(inode);
2033 } 2031 }
2034 2032
2035 error = -EIO; 2033 error = -EIO;
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
index 99a5e5a8ab5a..f07c3b69247d 100644
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -1964,7 +1964,7 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
1964 out_end_trans: 1964 out_end_trans:
1965 journal_end(th, th->t_super, th->t_blocks_allocated); 1965 journal_end(th, th->t_super, th->t_blocks_allocated);
1966 /* Drop can be outside and it needs more credits so it's better to have it outside */ 1966 /* Drop can be outside and it needs more credits so it's better to have it outside */
1967 vfs_dq_drop(inode); 1967 dquot_drop(inode);
1968 inode->i_flags |= S_NOQUOTA; 1968 inode->i_flags |= S_NOQUOTA;
1969 make_bad_inode(inode); 1969 make_bad_inode(inode);
1970 1970
diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c
index 9d4dcf0b07cb..9dea84e8a79a 100644
--- a/fs/reiserfs/namei.c
+++ b/fs/reiserfs/namei.c
@@ -546,7 +546,7 @@ static int reiserfs_add_entry(struct reiserfs_transaction_handle *th,
546*/ 546*/
547static int drop_new_inode(struct inode *inode) 547static int drop_new_inode(struct inode *inode)
548{ 548{
549 vfs_dq_drop(inode); 549 dquot_drop(inode);
550 make_bad_inode(inode); 550 make_bad_inode(inode);
551 inode->i_flags |= S_NOQUOTA; 551 inode->i_flags |= S_NOQUOTA;
552 iput(inode); 552 iput(inode);
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index 6b24e70e329b..34f7cd0cb02d 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -580,7 +580,7 @@ out:
580 580
581static void reiserfs_clear_inode(struct inode *inode) 581static void reiserfs_clear_inode(struct inode *inode)
582{ 582{
583 vfs_dq_drop(inode); 583 dquot_drop(inode);
584} 584}
585 585
586#ifdef CONFIG_QUOTA 586#ifdef CONFIG_QUOTA
@@ -623,7 +623,6 @@ static int reiserfs_quota_on(struct super_block *, int, int, char *, int);
623 623
624static const struct dquot_operations reiserfs_quota_operations = { 624static const struct dquot_operations reiserfs_quota_operations = {
625 .initialize = dquot_initialize, 625 .initialize = dquot_initialize,
626 .drop = dquot_drop,
627 .write_dquot = reiserfs_write_dquot, 626 .write_dquot = reiserfs_write_dquot,
628 .acquire_dquot = reiserfs_acquire_dquot, 627 .acquire_dquot = reiserfs_acquire_dquot,
629 .release_dquot = reiserfs_release_dquot, 628 .release_dquot = reiserfs_release_dquot,
diff --git a/fs/udf/ialloc.c b/fs/udf/ialloc.c
index e1856b89c9c8..15c6e992e587 100644
--- a/fs/udf/ialloc.c
+++ b/fs/udf/ialloc.c
@@ -37,7 +37,7 @@ void udf_free_inode(struct inode *inode)
37 * as writing the quota to disk may need the lock as well. 37 * as writing the quota to disk may need the lock as well.
38 */ 38 */
39 dquot_free_inode(inode); 39 dquot_free_inode(inode);
40 vfs_dq_drop(inode); 40 dquot_drop(inode);
41 41
42 clear_inode(inode); 42 clear_inode(inode);
43 43
@@ -156,7 +156,7 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err)
156 vfs_dq_init(inode); 156 vfs_dq_init(inode);
157 ret = dquot_alloc_inode(inode); 157 ret = dquot_alloc_inode(inode);
158 if (ret) { 158 if (ret) {
159 vfs_dq_drop(inode); 159 dquot_drop(inode);
160 inode->i_flags |= S_NOQUOTA; 160 inode->i_flags |= S_NOQUOTA;
161 inode->i_nlink = 0; 161 inode->i_nlink = 0;
162 iput(inode); 162 iput(inode);
diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index 859389a3832b..1199e8e21ee2 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -109,7 +109,7 @@ void udf_clear_inode(struct inode *inode)
109 (unsigned long long)iinfo->i_lenExtents); 109 (unsigned long long)iinfo->i_lenExtents);
110 } 110 }
111 111
112 vfs_dq_drop(inode); 112 dquot_drop(inode);
113 kfree(iinfo->i_ext.i_data); 113 kfree(iinfo->i_ext.i_data);
114 iinfo->i_ext.i_data = NULL; 114 iinfo->i_ext.i_data = NULL;
115} 115}
diff --git a/fs/ufs/ialloc.c b/fs/ufs/ialloc.c
index 02f77882c573..67b4bdb056fb 100644
--- a/fs/ufs/ialloc.c
+++ b/fs/ufs/ialloc.c
@@ -96,7 +96,7 @@ void ufs_free_inode (struct inode * inode)
96 is_directory = S_ISDIR(inode->i_mode); 96 is_directory = S_ISDIR(inode->i_mode);
97 97
98 dquot_free_inode(inode); 98 dquot_free_inode(inode);
99 vfs_dq_drop(inode); 99 dquot_drop(inode);
100 100
101 clear_inode (inode); 101 clear_inode (inode);
102 102
@@ -358,7 +358,7 @@ cg_found:
358 vfs_dq_init(inode); 358 vfs_dq_init(inode);
359 err = dquot_alloc_inode(inode); 359 err = dquot_alloc_inode(inode);
360 if (err) { 360 if (err) {
361 vfs_dq_drop(inode); 361 dquot_drop(inode);
362 goto fail_without_unlock; 362 goto fail_without_unlock;
363 } 363 }
364 364
diff --git a/fs/ufs/super.c b/fs/ufs/super.c
index 95d61cb3a5b8..66b63a751615 100644
--- a/fs/ufs/super.c
+++ b/fs/ufs/super.c
@@ -1434,7 +1434,7 @@ static void destroy_inodecache(void)
1434 1434
1435static void ufs_clear_inode(struct inode *inode) 1435static void ufs_clear_inode(struct inode *inode)
1436{ 1436{
1437 vfs_dq_drop(inode); 1437 dquot_drop(inode);
1438} 1438}
1439 1439
1440#ifdef CONFIG_QUOTA 1440#ifdef CONFIG_QUOTA