Linux-f2fs-devel Archive mirror
 help / color / mirror / Atom feed
From: Chao Yu <chao@kernel.org>
To: Zhiguo Niu <niuzhiguo84@gmail.com>
Cc: ke.wang@unisoc.com, linux-kernel@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net, hongyu.jin@unisoc.com,
	Zhiguo Niu <zhiguo.niu@unisoc.com>,
	Jaegeuk Kim <jaegeuk@kernel.org>
Subject: Re: [f2fs-dev] [PATCH v7] f2fs: unify the error handling of f2fs_is_valid_blkaddr
Date: Tue, 20 Feb 2024 15:58:00 +0800	[thread overview]
Message-ID: <5bf29cb0-96a6-4100-8755-750215d31ab6@kernel.org> (raw)
In-Reply-To: <CAHJ8P3J8WUAxOrG91id+sKKt7ndLnETdbzz6Zy7haoC9qfT0tg@mail.gmail.com>

On 2024/2/20 15:45, Zhiguo Niu wrote:
> 
> 
> On Tue, Feb 20, 2024 at 2:32 PM Chao Yu <chao@kernel.org <mailto:chao@kernel.org>> wrote:
>  >
>  > On 2024/2/20 13:34, Zhiguo Niu wrote:
>  > > I think do f2fs_handle_error in __is_bitmap_valid is a good way.
>  >
>  > Like this?
>  >
>  > ---
>  >   fs/f2fs/checkpoint.c | 28 ++++++++++++++--------------
>  >   1 file changed, 14 insertions(+), 14 deletions(-)
>  >
>  > diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
>  > index 87b7c988c8ca..b8a7e83eb4e0 100644
>  > --- a/fs/f2fs/checkpoint.c
>  > +++ b/fs/f2fs/checkpoint.c
>  > @@ -155,21 +155,24 @@ static bool __is_bitmap_valid(struct f2fs_sb_info *sbi, block_t blkaddr,
>  >                 return exist;
>  >
>  >         if ((exist && type == DATA_GENERIC_ENHANCE_UPDATE) ||
>  > -               (!exist && type == DATA_GENERIC_ENHANCE)) {
>  > -               f2fs_err(sbi, "Inconsistent error blkaddr:%u, sit bitmap:%d",
>  > -                        blkaddr, exist);
>  > -               set_sbi_flag(sbi, SBI_NEED_FSCK);
>  > -               dump_stack();
>  > -       }
>  > -
>  > +               (!exist && type == DATA_GENERIC_ENHANCE))
>  > +               goto out_err;
>  > +       if (!exist && type != DATA_GENERIC_ENHANCE_UPDATE)
>  > +               goto out_handle;
>  > +       return exist;
>  > +out_err:
>  > +       f2fs_err(sbi, "Inconsistent error blkaddr:%u, sit bitmap:%d",
>  > +                blkaddr, exist);
>  > +       set_sbi_flag(sbi, SBI_NEED_FSCK);
>  > +       dump_stack();
>  > +out_handle:
>  > +       f2fs_handle_error(sbi, ERROR_INVALID_BLKADDR);
>  >         return exist;
>  >   }
>  >
>  >   static bool __f2fs_is_valid_blkaddr(struct f2fs_sb_info *sbi,
>  >                                         block_t blkaddr, int type)
>  >   {
>  > -       bool valid = false;
>  > -
>  >         switch (type) {
>  >         case META_NAT:
>  >                 break;
>  > @@ -209,10 +212,7 @@ static bool __f2fs_is_valid_blkaddr(struct f2fs_sb_info *sbi,
>  >                         dump_stack();
>  >                         goto err;
>  >                 } else {
>  > -                       valid = __is_bitmap_valid(sbi, blkaddr, type);
>  > -                       if ((!valid && type != DATA_GENERIC_ENHANCE_UPDATE) ||
>  > -                               (valid && type == DATA_GENERIC_ENHANCE_UPDATE))
>  > -                               goto err;
>  > +                       return __is_bitmap_valid(sbi, blkaddr, type);
>  >                 }
>  >                 break;
>  >         case META_GENERIC:
>  > @@ -227,7 +227,7 @@ static bool __f2fs_is_valid_blkaddr(struct f2fs_sb_info *sbi,
>  >         return true;
>  >   err:
>  >         f2fs_handle_error(sbi, ERROR_INVALID_BLKADDR);
>  > -       return valid;
>  > +       return false;
> I think it's OK.
> Do we need to wait for Jaegeuk Kim’s suggestion or should I update the new patch  version first😀?
> thanks!

I guess we'd better to wait for Jaegeuk's comments.

Thanks,

>  >   }
>  >
>  >   bool f2fs_is_valid_blkaddr(struct f2fs_sb_info *sbi,
>  > --
>  > 2.40.1
>  >
>  >


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

      parent reply	other threads:[~2024-02-20  7:58 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-05  3:30 [f2fs-dev] [PATCH v7] f2fs: unify the error handling of f2fs_is_valid_blkaddr Zhiguo Niu
2024-02-05  3:47 ` Chao Yu
2024-02-06  3:32   ` Jaegeuk Kim
2024-02-06  3:36     ` Chao Yu
2024-02-06 23:38       ` Zhiguo Niu
2024-02-19  3:46     ` Chao Yu
2024-02-19 11:19       ` Zhiguo Niu
2024-02-19 14:36         ` Chao Yu
2024-02-20  2:36           ` Chao Yu
2024-02-20  5:34             ` Zhiguo Niu
2024-02-20  6:13               ` Chao Yu
2024-02-20  6:32               ` Chao Yu
     [not found]                 ` <CAHJ8P3J8WUAxOrG91id+sKKt7ndLnETdbzz6Zy7haoC9qfT0tg@mail.gmail.com>
2024-02-20  7:58                   ` Chao Yu [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=5bf29cb0-96a6-4100-8755-750215d31ab6@kernel.org \
    --to=chao@kernel.org \
    --cc=hongyu.jin@unisoc.com \
    --cc=jaegeuk@kernel.org \
    --cc=ke.wang@unisoc.com \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=niuzhiguo84@gmail.com \
    --cc=zhiguo.niu@unisoc.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 read-only IMAP folder(s) and NNTP newsgroup(s).