lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 28 Mar 2022 10:49:39 +0800
From:   Gao Xiang <hsiangkao@...ux.alibaba.com>
To:     Jeffle Xu <jefflexu@...ux.alibaba.com>
Cc:     dhowells@...hat.com, linux-cachefs@...hat.com, xiang@...nel.org,
        chao@...nel.org, linux-erofs@...ts.ozlabs.org,
        gregkh@...uxfoundation.org, fannaihao@...du.com,
        tao.peng@...ux.alibaba.com, willy@...radead.org,
        linux-kernel@...r.kernel.org, tianzichen@...ishou.com,
        joseph.qi@...ux.alibaba.com, bo.liu@...ux.alibaba.com,
        linux-fsdevel@...r.kernel.org, luodaowen.backend@...edance.com,
        eguan@...ux.alibaba.com, gerry@...ux.alibaba.com,
        torvalds@...ux-foundation.org
Subject: Re: [Linux-cachefs] [PATCH v6 14/22] erofs: add
 erofs_fscache_read_folios() helper

On Fri, Mar 25, 2022 at 08:22:15PM +0800, Jeffle Xu wrote:
> Add erofs_fscache_read_folios() helper reading from fscache. It supports
> on-demand read semantics. That is, it will make the backend prepare for
> the data when cache miss. Once data ready, it will reinitiate a read
> from the cache.
> 
> This helper can then be used to implement .readpage()/.readahead() of
> on-demand read semantics.
> 
> Besides also add erofs_fscache_read_folio() wrapper helper.
> 
> Signed-off-by: Jeffle Xu <jefflexu@...ux.alibaba.com>
> ---
>  fs/erofs/fscache.c | 39 +++++++++++++++++++++++++++++++++++++++
>  1 file changed, 39 insertions(+)
> 
> diff --git a/fs/erofs/fscache.c b/fs/erofs/fscache.c
> index 30383d9adb62..6a55f7b5f883 100644
> --- a/fs/erofs/fscache.c
> +++ b/fs/erofs/fscache.c
> @@ -7,6 +7,45 @@
>  
>  static struct fscache_volume *volume;
>  
> +/*
> + * erofs_fscache_read_folios - Read data from fscache.
> + *
> + * Fill the read data into page cache described by @start/len, which shall be
> + * both aligned with PAGE_SIZE. @pstart describes the corresponding physical
> + * start address in the cache file.
> + */
> +static int erofs_fscache_read_folios(struct fscache_cookie *cookie,
> +				     struct address_space *mapping,
> +				     loff_t start, size_t len,
> +				     loff_t pstart)
> +{
> +	struct netfs_cache_resources cres;
> +	struct iov_iter iter;
> +	int ret;
> +
> +	memset(&cres, 0, sizeof(cres));
> +
> +	ret = fscache_begin_read_operation(&cres, cookie);
> +	if (ret)
> +		return ret;
> +
> +	iov_iter_xarray(&iter, READ, &mapping->i_pages, start, len);
> +
> +	ret = fscache_read(&cres, pstart, &iter,
> +			   NETFS_READ_HOLE_ONDEMAND, NULL, NULL);
> +
> +	fscache_end_operation(&cres);
> +	return ret;
> +}
> +
> +static inline int erofs_fscache_read_folio(struct fscache_cookie *cookie,
> +					   struct folio *folio, loff_t pstart)

I've seen two users of this helper,

 1) erofs_fscache_readpage_noinline
 2) erofs_fscache_readpage_blob

Actually, we could fold such logic in these users since this additional
helper doesn't enhance the readability but increase the overhead when
reading the code.

It'd be better to get rid of it instead.

Thanks,
Gao Xiang

> +{
> +	return erofs_fscache_read_folios(cookie, folio_file_mapping(folio),
> +					 folio_pos(folio), folio_size(folio),
> +					 pstart);
> +}
> +
>  static const struct address_space_operations erofs_fscache_blob_aops = {
>  };
>  
> -- 
> 2.27.0
> 
> --
> Linux-cachefs mailing list
> Linux-cachefs@...hat.com
> https://listman.redhat.com/mailman/listinfo/linux-cachefs

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ