]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
libext2fs: don't update the summary counts when doing implied cluster allocation
authorDarrick J. Wong <darrick.wong@oracle.com>
Mon, 16 Dec 2013 04:50:52 +0000 (23:50 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 16 Dec 2013 04:50:54 +0000 (23:50 -0500)
When we're appending a block to a directory file or the journal file,
and the new block is part of a cluster that has already been allocated
to the file (implied cluster allocation), don't update the bitmap or
the summary counts because that was performed when the cluster was
allocated.

Reviewed-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lib/ext2fs/expanddir.c
lib/ext2fs/mkjournal.c

index 41c40882f6e3769a3d61f22bafbf35aa8ec5cc2e..153b838c11db4e9f3d8ef89eb909f993b8d03c6f 100644 (file)
@@ -54,6 +54,7 @@ static int expand_dir_proc(ext2_filsys        fs,
                        return BLOCK_ABORT;
                }
                es->newblocks++;
+               ext2fs_block_alloc_stats2(fs, new_blk, +1);
        }
        if (blockcnt > 0) {
                retval = ext2fs_new_dir_block(fs, 0, 0, &block);
@@ -80,7 +81,6 @@ static int expand_dir_proc(ext2_filsys        fs,
        }
        ext2fs_free_mem(&block);
        *blocknr = new_blk;
-       ext2fs_block_alloc_stats2(fs, new_blk, +1);
 
        if (es->done)
                return (BLOCK_CHANGED | BLOCK_ABORT);
index 69ac1350fd66ca3eccebce3a95bb31d4c01995e0..d09c45897a4a6f39143dc126ee2a0ed471b77b03 100644 (file)
@@ -250,6 +250,7 @@ static int mkjournal_proc(ext2_filsys       fs,
                        es->err = retval;
                        return BLOCK_ABORT;
                }
+               ext2fs_block_alloc_stats2(fs, new_blk, +1);
                es->newblocks++;
        }
        if (blockcnt >= 0)
@@ -285,7 +286,6 @@ static int mkjournal_proc(ext2_filsys       fs,
                return BLOCK_ABORT;
        }
        *blocknr = es->goal = new_blk;
-       ext2fs_block_alloc_stats2(fs, new_blk, +1);
 
        if (es->num_blocks == 0)
                return (BLOCK_CHANGED | BLOCK_ABORT);