From 6d67ee305cdfff7131a4105551409d1603dba81d Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Sat, 2 May 2009 20:59:04 -0400 Subject: [PATCH] Avoid unneeded updates of block group descriptors in ext2fs_closefs() 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" --- lib/ext2fs/closefs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ext2fs/closefs.c b/lib/ext2fs/closefs.c index b04f33b..ed7109e 100644 --- a/lib/ext2fs/closefs.c +++ b/lib/ext2fs/closefs.c @@ -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); -- 1.8.3.1