[PATCH] erofs-utils: mkfs: twist calculation of shared_xattr_id
Jingbo Xu
jefflexu at linux.alibaba.com
Fri Jun 9 19:02:25 AEST 2023
The on-disk format specifies that share xattr can be addressed by:
xattr offset = xattr_blkaddr * block_size + 4 * shared_xattr_id
That is, the shared_xattr_id is calculated from the xattr offset
(starting from xattr_blkaddr) divided by 4. Make this semantics
explicitly by calculating the divisor from 'sizeof(__le32)'.
It has no logic change.
Signed-off-by: Jingbo Xu <jefflexu at linux.alibaba.com>
---
lib/xattr.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/lib/xattr.c b/lib/xattr.c
index dbe0519..1cd04cf 100644
--- a/lib/xattr.c
+++ b/lib/xattr.c
@@ -643,8 +643,7 @@ int erofs_build_shared_xattrs_from_path(const char *path)
.e_value_size = cpu_to_le16(item->len[1])
};
- item->shared_xattr_id = (off + p) /
- sizeof(struct erofs_xattr_entry);
+ item->shared_xattr_id = (off + p) / sizeof(__le32);
memcpy(buf + p, &entry, sizeof(entry));
p += sizeof(struct erofs_xattr_entry);
--
2.19.1.6.gb485710b
More information about the Linux-erofs
mailing list