summaryrefslogtreecommitdiffstats
path: root/fs/f2fs/node.h
diff options
context:
space:
mode:
authorChao Yu <yuchao0@huawei.com>2017-09-29 13:59:35 +0800
committerJaegeuk Kim <jaegeuk@kernel.org>2017-10-10 12:49:53 -0700
commit9a4ffdf55811ff3382cdf44459ec17521bd47e5e (patch)
treec5d86b48db2be6f361deb42b7cf69a89168b46bb /fs/f2fs/node.h
parent71ad682c1c295f1ba4eec7478384138b6ad4dab2 (diff)
downloadlinux-stable-9a4ffdf55811ff3382cdf44459ec17521bd47e5e.tar.gz
linux-stable-9a4ffdf55811ff3382cdf44459ec17521bd47e5e.tar.bz2
linux-stable-9a4ffdf55811ff3382cdf44459ec17521bd47e5e.zip
f2fs: obsolete ALLOC_NID_LIST list
As Fan Li reported, there is no user traversing nid_list[ALLOC_NID_LIST] which is used for tracking preallocated nids. Let's drop it, and only track preallocated nids in free_nid_root radix-tree. Reported-by: Fan Li <fanofcode.li@samsung.com> Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/node.h')
-rw-r--r--fs/f2fs/node.h15
1 files changed, 3 insertions, 12 deletions
diff --git a/fs/f2fs/node.h b/fs/f2fs/node.h
index bb53e9955ff2..e91b08b4a51a 100644
--- a/fs/f2fs/node.h
+++ b/fs/f2fs/node.h
@@ -150,18 +150,10 @@ struct nat_entry_set {
unsigned int entry_cnt; /* the # of nat entries in set */
};
-/*
- * For free nid mangement
- */
-enum nid_state {
- NID_NEW, /* newly added to free nid list */
- NID_ALLOC /* it is allocated */
-};
-
struct free_nid {
struct list_head list; /* for free node id list */
nid_t nid; /* node id */
- int state; /* in use or not: NID_NEW or NID_ALLOC */
+ int state; /* in use or not: FREE_NID or PREALLOC_NID */
};
static inline void next_free_nid(struct f2fs_sb_info *sbi, nid_t *nid)
@@ -170,12 +162,11 @@ static inline void next_free_nid(struct f2fs_sb_info *sbi, nid_t *nid)
struct free_nid *fnid;
spin_lock(&nm_i->nid_list_lock);
- if (nm_i->nid_cnt[FREE_NID_LIST] <= 0) {
+ if (nm_i->nid_cnt[FREE_NID] <= 0) {
spin_unlock(&nm_i->nid_list_lock);
return;
}
- fnid = list_first_entry(&nm_i->nid_list[FREE_NID_LIST],
- struct free_nid, list);
+ fnid = list_first_entry(&nm_i->free_nid_list, struct free_nid, list);
*nid = fnid->nid;
spin_unlock(&nm_i->nid_list_lock);
}