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]
Message-ID: <0185cd6f-791b-41b4-a741-8004a8d43fdf@linux.alibaba.com>
Date: Wed, 24 Dec 2025 16:18:45 +0800
From: Gao Xiang <hsiangkao@...ux.alibaba.com>
To: Hongbo Li <lihongbo22@...wei.com>
Cc: linux-fsdevel@...r.kernel.org, linux-erofs@...ts.ozlabs.org,
 linux-kernel@...r.kernel.org, Chao Yu <chao@...nel.org>,
 Christian Brauner <brauner@...nel.org>, "Darrick J. Wong"
 <djwong@...nel.org>, Amir Goldstein <amir73il@...il.com>,
 Christoph Hellwig <hch@....de>
Subject: Re: [PATCH v11 09/10] erofs: support compressed inodes for page cache
 share



On 2025/12/24 12:09, Hongbo Li wrote:
> From: Hongzhen Luo <hongzhen@...ux.alibaba.com>
> 
> This patch adds page cache sharing functionality for compressed inodes.
> 
> Signed-off-by: Hongzhen Luo <hongzhen@...ux.alibaba.com>
> Signed-off-by: Hongbo Li <lihongbo22@...wei.com>
> ---
>   fs/erofs/zdata.c | 30 ++++++++++++++++++++++--------
>   1 file changed, 22 insertions(+), 8 deletions(-)
> 
> diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c
> index 65da21504632..759f3fe225c9 100644
> --- a/fs/erofs/zdata.c
> +++ b/fs/erofs/zdata.c
> @@ -493,7 +493,7 @@ enum z_erofs_pclustermode {
>   };
>   
>   struct z_erofs_frontend {
> -	struct inode *const inode;
> +	struct inode *inode;
>   	struct erofs_map_blocks map;
>   	struct z_erofs_bvec_iter biter;
>   
> @@ -1884,9 +1884,13 @@ static void z_erofs_pcluster_readmore(struct z_erofs_frontend *f,
>   static int z_erofs_read_folio(struct file *file, struct folio *folio)
>   {
>   	struct inode *const inode = folio->mapping->host;
> -	Z_EROFS_DEFINE_FRONTEND(f, inode, folio_pos(folio));
> +	bool need_iput = false;
> +	struct inode *realinode = erofs_real_inode(inode, &need_iput);
> +	Z_EROFS_DEFINE_FRONTEND(f, NULL, folio_pos(folio));

Why not just
	Z_EROFS_DEFINE_FRONTEND(f, realinode, folio_pos(folio));
?

>   	int err;
>   
> +	DBG_BUGON(!realinode);

Remove this line

> +	f.inode = realinode;
>   	trace_erofs_read_folio(folio, false);
>   	z_erofs_pcluster_readmore(&f, NULL, true);
>   	err = z_erofs_scan_folio(&f, folio, false);
> @@ -1896,23 +1900,30 @@ static int z_erofs_read_folio(struct file *file, struct folio *folio)
>   	/* if some pclusters are ready, need submit them anyway */
>   	err = z_erofs_runqueue(&f, 0) ?: err;
>   	if (err && err != -EINTR)
> -		erofs_err(inode->i_sb, "read error %d @ %lu of nid %llu",
> -			  err, folio->index, EROFS_I(inode)->nid);
> +		erofs_err(realinode->i_sb, "read error %d @ %lu of nid %llu",
> +			  err, folio->index, EROFS_I(realinode)->nid);
>   
>   	erofs_put_metabuf(&f.map.buf);
>   	erofs_release_pages(&f.pagepool);
> +
> +	if (need_iput)
> +		iput(realinode);
>   	return err;
>   }
>   
>   static void z_erofs_readahead(struct readahead_control *rac)
>   {
>   	struct inode *const inode = rac->mapping->host;
> -	Z_EROFS_DEFINE_FRONTEND(f, inode, readahead_pos(rac));
> +	bool need_iput;
> +	struct inode *realinode = erofs_real_inode(inode, &need_iput);
> +	Z_EROFS_DEFINE_FRONTEND(f, NULL, readahead_pos(rac));

Why not just
	Z_EROFS_DEFINE_FRONTEND(f, realinode, folio_pos(folio));
?

>   	unsigned int nrpages = readahead_count(rac);
>   	struct folio *head = NULL, *folio;
>   	int err;
>   
> -	trace_erofs_readahead(inode, readahead_index(rac), nrpages, false);
> +	DBG_BUGON(!realinode);

Remove this line.

Thanks,
Gao Xiang

> +	f.inode = realinode;
> +	trace_erofs_readahead(realinode, readahead_index(rac), nrpages, false);
>   	z_erofs_pcluster_readmore(&f, rac, true);
>   	while ((folio = readahead_folio(rac))) {
>   		folio->private = head;
> @@ -1926,8 +1937,8 @@ static void z_erofs_readahead(struct readahead_control *rac)
>   
>   		err = z_erofs_scan_folio(&f, folio, true);
>   		if (err && err != -EINTR)
> -			erofs_err(inode->i_sb, "readahead error at folio %lu @ nid %llu",
> -				  folio->index, EROFS_I(inode)->nid);
> +			erofs_err(realinode->i_sb, "readahead error at folio %lu @ nid %llu",
> +				  folio->index, EROFS_I(realinode)->nid);
>   	}
>   	z_erofs_pcluster_readmore(&f, rac, false);
>   	z_erofs_pcluster_end(&f);
> @@ -1935,6 +1946,9 @@ static void z_erofs_readahead(struct readahead_control *rac)
>   	(void)z_erofs_runqueue(&f, nrpages);
>   	erofs_put_metabuf(&f.map.buf);
>   	erofs_release_pages(&f.pagepool);
> +
> +	if (need_iput)
> +		iput(realinode);
>   }
>   
>   const struct address_space_operations z_erofs_aops = {


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ