[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Zo0JghFEaqxBs41l@dread.disaster.area>
Date: Tue, 9 Jul 2024 19:57:22 +1000
From: Dave Chinner <david@...morbit.com>
To: Christoph Hellwig <hch@....de>
Cc: John Garry <john.g.garry@...cle.com>, chandan.babu@...cle.com,
djwong@...nel.org, dchinner@...hat.com, viro@...iv.linux.org.uk,
brauner@...nel.org, jack@...e.cz, linux-xfs@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
catherine.hoang@...cle.com, martin.petersen@...cle.com
Subject: Re: [PATCH v2 10/13] xfs: Unmap blocks according to forcealign
On Sat, Jul 06, 2024 at 09:58:58AM +0200, Christoph Hellwig wrote:
>
> > + if (isforcealign) {
> > + off = ip->i_extsize - mod;
> > + } else {
> > + ASSERT(isrt);
> > + off = mp->m_sb.sb_rextsize - mod;
> > + }
>
> And we'll really need proper helpers so that we don't have to
> open code the i_extsize vs sb_rextsize logic all over.
We already have that: xfs_inode_alloc_unitsize().
Have the code get that value, then do all the alignment based on
whether it is allocation unit size > mp->m_sb.sb_blocksize. Then all
the calculations are generic and not dependent on forcealign or rt,
but on whether the inode requires multi-block contiguous extent
alignment....
i.e.
alloc_size = xfs_inode_alloc_unitsize(ip);
if (alloc_size > mp->m_sb.sb_blocksize) {
/* do aligned allocation setup stuff */
.....
}
....
No code should be doing "if (forcealign) ... else if (realtime) ..."
branching for alignment purposes. All the code should all be
generic based on the value xfs_inode_alloc_unitsize() returns.
-Dave.
--
Dave Chinner
david@...morbit.com
Powered by blists - more mailing lists