Skip to contentSkip to conversation

e2fsck: avoid unnecessary close/reopen for non-MMP filesystems

PATCH In review Theodore Ts'o 2 participants 2 messages Mar 22, 2012 – Mar 23, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 e2fsck: avoid unnecessary close/reopen for non-MMP filesystems

For file systems that do not use MMP, there's no reason to close the file system and then re-open the file system a second time, since EXT2_FLAG_SKIP_MMP has no meaning for non-MMP file systems anyway.

---
 e2fsck/unix.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)
e2fsck/unix.c +3 -5
index 59c52ff..d0b10d4 100644
@@ -1398,12 +1398,10 @@ failure:
 	    (flags & EXT2_FLAG_SKIP_MMP)) {
 		if (e2fsck_check_mmp(fs, ctx))
 			fatal_error(ctx, 0);
-	}
 
-	 /*
-	  * Restart in order to reopen fs but this time start mmp.
-	  */
-	if (flags & EXT2_FLAG_SKIP_MMP) {
+		/*
+		 * Restart in order to reopen fs but this time start mmp.
+		 */
 		ext2fs_close(fs);
 		ctx->fs = NULL;
 		flags &= ~EXT2_FLAG_SKIP_MMP;
Signature · 1 line
1.7.9.107.g97f9a
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Theodore Ts'o

For file systems that do not use MMP, there's no reason to close the file system and then re-open the file system a second time, since EXT2_FLAG_SKIP_MMP has no meaning for non-MMP file systems anyway.

Not sure how those two identical checks ended up next to each other.

Quoted 27 lines

---
e2fsck/unix.c | 8 +++-----

1 files changed, 3 insertions(+), 5 deletions(-)
e2fsck/unix.c +3 -5
index 59c52ff..d0b10d4 100644
@@ -1398,12 +1398,10 @@ failure:
       (flags & EXT2_FLAG_SKIP_MMP)) {
       if (e2fsck_check_mmp(fs, ctx))
           fatal_error(ctx, 0);
-    }
 
-     /*
-      * Restart in order to reopen fs but this time start mmp.
-      */
-    if (flags & EXT2_FLAG_SKIP_MMP) {
+        /*
+         * Restart in order to reopen fs but this time start mmp.
+         */
       ext2fs_close(fs);
       ctx->fs = NULL;
       flags &= ~EXT2_FLAG_SKIP_MMP;
Signature · 1 line
1.7.9.107.g97f9a