]> git.karo-electronics.de Git - linux-beck.git/commitdiff
f2fs: reuse nids more aggressively
authorJaegeuk Kim <jaegeuk@kernel.org>
Sat, 15 Aug 2015 00:57:29 +0000 (17:57 -0700)
committerJaegeuk Kim <jaegeuk@kernel.org>
Thu, 20 Aug 2015 16:00:11 +0000 (09:00 -0700)
If we can reuse nids as many as possible, we can mitigate producing obsolete
node pages in the page cache.

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

index 6e10c2a08ec6f4711eeec30a9378a81e0967662c..3cc32b8f82044b0a4f85fb68800ff783a2290a7b 100644 (file)
@@ -306,6 +306,10 @@ static void set_node_addr(struct f2fs_sb_info *sbi, struct node_info *ni,
        if (nat_get_blkaddr(e) != NEW_ADDR && new_blkaddr == NULL_ADDR) {
                unsigned char version = nat_get_version(e);
                nat_set_version(e, inc_node_version(version));
+
+               /* in order to reuse the nid */
+               if (nm_i->next_scan_nid > ni->nid)
+                       nm_i->next_scan_nid = ni->nid;
        }
 
        /* change address */