* [f2fs-dev] [PATCH] f2fs-tools: avoid ambigous checkpoint mirroring
@ 2020-01-09 1:59 Jaegeuk Kim
2020-01-11 9:33 ` Chao Yu
0 siblings, 1 reply; 3+ messages in thread
From: Jaegeuk Kim @ 2020-01-09 1:59 UTC (permalink / raw)
To: linux-f2fs-devel; +Cc: Jaegeuk Kim
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);
--
2.24.0.525.g8f36a354ae-goog
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [f2fs-dev] [PATCH] f2fs-tools: avoid ambigous checkpoint mirroring
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
0 siblings, 1 reply; 3+ messages in thread
From: Chao Yu @ 2020-01-11 9:33 UTC (permalink / raw)
To: Jaegeuk Kim, linux-f2fs-devel
Jaegeuk,
Any commit message? A little bit hard to just review on changed
codes.
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [f2fs-dev] [PATCH] f2fs-tools: avoid ambigous checkpoint mirroring
2020-01-11 9:33 ` Chao Yu
@ 2020-01-14 22:47 ` Jaegeuk Kim
0 siblings, 0 replies; 3+ messages in thread
From: Jaegeuk Kim @ 2020-01-14 22:47 UTC (permalink / raw)
To: Chao Yu; +Cc: linux-f2fs-devel
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-01-14 22:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 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).