Whamcloud - gitweb
Avoid unneeded updates of block group descriptors in ext2fs_closefs()
authorTheodore Ts'o <tytso@mit.edu>
Sun, 3 May 2009 00:59:04 +0000 (20:59 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Sun, 3 May 2009 00:59:04 +0000 (20:59 -0400)
If the superblock is clean, and we only need to update
s_kbytes_written, then we only need to update the superblock.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lib/ext2fs/closefs.c

index b04f33b..ed7109e 100644 (file)
@@ -389,7 +389,8 @@ errcode_t ext2fs_close(ext2_filsys fs)
                if (!(fs->flags & EXT2_FLAG_SUPER_ONLY))
                        fs->super->s_kbytes_written += meta_blks /
                                (fs->blocksize / 1024);
-               ext2fs_mark_super_dirty(fs);
+               if ((fs->flags & EXT2_FLAG_DIRTY) == 0)
+                       fs->flags |= EXT2_FLAG_SUPER_ONLY | EXT2_FLAG_DIRTY;
        }
        if (fs->flags & EXT2_FLAG_DIRTY) {
                retval = ext2fs_flush(fs);