[PATCH] quota: ext3: Improve quota credit estimates
Use improved credits estimates for quota operations. Also reserve a space for a quota operation in a transaction only if filesystem was mounted with some quota options. Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
@@ -128,7 +128,7 @@ static unsigned long blocks_for_truncate(struct inode *inode)
|
||||
if (needed > EXT3_MAX_TRANS_DATA)
|
||||
needed = EXT3_MAX_TRANS_DATA;
|
||||
|
||||
return EXT3_DATA_TRANS_BLOCKS + needed;
|
||||
return EXT3_DATA_TRANS_BLOCKS(inode->i_sb) + needed;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2763,7 +2763,8 @@ int ext3_setattr(struct dentry *dentry, struct iattr *attr)
|
||||
|
||||
/* (user+group)*(old+new) structure, inode write (sb,
|
||||
* inode block, ? - but truncate inode update has it) */
|
||||
handle = ext3_journal_start(inode, 4*EXT3_QUOTA_INIT_BLOCKS+3);
|
||||
handle = ext3_journal_start(inode, 2*(EXT3_QUOTA_INIT_BLOCKS(inode->i_sb)+
|
||||
EXT3_QUOTA_DEL_BLOCKS(inode->i_sb))+3);
|
||||
if (IS_ERR(handle)) {
|
||||
error = PTR_ERR(handle);
|
||||
goto err_out;
|
||||
@@ -2861,7 +2862,7 @@ static int ext3_writepage_trans_blocks(struct inode *inode)
|
||||
#ifdef CONFIG_QUOTA
|
||||
/* We know that structure was already allocated during DQUOT_INIT so
|
||||
* we will be updating only the data blocks + inodes */
|
||||
ret += 2*EXT3_QUOTA_TRANS_BLOCKS;
|
||||
ret += 2*EXT3_QUOTA_TRANS_BLOCKS(inode->i_sb);
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user