diff options
author | Christoph Hellwig <hch@infradead.org> | 2010-03-03 09:05:05 -0500 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2010-03-04 18:20:30 -0500 |
commit | 9f7547580263d4a55efe06ce5cfd567f568be6e8 (patch) | |
tree | 6f926a075eeed815d0a6680c06f235da0e5ea6d9 /fs/quota/dquot.c | |
parent | 257ba15cedf1288f0c96118d7e63947231d27278 (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/quota/dquot.c')
-rw-r--r-- | fs/quota/dquot.c | 52 |
1 files changed, 25 insertions, 27 deletions
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 | */ |
1361 | int dquot_drop(struct inode *inode) | 1361 | static 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 | } |
1375 | EXPORT_SYMBOL(dquot_drop); | ||
1376 | 1374 | ||
1377 | /* Wrapper to remove references to quota structures from inode */ | 1375 | void dquot_drop(struct inode *inode) |
1378 | void 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); |
1398 | EXPORT_SYMBOL(vfs_dq_drop); | 1396 | } |
1397 | EXPORT_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 | */ |
1813 | const struct dquot_operations dquot_operations = { | 1812 | const 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; |