All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Chao Yu <chao@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH 1/2] f2fs: remove folio_detach_private() in .invalidate_folio and .release_folio
Date: Tue, 11 Apr 2023 09:58:17 -0700	[thread overview]
Message-ID: <ZDWRqRgwuLpkR7qO@google.com> (raw)
In-Reply-To: <b05d7ce8-ef98-a7ef-9873-4403ec0858c1@kernel.org>

On 04/11, Chao Yu wrote:
> On 2023/4/11 2:33, Jaegeuk Kim wrote:
> > On 04/10, Chao Yu wrote:
> > > We have maintain PagePrivate and page_private and page reference
> > > w/ {set,clear}_page_private_*, it doesn't need to call
> > > folio_detach_private() in the end of .invalidate_folio and
> > > .release_folio, remove it and use f2fs_bug_on instead.
> > > 
> > > Signed-off-by: Chao Yu <chao@kernel.org>
> > > ---
> > >   fs/f2fs/data.c | 7 +++++--
> > >   1 file changed, 5 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> > > index 4946df6dd253..8b179b4bdc03 100644
> > > --- a/fs/f2fs/data.c
> > > +++ b/fs/f2fs/data.c
> > > @@ -3737,7 +3737,8 @@ void f2fs_invalidate_folio(struct folio *folio, size_t offset, size_t length)
> > >   			inode->i_ino == F2FS_COMPRESS_INO(sbi))
> > >   		clear_page_private_data(&folio->page);
> > > -	folio_detach_private(folio);
> > > +	f2fs_bug_on(sbi, PagePrivate(&folio->page));
> > > +	f2fs_bug_on(sbi, page_private(&folio->page));
> > 
> > I think we can just check page_private() only.
> 
> Why? how about the case PagePrivate was set, but page_private was't? It must
> be a bug as well?

Given the code, I think both are set all the time. My concern is someone is
not doing set/get properly. Actually, I got a panic on page_private() when
running fsstress overnight. I'm trying to reproduce it to find which bit was
set.

> 
> Thanks,
> 
> > 
> > >   }
> > >   bool f2fs_release_folio(struct folio *folio, gfp_t wait)
> > > @@ -3759,7 +3760,9 @@ bool f2fs_release_folio(struct folio *folio, gfp_t wait)
> > >   	clear_page_private_reference(&folio->page);
> > >   	clear_page_private_gcing(&folio->page);
> > > -	folio_detach_private(folio);
> > > +	f2fs_bug_on(sbi, PagePrivate(&folio->page));
> > > +	f2fs_bug_on(sbi, page_private(&folio->page));
> > > +
> > >   	return true;
> > >   }
> > > -- 
> > > 2.25.1


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

WARNING: multiple messages have this Message-ID (diff)
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Chao Yu <chao@kernel.org>
Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] f2fs: remove folio_detach_private() in .invalidate_folio and .release_folio
Date: Tue, 11 Apr 2023 09:58:17 -0700	[thread overview]
Message-ID: <ZDWRqRgwuLpkR7qO@google.com> (raw)
In-Reply-To: <b05d7ce8-ef98-a7ef-9873-4403ec0858c1@kernel.org>

On 04/11, Chao Yu wrote:
> On 2023/4/11 2:33, Jaegeuk Kim wrote:
> > On 04/10, Chao Yu wrote:
> > > We have maintain PagePrivate and page_private and page reference
> > > w/ {set,clear}_page_private_*, it doesn't need to call
> > > folio_detach_private() in the end of .invalidate_folio and
> > > .release_folio, remove it and use f2fs_bug_on instead.
> > > 
> > > Signed-off-by: Chao Yu <chao@kernel.org>
> > > ---
> > >   fs/f2fs/data.c | 7 +++++--
> > >   1 file changed, 5 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> > > index 4946df6dd253..8b179b4bdc03 100644
> > > --- a/fs/f2fs/data.c
> > > +++ b/fs/f2fs/data.c
> > > @@ -3737,7 +3737,8 @@ void f2fs_invalidate_folio(struct folio *folio, size_t offset, size_t length)
> > >   			inode->i_ino == F2FS_COMPRESS_INO(sbi))
> > >   		clear_page_private_data(&folio->page);
> > > -	folio_detach_private(folio);
> > > +	f2fs_bug_on(sbi, PagePrivate(&folio->page));
> > > +	f2fs_bug_on(sbi, page_private(&folio->page));
> > 
> > I think we can just check page_private() only.
> 
> Why? how about the case PagePrivate was set, but page_private was't? It must
> be a bug as well?

Given the code, I think both are set all the time. My concern is someone is
not doing set/get properly. Actually, I got a panic on page_private() when
running fsstress overnight. I'm trying to reproduce it to find which bit was
set.

> 
> Thanks,
> 
> > 
> > >   }
> > >   bool f2fs_release_folio(struct folio *folio, gfp_t wait)
> > > @@ -3759,7 +3760,9 @@ bool f2fs_release_folio(struct folio *folio, gfp_t wait)
> > >   	clear_page_private_reference(&folio->page);
> > >   	clear_page_private_gcing(&folio->page);
> > > -	folio_detach_private(folio);
> > > +	f2fs_bug_on(sbi, PagePrivate(&folio->page));
> > > +	f2fs_bug_on(sbi, page_private(&folio->page));
> > > +
> > >   	return true;
> > >   }
> > > -- 
> > > 2.25.1

  reply	other threads:[~2023-04-11 16:58 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-10  2:24 [f2fs-dev] [PATCH 1/2] f2fs: remove folio_detach_private() in .invalidate_folio and .release_folio Chao Yu
2023-04-10  2:24 ` Chao Yu
2023-04-10  2:24 ` [f2fs-dev] [PATCH 2/2] f2fs: clean up with {attach, detach}_page_private() Chao Yu
2023-04-10  2:24   ` [PATCH 2/2] f2fs: clean up with {attach,detach}_page_private() Chao Yu
2023-04-10 18:47   ` [f2fs-dev] [PATCH 2/2] f2fs: clean up with {attach, detach}_page_private() Jaegeuk Kim
2023-04-10 18:47     ` [PATCH 2/2] f2fs: clean up with {attach,detach}_page_private() Jaegeuk Kim
2023-04-11  8:37     ` [f2fs-dev] [PATCH 2/2] f2fs: clean up with {attach, detach}_page_private() Chao Yu
2023-04-11  8:37       ` [PATCH 2/2] f2fs: clean up with {attach,detach}_page_private() Chao Yu
2023-04-10 18:33 ` [f2fs-dev] [PATCH 1/2] f2fs: remove folio_detach_private() in .invalidate_folio and .release_folio Jaegeuk Kim
2023-04-10 18:33   ` Jaegeuk Kim
2023-04-11  8:34   ` [f2fs-dev] " Chao Yu
2023-04-11  8:34     ` Chao Yu
2023-04-11 16:58     ` Jaegeuk Kim [this message]
2023-04-11 16:58       ` Jaegeuk Kim
2023-04-12 16:16       ` [f2fs-dev] " Jaegeuk Kim
2023-04-12 16:16         ` Jaegeuk Kim

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=ZDWRqRgwuLpkR7qO@google.com \
    --to=jaegeuk@kernel.org \
    --cc=chao@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.