diff options
author | Jan Kara <jack@suse.cz> | 2005-06-24 01:01:06 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-24 03:05:20 -0400 |
commit | 556a2a45bce1740f035befaa7201e4ad836c7257 (patch) | |
tree | d4a85b6f2bd02ab5c7c194e351508b80035f07c5 /fs/reiserfs/inode.c | |
parent | 1f54587bea84a35125c95e19b98c2f464c50871b (diff) |
[PATCH] quota: reiserfs: improve quota credit estimates
Use improved credits estimates for quota operations. Also reserve space
for a quota operation in a transaction only if filesystem was mounted with
some quota option.
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/reiserfs/inode.c')
-rw-r--r-- | fs/reiserfs/inode.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c index 073425e6e0a9..0d5817f81972 100644 --- a/fs/reiserfs/inode.c +++ b/fs/reiserfs/inode.c | |||
@@ -28,7 +28,7 @@ static int reiserfs_prepare_write(struct file *f, struct page *page, | |||
28 | void reiserfs_delete_inode (struct inode * inode) | 28 | void reiserfs_delete_inode (struct inode * inode) |
29 | { | 29 | { |
30 | /* We need blocks for transaction + (user+group) quota update (possibly delete) */ | 30 | /* We need blocks for transaction + (user+group) quota update (possibly delete) */ |
31 | int jbegin_count = JOURNAL_PER_BALANCE_CNT * 2 + 2 * REISERFS_QUOTA_INIT_BLOCKS; | 31 | int jbegin_count = JOURNAL_PER_BALANCE_CNT * 2 + 2 * REISERFS_QUOTA_INIT_BLOCKS(inode->i_sb); |
32 | struct reiserfs_transaction_handle th ; | 32 | struct reiserfs_transaction_handle th ; |
33 | 33 | ||
34 | reiserfs_write_lock(inode->i_sb); | 34 | reiserfs_write_lock(inode->i_sb); |
@@ -591,7 +591,7 @@ int reiserfs_get_block (struct inode * inode, sector_t block, | |||
591 | XXX in practically impossible worst case direct2indirect() | 591 | XXX in practically impossible worst case direct2indirect() |
592 | can incur (much) more than 3 balancings. | 592 | can incur (much) more than 3 balancings. |
593 | quota update for user, group */ | 593 | quota update for user, group */ |
594 | int jbegin_count = JOURNAL_PER_BALANCE_CNT * 3 + 1 + 2 * REISERFS_QUOTA_TRANS_BLOCKS; | 594 | int jbegin_count = JOURNAL_PER_BALANCE_CNT * 3 + 1 + 2 * REISERFS_QUOTA_TRANS_BLOCKS(inode->i_sb); |
595 | int version; | 595 | int version; |
596 | int dangle = 1; | 596 | int dangle = 1; |
597 | loff_t new_offset = (((loff_t)block) << inode->i_sb->s_blocksize_bits) + 1 ; | 597 | loff_t new_offset = (((loff_t)block) << inode->i_sb->s_blocksize_bits) + 1 ; |
@@ -2796,14 +2796,15 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr) { | |||
2796 | 2796 | ||
2797 | if (!error) { | 2797 | if (!error) { |
2798 | struct reiserfs_transaction_handle th; | 2798 | struct reiserfs_transaction_handle th; |
2799 | int jbegin_count = 2*(REISERFS_QUOTA_INIT_BLOCKS(inode->i_sb)+REISERFS_QUOTA_DEL_BLOCKS(inode->i_sb))+2; | ||
2799 | 2800 | ||
2800 | /* (user+group)*(old+new) structure - we count quota info and , inode write (sb, inode) */ | 2801 | /* (user+group)*(old+new) structure - we count quota info and , inode write (sb, inode) */ |
2801 | error = journal_begin(&th, inode->i_sb, 4*REISERFS_QUOTA_INIT_BLOCKS+2); | 2802 | error = journal_begin(&th, inode->i_sb, jbegin_count); |
2802 | if (error) | 2803 | if (error) |
2803 | goto out; | 2804 | goto out; |
2804 | error = DQUOT_TRANSFER(inode, attr) ? -EDQUOT : 0; | 2805 | error = DQUOT_TRANSFER(inode, attr) ? -EDQUOT : 0; |
2805 | if (error) { | 2806 | if (error) { |
2806 | journal_end(&th, inode->i_sb, 4*REISERFS_QUOTA_INIT_BLOCKS+2); | 2807 | journal_end(&th, inode->i_sb, jbegin_count); |
2807 | goto out; | 2808 | goto out; |
2808 | } | 2809 | } |
2809 | /* Update corresponding info in inode so that everything is in | 2810 | /* Update corresponding info in inode so that everything is in |
@@ -2813,7 +2814,7 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr) { | |||
2813 | if (attr->ia_valid & ATTR_GID) | 2814 | if (attr->ia_valid & ATTR_GID) |
2814 | inode->i_gid = attr->ia_gid; | 2815 | inode->i_gid = attr->ia_gid; |
2815 | mark_inode_dirty(inode); | 2816 | mark_inode_dirty(inode); |
2816 | error = journal_end(&th, inode->i_sb, 4*REISERFS_QUOTA_INIT_BLOCKS+2); | 2817 | error = journal_end(&th, inode->i_sb, jbegin_count); |
2817 | } | 2818 | } |
2818 | } | 2819 | } |
2819 | if (!error) | 2820 | if (!error) |