Re: [PATCH 03/27] f2fs: Add f2fs_folio_put()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 02/24, Jaegeuk Kim wrote:
> Hi Matthew,
> 
> On 02/21, Jaegeuk Kim wrote:
> > On 02/18, Matthew Wilcox (Oracle) wrote:
> > > Convert f2fs_put_page() to f2fs_folio_put() and add a wrapper.
> > > Replaces three calls to compound_head() with one.
> > > 
> > > Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx>
> > > ---
> > >  fs/f2fs/f2fs.h | 15 ++++++++++-----
> > >  1 file changed, 10 insertions(+), 5 deletions(-)
> > > 
> > > diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> > > index b05653f196dd..5e01a08afbd7 100644
> > > --- a/fs/f2fs/f2fs.h
> > > +++ b/fs/f2fs/f2fs.h
> > > @@ -2806,16 +2806,21 @@ static inline struct page *f2fs_pagecache_get_page(
> > >  	return pagecache_get_page(mapping, index, fgp_flags, gfp_mask);
> > >  }
> > >  
> > > -static inline void f2fs_put_page(struct page *page, int unlock)
> > > +static inline void f2fs_folio_put(struct folio *folio, bool unlock)
> > >  {
> > > -	if (!page)
> > > +	if (!folio)
> > >  		return;
> > >  
> > >  	if (unlock) {
> > > -		f2fs_bug_on(F2FS_P_SB(page), !PageLocked(page));
> > > -		unlock_page(page);
> > > +		f2fs_bug_on(F2FS_F_SB(folio), !folio_test_locked(folio));
> > > +		folio_unlock(folio);
> > >  	}
> > > -	put_page(page);
> > > +	folio_put(folio);
> > > +}
> > > +
> > > +static inline void f2fs_put_page(struct page *page, int unlock)
> > > +{
> > 
> > I got a kernel panic, since there are still several places to pass a null
> > page pointer, which feeds to page_folio() which doesn't expect the null.
> > 
> > Applying this can avoid the panic.
> > 
> > 	if (!page)
> > 		return;
> 
> Please let me know, if you want me to apply this to your patch directly, or post
> v2.

I applied the fix into your patch. Thanks.

> 
> Thanks,
> 
> > 
> > > +	f2fs_folio_put(page_folio(page), unlock);
> > >  }
> > >  
> > >  static inline void f2fs_put_dnode(struct dnode_of_data *dn)
> > > -- 
> > > 2.47.2
> > > 




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux