Re: [PATCH 26/32] xfs: split out handle management helpers a bit

Darrick J. Wong
2024-04-10T22:01:42Z

On Tue, Apr 09, 2024 at 10:56:06PM -0700, Christoph Hellwig wrote:
> > + handle->ha_fid.fid_len = sizeof(struct xfs_fid) -
> > + sizeof(handle->ha_fid.fid_len);
>
> If we clean this up anyway, maybe add a helper for the above calculation
> and share it with xfs_khandle_to_dentry?

Done:

static inline size_t
xfs_filehandle_fid_len(void)
{
struct xfs_handle *handle = NULL;

return sizeof(struct xfs_fid) - sizeof(handle->ha_fid.fid_len);
}

static inline size_t
xfs_filehandle_init(
struct xfs_mount *mp,
xfs_ino_t ino,
uint32_t gen,
struct xfs_handle *handle)
{
memcpy(&handle->ha_fsid, mp->m_fixedfsid, sizeof(struct xfs_fsid));

handle->ha_fid.fid_len = xfs_filehandle_fid_len();
...
}

> Otherwise looks good:
>
> Reviewed-by: Christoph Hellwig <hch@lst.de>

Thanks!

--D