All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] f2fs: use MAX_FREE_NIDS for the free nids target
@ 2017-02-26 12:47 Kinglong Mee
  2017-02-27  6:14 ` Chao Yu
  0 siblings, 1 reply; 2+ messages in thread
From: Kinglong Mee @ 2017-02-26 12:47 UTC (permalink / raw)
  To: Jaegeuk Kim; +Cc: linux-f2fs-devel

F2FS has define MAX_FREE_NIDS for maximum of cached free nids target.

#define MAX_FREE_NIDS   (NAT_ENTRY_PER_BLOCK * FREE_NID_PAGES)

Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
---
 fs/f2fs/node.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 6d43095..9284f65 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -1870,7 +1870,6 @@ static void scan_free_nid_bits(struct f2fs_sb_info *sbi)
 	struct curseg_info *curseg = CURSEG_I(sbi, CURSEG_HOT_DATA);
 	struct f2fs_journal *journal = curseg->journal;
 	unsigned int i, idx;
-	unsigned int target = FREE_NID_PAGES * NAT_ENTRY_PER_BLOCK;
 
 	down_read(&nm_i->nat_tree_lock);
 
@@ -1886,7 +1885,7 @@ static void scan_free_nid_bits(struct f2fs_sb_info *sbi)
 			nid = i * NAT_ENTRY_PER_BLOCK + idx;
 			add_free_nid(sbi, nid, true);
 
-			if (nm_i->nid_cnt[FREE_NID_LIST] >= target)
+			if (nm_i->nid_cnt[FREE_NID_LIST] >= MAX_FREE_NIDS)
 				goto out;
 		}
 	}
@@ -1912,7 +1911,6 @@ static int scan_nat_bits(struct f2fs_sb_info *sbi)
 	struct f2fs_nm_info *nm_i = NM_I(sbi);
 	struct page *page;
 	unsigned int i = 0;
-	nid_t target = FREE_NID_PAGES * NAT_ENTRY_PER_BLOCK;
 	nid_t nid;
 
 	if (!enabled_nat_bits(sbi, NULL))
@@ -1933,7 +1931,7 @@ static int scan_nat_bits(struct f2fs_sb_info *sbi)
 		add_free_nid(sbi, nid, true);
 	}
 
-	if (nm_i->nid_cnt[FREE_NID_LIST] >= target)
+	if (nm_i->nid_cnt[FREE_NID_LIST] >= MAX_FREE_NIDS)
 		goto out;
 	i++;
 	goto check_empty;
@@ -1951,7 +1949,7 @@ static int scan_nat_bits(struct f2fs_sb_info *sbi)
 	scan_nat_page(sbi, page, nid);
 	f2fs_put_page(page, 1);
 
-	if (nm_i->nid_cnt[FREE_NID_LIST] < target) {
+	if (nm_i->nid_cnt[FREE_NID_LIST] < MAX_FREE_NIDS) {
 		i++;
 		goto check_partial;
 	}
-- 
2.9.3


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] f2fs: use MAX_FREE_NIDS for the free nids target
  2017-02-26 12:47 [PATCH] f2fs: use MAX_FREE_NIDS for the free nids target Kinglong Mee
@ 2017-02-27  6:14 ` Chao Yu
  0 siblings, 0 replies; 2+ messages in thread
From: Chao Yu @ 2017-02-27  6:14 UTC (permalink / raw)
  To: Kinglong Mee, Jaegeuk Kim; +Cc: linux-f2fs-devel

On 2017/2/26 20:47, Kinglong Mee wrote:
> F2FS has define MAX_FREE_NIDS for maximum of cached free nids target.
> 
> #define MAX_FREE_NIDS   (NAT_ENTRY_PER_BLOCK * FREE_NID_PAGES)
> 
> Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>

All clean patches looks good to me.

To Jaegeuk, please add:

Reviewed-by: Chao Yu <yuchao0@huawei.com>

Thanks,

> ---
>  fs/f2fs/node.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
> index 6d43095..9284f65 100644
> --- a/fs/f2fs/node.c
> +++ b/fs/f2fs/node.c
> @@ -1870,7 +1870,6 @@ static void scan_free_nid_bits(struct f2fs_sb_info *sbi)
>  	struct curseg_info *curseg = CURSEG_I(sbi, CURSEG_HOT_DATA);
>  	struct f2fs_journal *journal = curseg->journal;
>  	unsigned int i, idx;
> -	unsigned int target = FREE_NID_PAGES * NAT_ENTRY_PER_BLOCK;
>  
>  	down_read(&nm_i->nat_tree_lock);
>  
> @@ -1886,7 +1885,7 @@ static void scan_free_nid_bits(struct f2fs_sb_info *sbi)
>  			nid = i * NAT_ENTRY_PER_BLOCK + idx;
>  			add_free_nid(sbi, nid, true);
>  
> -			if (nm_i->nid_cnt[FREE_NID_LIST] >= target)
> +			if (nm_i->nid_cnt[FREE_NID_LIST] >= MAX_FREE_NIDS)
>  				goto out;
>  		}
>  	}
> @@ -1912,7 +1911,6 @@ static int scan_nat_bits(struct f2fs_sb_info *sbi)
>  	struct f2fs_nm_info *nm_i = NM_I(sbi);
>  	struct page *page;
>  	unsigned int i = 0;
> -	nid_t target = FREE_NID_PAGES * NAT_ENTRY_PER_BLOCK;
>  	nid_t nid;
>  
>  	if (!enabled_nat_bits(sbi, NULL))
> @@ -1933,7 +1931,7 @@ static int scan_nat_bits(struct f2fs_sb_info *sbi)
>  		add_free_nid(sbi, nid, true);
>  	}
>  
> -	if (nm_i->nid_cnt[FREE_NID_LIST] >= target)
> +	if (nm_i->nid_cnt[FREE_NID_LIST] >= MAX_FREE_NIDS)
>  		goto out;
>  	i++;
>  	goto check_empty;
> @@ -1951,7 +1949,7 @@ static int scan_nat_bits(struct f2fs_sb_info *sbi)
>  	scan_nat_page(sbi, page, nid);
>  	f2fs_put_page(page, 1);
>  
> -	if (nm_i->nid_cnt[FREE_NID_LIST] < target) {
> +	if (nm_i->nid_cnt[FREE_NID_LIST] < MAX_FREE_NIDS) {
>  		i++;
>  		goto check_partial;
>  	}
> 


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-02-27  6:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-26 12:47 [PATCH] f2fs: use MAX_FREE_NIDS for the free nids target Kinglong Mee
2017-02-27  6:14 ` Chao Yu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.