On Tue, Nov 04, 2025 at 11:05:49PM +0800, Yongpeng Yang wrote:
> On 11/4/2025 7:12 PM, Christoph Hellwig wrote:
> > On Mon, Nov 03, 2025 at 08:48:29AM -0800, Eric Biggers wrote:
> > > >         *inode_ret = inode;
> > > > -       *lblk_num_ret = ((u64)folio->index << (PAGE_SHIFT - 
> > > > inode->i_blkbits)) +
> > > > +       *lblk_num_ret = (((u64)folio->index << PAGE_SHIFT) >> 
> > > > inode->i_blkbits) +
> > 
> > This should be using folio_pos() instead of open coding the arithmetics.
> > 
> 
> How about this modification: using "<< PAGE_SHIFT" instead of "* PAGE_SIZE"
> for page_offset and folio_pos?

Any decent compiler turns a multiplication by a compіle time fixed
power of two constant in shifts, so why bother?

(and yes, I just double checked this happens here)


Reply via email to