Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1498925 > unrolled thread
| Started by | Chao Yu <chao@kernel.org> |
|---|---|
| First post | 2016-10-11 16:40 +0200 |
| Last post | 2016-10-13 12:30 +0200 |
| Articles | 5 — 3 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 3/7] f2fs: rename free nid cache operation Chao Yu <chao@kernel.org> - 2016-10-11 16:40 +0200
Re: [PATCH 3/7] f2fs: rename free nid cache operation Jaegeuk Kim <jaegeuk@kernel.org> - 2016-10-11 19:30 +0200
Re: [PATCH 3/7] f2fs: rename free nid cache operation Chao Yu <chao@kernel.org> - 2016-10-12 17:20 +0200
Re: [PATCH 3/7] f2fs: rename free nid cache operation Jaegeuk Kim <jaegeuk@kernel.org> - 2016-10-12 19:30 +0200
Re: [PATCH 3/7] f2fs: rename free nid cache operation Chao Yu <yuchao0@huawei.com> - 2016-10-13 12:30 +0200
| From | Chao Yu <chao@kernel.org> |
|---|---|
| Date | 2016-10-11 16:40 +0200 |
| Subject | [PATCH 3/7] f2fs: rename free nid cache operation |
| Message-ID | <sr6nL-7Uu-19@gated-at.bofh.it> |
From: Chao Yu <yuchao0@huawei.com>
Rename free nid cache operation for readability, no functionality change.
Signed-off-by: Chao Yu <yuchao0@huawei.com>
---
fs/f2fs/node.c | 28 +++++++++++++++++-----------
1 file changed, 17 insertions(+), 11 deletions(-)
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index ea9ff8c..92c9aa4 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -1689,13 +1689,19 @@ const struct address_space_operations f2fs_node_aops = {
#endif
};
-static struct free_nid *__lookup_free_nid_list(struct f2fs_nm_info *nm_i,
+static struct free_nid *__lookup_free_nid_cache(struct f2fs_nm_info *nm_i,
nid_t n)
{
return radix_tree_lookup(&nm_i->free_nid_root, n);
}
-static void __del_from_free_nid_list(struct f2fs_nm_info *nm_i,
+static int __insert_to_free_nid_cache(struct f2fs_nm_info *nm_i,
+ struct free_nid *i)
+{
+ return radix_tree_insert(&nm_i->free_nid_root, i->nid, i);
+}
+
+static void __del_from_free_nid_cache(struct f2fs_nm_info *nm_i,
struct free_nid *i)
{
radix_tree_delete(&nm_i->free_nid_root, i->nid);
@@ -1763,7 +1769,7 @@ static int add_free_nid(struct f2fs_sb_info *sbi, nid_t nid, bool build)
}
spin_lock(&nm_i->free_nid_list_lock);
- if (radix_tree_insert(&nm_i->free_nid_root, i->nid, i)) {
+ if (__insert_to_free_nid_cache(nm_i, i)) {
spin_unlock(&nm_i->free_nid_list_lock);
radix_tree_preload_end();
kmem_cache_free(free_nid_slab, i);
@@ -1782,10 +1788,10 @@ static void remove_free_nid(struct f2fs_sb_info *sbi, nid_t nid)
bool need_free = false;
spin_lock(&nm_i->free_nid_list_lock);
- i = __lookup_free_nid_list(nm_i, nid);
+ i = __lookup_free_nid_cache(nm_i, nid);
if (i && i->state == NID_NEW) {
__remove_nid_from_list(sbi, i, FREE_NID_LIST);
- __del_from_free_nid_list(nm_i, i);
+ __del_from_free_nid_cache(nm_i, i);
need_free = true;
}
spin_unlock(&nm_i->free_nid_list_lock);
@@ -1922,10 +1928,10 @@ void alloc_nid_done(struct f2fs_sb_info *sbi, nid_t nid)
struct free_nid *i;
spin_lock(&nm_i->free_nid_list_lock);
- i = __lookup_free_nid_list(nm_i, nid);
+ i = __lookup_free_nid_cache(nm_i, nid);
f2fs_bug_on(sbi, !i);
__remove_nid_from_list(sbi, i, ALLOC_NID_LIST);
- __del_from_free_nid_list(nm_i, i);
+ __del_from_free_nid_cache(nm_i, i);
spin_unlock(&nm_i->free_nid_list_lock);
kmem_cache_free(free_nid_slab, i);
@@ -1944,13 +1950,13 @@ void alloc_nid_failed(struct f2fs_sb_info *sbi, nid_t nid)
return;
spin_lock(&nm_i->free_nid_list_lock);
- i = __lookup_free_nid_list(nm_i, nid);
+ i = __lookup_free_nid_cache(nm_i, nid);
f2fs_bug_on(sbi, !i);
__remove_nid_from_list(sbi, i, ALLOC_NID_LIST);
if (!available_free_memory(sbi, FREE_NIDS)) {
- __del_from_free_nid_list(nm_i, i);
+ __del_from_free_nid_cache(nm_i, i);
need_free = true;
} else {
i->state = NID_NEW;
@@ -1980,7 +1986,7 @@ int try_to_free_nids(struct f2fs_sb_info *sbi, int nr_shrink)
break;
__remove_nid_from_list(sbi, i, FREE_NID_LIST);
- __del_from_free_nid_list(nm_i, i);
+ __del_from_free_nid_cache(nm_i, i);
kmem_cache_free(free_nid_slab, i);
nr_shrink--;
@@ -2368,7 +2374,7 @@ void destroy_node_manager(struct f2fs_sb_info *sbi)
spin_lock(&nm_i->free_nid_list_lock);
list_for_each_entry_safe(i, next_i, &nm_i->free_nid_list, list) {
__remove_nid_from_list(sbi, i, FREE_NID_LIST);
- __del_from_free_nid_list(nm_i, i);
+ __del_from_free_nid_cache(nm_i, i);
spin_unlock(&nm_i->free_nid_list_lock);
kmem_cache_free(free_nid_slab, i);
spin_lock(&nm_i->free_nid_list_lock);
--
2.10.1
[toc] | [next] | [standalone]
| From | Jaegeuk Kim <jaegeuk@kernel.org> |
|---|---|
| Date | 2016-10-11 19:30 +0200 |
| Message-ID | <sr92h-15w-17@gated-at.bofh.it> |
| In reply to | #1498925 |
Hi Chao,
On Tue, Oct 11, 2016 at 10:31:32PM +0800, Chao Yu wrote:
> From: Chao Yu <yuchao0@huawei.com>
>
> Rename free nid cache operation for readability, no functionality change.
Well, I don't think this can be a *cache*, since there is no cache-related
operations such as reordering by cache hit, whereas it is more likely to
be a singled one-way list.
Thanks,
>
> Signed-off-by: Chao Yu <yuchao0@huawei.com>
> ---
> fs/f2fs/node.c | 28 +++++++++++++++++-----------
> 1 file changed, 17 insertions(+), 11 deletions(-)
>
> diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
> index ea9ff8c..92c9aa4 100644
> --- a/fs/f2fs/node.c
> +++ b/fs/f2fs/node.c
> @@ -1689,13 +1689,19 @@ const struct address_space_operations f2fs_node_aops = {
> #endif
> };
>
> -static struct free_nid *__lookup_free_nid_list(struct f2fs_nm_info *nm_i,
> +static struct free_nid *__lookup_free_nid_cache(struct f2fs_nm_info *nm_i,
> nid_t n)
> {
> return radix_tree_lookup(&nm_i->free_nid_root, n);
> }
>
> -static void __del_from_free_nid_list(struct f2fs_nm_info *nm_i,
> +static int __insert_to_free_nid_cache(struct f2fs_nm_info *nm_i,
> + struct free_nid *i)
> +{
> + return radix_tree_insert(&nm_i->free_nid_root, i->nid, i);
> +}
> +
> +static void __del_from_free_nid_cache(struct f2fs_nm_info *nm_i,
> struct free_nid *i)
> {
> radix_tree_delete(&nm_i->free_nid_root, i->nid);
> @@ -1763,7 +1769,7 @@ static int add_free_nid(struct f2fs_sb_info *sbi, nid_t nid, bool build)
> }
>
> spin_lock(&nm_i->free_nid_list_lock);
> - if (radix_tree_insert(&nm_i->free_nid_root, i->nid, i)) {
> + if (__insert_to_free_nid_cache(nm_i, i)) {
> spin_unlock(&nm_i->free_nid_list_lock);
> radix_tree_preload_end();
> kmem_cache_free(free_nid_slab, i);
> @@ -1782,10 +1788,10 @@ static void remove_free_nid(struct f2fs_sb_info *sbi, nid_t nid)
> bool need_free = false;
>
> spin_lock(&nm_i->free_nid_list_lock);
> - i = __lookup_free_nid_list(nm_i, nid);
> + i = __lookup_free_nid_cache(nm_i, nid);
> if (i && i->state == NID_NEW) {
> __remove_nid_from_list(sbi, i, FREE_NID_LIST);
> - __del_from_free_nid_list(nm_i, i);
> + __del_from_free_nid_cache(nm_i, i);
> need_free = true;
> }
> spin_unlock(&nm_i->free_nid_list_lock);
> @@ -1922,10 +1928,10 @@ void alloc_nid_done(struct f2fs_sb_info *sbi, nid_t nid)
> struct free_nid *i;
>
> spin_lock(&nm_i->free_nid_list_lock);
> - i = __lookup_free_nid_list(nm_i, nid);
> + i = __lookup_free_nid_cache(nm_i, nid);
> f2fs_bug_on(sbi, !i);
> __remove_nid_from_list(sbi, i, ALLOC_NID_LIST);
> - __del_from_free_nid_list(nm_i, i);
> + __del_from_free_nid_cache(nm_i, i);
> spin_unlock(&nm_i->free_nid_list_lock);
>
> kmem_cache_free(free_nid_slab, i);
> @@ -1944,13 +1950,13 @@ void alloc_nid_failed(struct f2fs_sb_info *sbi, nid_t nid)
> return;
>
> spin_lock(&nm_i->free_nid_list_lock);
> - i = __lookup_free_nid_list(nm_i, nid);
> + i = __lookup_free_nid_cache(nm_i, nid);
> f2fs_bug_on(sbi, !i);
>
> __remove_nid_from_list(sbi, i, ALLOC_NID_LIST);
>
> if (!available_free_memory(sbi, FREE_NIDS)) {
> - __del_from_free_nid_list(nm_i, i);
> + __del_from_free_nid_cache(nm_i, i);
> need_free = true;
> } else {
> i->state = NID_NEW;
> @@ -1980,7 +1986,7 @@ int try_to_free_nids(struct f2fs_sb_info *sbi, int nr_shrink)
> break;
>
> __remove_nid_from_list(sbi, i, FREE_NID_LIST);
> - __del_from_free_nid_list(nm_i, i);
> + __del_from_free_nid_cache(nm_i, i);
>
> kmem_cache_free(free_nid_slab, i);
> nr_shrink--;
> @@ -2368,7 +2374,7 @@ void destroy_node_manager(struct f2fs_sb_info *sbi)
> spin_lock(&nm_i->free_nid_list_lock);
> list_for_each_entry_safe(i, next_i, &nm_i->free_nid_list, list) {
> __remove_nid_from_list(sbi, i, FREE_NID_LIST);
> - __del_from_free_nid_list(nm_i, i);
> + __del_from_free_nid_cache(nm_i, i);
> spin_unlock(&nm_i->free_nid_list_lock);
> kmem_cache_free(free_nid_slab, i);
> spin_lock(&nm_i->free_nid_list_lock);
> --
> 2.10.1
[toc] | [prev] | [next] | [standalone]
| From | Chao Yu <chao@kernel.org> |
|---|---|
| Date | 2016-10-12 17:20 +0200 |
| Message-ID | <srtu1-6cx-13@gated-at.bofh.it> |
| In reply to | #1499033 |
Hi Jaegeuk,
On 2016/10/12 1:19, Jaegeuk Kim wrote:
> Hi Chao,
>
> On Tue, Oct 11, 2016 at 10:31:32PM +0800, Chao Yu wrote:
>> From: Chao Yu <yuchao0@huawei.com>
>>
>> Rename free nid cache operation for readability, no functionality change.
>
> Well, I don't think this can be a *cache*, since there is no cache-related
> operations such as reordering by cache hit, whereas it is more likely to
This is because we do not record any nids which has been allocated to node
blocks, otherwise we will recored the status of nid in the cache and also it can
be hitted during lookup.
In original patches, free_nid_list is split to two separate lists: free_nid_list
and alloc_nid_list, __lookup_free_nid_list looks like just search the first one,
so in order to avoid misunderstanding, I proposal this change.
Anyway, what about using __{lookup,insert_to,remove_from}_nid_list instead?
Thanks,
> be a singled one-way list.
>
> Thanks,
>
>>
>> Signed-off-by: Chao Yu <yuchao0@huawei.com>
>> ---
>> fs/f2fs/node.c | 28 +++++++++++++++++-----------
>> 1 file changed, 17 insertions(+), 11 deletions(-)
>>
>> diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
>> index ea9ff8c..92c9aa4 100644
>> --- a/fs/f2fs/node.c
>> +++ b/fs/f2fs/node.c
>> @@ -1689,13 +1689,19 @@ const struct address_space_operations f2fs_node_aops = {
>> #endif
>> };
>>
>> -static struct free_nid *__lookup_free_nid_list(struct f2fs_nm_info *nm_i,
>> +static struct free_nid *__lookup_free_nid_cache(struct f2fs_nm_info *nm_i,
>> nid_t n)
>> {
>> return radix_tree_lookup(&nm_i->free_nid_root, n);
>> }
>>
>> -static void __del_from_free_nid_list(struct f2fs_nm_info *nm_i,
>> +static int __insert_to_free_nid_cache(struct f2fs_nm_info *nm_i,
>> + struct free_nid *i)
>> +{
>> + return radix_tree_insert(&nm_i->free_nid_root, i->nid, i);
>> +}
>> +
>> +static void __del_from_free_nid_cache(struct f2fs_nm_info *nm_i,
>> struct free_nid *i)
>> {
>> radix_tree_delete(&nm_i->free_nid_root, i->nid);
>> @@ -1763,7 +1769,7 @@ static int add_free_nid(struct f2fs_sb_info *sbi, nid_t nid, bool build)
>> }
>>
>> spin_lock(&nm_i->free_nid_list_lock);
>> - if (radix_tree_insert(&nm_i->free_nid_root, i->nid, i)) {
>> + if (__insert_to_free_nid_cache(nm_i, i)) {
>> spin_unlock(&nm_i->free_nid_list_lock);
>> radix_tree_preload_end();
>> kmem_cache_free(free_nid_slab, i);
>> @@ -1782,10 +1788,10 @@ static void remove_free_nid(struct f2fs_sb_info *sbi, nid_t nid)
>> bool need_free = false;
>>
>> spin_lock(&nm_i->free_nid_list_lock);
>> - i = __lookup_free_nid_list(nm_i, nid);
>> + i = __lookup_free_nid_cache(nm_i, nid);
>> if (i && i->state == NID_NEW) {
>> __remove_nid_from_list(sbi, i, FREE_NID_LIST);
>> - __del_from_free_nid_list(nm_i, i);
>> + __del_from_free_nid_cache(nm_i, i);
>> need_free = true;
>> }
>> spin_unlock(&nm_i->free_nid_list_lock);
>> @@ -1922,10 +1928,10 @@ void alloc_nid_done(struct f2fs_sb_info *sbi, nid_t nid)
>> struct free_nid *i;
>>
>> spin_lock(&nm_i->free_nid_list_lock);
>> - i = __lookup_free_nid_list(nm_i, nid);
>> + i = __lookup_free_nid_cache(nm_i, nid);
>> f2fs_bug_on(sbi, !i);
>> __remove_nid_from_list(sbi, i, ALLOC_NID_LIST);
>> - __del_from_free_nid_list(nm_i, i);
>> + __del_from_free_nid_cache(nm_i, i);
>> spin_unlock(&nm_i->free_nid_list_lock);
>>
>> kmem_cache_free(free_nid_slab, i);
>> @@ -1944,13 +1950,13 @@ void alloc_nid_failed(struct f2fs_sb_info *sbi, nid_t nid)
>> return;
>>
>> spin_lock(&nm_i->free_nid_list_lock);
>> - i = __lookup_free_nid_list(nm_i, nid);
>> + i = __lookup_free_nid_cache(nm_i, nid);
>> f2fs_bug_on(sbi, !i);
>>
>> __remove_nid_from_list(sbi, i, ALLOC_NID_LIST);
>>
>> if (!available_free_memory(sbi, FREE_NIDS)) {
>> - __del_from_free_nid_list(nm_i, i);
>> + __del_from_free_nid_cache(nm_i, i);
>> need_free = true;
>> } else {
>> i->state = NID_NEW;
>> @@ -1980,7 +1986,7 @@ int try_to_free_nids(struct f2fs_sb_info *sbi, int nr_shrink)
>> break;
>>
>> __remove_nid_from_list(sbi, i, FREE_NID_LIST);
>> - __del_from_free_nid_list(nm_i, i);
>> + __del_from_free_nid_cache(nm_i, i);
>>
>> kmem_cache_free(free_nid_slab, i);
>> nr_shrink--;
>> @@ -2368,7 +2374,7 @@ void destroy_node_manager(struct f2fs_sb_info *sbi)
>> spin_lock(&nm_i->free_nid_list_lock);
>> list_for_each_entry_safe(i, next_i, &nm_i->free_nid_list, list) {
>> __remove_nid_from_list(sbi, i, FREE_NID_LIST);
>> - __del_from_free_nid_list(nm_i, i);
>> + __del_from_free_nid_cache(nm_i, i);
>> spin_unlock(&nm_i->free_nid_list_lock);
>> kmem_cache_free(free_nid_slab, i);
>> spin_lock(&nm_i->free_nid_list_lock);
>> --
>> 2.10.1
[toc] | [prev] | [next] | [standalone]
| From | Jaegeuk Kim <jaegeuk@kernel.org> |
|---|---|
| Date | 2016-10-12 19:30 +0200 |
| Message-ID | <srvvQ-7sZ-5@gated-at.bofh.it> |
| In reply to | #1499767 |
On Wed, Oct 12, 2016 at 11:14:42PM +0800, Chao Yu wrote:
> Hi Jaegeuk,
>
> On 2016/10/12 1:19, Jaegeuk Kim wrote:
> > Hi Chao,
> >
> > On Tue, Oct 11, 2016 at 10:31:32PM +0800, Chao Yu wrote:
> >> From: Chao Yu <yuchao0@huawei.com>
> >>
> >> Rename free nid cache operation for readability, no functionality change.
> >
> > Well, I don't think this can be a *cache*, since there is no cache-related
> > operations such as reordering by cache hit, whereas it is more likely to
>
> This is because we do not record any nids which has been allocated to node
> blocks, otherwise we will recored the status of nid in the cache and also it can
> be hitted during lookup.
>
> In original patches, free_nid_list is split to two separate lists: free_nid_list
> and alloc_nid_list, __lookup_free_nid_list looks like just search the first one,
> so in order to avoid misunderstanding, I proposal this change.
>
> Anyway, what about using __{lookup,insert_to,remove_from}_nid_list instead?
Then, how about this one?
From 4f4b48de34ffaf94baa2065bcd5d44566f8d25b9 Mon Sep 17 00:00:00 2001
From: Jaegeuk Kim <jaegeuk@kernel.org>
Date: Wed, 12 Oct 2016 10:09:59 -0700
Subject: [PATCH] f2fs: clean up free nid list operations
This patch cleans up to use consistent free nid list ops.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
fs/f2fs/node.c | 56 ++++++++++++++++++++++++++------------------------------
1 file changed, 26 insertions(+), 30 deletions(-)
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 54d1c49..3d2e259 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -1698,25 +1698,26 @@ static struct free_nid *__lookup_free_nid_list(struct f2fs_nm_info *nm_i,
return radix_tree_lookup(&nm_i->free_nid_root, n);
}
-static void __del_from_free_nid_list(struct f2fs_nm_info *nm_i,
- struct free_nid *i)
-{
- radix_tree_delete(&nm_i->free_nid_root, i->nid);
-}
-
-static void __insert_nid_to_list(struct f2fs_sb_info *sbi,
- struct free_nid *i, enum nid_list list)
+static int __insert_nid_to_list(struct f2fs_sb_info *sbi,
+ struct free_nid *i, enum nid_list list, bool new)
{
struct f2fs_nm_info *nm_i = NM_I(sbi);
+ if (new) {
+ int err = radix_tree_insert(&nm_i->free_nid_root, i->nid, i);
+ if (err)
+ return err;
+ }
+
f2fs_bug_on(sbi, list == FREE_NID_LIST ? i->state != NID_NEW :
i->state != NID_ALLOC);
nm_i->nid_cnt[list]++;
list_add_tail(&i->list, &nm_i->nid_list[list]);
+ return 0;
}
static void __remove_nid_from_list(struct f2fs_sb_info *sbi,
- struct free_nid *i, enum nid_list list)
+ struct free_nid *i, enum nid_list list, bool reuse)
{
struct f2fs_nm_info *nm_i = NM_I(sbi);
@@ -1724,6 +1725,8 @@ static void __remove_nid_from_list(struct f2fs_sb_info *sbi,
i->state != NID_ALLOC);
nm_i->nid_cnt[list]--;
list_del(&i->list);
+ if (!reuse)
+ radix_tree_delete(&nm_i->free_nid_root, i->nid);
}
static int add_free_nid(struct f2fs_sb_info *sbi, nid_t nid, bool build)
@@ -1731,6 +1734,7 @@ static int add_free_nid(struct f2fs_sb_info *sbi, nid_t nid, bool build)
struct f2fs_nm_info *nm_i = NM_I(sbi);
struct free_nid *i;
struct nat_entry *ne;
+ int err;
if (!available_free_memory(sbi, FREE_NIDS))
return -1;
@@ -1757,15 +1761,13 @@ static int add_free_nid(struct f2fs_sb_info *sbi, nid_t nid, bool build)
}
spin_lock(&nm_i->nid_list_lock);
- if (radix_tree_insert(&nm_i->free_nid_root, i->nid, i)) {
- spin_unlock(&nm_i->nid_list_lock);
- radix_tree_preload_end();
+ err = __insert_nid_to_list(sbi, i, FREE_NID_LIST, true);
+ spin_unlock(&nm_i->nid_list_lock);
+ radix_tree_preload_end();
+ if (err) {
kmem_cache_free(free_nid_slab, i);
return 0;
}
- __insert_nid_to_list(sbi, i, FREE_NID_LIST);
- spin_unlock(&nm_i->nid_list_lock);
- radix_tree_preload_end();
return 1;
}
@@ -1778,8 +1780,7 @@ static void remove_free_nid(struct f2fs_sb_info *sbi, nid_t nid)
spin_lock(&nm_i->nid_list_lock);
i = __lookup_free_nid_list(nm_i, nid);
if (i && i->state == NID_NEW) {
- __remove_nid_from_list(sbi, i, FREE_NID_LIST);
- __del_from_free_nid_list(nm_i, i);
+ __remove_nid_from_list(sbi, i, FREE_NID_LIST, false);
need_free = true;
}
spin_unlock(&nm_i->nid_list_lock);
@@ -1899,9 +1900,9 @@ retry:
struct free_nid, list);
*nid = i->nid;
- __remove_nid_from_list(sbi, i, FREE_NID_LIST);
+ __remove_nid_from_list(sbi, i, FREE_NID_LIST, true);
i->state = NID_ALLOC;
- __insert_nid_to_list(sbi, i, ALLOC_NID_LIST);
+ __insert_nid_to_list(sbi, i, ALLOC_NID_LIST, false);
spin_unlock(&nm_i->nid_list_lock);
return true;
}
@@ -1923,8 +1924,7 @@ void alloc_nid_done(struct f2fs_sb_info *sbi, nid_t nid)
spin_lock(&nm_i->nid_list_lock);
i = __lookup_free_nid_list(nm_i, nid);
f2fs_bug_on(sbi, !i);
- __remove_nid_from_list(sbi, i, ALLOC_NID_LIST);
- __del_from_free_nid_list(nm_i, i);
+ __remove_nid_from_list(sbi, i, ALLOC_NID_LIST, false);
spin_unlock(&nm_i->nid_list_lock);
kmem_cache_free(free_nid_slab, i);
@@ -1946,14 +1946,13 @@ void alloc_nid_failed(struct f2fs_sb_info *sbi, nid_t nid)
i = __lookup_free_nid_list(nm_i, nid);
f2fs_bug_on(sbi, !i);
- __remove_nid_from_list(sbi, i, ALLOC_NID_LIST);
-
if (!available_free_memory(sbi, FREE_NIDS)) {
- __del_from_free_nid_list(nm_i, i);
+ __remove_nid_from_list(sbi, i, ALLOC_NID_LIST, false);
need_free = true;
} else {
+ __remove_nid_from_list(sbi, i, ALLOC_NID_LIST, true);
i->state = NID_NEW;
- __insert_nid_to_list(sbi, i, FREE_NID_LIST);
+ __insert_nid_to_list(sbi, i, FREE_NID_LIST, false);
}
spin_unlock(&nm_i->nid_list_lock);
@@ -1980,9 +1979,7 @@ int try_to_free_nids(struct f2fs_sb_info *sbi, int nr_shrink)
nm_i->nid_cnt[FREE_NID_LIST] <= MAX_FREE_NIDS)
break;
- __remove_nid_from_list(sbi, i, FREE_NID_LIST);
- __del_from_free_nid_list(nm_i, i);
-
+ __remove_nid_from_list(sbi, i, FREE_NID_LIST, false);
kmem_cache_free(free_nid_slab, i);
nr_shrink--;
}
@@ -2369,8 +2366,7 @@ void destroy_node_manager(struct f2fs_sb_info *sbi)
spin_lock(&nm_i->nid_list_lock);
list_for_each_entry_safe(i, next_i, &nm_i->nid_list[FREE_NID_LIST],
list) {
- __remove_nid_from_list(sbi, i, FREE_NID_LIST);
- __del_from_free_nid_list(nm_i, i);
+ __remove_nid_from_list(sbi, i, FREE_NID_LIST, false);
spin_unlock(&nm_i->nid_list_lock);
kmem_cache_free(free_nid_slab, i);
spin_lock(&nm_i->nid_list_lock);
--
2.8.3
[toc] | [prev] | [next] | [standalone]
| From | Chao Yu <yuchao0@huawei.com> |
|---|---|
| Date | 2016-10-13 12:30 +0200 |
| Message-ID | <srLqW-2eM-53@gated-at.bofh.it> |
| In reply to | #1499842 |
On 2016/10/13 1:15, Jaegeuk Kim wrote: > Then, how about this one? > >>From 4f4b48de34ffaf94baa2065bcd5d44566f8d25b9 Mon Sep 17 00:00:00 2001 > From: Jaegeuk Kim <jaegeuk@kernel.org> > Date: Wed, 12 Oct 2016 10:09:59 -0700 > Subject: [PATCH] f2fs: clean up free nid list operations > > This patch cleans up to use consistent free nid list ops. > > Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> Reviewed-by: Chao Yu <yuchao0@huawei.com> Thanks,
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web