Message ID | 20241211085636.1380516-4-hch@lst.de (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [01/43] xfs: constify feature checks | expand |
On Wed, Dec 11, 2024 at 09:54:28AM +0100, Christoph Hellwig wrote: > Shortcut dereferencing the xg_block_count field in the generic group > structure. > > Signed-off-by: Christoph Hellwig <hch@lst.de> Looks good, though I imagine there are a few more places where you could use this helper? Reviewed-by: "Darrick J. Wong" <djwong@kernel.org> --D > --- > fs/xfs/libxfs/xfs_rtgroup.c | 2 +- > fs/xfs/libxfs/xfs_rtgroup.h | 5 +++++ > 2 files changed, 6 insertions(+), 1 deletion(-) > > diff --git a/fs/xfs/libxfs/xfs_rtgroup.c b/fs/xfs/libxfs/xfs_rtgroup.c > index d84d32f1b48f..97aad8967149 100644 > --- a/fs/xfs/libxfs/xfs_rtgroup.c > +++ b/fs/xfs/libxfs/xfs_rtgroup.c > @@ -270,7 +270,7 @@ xfs_rtgroup_get_geometry( > /* Fill out form. */ > memset(rgeo, 0, sizeof(*rgeo)); > rgeo->rg_number = rtg_rgno(rtg); > - rgeo->rg_length = rtg_group(rtg)->xg_block_count; > + rgeo->rg_length = rtg_blocks(rtg); > xfs_rtgroup_geom_health(rtg, rgeo); > return 0; > } > diff --git a/fs/xfs/libxfs/xfs_rtgroup.h b/fs/xfs/libxfs/xfs_rtgroup.h > index de4eeb381fc9..0e1d9474ab77 100644 > --- a/fs/xfs/libxfs/xfs_rtgroup.h > +++ b/fs/xfs/libxfs/xfs_rtgroup.h > @@ -66,6 +66,11 @@ static inline xfs_rgnumber_t rtg_rgno(const struct xfs_rtgroup *rtg) > return rtg->rtg_group.xg_gno; > } > > +static inline xfs_rgblock_t rtg_blocks(const struct xfs_rtgroup *rtg) > +{ > + return rtg->rtg_group.xg_block_count; > +} > + > static inline struct xfs_inode *rtg_bitmap(const struct xfs_rtgroup *rtg) > { > return rtg->rtg_inodes[XFS_RTGI_BITMAP]; > -- > 2.45.2 > >
On Thu, Dec 12, 2024 at 01:12:25PM -0800, Darrick J. Wong wrote: > On Wed, Dec 11, 2024 at 09:54:28AM +0100, Christoph Hellwig wrote: > > Shortcut dereferencing the xg_block_count field in the generic group > > structure. > > > > Signed-off-by: Christoph Hellwig <hch@lst.de> > > Looks good, though I imagine there are a few more places where you could > use this helper? While the zoned code uses it a lot, there are surprisingly few uses in your baseline. But when reassuring me I noticed your recently added RT-aware failure notifier could use it, so at least one more.
On Fri, Dec 13, 2024 at 06:00:46AM +0100, Christoph Hellwig wrote: > On Thu, Dec 12, 2024 at 01:12:25PM -0800, Darrick J. Wong wrote: > > On Wed, Dec 11, 2024 at 09:54:28AM +0100, Christoph Hellwig wrote: > > > Shortcut dereferencing the xg_block_count field in the generic group > > > structure. > > > > > > Signed-off-by: Christoph Hellwig <hch@lst.de> > > > > Looks good, though I imagine there are a few more places where you could > > use this helper? > > While the zoned code uses it a lot, there are surprisingly few uses > in your baseline. But when reassuring me I noticed your recently added > RT-aware failure notifier could use it, so at least one more. <nod> Well at least it's an easy enough cleanup after all the dust settles. :) --D
diff --git a/fs/xfs/libxfs/xfs_rtgroup.c b/fs/xfs/libxfs/xfs_rtgroup.c index d84d32f1b48f..97aad8967149 100644 --- a/fs/xfs/libxfs/xfs_rtgroup.c +++ b/fs/xfs/libxfs/xfs_rtgroup.c @@ -270,7 +270,7 @@ xfs_rtgroup_get_geometry( /* Fill out form. */ memset(rgeo, 0, sizeof(*rgeo)); rgeo->rg_number = rtg_rgno(rtg); - rgeo->rg_length = rtg_group(rtg)->xg_block_count; + rgeo->rg_length = rtg_blocks(rtg); xfs_rtgroup_geom_health(rtg, rgeo); return 0; } diff --git a/fs/xfs/libxfs/xfs_rtgroup.h b/fs/xfs/libxfs/xfs_rtgroup.h index de4eeb381fc9..0e1d9474ab77 100644 --- a/fs/xfs/libxfs/xfs_rtgroup.h +++ b/fs/xfs/libxfs/xfs_rtgroup.h @@ -66,6 +66,11 @@ static inline xfs_rgnumber_t rtg_rgno(const struct xfs_rtgroup *rtg) return rtg->rtg_group.xg_gno; } +static inline xfs_rgblock_t rtg_blocks(const struct xfs_rtgroup *rtg) +{ + return rtg->rtg_group.xg_block_count; +} + static inline struct xfs_inode *rtg_bitmap(const struct xfs_rtgroup *rtg) { return rtg->rtg_inodes[XFS_RTGI_BITMAP];
Shortcut dereferencing the xg_block_count field in the generic group structure. Signed-off-by: Christoph Hellwig <hch@lst.de> --- fs/xfs/libxfs/xfs_rtgroup.c | 2 +- fs/xfs/libxfs/xfs_rtgroup.h | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-)