]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
f2fs: fix to build free nids from readaheaded nat pages
authorChao Yu <chao2.yu@samsung.com>
Fri, 24 Jul 2015 10:26:26 +0000 (18:26 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Wed, 5 Aug 2015 15:08:14 +0000 (08:08 -0700)
When there is no enough free nids in free nid cache, we will try to
readahead FREE_NID_PAGES:4 nat pages into page cache of meta_inode,
then, reading nat entries in nat page for adding free nids to free nid
cache.

But when traversing all nat pages we readaheaded in a circulation,
our exit condition is not set right, one more nat page will be scanned
without readaheading, resulting worse read performance.

This patch fixes to read the correct number nat pages to avoid bad
performance.

Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/node.c

index 7dd2b9d78a45e3162790031ed45a2f63e13e5396..ac9110788b175d64591b1a0ad711fc810060344d 100644 (file)
@@ -1532,7 +1532,7 @@ static void build_free_nids(struct f2fs_sb_info *sbi)
                if (unlikely(nid >= nm_i->max_nid))
                        nid = 0;
 
-               if (i++ == FREE_NID_PAGES)
+               if (++i >= FREE_NID_PAGES)
                        break;
        }