All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] f2fs: allocate hot_data for atomic write more strictly
@ 2018-04-16 11:34 Yunlei He
  2018-04-17  8:30 ` Chao Yu
  0 siblings, 1 reply; 4+ messages in thread
From: Yunlei He @ 2018-04-16 11:34 UTC (permalink / raw)
  To: jaegeuk, yuchao0, linux-f2fs-devel; +Cc: zhangdianfang

If a file not set type as hot, has dirty pages more than
threshold 64 before starting atomic write, may be lose hot
flag.

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

diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 79eeed5..bf61e20 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -1685,7 +1685,6 @@ static int f2fs_ioc_start_atomic_write(struct file *filp)
 		goto out;
 
 	set_inode_flag(inode, FI_ATOMIC_FILE);
-	set_inode_flag(inode, FI_HOT_DATA);
 	f2fs_update_time(F2FS_I_SB(inode), REQ_TIME);
 
 	if (!get_dirty_pages(inode))
@@ -1697,11 +1696,11 @@ static int f2fs_ioc_start_atomic_write(struct file *filp)
 	ret = filemap_write_and_wait_range(inode->i_mapping, 0, LLONG_MAX);
 	if (ret) {
 		clear_inode_flag(inode, FI_ATOMIC_FILE);
-		clear_inode_flag(inode, FI_HOT_DATA);
 		goto out;
 	}
 
 inc_stat:
+	set_inode_flag(inode, FI_HOT_DATA);
 	F2FS_I(inode)->inmem_task = current;
 	stat_inc_atomic_write(inode);
 	stat_update_max_atomic_write(inode);
-- 
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: allocate hot_data for atomic write more strictly
  2018-04-16 11:34 [PATCH] f2fs: allocate hot_data for atomic write more strictly Yunlei He
@ 2018-04-17  8:30 ` Chao Yu
  2018-04-17  9:14   ` heyunlei
  0 siblings, 1 reply; 4+ messages in thread
From: Chao Yu @ 2018-04-17  8:30 UTC (permalink / raw)
  To: Yunlei He, jaegeuk, linux-f2fs-devel; +Cc: zhangdianfang

On 2018/4/16 19:34, Yunlei He wrote:
> If a file not set type as hot, has dirty pages more than
> threshold 64 before starting atomic write, may be lose hot
> flag.
> 
> Signed-off-by: Yunlei He <heyunlei@huawei.com>
> ---
>  fs/f2fs/file.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
> index 79eeed5..bf61e20 100644
> --- a/fs/f2fs/file.c
> +++ b/fs/f2fs/file.c
> @@ -1685,7 +1685,6 @@ static int f2fs_ioc_start_atomic_write(struct file *filp)
>  		goto out;
>  
>  	set_inode_flag(inode, FI_ATOMIC_FILE);

How about moving this below inc_stat tag? If there is still dirty page, for
reclaim path, we may redirty page with atomic write mode, we need to avoid that.

> -	set_inode_flag(inode, FI_HOT_DATA);
>  	f2fs_update_time(F2FS_I_SB(inode), REQ_TIME);

Ditto.

Thanks,

>  
>  	if (!get_dirty_pages(inode))
> @@ -1697,11 +1696,11 @@ static int f2fs_ioc_start_atomic_write(struct file *filp)
>  	ret = filemap_write_and_wait_range(inode->i_mapping, 0, LLONG_MAX);
>  	if (ret) {
>  		clear_inode_flag(inode, FI_ATOMIC_FILE);
> -		clear_inode_flag(inode, FI_HOT_DATA);
>  		goto out;
>  	}
>  
>  inc_stat:
> +	set_inode_flag(inode, FI_HOT_DATA);
>  	F2FS_I(inode)->inmem_task = current;
>  	stat_inc_atomic_write(inode);
>  	stat_update_max_atomic_write(inode);
> 


------------------------------------------------------------------------------
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

* Re: [PATCH] f2fs: allocate hot_data for atomic write more strictly
  2018-04-17  8:30 ` Chao Yu
@ 2018-04-17  9:14   ` heyunlei
  2018-04-17  9:52     ` Chao Yu
  0 siblings, 1 reply; 4+ messages in thread
From: heyunlei @ 2018-04-17  9:14 UTC (permalink / raw)
  To: Yuchao (T), jaegeuk, linux-f2fs-devel; +Cc: Zhangdianfang (Euler)



>-----Original Message-----
>From: Yuchao (T)
>Sent: Tuesday, April 17, 2018 4:31 PM
>To: heyunlei; jaegeuk@kernel.org; linux-f2fs-devel@lists.sourceforge.net
>Cc: Wangbintian; Zhangdianfang (Euler)
>Subject: Re: [f2fs-dev][PATCH] f2fs: allocate hot_data for atomic write more strictly
>
>On 2018/4/16 19:34, Yunlei He wrote:
>> If a file not set type as hot, has dirty pages more than
>> threshold 64 before starting atomic write, may be lose hot
>> flag.
>>
>> Signed-off-by: Yunlei He <heyunlei@huawei.com>
>> ---
>>  fs/f2fs/file.c | 3 +--
>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
>> index 79eeed5..bf61e20 100644
>> --- a/fs/f2fs/file.c
>> +++ b/fs/f2fs/file.c
>> @@ -1685,7 +1685,6 @@ static int f2fs_ioc_start_atomic_write(struct file *filp)
>>  		goto out;
>>
>>  	set_inode_flag(inode, FI_ATOMIC_FILE);
>
>How about moving this below inc_stat tag? If there is still dirty page, for
>reclaim path, we may redirty page with atomic write mode, we need to avoid that.
>
With it,maybe still has dirty pages after filemap_write_and_wait_range,
which are not inmem pages and maybe affect atomicity?

Thanks.

>> -	set_inode_flag(inode, FI_HOT_DATA);
>>  	f2fs_update_time(F2FS_I_SB(inode), REQ_TIME);
>
>Ditto.
>
>Thanks,
>
>>
>>  	if (!get_dirty_pages(inode))
>> @@ -1697,11 +1696,11 @@ static int f2fs_ioc_start_atomic_write(struct file *filp)
>>  	ret = filemap_write_and_wait_range(inode->i_mapping, 0, LLONG_MAX);
>>  	if (ret) {
>>  		clear_inode_flag(inode, FI_ATOMIC_FILE);
>> -		clear_inode_flag(inode, FI_HOT_DATA);
>>  		goto out;
>>  	}
>>
>>  inc_stat:
>> +	set_inode_flag(inode, FI_HOT_DATA);
>>  	F2FS_I(inode)->inmem_task = current;
>>  	stat_inc_atomic_write(inode);
>>  	stat_update_max_atomic_write(inode);
>>

------------------------------------------------------------------------------
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: allocate hot_data for atomic write more strictly
  2018-04-17  9:14   ` heyunlei
@ 2018-04-17  9:52     ` Chao Yu
  0 siblings, 0 replies; 4+ messages in thread
From: Chao Yu @ 2018-04-17  9:52 UTC (permalink / raw)
  To: heyunlei, jaegeuk, linux-f2fs-devel; +Cc: Zhangdianfang (Euler)

On 2018/4/17 17:14, heyunlei wrote:
> 
> 
>> -----Original Message-----
>> From: Yuchao (T)
>> Sent: Tuesday, April 17, 2018 4:31 PM
>> To: heyunlei; jaegeuk@kernel.org; linux-f2fs-devel@lists.sourceforge.net
>> Cc: Wangbintian; Zhangdianfang (Euler)
>> Subject: Re: [f2fs-dev][PATCH] f2fs: allocate hot_data for atomic write more strictly
>>
>> On 2018/4/16 19:34, Yunlei He wrote:
>>> If a file not set type as hot, has dirty pages more than
>>> threshold 64 before starting atomic write, may be lose hot
>>> flag.
>>>
>>> Signed-off-by: Yunlei He <heyunlei@huawei.com>
>>> ---
>>>  fs/f2fs/file.c | 3 +--
>>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>>
>>> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
>>> index 79eeed5..bf61e20 100644
>>> --- a/fs/f2fs/file.c
>>> +++ b/fs/f2fs/file.c
>>> @@ -1685,7 +1685,6 @@ static int f2fs_ioc_start_atomic_write(struct file *filp)
>>>  		goto out;
>>>
>>>  	set_inode_flag(inode, FI_ATOMIC_FILE);
>>
>> How about moving this below inc_stat tag? If there is still dirty page, for
>> reclaim path, we may redirty page with atomic write mode, we need to avoid that.
>>
> With it,maybe still has dirty pages after filemap_write_and_wait_range,
> which are not inmem pages and maybe affect atomicity?

I just send a patch, could you check that?

Thanks,

> 
> Thanks.
> 
>>> -	set_inode_flag(inode, FI_HOT_DATA);
>>>  	f2fs_update_time(F2FS_I_SB(inode), REQ_TIME);
>>
>> Ditto.
>>
>> Thanks,
>>
>>>
>>>  	if (!get_dirty_pages(inode))
>>> @@ -1697,11 +1696,11 @@ static int f2fs_ioc_start_atomic_write(struct file *filp)
>>>  	ret = filemap_write_and_wait_range(inode->i_mapping, 0, LLONG_MAX);
>>>  	if (ret) {
>>>  		clear_inode_flag(inode, FI_ATOMIC_FILE);
>>> -		clear_inode_flag(inode, FI_HOT_DATA);
>>>  		goto out;
>>>  	}
>>>
>>>  inc_stat:
>>> +	set_inode_flag(inode, FI_HOT_DATA);
>>>  	F2FS_I(inode)->inmem_task = current;
>>>  	stat_inc_atomic_write(inode);
>>>  	stat_update_max_atomic_write(inode);
>>>
> 


------------------------------------------------------------------------------
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:[~2018-04-17  9:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-16 11:34 [PATCH] f2fs: allocate hot_data for atomic write more strictly Yunlei He
2018-04-17  8:30 ` Chao Yu
2018-04-17  9:14   ` heyunlei
2018-04-17  9:52     ` 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.