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:   Fri, 25 Mar 2022 21:46:35 +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 13/22] erofs: add anonymous inode
 managing page cache of blob file

On Fri, Mar 25, 2022 at 08:22:14PM +0800, Jeffle Xu wrote:
> Introduce one anonymous inode for managing page cache of corresponding
> blob file. Then erofs could read directly from the address space of the
> anonymous inode when cache hit.
> 
> Signed-off-by: Jeffle Xu <jefflexu@...ux.alibaba.com>
> ---
>  fs/erofs/fscache.c  | 41 ++++++++++++++++++++++++++++++++++++++++-
>  fs/erofs/internal.h |  7 +++++--
>  2 files changed, 45 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/erofs/fscache.c b/fs/erofs/fscache.c
> index 73235fd43bf6..30383d9adb62 100644
> --- a/fs/erofs/fscache.c
> +++ b/fs/erofs/fscache.c
> @@ -7,6 +7,9 @@
>  
>  static struct fscache_volume *volume;
>  
> +static const struct address_space_operations erofs_fscache_blob_aops = {
> +};
> +
>  static int erofs_fscache_init_cookie(struct erofs_fscache *ctx, char *path)
>  {
>  	struct fscache_cookie *cookie;
> @@ -31,6 +34,29 @@ static inline void erofs_fscache_cleanup_cookie(struct erofs_fscache *ctx)
>  	ctx->cookie = NULL;
>  }
>  
> +static int erofs_fscache_get_inode(struct erofs_fscache *ctx,
> +				   struct super_block *sb)

I think it can be folded as well.

> +{
> +	struct inode *const inode = new_inode(sb);
> +
> +	if (!inode)
> +		return -ENOMEM;
> +
> +	set_nlink(inode, 1);
> +	inode->i_size = OFFSET_MAX;
> +	inode->i_mapping->a_ops = &erofs_fscache_blob_aops;
> +	mapping_set_gfp_mask(inode->i_mapping, GFP_NOFS);
> +
> +	ctx->inode = inode;
> +	return 0;
> +}
> +
> +static inline void erofs_fscache_put_inode(struct erofs_fscache *ctx)

Ditto.

> +{
> +	iput(ctx->inode);
> +	ctx->inode = NULL;
> +}
> +
>  /*
>   * erofs_fscache_get - create an fscache context for blob file
>   * @sb:		superblock
> @@ -38,7 +64,8 @@ static inline void erofs_fscache_cleanup_cookie(struct erofs_fscache *ctx)
>   *
>   * Return: fscache context on success, ERR_PTR() on failure.
>   */
> -struct erofs_fscache *erofs_fscache_get(struct super_block *sb, char *path)
> +struct erofs_fscache *erofs_fscache_get(struct super_block *sb, char *path,
> +					bool need_inode)
>  {
>  	struct erofs_fscache *ctx;
>  	int ret;
> @@ -53,7 +80,18 @@ struct erofs_fscache *erofs_fscache_get(struct super_block *sb, char *path)
>  		goto err;
>  	}
>  
> +	if (need_inode) {
> +		ret = erofs_fscache_get_inode(ctx, sb);
> +		if (ret) {
> +			erofs_err(sb, "failed to get anonymous inode");

				       failed to get fscache inode of [path].

Thanks,
Gao Xiang

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ