diff options
author | Christoph Hellwig <hch@infradead.org> | 2010-03-03 09:05:00 -0500 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2010-03-04 18:20:28 -0500 |
commit | 5dd4056db84387975140ff2568eaa0406f07985e (patch) | |
tree | 03c26d7f6e3367b167bfeeb1a01654c6619573f4 /fs/ext3 | |
parent | 49792c806d0bfd53afc789dcdf50dc9bed2c5b83 (diff) |
dquot: cleanup space allocation / freeing routines
Get rid of the alloc_space, free_space, reserve_space, claim_space and
release_rsv dquot operations - they are always called from the filesystem
and if a filesystem really needs their own (which none currently does)
it can just call into it's own routine directly.
Move shared logic into the common __dquot_alloc_space,
dquot_claim_space_nodirty and __dquot_free_space low-level methods,
and rationalize the wrappers around it to move as much as possible
code into the common block for CONFIG_QUOTA vs not. Also rename
all these helpers to be named dquot_* instead of vfs_dq_*.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/ext3')
-rw-r--r-- | fs/ext3/balloc.c | 11 | ||||
-rw-r--r-- | fs/ext3/inode.c | 2 | ||||
-rw-r--r-- | fs/ext3/super.c | 2 | ||||
-rw-r--r-- | fs/ext3/xattr.c | 8 |
4 files changed, 11 insertions, 12 deletions
diff --git a/fs/ext3/balloc.c b/fs/ext3/balloc.c index 27967f92e82..161da2d3f89 100644 --- a/fs/ext3/balloc.c +++ b/fs/ext3/balloc.c | |||
@@ -676,7 +676,7 @@ void ext3_free_blocks(handle_t *handle, struct inode *inode, | |||
676 | } | 676 | } |
677 | ext3_free_blocks_sb(handle, sb, block, count, &dquot_freed_blocks); | 677 | ext3_free_blocks_sb(handle, sb, block, count, &dquot_freed_blocks); |
678 | if (dquot_freed_blocks) | 678 | if (dquot_freed_blocks) |
679 | vfs_dq_free_block(inode, dquot_freed_blocks); | 679 | dquot_free_block(inode, dquot_freed_blocks); |
680 | return; | 680 | return; |
681 | } | 681 | } |
682 | 682 | ||
@@ -1502,8 +1502,9 @@ ext3_fsblk_t ext3_new_blocks(handle_t *handle, struct inode *inode, | |||
1502 | /* | 1502 | /* |
1503 | * Check quota for allocation of this block. | 1503 | * Check quota for allocation of this block. |
1504 | */ | 1504 | */ |
1505 | if (vfs_dq_alloc_block(inode, num)) { | 1505 | err = dquot_alloc_block(inode, num); |
1506 | *errp = -EDQUOT; | 1506 | if (err) { |
1507 | *errp = err; | ||
1507 | return 0; | 1508 | return 0; |
1508 | } | 1509 | } |
1509 | 1510 | ||
@@ -1713,7 +1714,7 @@ allocated: | |||
1713 | 1714 | ||
1714 | *errp = 0; | 1715 | *errp = 0; |
1715 | brelse(bitmap_bh); | 1716 | brelse(bitmap_bh); |
1716 | vfs_dq_free_block(inode, *count-num); | 1717 | dquot_free_block(inode, *count-num); |
1717 | *count = num; | 1718 | *count = num; |
1718 | return ret_block; | 1719 | return ret_block; |
1719 | 1720 | ||
@@ -1728,7 +1729,7 @@ out: | |||
1728 | * Undo the block allocation | 1729 | * Undo the block allocation |
1729 | */ | 1730 | */ |
1730 | if (!performed_allocation) | 1731 | if (!performed_allocation) |
1731 | vfs_dq_free_block(inode, *count); | 1732 | dquot_free_block(inode, *count); |
1732 | brelse(bitmap_bh); | 1733 | brelse(bitmap_bh); |
1733 | return 0; | 1734 | return 0; |
1734 | } | 1735 | } |
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c index eda9121d7d5..20f02d69365 100644 --- a/fs/ext3/inode.c +++ b/fs/ext3/inode.c | |||
@@ -3336,7 +3336,7 @@ int ext3_mark_inode_dirty(handle_t *handle, struct inode *inode) | |||
3336 | * i_size has been changed by generic_commit_write() and we thus need | 3336 | * i_size has been changed by generic_commit_write() and we thus need |
3337 | * to include the updated inode in the current transaction. | 3337 | * to include the updated inode in the current transaction. |
3338 | * | 3338 | * |
3339 | * Also, vfs_dq_alloc_space() will always dirty the inode when blocks | 3339 | * Also, dquot_alloc_space() will always dirty the inode when blocks |
3340 | * are allocated to the file. | 3340 | * are allocated to the file. |
3341 | * | 3341 | * |
3342 | * If the inode is marked synchronous, we don't honour that here - doing | 3342 | * If the inode is marked synchronous, we don't honour that here - doing |
diff --git a/fs/ext3/super.c b/fs/ext3/super.c index 5c54e5f685d..8c13910a378 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c | |||
@@ -752,9 +752,7 @@ static ssize_t ext3_quota_write(struct super_block *sb, int type, | |||
752 | static const struct dquot_operations ext3_quota_operations = { | 752 | static const struct dquot_operations ext3_quota_operations = { |
753 | .initialize = dquot_initialize, | 753 | .initialize = dquot_initialize, |
754 | .drop = dquot_drop, | 754 | .drop = dquot_drop, |
755 | .alloc_space = dquot_alloc_space, | ||
756 | .alloc_inode = dquot_alloc_inode, | 755 | .alloc_inode = dquot_alloc_inode, |
757 | .free_space = dquot_free_space, | ||
758 | .free_inode = dquot_free_inode, | 756 | .free_inode = dquot_free_inode, |
759 | .transfer = dquot_transfer, | 757 | .transfer = dquot_transfer, |
760 | .write_dquot = ext3_write_dquot, | 758 | .write_dquot = ext3_write_dquot, |
diff --git a/fs/ext3/xattr.c b/fs/ext3/xattr.c index 2d2fb2a8596..534a94c3a93 100644 --- a/fs/ext3/xattr.c +++ b/fs/ext3/xattr.c | |||
@@ -500,7 +500,7 @@ ext3_xattr_release_block(handle_t *handle, struct inode *inode, | |||
500 | error = ext3_journal_dirty_metadata(handle, bh); | 500 | error = ext3_journal_dirty_metadata(handle, bh); |
501 | if (IS_SYNC(inode)) | 501 | if (IS_SYNC(inode)) |
502 | handle->h_sync = 1; | 502 | handle->h_sync = 1; |
503 | vfs_dq_free_block(inode, 1); | 503 | dquot_free_block(inode, 1); |
504 | ea_bdebug(bh, "refcount now=%d; releasing", | 504 | ea_bdebug(bh, "refcount now=%d; releasing", |
505 | le32_to_cpu(BHDR(bh)->h_refcount)); | 505 | le32_to_cpu(BHDR(bh)->h_refcount)); |
506 | if (ce) | 506 | if (ce) |
@@ -775,8 +775,8 @@ inserted: | |||
775 | else { | 775 | else { |
776 | /* The old block is released after updating | 776 | /* The old block is released after updating |
777 | the inode. */ | 777 | the inode. */ |
778 | error = -EDQUOT; | 778 | error = dquot_alloc_block(inode, 1); |
779 | if (vfs_dq_alloc_block(inode, 1)) | 779 | if (error) |
780 | goto cleanup; | 780 | goto cleanup; |
781 | error = ext3_journal_get_write_access(handle, | 781 | error = ext3_journal_get_write_access(handle, |
782 | new_bh); | 782 | new_bh); |
@@ -850,7 +850,7 @@ cleanup: | |||
850 | return error; | 850 | return error; |
851 | 851 | ||
852 | cleanup_dquot: | 852 | cleanup_dquot: |
853 | vfs_dq_free_block(inode, 1); | 853 | dquot_free_block(inode, 1); |
854 | goto cleanup; | 854 | goto cleanup; |
855 | 855 | ||
856 | bad_block: | 856 | bad_block: |