Message ID | 169704721662.1773834.1354453014423462886.stgit@frogsfrogsfrogs (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | xfs: refactor rtbitmap/summary macros | expand |
On Wed, Oct 11, 2023 at 11:06:45AM -0700, Darrick J. Wong wrote: > @@ -181,7 +181,7 @@ xfs_rtfind_back( > return error; > } > bufp = bp->b_addr; > - word = XFS_BLOCKWMASK(mp); > + word = mp->m_blockwsize - 1; > b = &bufp[word]; > } else { > /* > @@ -227,7 +227,7 @@ xfs_rtfind_back( > return error; > } > bufp = bp->b_addr; > - word = XFS_BLOCKWMASK(mp); > + word = mp->m_blockwsize - 1; > b = &bufp[word]; > } else { Random rambling: there is a fairly large chunk of code duplicated here. Maybe the caching series and/or Dave's suggest args cleanup would be good opportunity to refactor it. Same for the next two clusters of two chunks. The patch itself looks good: Reviewed-by: Christoph Hellwig <hch@lst.de>
On Thu, Oct 12, 2023 at 07:33:06AM +0200, Christoph Hellwig wrote: > On Wed, Oct 11, 2023 at 11:06:45AM -0700, Darrick J. Wong wrote: > > @@ -181,7 +181,7 @@ xfs_rtfind_back( > > return error; > > } > > bufp = bp->b_addr; > > - word = XFS_BLOCKWMASK(mp); > > + word = mp->m_blockwsize - 1; > > b = &bufp[word]; > > } else { > > /* > > @@ -227,7 +227,7 @@ xfs_rtfind_back( > > return error; > > } > > bufp = bp->b_addr; > > - word = XFS_BLOCKWMASK(mp); > > + word = mp->m_blockwsize - 1; > > b = &bufp[word]; > > } else { > > Random rambling: there is a fairly large chunk of code duplicated > here. Maybe the caching series and/or Dave's suggest args cleanup > would be good opportunity to refactor it. Same for the next two > clusters of two chunks. Yeah, Dave and I will have to figure out how to integrate these two. I might just pull in his rtalloc_args patch at the end of this series. --D > The patch itself looks good: > > Reviewed-by: Christoph Hellwig <hch@lst.de>
On Thu, Oct 12, 2023 at 11:20:30AM -0700, Darrick J. Wong wrote: > > Random rambling: there is a fairly large chunk of code duplicated > > here. Maybe the caching series and/or Dave's suggest args cleanup > > would be good opportunity to refactor it. Same for the next two > > clusters of two chunks. > > Yeah, Dave and I will have to figure out how to integrate these two. > I might just pull in his rtalloc_args patch at the end of this series. They way I understood his review of Omars patches isn't that he has a rtalloc_args patch, but suggest adding that structure. I can take care of that after your series and Omar has landed, together with the bitmap/summary access abstraction.
On Fri, Oct 13, 2023 at 07:53:24AM +0200, Christoph Hellwig wrote: > On Thu, Oct 12, 2023 at 11:20:30AM -0700, Darrick J. Wong wrote: > > > Random rambling: there is a fairly large chunk of code duplicated > > > here. Maybe the caching series and/or Dave's suggest args cleanup > > > would be good opportunity to refactor it. Same for the next two > > > clusters of two chunks. > > > > Yeah, Dave and I will have to figure out how to integrate these two. > > I might just pull in his rtalloc_args patch at the end of this series. > > They way I understood his review of Omars patches isn't that he > has a rtalloc_args patch, but suggest adding that structure. > > I can take care of that after your series and Omar has landed, together > with the bitmap/summary access abstraction. Ah. I stg import'd Dave's suggestionpatch and it more or less applied, so it's already in the work branch. It also reduced Omar's patchset quite a bit. --D
diff --git a/fs/xfs/libxfs/xfs_format.h b/fs/xfs/libxfs/xfs_format.h index 932e22e024d5b..dff9e654087b9 100644 --- a/fs/xfs/libxfs/xfs_format.h +++ b/fs/xfs/libxfs/xfs_format.h @@ -1213,8 +1213,6 @@ static inline bool xfs_dinode_has_large_extent_counts( #define XFS_BLOCKSIZE(mp) ((mp)->m_sb.sb_blocksize) #define XFS_BLOCKMASK(mp) ((mp)->m_blockmask) -#define XFS_BLOCKWSIZE(mp) ((mp)->m_blockwsize) -#define XFS_BLOCKWMASK(mp) ((mp)->m_blockwmask) /* * RT Summary and bit manipulation macros. diff --git a/fs/xfs/libxfs/xfs_rtbitmap.c b/fs/xfs/libxfs/xfs_rtbitmap.c index ce8736666a1ef..1f4886287aad0 100644 --- a/fs/xfs/libxfs/xfs_rtbitmap.c +++ b/fs/xfs/libxfs/xfs_rtbitmap.c @@ -181,7 +181,7 @@ xfs_rtfind_back( return error; } bufp = bp->b_addr; - word = XFS_BLOCKWMASK(mp); + word = mp->m_blockwsize - 1; b = &bufp[word]; } else { /* @@ -227,7 +227,7 @@ xfs_rtfind_back( return error; } bufp = bp->b_addr; - word = XFS_BLOCKWMASK(mp); + word = mp->m_blockwsize - 1; b = &bufp[word]; } else { /* @@ -345,7 +345,7 @@ xfs_rtfind_forw( * Go on to next block if that's where the next word is * and we need the next word. */ - if (++word == XFS_BLOCKWSIZE(mp) && i < len) { + if (++word == mp->m_blockwsize && i < len) { /* * If done with this block, get the previous one. */ @@ -390,7 +390,7 @@ xfs_rtfind_forw( * Go on to next block if that's where the next word is * and we need the next word. */ - if (++word == XFS_BLOCKWSIZE(mp) && i < len) { + if (++word == mp->m_blockwsize && i < len) { /* * If done with this block, get the next one. */ @@ -600,7 +600,7 @@ xfs_rtmodify_range( * Go on to the next block if that's where the next word is * and we need the next word. */ - if (++word == XFS_BLOCKWSIZE(mp) && i < len) { + if (++word == mp->m_blockwsize && i < len) { /* * Log the changed part of this block. * Get the next one. @@ -640,7 +640,7 @@ xfs_rtmodify_range( * Go on to the next block if that's where the next word is * and we need the next word. */ - if (++word == XFS_BLOCKWSIZE(mp) && i < len) { + if (++word == mp->m_blockwsize && i < len) { /* * Log the changed part of this block. * Get the next one. @@ -843,7 +843,7 @@ xfs_rtcheck_range( * Go on to next block if that's where the next word is * and we need the next word. */ - if (++word == XFS_BLOCKWSIZE(mp) && i < len) { + if (++word == mp->m_blockwsize && i < len) { /* * If done with this block, get the next one. */ @@ -889,7 +889,7 @@ xfs_rtcheck_range( * Go on to next block if that's where the next word is * and we need the next word. */ - if (++word == XFS_BLOCKWSIZE(mp) && i < len) { + if (++word == mp->m_blockwsize && i < len) { /* * If done with this block, get the next one. */ diff --git a/fs/xfs/libxfs/xfs_rtbitmap.h b/fs/xfs/libxfs/xfs_rtbitmap.h index e53011bc638d6..5f4a453e29eb6 100644 --- a/fs/xfs/libxfs/xfs_rtbitmap.h +++ b/fs/xfs/libxfs/xfs_rtbitmap.h @@ -109,7 +109,7 @@ xfs_rtx_to_rbmword( struct xfs_mount *mp, xfs_rtxnum_t rtx) { - return (rtx >> XFS_NBWORDLOG) & XFS_BLOCKWMASK(mp); + return (rtx >> XFS_NBWORDLOG) & (mp->m_blockwsize - 1); } /* Convert a file block offset in the rt bitmap file to an rt extent number. */