]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: minor cleanups of xfs_attr3_rmt_blocks
authorDarrick J. Wong <djwong@kernel.org>
Mon, 29 Jul 2024 23:22:57 +0000 (16:22 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 30 Jul 2024 00:01:05 +0000 (17:01 -0700)
Source kernel commit: 3791a053294b037a6bf62df03480f5c5ddfd4d1b

Clean up the type signature of this function since we don't have
negative attr lengths or block counts.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Andrey Albershteyn <aalbersh@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
libxfs/xfs_attr_remote.c

index 58078465bf316e75871a9f986b93054b9556b96e..a048aa5f2cdb8b5736b43922d08fe0d6ab598c9e 100644 (file)
@@ -55,19 +55,19 @@ xfs_attr3_rmt_buf_space(
        return blocksize;
 }
 
-/*
- * Each contiguous block has a header, so it is not just a simple attribute
- * length to FSB conversion.
- */
+/* Compute number of fsblocks needed to store a remote attr value */
 unsigned int
 xfs_attr3_rmt_blocks(
        struct xfs_mount        *mp,
        unsigned int            attrlen)
 {
-       if (xfs_has_crc(mp)) {
-               unsigned int buflen = xfs_attr3_rmt_buf_space(mp);
-               return (attrlen + buflen - 1) / buflen;
-       }
+       /*
+        * Each contiguous block has a header, so it is not just a simple
+        * attribute length to FSB conversion.
+        */
+       if (xfs_has_crc(mp))
+               return howmany(attrlen, xfs_attr3_rmt_buf_space(mp));
+
        return XFS_B_TO_FSB(mp, attrlen);
 }