mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jaegeuk Kim <jaegeuk.kim@samsung.com>
To: unlisted-recipients:; (no To-header on input)
Cc: Jaegeuk Kim <jaegeuk.kim@samsung.com>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net
Subject: [PATCH 3/4] f2fs: remain nat cache entries for further free nid allocation
Date: Mon, 25 Mar 2013 08:40:13 +0900	[thread overview]
Message-ID: <1364168414-12815-3-git-send-email-jaegeuk.kim@samsung.com> (raw)
In-Reply-To: <1364168414-12815-1-git-send-email-jaegeuk.kim@samsung.com>

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.

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
---
 fs/f2fs/node.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index f7b03ba..0177f94 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);
-- 
1.8.1.3.566.gaa39828


  parent reply	other threads:[~2013-03-24 23:41 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-24 23:40 [PATCH 1/4] f2fs: fix the recovery flow to handle errors correctly Jaegeuk Kim
2013-03-24 23:40 ` [PATCH 2/4] f2fs: do not skip writing file meta during fsync Jaegeuk Kim
2013-03-26  0:48   ` Namjae Jeon
2013-03-27  0:18     ` Jaegeuk Kim
2013-03-27  0:57       ` Namjae Jeon
2013-03-27  1:18         ` Jaegeuk Kim
2013-03-27  1:28           ` Namjae Jeon
2013-03-24 23:40 ` Jaegeuk Kim [this message]
2013-03-26  0:49   ` [PATCH 3/4] f2fs: remain nat cache entries for further free nid allocation Namjae Jeon
2013-03-24 23:40 ` [PATCH 4/4] f2fs: fix to give correct parent inode number for roll forward Jaegeuk Kim
2013-03-27  1:34   ` Namjae Jeon
2013-03-25  6:30 ` [PATCH 1/4] f2fs: fix the recovery flow to handle errors correctly Namjae Jeon
2013-03-25  7:49   ` Jaegeuk Kim
2013-03-26  0:44     ` Namjae Jeon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1364168414-12815-3-git-send-email-jaegeuk.kim@samsung.com \
    --to=jaegeuk.kim@samsung.com \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®