[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:
@@ -358,6 +358,7 @@ struct ext3_inode {
|
||||
#define EXT3_MOUNT_RESERVATION 0x10000 /* Preallocation */
|
||||
#define EXT3_MOUNT_BARRIER 0x20000 /* Use block barriers */
|
||||
#define EXT3_MOUNT_NOBH 0x40000 /* No bufferheads */
|
||||
#define EXT3_MOUNT_QUOTA 0x80000 /* Some quota option set */
|
||||
|
||||
/* Compatibility, for having both ext2_fs.h and ext3_fs.h included at once */
|
||||
#ifndef _LINUX_EXT2_FS_H
|
||||
|
||||
@@ -42,15 +42,15 @@
|
||||
* superblock only gets updated once, of course, so don't bother
|
||||
* counting that again for the quota updates. */
|
||||
|
||||
#define EXT3_DATA_TRANS_BLOCKS (EXT3_SINGLEDATA_TRANS_BLOCKS + \
|
||||
#define EXT3_DATA_TRANS_BLOCKS(sb) (EXT3_SINGLEDATA_TRANS_BLOCKS + \
|
||||
EXT3_XATTR_TRANS_BLOCKS - 2 + \
|
||||
2*EXT3_QUOTA_TRANS_BLOCKS)
|
||||
2*EXT3_QUOTA_TRANS_BLOCKS(sb))
|
||||
|
||||
/* Delete operations potentially hit one directory's namespace plus an
|
||||
* entire inode, plus arbitrary amounts of bitmap/indirection data. Be
|
||||
* generous. We can grow the delete transaction later if necessary. */
|
||||
|
||||
#define EXT3_DELETE_TRANS_BLOCKS (2 * EXT3_DATA_TRANS_BLOCKS + 64)
|
||||
#define EXT3_DELETE_TRANS_BLOCKS(sb) (2 * EXT3_DATA_TRANS_BLOCKS(sb) + 64)
|
||||
|
||||
/* Define an arbitrary limit for the amount of data we will anticipate
|
||||
* writing to any given transaction. For unbounded transactions such as
|
||||
@@ -74,14 +74,17 @@
|
||||
#ifdef CONFIG_QUOTA
|
||||
/* Amount of blocks needed for quota update - we know that the structure was
|
||||
* allocated so we need to update only inode+data */
|
||||
#define EXT3_QUOTA_TRANS_BLOCKS 2
|
||||
#define EXT3_QUOTA_TRANS_BLOCKS(sb) (test_opt(sb, QUOTA) ? 2 : 0)
|
||||
/* Amount of blocks needed for quota insert/delete - we do some block writes
|
||||
* but inode, sb and group updates are done only once */
|
||||
#define EXT3_QUOTA_INIT_BLOCKS (DQUOT_MAX_WRITES*\
|
||||
(EXT3_SINGLEDATA_TRANS_BLOCKS-3)+3)
|
||||
#define EXT3_QUOTA_INIT_BLOCKS(sb) (test_opt(sb, QUOTA) ? (DQUOT_INIT_ALLOC*\
|
||||
(EXT3_SINGLEDATA_TRANS_BLOCKS-3)+3+DQUOT_INIT_REWRITE) : 0)
|
||||
#define EXT3_QUOTA_DEL_BLOCKS(sb) (test_opt(sb, QUOTA) ? (DQUOT_DEL_ALLOC*\
|
||||
(EXT3_SINGLEDATA_TRANS_BLOCKS-3)+3+DQUOT_DEL_REWRITE) : 0)
|
||||
#else
|
||||
#define EXT3_QUOTA_TRANS_BLOCKS 0
|
||||
#define EXT3_QUOTA_INIT_BLOCKS 0
|
||||
#define EXT3_QUOTA_TRANS_BLOCKS(sb) 0
|
||||
#define EXT3_QUOTA_INIT_BLOCKS(sb) 0
|
||||
#define EXT3_QUOTA_DEL_BLOCKS(sb) 0
|
||||
#endif
|
||||
|
||||
int
|
||||
|
||||
Reference in New Issue
Block a user