diff options
author | Gu Zheng <guz.fnst@cn.fujitsu.com> | 2014-02-21 05:08:29 -0500 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2014-02-24 02:00:40 -0500 |
commit | f978f5a0616d18f303d9c8f51c293a03bc09dbaf (patch) | |
tree | b980450e4d7b915a8bc416fbd5d23813eed4d8cc /fs/f2fs | |
parent | fffc2a00fc01b781c1e3b9541e3e0f270c50ce90 (diff) |
f2fs: introduce help macro on_build_free_nids()
Introduce help macro on_build_free_nids() which just uses build_lock
to judge whether the building free nid is going, so that we can remove
the on_build_free_nids field from f2fs_sb_info.
Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
[Jaegeuk Kim: remove an unnecessary white line removal]
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs/f2fs')
-rw-r--r-- | fs/f2fs/f2fs.h | 1 | ||||
-rw-r--r-- | fs/f2fs/node.c | 6 |
2 files changed, 3 insertions, 4 deletions
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 91f4c5e7b6a2..c56e67b468da 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h | |||
@@ -417,7 +417,6 @@ struct f2fs_sb_info { | |||
417 | struct mutex node_write; /* locking node writes */ | 417 | struct mutex node_write; /* locking node writes */ |
418 | struct mutex writepages; /* mutex for writepages() */ | 418 | struct mutex writepages; /* mutex for writepages() */ |
419 | bool por_doing; /* recovery is doing or not */ | 419 | bool por_doing; /* recovery is doing or not */ |
420 | bool on_build_free_nids; /* build_free_nids is doing */ | ||
421 | wait_queue_head_t cp_wait; | 420 | wait_queue_head_t cp_wait; |
422 | 421 | ||
423 | /* for orphan inode management */ | 422 | /* for orphan inode management */ |
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index a070b1457d70..431bcb42cdd0 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c | |||
@@ -21,6 +21,8 @@ | |||
21 | #include "segment.h" | 21 | #include "segment.h" |
22 | #include <trace/events/f2fs.h> | 22 | #include <trace/events/f2fs.h> |
23 | 23 | ||
24 | #define on_build_free_nids(nmi) mutex_is_locked(&nm_i->build_lock) | ||
25 | |||
24 | static struct kmem_cache *nat_entry_slab; | 26 | static struct kmem_cache *nat_entry_slab; |
25 | static struct kmem_cache *free_nid_slab; | 27 | static struct kmem_cache *free_nid_slab; |
26 | 28 | ||
@@ -1422,7 +1424,7 @@ retry: | |||
1422 | spin_lock(&nm_i->free_nid_list_lock); | 1424 | spin_lock(&nm_i->free_nid_list_lock); |
1423 | 1425 | ||
1424 | /* We should not use stale free nids created by build_free_nids */ | 1426 | /* We should not use stale free nids created by build_free_nids */ |
1425 | if (nm_i->fcnt && !sbi->on_build_free_nids) { | 1427 | if (nm_i->fcnt && !on_build_free_nids(nm_i)) { |
1426 | f2fs_bug_on(list_empty(&nm_i->free_nid_list)); | 1428 | f2fs_bug_on(list_empty(&nm_i->free_nid_list)); |
1427 | list_for_each(this, &nm_i->free_nid_list) { | 1429 | list_for_each(this, &nm_i->free_nid_list) { |
1428 | i = list_entry(this, struct free_nid, list); | 1430 | i = list_entry(this, struct free_nid, list); |
@@ -1441,9 +1443,7 @@ retry: | |||
1441 | 1443 | ||
1442 | /* Let's scan nat pages and its caches to get free nids */ | 1444 | /* Let's scan nat pages and its caches to get free nids */ |
1443 | mutex_lock(&nm_i->build_lock); | 1445 | mutex_lock(&nm_i->build_lock); |
1444 | sbi->on_build_free_nids = true; | ||
1445 | build_free_nids(sbi); | 1446 | build_free_nids(sbi); |
1446 | sbi->on_build_free_nids = false; | ||
1447 | mutex_unlock(&nm_i->build_lock); | 1447 | mutex_unlock(&nm_i->build_lock); |
1448 | goto retry; | 1448 | goto retry; |
1449 | } | 1449 | } |