Hi Pengyang,

On 04/25, Hou Pengyang wrote:
> If a page is cold, NOT atomit written and need_ipu now, there is
> a high probability that IPU should be adapted. For IPU, we try to
> check extent tree to get the block index first, instead of reading
> the dnode page, where may lead to an useless dnode IO, since no need to
> update the dnode index for IPU.
> 
> Signed-off-by: Hou Pengyang <houpengy...@huawei.com>
> Signed-off-by: Chao Yu <yuch...@huawei.com>
> ---
>  fs/f2fs/data.c    | 11 ++++++++++-
>  fs/f2fs/gc.c      |  1 +
>  fs/f2fs/segment.c |  1 +
>  3 files changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> index 02400b0..183a426 100644
> --- a/fs/f2fs/data.c
> +++ b/fs/f2fs/data.c
> @@ -1346,21 +1346,29 @@ int do_write_data_page(struct f2fs_io_info *fio)
>       struct page *page = fio->page;
>       struct inode *inode = page->mapping->host;
>       struct dnode_of_data dn;
> +     struct extent_info ei = {0,0,0};
>       int err = 0;
>  
>       set_new_dnode(&dn, inode, NULL, NULL, 0);
> +     if (need_inplace_update(fio) &&
> +                     f2fs_lookup_extent_cache(inode, page->index, &ei)) {
> +             fio->old_blkaddr = ei.blk + page->index - ei.fofs;
> +             if (fio->old_blkaddr != NULL_ADDR &&
> +                             fio->old_blkaddr != NEW_ADDR)

                        ipu_force = true;

I added one variable to do below ipu explicitly.

Thanks,

> +                     goto got_it;
> +     }
>       err = get_dnode_of_data(&dn, page->index, LOOKUP_NODE);
>       if (err)
>               return err;
>  
>       fio->old_blkaddr = dn.data_blkaddr;
> -
>       /* This page is already truncated */
>       if (fio->old_blkaddr == NULL_ADDR) {
>               ClearPageUptodate(page);
>               goto out_writepage;
>       }
>  
> +got_it:
>       err = encrypt_one_page(fio);
>       if (err)
>               goto out_writepage;
> @@ -1408,6 +1416,7 @@ static int __write_data_page(struct page *page, bool 
> *submitted,
>               .type = DATA,
>               .op = REQ_OP_WRITE,
>               .op_flags = wbc_to_write_flags(wbc),
> +             .old_blkaddr = NULL_ADDR,
>               .page = page,
>               .encrypted_page = NULL,
>               .submitted = false,
> diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
> index 499a43f..e034857 100644
> --- a/fs/f2fs/gc.c
> +++ b/fs/f2fs/gc.c
> @@ -712,6 +712,7 @@ static void move_data_page(struct inode *inode, block_t 
> bidx, int gc_type,
>                       .type = DATA,
>                       .op = REQ_OP_WRITE,
>                       .op_flags = REQ_SYNC,
> +                     .old_blkaddr = NULL_ADDR,
>                       .page = page,
>                       .encrypted_page = NULL,
>               };
> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> index 2a95535..9f86b98 100644
> --- a/fs/f2fs/segment.c
> +++ b/fs/f2fs/segment.c
> @@ -291,6 +291,7 @@ static int __commit_inmem_pages(struct inode *inode,
>               .type = DATA,
>               .op = REQ_OP_WRITE,
>               .op_flags = REQ_SYNC | REQ_PRIO,
> +             .old_blkaddr = NULL_ADDR,
>               .encrypted_page = NULL,
>       };
>       pgoff_t last_idx = ULONG_MAX;
> -- 
> 2.10.1
> 
> 
> ------------------------------------------------------------------------------
> 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

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

Reply via email to