summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk.kim@samsung.com>2013-03-21 12:53:19 +0900
committerJaegeuk Kim <jaegeuk.kim@samsung.com>2013-03-27 09:16:18 +0900
commitfa37241743ac26ba0ac6f54579158c2fae310a5c (patch)
tree3d1fed6b28e7e3f085b5f72e5ad2a706d5a7712b
parent0ff153a2f1fa7ef31d6d9bc9ce6c3815dede55e6 (diff)
f2fs: remain nat cache entries for further free nid allocation
In the checkpoint flow, the f2fs investigates the total nat cache entries. Previously, if an entry has NULL_ADDR, f2fs drops the entry and adds the obsolete nid to the free nid list. However, this free nid will be reused sooner, resulting in its nat entry miss. In order to avoid this, we don't need to drop the nat cache entry at this moment. Reviewed-by: Namjae Jeon <namjae.jeon@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
-rw-r--r--fs/f2fs/node.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index f7b03ba9c0d7..0177f9434c25 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -1621,11 +1621,11 @@ flush_now:
nid_in_journal(sum, offset) = cpu_to_le32(nid);
}
- if (nat_get_blkaddr(ne) == NULL_ADDR) {
+ if (nat_get_blkaddr(ne) == NULL_ADDR &&
+ !add_free_nid(NM_I(sbi), nid)) {
write_lock(&nm_i->nat_tree_lock);
__del_from_nat_cache(nm_i, ne);
write_unlock(&nm_i->nat_tree_lock);
- add_free_nid(NM_I(sbi), nid);
} else {
write_lock(&nm_i->nat_tree_lock);
__clear_nat_cache_dirty(nm_i, ne);