Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1404810 > unrolled thread

[PATCH] f2fs: fix to redirty page if fail to gc data page

Started byChao Yu <chao@kernel.org>
First post2016-05-21 07:30 +0200
Last post2016-05-31 08:20 +0200
Articles 4 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] f2fs: fix to redirty page if fail to gc data page Chao Yu <chao@kernel.org> - 2016-05-21 07:30 +0200
    Re: [PATCH] f2fs: fix to redirty page if fail to gc data page Chao Yu <yuchao0@huawei.com> - 2016-05-28 03:00 +0200
    Re: [PATCH] f2fs: fix to redirty page if fail to gc data page Jaegeuk Kim <jaegeuk@kernel.org> - 2016-05-30 04:40 +0200
      Re: [PATCH] f2fs: fix to redirty page if fail to gc data page Chao Yu <yuchao0@huawei.com> - 2016-05-31 08:20 +0200

#1404810 — [PATCH] f2fs: fix to redirty page if fail to gc data page

FromChao Yu <chao@kernel.org>
Date2016-05-21 07:30 +0200
Subject[PATCH] f2fs: fix to redirty page if fail to gc data page
Message-ID<rB7E5-7Ti-1@gated-at.bofh.it>
From: Chao Yu <yuchao0@huawei.com>

If we fail to move data page during foreground GC, we should give another
chance to writeback that page which was set dirty previously by writer.

Signed-off-by: Chao Yu <yuchao0@huawei.com>
---
 fs/f2fs/gc.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
index 38d56f6..ee213a8 100644
--- a/fs/f2fs/gc.c
+++ b/fs/f2fs/gc.c
@@ -653,12 +653,15 @@ static void move_data_page(struct inode *inode, block_t bidx, int gc_type)
 			.page = page,
 			.encrypted_page = NULL,
 		};
+		bool is_dirty = PageDirty(page);
+
 		set_page_dirty(page);
 		f2fs_wait_on_page_writeback(page, DATA, true);
 		if (clear_page_dirty_for_io(page))
 			inode_dec_dirty_pages(inode);
 		set_cold_data(page);
-		do_write_data_page(&fio);
+		if (do_write_data_page(&fio) && is_dirty)
+			set_page_dirty(page);
 		clear_cold_data(page);
 	}
 out:
-- 
2.7.2

[toc] | [next] | [standalone]


#1408362

FromChao Yu <yuchao0@huawei.com>
Date2016-05-28 03:00 +0200
Message-ID<rDALD-27L-1@gated-at.bofh.it>
In reply to#1404810
Ping,

On 2016/5/21 13:19, Chao Yu wrote:
> From: Chao Yu <yuchao0@huawei.com>
> 
> If we fail to move data page during foreground GC, we should give another
> chance to writeback that page which was set dirty previously by writer.
> 
> Signed-off-by: Chao Yu <yuchao0@huawei.com>
> ---
>  fs/f2fs/gc.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
> index 38d56f6..ee213a8 100644
> --- a/fs/f2fs/gc.c
> +++ b/fs/f2fs/gc.c
> @@ -653,12 +653,15 @@ static void move_data_page(struct inode *inode, block_t bidx, int gc_type)
>  			.page = page,
>  			.encrypted_page = NULL,
>  		};
> +		bool is_dirty = PageDirty(page);
> +
>  		set_page_dirty(page);
>  		f2fs_wait_on_page_writeback(page, DATA, true);
>  		if (clear_page_dirty_for_io(page))
>  			inode_dec_dirty_pages(inode);
>  		set_cold_data(page);
> -		do_write_data_page(&fio);
> +		if (do_write_data_page(&fio) && is_dirty)
> +			set_page_dirty(page);
>  		clear_cold_data(page);
>  	}
>  out:
> 

[toc] | [prev] | [next] | [standalone]


#1408728

FromJaegeuk Kim <jaegeuk@kernel.org>
Date2016-05-30 04:40 +0200
Message-ID<rElhv-6xF-3@gated-at.bofh.it>
In reply to#1404810
Hi Chao,

On Sat, May 21, 2016 at 01:19:11PM +0800, Chao Yu wrote:
> From: Chao Yu <yuchao0@huawei.com>
> 
> If we fail to move data page during foreground GC, we should give another
> chance to writeback that page which was set dirty previously by writer.
> 
> Signed-off-by: Chao Yu <yuchao0@huawei.com>
> ---
>  fs/f2fs/gc.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
> index 38d56f6..ee213a8 100644
> --- a/fs/f2fs/gc.c
> +++ b/fs/f2fs/gc.c
> @@ -653,12 +653,15 @@ static void move_data_page(struct inode *inode, block_t bidx, int gc_type)
>  			.page = page,
>  			.encrypted_page = NULL,
>  		};
> +		bool is_dirty = PageDirty(page);
> +
>  		set_page_dirty(page);
>  		f2fs_wait_on_page_writeback(page, DATA, true);
>  		if (clear_page_dirty_for_io(page))
>  			inode_dec_dirty_pages(inode);
>  		set_cold_data(page);
> -		do_write_data_page(&fio);
> +		if (do_write_data_page(&fio) && is_dirty)
> +			set_page_dirty(page);

If this page is truncated with -ENOENT, we don't need to set it dirty again.
I expect that, if we get an error here, do_garbage_collect() would retry FG_GC
again.

Thanks,

>  		clear_cold_data(page);
>  	}
>  out:
> -- 
> 2.7.2

[toc] | [prev] | [next] | [standalone]


#1409821

FromChao Yu <yuchao0@huawei.com>
Date2016-05-31 08:20 +0200
Message-ID<rELbY-79h-7@gated-at.bofh.it>
In reply to#1408728
Hi Jaegeuk,

On 2016/5/30 10:37, Jaegeuk Kim wrote:
> Hi Chao,
> 
> On Sat, May 21, 2016 at 01:19:11PM +0800, Chao Yu wrote:
>> From: Chao Yu <yuchao0@huawei.com>
>>
>> If we fail to move data page during foreground GC, we should give another
>> chance to writeback that page which was set dirty previously by writer.
>>
>> Signed-off-by: Chao Yu <yuchao0@huawei.com>
>> ---
>>  fs/f2fs/gc.c | 5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
>> index 38d56f6..ee213a8 100644
>> --- a/fs/f2fs/gc.c
>> +++ b/fs/f2fs/gc.c
>> @@ -653,12 +653,15 @@ static void move_data_page(struct inode *inode, block_t bidx, int gc_type)
>>  			.page = page,
>>  			.encrypted_page = NULL,
>>  		};
>> +		bool is_dirty = PageDirty(page);
>> +
>>  		set_page_dirty(page);
>>  		f2fs_wait_on_page_writeback(page, DATA, true);
>>  		if (clear_page_dirty_for_io(page))
>>  			inode_dec_dirty_pages(inode);
>>  		set_cold_data(page);
>> -		do_write_data_page(&fio);
>> +		if (do_write_data_page(&fio) && is_dirty)
>> +			set_page_dirty(page);
> 
> If this page is truncated with -ENOENT, we don't need to set it dirty again.

Agree

> I expect that, if we get an error here, do_garbage_collect() would retry FG_GC

IIRC, you have reworked the FG_GC flows changed from an infinite loop to trying
do the movement just one time. Here, I think if there are just few of blocks are
failed to be moved, we can give one more time for retrying. How do you think?

> again.
> 
> Thanks,
> 
>>  		clear_cold_data(page);
>>  	}
>>  out:
>> -- 
>> 2.7.2
> .
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web