Hi Chao,

On Sat, May 21, 2016 at 01:19:11PM +0800, Chao Yu wrote:
> From: Chao Yu <[email protected]>
> 
> 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 <[email protected]>
> ---
>  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

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to