]> Pileus Git - ~andy/linux/commitdiff
ext4: fix the number of credits needed for ext4_unlink() and ext4_rmdir()
authorTheodore Ts'o <tytso@mit.edu>
Sat, 9 Feb 2013 20:06:24 +0000 (15:06 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 9 Feb 2013 20:06:24 +0000 (15:06 -0500)
The ext4_unlink() and ext4_rmdir() don't actually release the blocks
associated with the file/directory.  This gets done in a separate jbd2
handle called via ext4_evict_inode().  Thus, we don't need to reserve
lots of journal credits for the truncate.

Note that using too many journal credits is non-optimal because it can
leading to the journal transmit getting closed too early, before it is
strictly necessary.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Jan Kara <jack@suse.cz>
fs/ext4/ext4_jbd2.h
fs/ext4/namei.c

index 302814b85945aace18a0de8fbd320bbb8aa66e41..c1fc2dca14aeb53f110bc15de5e49d7d0d992728 100644 (file)
 #define EXT4_META_TRANS_BLOCKS(sb)     (EXT4_XATTR_TRANS_BLOCKS + \
                                        EXT4_MAXQUOTAS_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 EXT4_DELETE_TRANS_BLOCKS(sb)   (2 * EXT4_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
  * write(2) and truncate(2) we can write more than this, but we always
index 36a4afd12f39e696a19dc4fcb977afd0cf6b80b2..5f3d2b569c632d90902147154a8dcf10a9779ad6 100644 (file)
@@ -2748,7 +2748,7 @@ static int ext4_rmdir(struct inode *dir, struct dentry *dentry)
                goto end_rmdir;
 
        handle = ext4_journal_start(dir, EXT4_HT_DIR,
-                                   EXT4_DELETE_TRANS_BLOCKS(dir->i_sb));
+                                   EXT4_DATA_TRANS_BLOCKS(dir->i_sb));
        if (IS_ERR(handle)) {
                retval = PTR_ERR(handle);
                handle = NULL;
@@ -2811,7 +2811,7 @@ static int ext4_unlink(struct inode *dir, struct dentry *dentry)
                goto end_unlink;
 
        handle = ext4_journal_start(dir, EXT4_HT_DIR,
-                                   EXT4_DELETE_TRANS_BLOCKS(dir->i_sb));
+                                   EXT4_DATA_TRANS_BLOCKS(dir->i_sb));
        if (IS_ERR(handle)) {
                retval = PTR_ERR(handle);
                handle = NULL;