summaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2024-05-02 16:48:37 +0200
committerDarrick J. Wong <djwong@kernel.org>2024-05-02 16:48:37 +0200
commit3791a053294b037a6bf62df03480f5c5ddfd4d1b (patch)
treea35e688a2edcac3fff50913f9a7ad1d516bf5c14 /fs/xfs
parentxfs: create a helper to compute the blockcount of a max sized remote value (diff)
downloadlinux-3791a053294b037a6bf62df03480f5c5ddfd4d1b.tar.xz
linux-3791a053294b037a6bf62df03480f5c5ddfd4d1b.zip
xfs: minor cleanups of xfs_attr3_rmt_blocks
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>
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/libxfs/xfs_attr_remote.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/fs/xfs/libxfs/xfs_attr_remote.c b/fs/xfs/libxfs/xfs_attr_remote.c
index 043b837a3ef7..4c44ce1c8a64 100644
--- a/fs/xfs/libxfs/xfs_attr_remote.c
+++ b/fs/xfs/libxfs/xfs_attr_remote.c
@@ -56,19 +56,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);
}