2012-03-22 03:21:20

by Theodore Ts'o

[permalink] [raw]
Subject: [PATCH] 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.

Signed-off-by: "Theodore Ts'o" <[email protected]>
Cc: Andreas Dilger <[email protected]>
---
e2fsck/unix.c | 8 +++-----
1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/e2fsck/unix.c b/e2fsck/unix.c
index 59c52ff..d0b10d4 100644
--- a/e2fsck/unix.c
+++ b/e2fsck/unix.c
@@ -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;
--
1.7.9.107.g97f9a



2012-03-23 00:04:19

by Andreas Dilger

[permalink] [raw]
Subject: Re: [PATCH] e2fsck: avoid unnecessary close/reopen for non-MMP filesystems

On 2012-03-21, at 21:21, Theodore Ts'o <[email protected]> wrote:
> 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.
>
> Signed-off-by: "Theodore Ts'o" <[email protected]>

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

Acked-by: Andreas Dilger <[email protected]>

> ---
> e2fsck/unix.c | 8 +++-----
> 1 files changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/e2fsck/unix.c b/e2fsck/unix.c
> index 59c52ff..d0b10d4 100644
> --- a/e2fsck/unix.c
> +++ b/e2fsck/unix.c
> @@ -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;
> --
> 1.7.9.107.g97f9a
>