Re: [PATCH 14/14] ext4: use a byte granularity cursor in ext4_mpage_readpages

Eric Biggers <[email protected]>
Newsgroups org.kernel.vger.linux-fscrypt,net.sourceforge.lists.linux-f2fs-devel,org.kernel.vger.linux-ext4,org.kernel.vger.linux-fsdevel
Message-ID <20260227222950.GC5357@quark>
On Thu, Feb 26, 2026 at 06:49:34AM -0800, Christoph Hellwig wrote:
> +		block_in_file = EXT4_PG_TO_LBLK(inode, folio->index);
> +		pos = (loff_t)block_in_file << blkbits;

The EXT4_PG_TO_LBLK() expands to:

        (((loff_t)(folio->index) << PAGE_SHIFT) >> (inode)->i_blkbits)

So it calculates the pos as an intermediate step, and we end up with the
redundant pos = (pos >> blkbits) << blkbits.

It probably would make more sense to calculate the pos first, similar to
what other places in this series do:

        pos = folio_pos(folio);                                          
        block_in_file = pos >> blkbits;

- Eric
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.