Re: [PATCH 01/29] xfs: use unsigned ints for non-negative quantities in xfs_attr_remote.c

Darrick J. Wong
2024-04-02T16:25:31Z

On Tue, Apr 02, 2024 at 11:51:55AM +0200, Andrey Albershteyn wrote:
> On 2024-03-29 17:36:19, Darrick J. Wong wrote:
> > From: Darrick J. Wong <djwong@kernel.org>
> >
> > In the next few patches we're going to refactor the attr remote code so
> > that we can support headerless remote xattr values for storing merkle
> > tree blocks. For now, let's change the code to use unsigned int to
> > describe quantities of bytes and blocks that cannot be negative.
> >
> > Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> > ---
> > fs/xfs/libxfs/xfs_attr_remote.c | 54 ++++++++++++++++++++-------------------
> > fs/xfs/libxfs/xfs_attr_remote.h | 2 +
> > 2 files changed, 28 insertions(+), 28 deletions(-)
> >
> >
> > diff --git a/fs/xfs/libxfs/xfs_attr_remote.c b/fs/xfs/libxfs/xfs_attr_remote.c
> > index a8de9dc1e998a..c778a3a51792e 100644
> > --- a/fs/xfs/libxfs/xfs_attr_remote.c
> > +++ b/fs/xfs/libxfs/xfs_attr_remote.c
> > @@ -47,13 +47,13 @@
> > * Each contiguous block has a header, so it is not just a simple attribute
> > * length to FSB conversion.
> > */
> > -int
> > +unsigned int
> > xfs_attr3_rmt_blocks(
> > - struct xfs_mount *mp,
> > - int attrlen)
> > + struct xfs_mount *mp,
> > + unsigned int attrlen)
> > {
> > if (xfs_has_crc(mp)) {
> > - int buflen = XFS_ATTR3_RMT_BUF_SPACE(mp, mp->m_sb.sb_blocksize);
> > + unsigned int buflen = XFS_ATTR3_RMT_BUF_SPACE(mp, mp->m_sb.sb_blocksize);
> > return (attrlen + buflen - 1) / buflen;
> > }
> > return XFS_B_TO_FSB(mp, attrlen);
> > @@ -122,9 +122,9 @@ __xfs_attr3_rmt_read_verify(
>
> fsbsize in xfs_attr3_rmt_verify()?

Ah, yes, good catch. Fixed.

> Otherwise, looks good to me:
> Reviewed-by: Andrey Albershteyn <aalbersh@redhat.com>

Thanks!

--D

> --
> - Andrey
>
>