On 11/17, Chao Yu wrote:
> On 2017/11/17 16:13, Yunlei He wrote:
> > No need to read nat block if nat_block_bitmap is set.
> > 
> > Signed-off-by: Yunlei He <heyun...@huawei.com>
> > ---
> >  fs/f2fs/node.c | 12 +++++++-----
> >  1 file changed, 7 insertions(+), 5 deletions(-)
> > 
> > diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
> > index fe1fc66..104b44c 100644
> > --- a/fs/f2fs/node.c
> > +++ b/fs/f2fs/node.c
> > @@ -1949,9 +1949,6 @@ static void scan_nat_page(struct f2fs_sb_info *sbi,
> >     unsigned int nat_ofs = NAT_BLOCK_OFFSET(start_nid);
> >     int i;
> >  
> > -   if (test_bit_le(nat_ofs, nm_i->nat_block_bitmap))
> > -           return;
> > -
> >     __set_bit_le(nat_ofs, nm_i->nat_block_bitmap);
> >  
> >     i = start_nid % NAT_ENTRY_PER_BLOCK;
> > @@ -2056,11 +2053,16 @@ static void __build_free_nids(struct f2fs_sb_info 
> > *sbi, bool sync, bool mount)
> >     down_read(&nm_i->nat_tree_lock);
> >  
> >     while (1) {
> > -           struct page *page = get_current_nat_page(sbi, nid);
> > +           struct page *page;
> >  
> > +           if (test_bit_le(NAT_BLOCK_OFFSET(nid),
> > +                                   nm_i->nat_block_bitmap)) {
> > +                   goto skip;
> > +           }

I modified this to avoid goto statement like:
                if (!test_bit_le()) {
                        /* do something */
                }

Thanks,

> Coding style, we don't need brace for a single line, other party looks good
> to me:
> 
> Reviewed-by: Chao Yu <yuch...@huawei.com>
> 
> Thanks,
> 
> > +           page = get_current_nat_page(sbi, nid);
> >             scan_nat_page(sbi, page, nid);
> >             f2fs_put_page(page, 1);
> > -
> > +skip:
> >             nid += (NAT_ENTRY_PER_BLOCK - (nid % NAT_ENTRY_PER_BLOCK));
> >             if (unlikely(nid >= nm_i->max_nid))
> >                     nid = 0;
> > 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to