All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] f2fs: no need to scan nat bitmap if it's not enable
@ 2017-09-07  2:55 Yunlei He
  2017-09-07  3:29 ` Chao Yu
  0 siblings, 1 reply; 4+ messages in thread
From: Yunlei He @ 2017-09-07  2:55 UTC (permalink / raw)
  To: jaegeuk, yuchao0, linux-f2fs-devel; +Cc: heyunlei, morgan.wang

Now, nat bitmap will get lost after sudden power off,
when we build free nids, it's better to judge nat bitmap
enable or not before scan nat bitmap.

Signed-off-by: Yunlei He <heyunlei@huawei.com>
---
 fs/f2fs/node.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index fca8783..482f424 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -1937,6 +1937,9 @@ static void scan_free_nid_bits(struct f2fs_sb_info *sbi)
 	struct f2fs_journal *journal = curseg->journal;
 	unsigned int i, idx;
 
+	if (!enabled_nat_bits(sbi, NULL))
+		return;
+
 	down_read(&nm_i->nat_tree_lock);
 
 	for (i = 0; i < nm_i->nat_blocks; i++) {
-- 
1.9.1


------------------------------------------------------------------------------
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] 4+ messages in thread

* Re: [PATCH] f2fs: no need to scan nat bitmap if it's not enable
  2017-09-07  2:55 [PATCH] f2fs: no need to scan nat bitmap if it's not enable Yunlei He
@ 2017-09-07  3:29 ` Chao Yu
  2017-09-07  3:44   ` 答复: " heyunlei
  0 siblings, 1 reply; 4+ messages in thread
From: Chao Yu @ 2017-09-07  3:29 UTC (permalink / raw)
  To: Yunlei He, jaegeuk, linux-f2fs-devel; +Cc: morgan.wang

On 2017/9/7 10:55, Yunlei He wrote:
> Now, nat bitmap will get lost after sudden power off,
> when we build free nids, it's better to judge nat bitmap
> enable or not before scan nat bitmap.

We will load uptodate nit_bits map in last valid checkpoint after SPOR, is there
any problem here?

Thanks,

> 
> Signed-off-by: Yunlei He <heyunlei@huawei.com>
> ---
>  fs/f2fs/node.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
> index fca8783..482f424 100644
> --- a/fs/f2fs/node.c
> +++ b/fs/f2fs/node.c
> @@ -1937,6 +1937,9 @@ static void scan_free_nid_bits(struct f2fs_sb_info *sbi)
>  	struct f2fs_journal *journal = curseg->journal;
>  	unsigned int i, idx;
>  
> +	if (!enabled_nat_bits(sbi, NULL))
> +		return;
> +
>  	down_read(&nm_i->nat_tree_lock);
>  
>  	for (i = 0; i < nm_i->nat_blocks; i++) {
> 


------------------------------------------------------------------------------
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] 4+ messages in thread

* 答复: [PATCH] f2fs: no need to scan nat bitmap if it's not enable
  2017-09-07  3:29 ` Chao Yu
@ 2017-09-07  3:44   ` heyunlei
  2017-09-07  6:17     ` Chao Yu
  0 siblings, 1 reply; 4+ messages in thread
From: heyunlei @ 2017-09-07  3:44 UTC (permalink / raw)
  To: Yuchao (T), jaegeuk, linux-f2fs-devel; +Cc: Wangkai (Morgan, Euler)

Hi Chao,
On 2017/9/7 10:55, Yunlei He wrote:
> Now, nat bitmap will get lost after sudden power off, when we build 
> free nids, it's better to judge nat bitmap enable or not before scan 
> nat bitmap.

We will load uptodate nit_bits map in last valid checkpoint after SPOR, is there any problem here?

Thanks,

 We write nat bits only when CP_UMOUNT is set, is something else I missing? 

Thanks,

> 
> Signed-off-by: Yunlei He <heyunlei@huawei.com>
> ---
>  fs/f2fs/node.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index fca8783..482f424 
> 100644
> --- a/fs/f2fs/node.c
> +++ b/fs/f2fs/node.c
> @@ -1937,6 +1937,9 @@ static void scan_free_nid_bits(struct f2fs_sb_info *sbi)
>  	struct f2fs_journal *journal = curseg->journal;
>  	unsigned int i, idx;
>  
> +	if (!enabled_nat_bits(sbi, NULL))
> +		return;
> +
>  	down_read(&nm_i->nat_tree_lock);
>  
>  	for (i = 0; i < nm_i->nat_blocks; i++) {
> 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: 答复: [PATCH] f2fs: no need to scan nat bitmap if it's not enable
  2017-09-07  3:44   ` 答复: " heyunlei
@ 2017-09-07  6:17     ` Chao Yu
  0 siblings, 0 replies; 4+ messages in thread
From: Chao Yu @ 2017-09-07  6:17 UTC (permalink / raw)
  To: heyunlei, jaegeuk, linux-f2fs-devel; +Cc: Wangkai (Morgan, Euler)

Hi Yunlei,

On 2017/9/7 11:44, heyunlei wrote:
> Hi Chao,
> On 2017/9/7 10:55, Yunlei He wrote:
>> Now, nat bitmap will get lost after sudden power off, when we build 
>> free nids, it's better to judge nat bitmap enable or not before scan 
>> nat bitmap.
> 
> We will load uptodate nit_bits map in last valid checkpoint after SPOR, is there any problem here?
> 
> Thanks,
> 
>  We write nat bits only when CP_UMOUNT is set, is something else I missing? 

Yup, if nat_bits map is out of update, we have already skipped loading it in
load_free_nid_bitmap.

You're trying to shut down free nide bitmap cache which is just pure
intermediate cache, the cache will be initialized with nat_bits map and be
updated during free nid allocation/releasing, for SPOR case, we will skip
initialization step, but still the cache can run well due to other updating
mechanism. So I don't think we have to disable the cache for that case.

Below patches can help you understand well about history and implementation of
the cache, please check them:

f2fs: add bitmaps for empty or full NAT blocks
f2fs: introduce free nid bitmap
f2fs: combine nat_bits and free_nid_bitmap cache

Thanks,

> 
> Thanks,
> 
>>
>> Signed-off-by: Yunlei He <heyunlei@huawei.com>
>> ---
>>  fs/f2fs/node.c | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index fca8783..482f424 
>> 100644
>> --- a/fs/f2fs/node.c
>> +++ b/fs/f2fs/node.c
>> @@ -1937,6 +1937,9 @@ static void scan_free_nid_bits(struct f2fs_sb_info *sbi)
>>  	struct f2fs_journal *journal = curseg->journal;
>>  	unsigned int i, idx;
>>  
>> +	if (!enabled_nat_bits(sbi, NULL))
>> +		return;
>> +
>>  	down_read(&nm_i->nat_tree_lock);
>>  
>>  	for (i = 0; i < nm_i->nat_blocks; i++) {
>>
> 


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

end of thread, other threads:[~2017-09-07  6:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-07  2:55 [PATCH] f2fs: no need to scan nat bitmap if it's not enable Yunlei He
2017-09-07  3:29 ` Chao Yu
2017-09-07  3:44   ` 答复: " heyunlei
2017-09-07  6:17     ` 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.