Re: [f2fs-dev] [PATCH 3/3] f2fs: avoid reading NAT page by get_node_info

From: Jaegeuk Kim
Date: Thu Feb 23 2017 - 13:20:13 EST


On 02/23, Chao Yu wrote:
> On 2017/2/14 10:06, Jaegeuk Kim wrote:
> > We've not seen this buggy case for a long time, so it's time to avoid this
> > unnecessary get_node_info() call which reading NAT page to cache nat entry.
> >
> > Signed-off-by: Jaegeuk Kim <jaegeuk@xxxxxxxxxx>
> > ---
> > fs/f2fs/node.c | 11 +++++------
> > 1 file changed, 5 insertions(+), 6 deletions(-)
> >
> > diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
> > index e001d084667f..b63bdb85ad66 100644
> > --- a/fs/f2fs/node.c
> > +++ b/fs/f2fs/node.c
> > @@ -1033,7 +1033,7 @@ struct page *new_node_page(struct dnode_of_data *dn,
> > unsigned int ofs, struct page *ipage)
> > {
> > struct f2fs_sb_info *sbi = F2FS_I_SB(dn->inode);
> > - struct node_info old_ni, new_ni;
> > + struct node_info new_ni;
> > struct page *page;
> > int err;
> >
> > @@ -1049,12 +1049,11 @@ struct page *new_node_page(struct dnode_of_data *dn,
> > goto fail;
> > }
> >
> > - get_node_info(sbi, dn->nid, &old_ni);
> > -
> > - /* Reinitialize old_ni with new node page */
> > - f2fs_bug_on(sbi, old_ni.blk_addr != NULL_ADDR);
>
> What about keeping get_node_info covered with CONFIG_F2FS_CHECK_FS for
> consistence as we just introduce two new free nid caches, I think it will be
> helpful for detecting bugs of these new codes.

Good idea!
I added it like this.