linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Chao Yu <yuchao0@huawei.com>
Cc: linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH] f2fs-tools: avoid ambigous checkpoint mirroring
Date: Tue, 14 Jan 2020 14:47:48 -0800	[thread overview]
Message-ID: <20200114224748.GA19274@jaegeuk-macbookpro.roam.corp.google.com> (raw)
In-Reply-To: <4bac40d1-4a3f-65ed-0eea-40101fde3fdc@huawei.com>

On 01/11, Chao Yu wrote:
> Jaegeuk,
> 
> Any commit message? A little bit hard to just review on changed
> codes.

I dropped this patch due to causing subtle inconsistency problem. Not sure why
tho.

> 
> On 2020/1/9 9:59, Jaegeuk Kim wrote:
> > Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> > ---
> >  fsck/fsck.c  | 26 ++++++++++++++------------
> >  fsck/fsck.h  |  1 -
> >  fsck/mount.c | 20 +++++---------------
> >  3 files changed, 19 insertions(+), 28 deletions(-)
> > 
> > diff --git a/fsck/fsck.c b/fsck/fsck.c
> > index 507437d..8383f08 100644
> > --- a/fsck/fsck.c
> > +++ b/fsck/fsck.c
> > @@ -2171,16 +2171,6 @@ static void fix_checkpoint(struct f2fs_sb_info *sbi)
> >  	ASSERT(ret >= 0);
> >  }
> >  
> > -static void fix_checkpoints(struct f2fs_sb_info *sbi)
> > -{
> > -	/* copy valid checkpoint to its mirror position */
> > -	duplicate_checkpoint(sbi);
> > -
> > -	/* repair checkpoint at CP #0 position */
> > -	sbi->cur_cp = 1;
> > -	fix_checkpoint(sbi);
> > -}
> > -
> >  #ifdef HAVE_LINUX_BLKZONED_H
> >  
> >  /*
> > @@ -3103,6 +3093,12 @@ int fsck_verify(struct f2fs_sb_info *sbi)
> >  		struct f2fs_checkpoint *cp = F2FS_CKPT(sbi);
> >  
> >  		if (force || c.bug_on || c.bug_nat_bits) {
> > +			/*
> > +			 * copy valid checkpoint to its mirror position and
> > +			 * fix everything in cp #0.
> > +			 */
> > +			duplicate_checkpoint(sbi);
> > +
> >  			/* flush nats to write_nit_bits below */
> >  			flush_journal_entries(sbi);
> >  			fix_hard_links(sbi);
> > @@ -3111,10 +3107,16 @@ int fsck_verify(struct f2fs_sb_info *sbi)
> >  			fix_wp_sit_alignment(sbi);
> >  			fix_curseg_info(sbi);
> >  			fix_checksum(sbi);
> > -			fix_checkpoints(sbi);
> > +			fix_checkpoint(sbi);
> >  		} else if (is_set_ckpt_flags(cp, CP_FSCK_FLAG) ||
> >  			is_set_ckpt_flags(cp, CP_QUOTA_NEED_FSCK_FLAG)) {
> > -			write_checkpoints(sbi);
> > +
> > +			/*
> > +			 * copy valid checkpoint to its mirror position and
> > +			 * fix everything in cp #0.
> > +			 */
> > +			duplicate_checkpoint(sbi);
> > +			write_checkpoint(sbi);
> >  		}
> >  	}
> >  	return ret;
> > diff --git a/fsck/fsck.h b/fsck/fsck.h
> > index c4432e8..bbc2593 100644
> > --- a/fsck/fsck.h
> > +++ b/fsck/fsck.h
> > @@ -203,7 +203,6 @@ extern void write_curseg_info(struct f2fs_sb_info *);
> >  extern int find_next_free_block(struct f2fs_sb_info *, u64 *, int, int, bool);
> >  extern void duplicate_checkpoint(struct f2fs_sb_info *);
> >  extern void write_checkpoint(struct f2fs_sb_info *);
> > -extern void write_checkpoints(struct f2fs_sb_info *);
> >  extern void update_superblock(struct f2fs_super_block *, int);
> >  extern void update_data_blkaddr(struct f2fs_sb_info *, nid_t, u16, block_t);
> >  extern void update_nat_blkaddr(struct f2fs_sb_info *, nid_t, nid_t, block_t);
> > diff --git a/fsck/mount.c b/fsck/mount.c
> > index 882f1ea..ffc10fb 100644
> > --- a/fsck/mount.c
> > +++ b/fsck/mount.c
> > @@ -2404,11 +2404,8 @@ next:
> >  
> >  void flush_journal_entries(struct f2fs_sb_info *sbi)
> >  {
> > -	int n_nats = flush_nat_journal_entries(sbi);
> > -	int n_sits = flush_sit_journal_entries(sbi);
> > -
> > -	if (n_nats || n_sits)
> > -		write_checkpoints(sbi);
> > +	flush_nat_journal_entries(sbi);
> > +	flush_sit_journal_entries(sbi);
> >  }
> >  
> >  void flush_sit_entries(struct f2fs_sb_info *sbi)
> > @@ -2777,6 +2774,9 @@ void duplicate_checkpoint(struct f2fs_sb_info *sbi)
> >  
> >  	sbi->cp_backuped = 1;
> >  
> > +	/* repair checkpoint at CP #0 position */
> > +	sbi->cur_cp = 1;
> > +
> >  	MSG(0, "Info: Duplicate valid checkpoint to mirror position "
> >  		"%llu -> %llu\n", src, dst);
> >  }
> > @@ -2870,16 +2870,6 @@ void write_checkpoint(struct f2fs_sb_info *sbi)
> >  	ASSERT(ret >= 0);
> >  }
> >  
> > -void write_checkpoints(struct f2fs_sb_info *sbi)
> > -{
> > -	/* copy valid checkpoint to its mirror position */
> > -	duplicate_checkpoint(sbi);
> > -
> > -	/* repair checkpoint at CP #0 position */
> > -	sbi->cur_cp = 1;
> > -	write_checkpoint(sbi);
> > -}
> > -
> >  void build_nat_area_bitmap(struct f2fs_sb_info *sbi)
> >  {
> >  	struct curseg_info *curseg = CURSEG_I(sbi, CURSEG_HOT_DATA);
> > 


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

      reply	other threads:[~2020-01-14 22:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-09  1:59 [f2fs-dev] [PATCH] f2fs-tools: avoid ambigous checkpoint mirroring Jaegeuk Kim
2020-01-11  9:33 ` Chao Yu
2020-01-14 22:47   ` Jaegeuk Kim [this message]

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=20200114224748.GA19274@jaegeuk-macbookpro.roam.corp.google.com \
    --to=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=yuchao0@huawei.com \
    /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).