public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Gao Xiang <hsiangkao@linux.alibaba.com>
To: Christoph Hellwig <hch@lst.de>, Hongbo Li <lihongbo22@huawei.com>
Cc: chao@kernel.org, brauner@kernel.org, djwong@kernel.org,
	amir73il@gmail.com, linux-fsdevel@vger.kernel.org,
	linux-erofs@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v16 04/10] erofs: add erofs_inode_set_aops helper to set the aops.
Date: Fri, 23 Jan 2026 15:42:14 +0800	[thread overview]
Message-ID: <e0b170ec-253e-49ed-be62-9a90e9eb9053@linux.alibaba.com> (raw)
In-Reply-To: <20260123061825.GA25722@lst.de>



On 2026/1/23 14:18, Christoph Hellwig wrote:
> On Thu, Jan 22, 2026 at 09:54:15PM +0800, Gao Xiang wrote:
>>> @@ -455,6 +455,29 @@ static inline void *erofs_vm_map_ram(struct page **pages, unsigned int count)
>>>    	return NULL;
>>>    }
>>>    +static inline int erofs_inode_set_aops(struct inode *inode,
>>> +				       struct inode *realinode, bool no_fscache)
>>> +{
>>> +	if (erofs_inode_is_data_compressed(EROFS_I(realinode)->datalayout)) {
>>> +		if (!IS_ENABLED(CONFIG_EROFS_FS_ZIP))
>>> +			return -EOPNOTSUPP;
>>> +		DO_ONCE_LITE_IF(realinode->i_blkbits != PAGE_SHIFT,
>>> +			  erofs_info, realinode->i_sb,
>>> +			  "EXPERIMENTAL EROFS subpage compressed block support in use. Use at your own risk!");
>>> +		inode->i_mapping->a_ops = &z_erofs_aops;
>>
>> Is that available if CONFIG_EROFS_FS_ZIP is undefined?
> 
> z_erofs_aops is declared unconditionally, and the IS_ENABLED above
> ensures the compiler will never generate a reference to it.
> 
> So this is fine, and a very usualy trick to make the code more
> readable.

Yeah, I get your point, that is really helpful and I haven't
used that trick.

The other problem was the else part is incorrect, Hongbo,
how about applying the following code and resend the next
version, I will apply all patches later:

static inline int erofs_inode_set_aops(struct inode *inode,
                                        struct inode *realinode, bool no_fscache)
{
         if (erofs_inode_is_data_compressed(EROFS_I(realinode)->datalayout)) {
                 if (!IS_ENABLED(CONFIG_EROFS_FS_ZIP))
                         return -EOPNOTSUPP;
                 DO_ONCE_LITE_IF(realinode->i_blkbits != PAGE_SHIFT,
                           erofs_info, realinode->i_sb,
                           "EXPERIMENTAL EROFS subpage compressed block support in use. Use at your own risk!");
                 inode->i_mapping->a_ops = &z_erofs_aops;
                 return 0;
         }
         inode->i_mapping->a_ops = &erofs_aops;
         if (IS_ENABLED(CONFIG_EROFS_FS_ONDEMAND) && !no_fscache &&
             erofs_is_fscache_mode(realinode->i_sb))
                 inode->i_mapping->a_ops = &erofs_fscache_access_aops;
         if (IS_ENABLED(CONFIG_EROFS_FS_BACKED_BY_FILE) &&
             erofs_is_fileio_mode(EROFS_SB(realinode->i_sb)))
                 inode->i_mapping->a_ops = &erofs_fileio_aops;
         return 0;
}

Thanks,
Gao Xiang

  reply	other threads:[~2026-01-23  7:42 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-22 13:37 [PATCH v16 00/10] erofs: Introduce page cache sharing feature Hongbo Li
2026-01-22 13:37 ` [PATCH v16 01/10] fs: Export alloc_empty_backing_file Hongbo Li
2026-01-22 13:37 ` [PATCH v16 02/10] erofs: decouple `struct erofs_anon_fs_type` Hongbo Li
2026-01-22 13:37 ` [PATCH v16 03/10] erofs: support user-defined fingerprint name Hongbo Li
2026-01-22 13:37 ` [PATCH v16 04/10] erofs: add erofs_inode_set_aops helper to set the aops Hongbo Li
2026-01-22 13:54   ` Gao Xiang
2026-01-23  6:18     ` Christoph Hellwig
2026-01-23  7:42       ` Gao Xiang [this message]
2026-01-23  8:21         ` Hongbo Li
2026-01-22 13:37 ` [PATCH v16 05/10] erofs: using domain_id in the safer way Hongbo Li
2026-01-22 13:37 ` [PATCH v16 06/10] erofs: introduce the page cache share feature Hongbo Li
2026-01-22 14:01   ` Gao Xiang
2026-01-22 15:09     ` Hongbo Li
2026-01-22 13:37 ` [PATCH v16 07/10] erofs: pass inode to trace_erofs_read_folio Hongbo Li
2026-01-22 13:37 ` [PATCH v16 08/10] erofs: support unencoded inodes for page cache share Hongbo Li
2026-01-22 13:37 ` [PATCH v16 09/10] erofs: support compressed " Hongbo Li
2026-01-22 13:37 ` [PATCH v16 10/10] erofs: implement .fadvise " Hongbo Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e0b170ec-253e-49ed-be62-9a90e9eb9053@linux.alibaba.com \
    --to=hsiangkao@linux.alibaba.com \
    --cc=amir73il@gmail.com \
    --cc=brauner@kernel.org \
    --cc=chao@kernel.org \
    --cc=djwong@kernel.org \
    --cc=hch@lst.de \
    --cc=lihongbo22@huawei.com \
    --cc=linux-erofs@lists.ozlabs.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox