linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@redhat.com>
To: Lukas Czerner <lczerner@redhat.com>
Cc: linux-ext4@vger.kernel.org, tytso@mit.edu
Subject: Re: [PATCH 3/4] e2fsck: Do not discard when in read only mode
Date: Mon, 05 Mar 2012 13:33:56 -0600	[thread overview]
Message-ID: <4F551524.60809@redhat.com> (raw)
In-Reply-To: <1330933776-2696-3-git-send-email-lczerner@redhat.com>

On 03/05/2012 01:49 AM, Lukas Czerner wrote:
> When argument '-n' was specified and should run in read-only mode, we
> should not attempt to discard anything. In order to do that we have to
> check for E2F_OPT_NO flag and clear E2F_OPT_DISCARD flag if E2F_OPT_NO
> is set.
> 
> This commit fixes the problem when we would mark inode tables as zeroed
> (EXT2_BG_INODE_ZEROED) even when e2fsck is running in read-only mode. We
> also move the check for E2F_OPT_NO so we can clear E2F_OPT_DISCARD as
> early as possible.
> 
> Signed-off-by: Lukas Czerner <lczerner@redhat.com>

Reviewed-by: Eric Sandeen <sandeen@redhat.com>

Probably no need to test (ctx->options & E2F_OPT_DISCARD) before
clearing it, but no big deal.

> ---
>  e2fsck/pass5.c |    5 ++---
>  e2fsck/unix.c  |    5 +++++
>  2 files changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/e2fsck/pass5.c b/e2fsck/pass5.c
> index 37bbac2..741e6dd 100644
> --- a/e2fsck/pass5.c
> +++ b/e2fsck/pass5.c
> @@ -88,8 +88,7 @@ static void e2fsck_discard_blocks(e2fsck_t ctx, blk64_t start,
>  	if (ext2fs_test_changed(fs))
>  		ctx->options &= ~E2F_OPT_DISCARD;
>  
> -	if (!(ctx->options & E2F_OPT_NO) &&
> -	    (ctx->options & E2F_OPT_DISCARD) &&
> +	if ((ctx->options & E2F_OPT_DISCARD) &&
>  	    (io_channel_discard(fs->io, start, count)))
>  		ctx->options &= ~E2F_OPT_DISCARD;
>  }
> @@ -117,7 +116,7 @@ static void e2fsck_discard_inodes(e2fsck_t ctx, int group,
>  		ctx->options &= ~E2F_OPT_DISCARD;
>  	}
>  
> -	if ((ctx->options & E2F_OPT_NO) || !(ctx->options & E2F_OPT_DISCARD))
> +	if (!(ctx->options & E2F_OPT_DISCARD))
>  		return;
>  
>  	/*
> diff --git a/e2fsck/unix.c b/e2fsck/unix.c
> index 6f97b0f..b31a1e3 100644
> --- a/e2fsck/unix.c
> +++ b/e2fsck/unix.c
> @@ -903,6 +903,11 @@ static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx)
>  	profile_set_syntax_err_cb(syntax_err_report);
>  	profile_init(config_fn, &ctx->profile);
>  
> +	/* Turn off discard in read-only mode */
> +	if ((ctx->options & E2F_OPT_NO) &&
> +	    (ctx->options & E2F_OPT_DISCARD))
> +		ctx->options &= ~E2F_OPT_DISCARD;
> +
>  	if (flush) {
>  		fd = open(ctx->filesystem_name, O_RDONLY, 0);
>  		if (fd < 0) {


  reply	other threads:[~2012-03-05 19:33 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-05  7:49 [PATCH 1/4] e2fsck: Discard only unused parts of inode table Lukas Czerner
2012-03-05  7:49 ` [PATCH 2/4] e2fsck: Do not forget to discard last block group Lukas Czerner
2012-03-05 19:29   ` Eric Sandeen
2012-03-11 19:18   ` Ted Ts'o
2012-03-11 19:33     ` [PATCH 1/3] e2fsck: remove last argument from e2fsck_discard_blocks() Theodore Ts'o
2012-03-11 19:33       ` [PATCH 2/3] e2fsck: do not forget to discard last block group Theodore Ts'o
2012-03-12  7:31         ` Lukas Czerner
2012-03-11 19:33       ` [PATCH 3/3] e2fsck: optimize CPU usage in check_{block,inode}_bitmaps() Theodore Ts'o
2012-03-12  7:44         ` Lukas Czerner
2012-03-12  7:30       ` [PATCH 1/3] e2fsck: remove last argument from e2fsck_discard_blocks() Lukas Czerner
2012-03-05  7:49 ` [PATCH 3/4] e2fsck: Do not discard when in read only mode Lukas Czerner
2012-03-05 19:33   ` Eric Sandeen [this message]
2012-03-11 19:35   ` Ted Ts'o
2012-03-05  7:49 ` [PATCH 4/4] e2fsck: Do not discard itable if discard doen't zero data Lukas Czerner
2012-03-05 19:46   ` Eric Sandeen
2012-03-11 19:39   ` Ted Ts'o
2012-03-05 17:45 ` [PATCH 1/4] e2fsck: Discard only unused parts of inode table Eric Sandeen
2012-03-05 18:43   ` Lukas Czerner
2012-03-05 19:01     ` Eric Sandeen
2012-03-11 19:27 ` Ted Ts'o
2012-03-12  7:26   ` Lukas Czerner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F551524.60809@redhat.com \
    --to=sandeen@redhat.com \
    --cc=lczerner@redhat.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).