diff options
author | Jingbo Xu <jefflexu@linux.alibaba.com> | 2023-06-09 17:02:25 +0800 |
---|---|---|
committer | Gao Xiang <hsiangkao@linux.alibaba.com> | 2023-06-12 16:46:15 +0800 |
commit | 363966dc60c196bff2f9feeb7d249245265d5f12 (patch) | |
tree | b368ed5d5629d5b96a0b955afc35910cd39137d9 | |
parent | 6a0a9f7b20a78c6e3a195abb8d8538742df1791b (diff) | |
download | erofs-utils-363966dc60c196bff2f9feeb7d249245265d5f12.tar.gz |
erofs-utils: mkfs: twist calculation of shared_xattr_id
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@linux.alibaba.com>
Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/20230609090225.91890-1-jefflexu@linux.alibaba.com
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
-rw-r--r-- | lib/xattr.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/xattr.c b/lib/xattr.c index 5e9e413..7d7dc54 100644 --- a/lib/xattr.c +++ b/lib/xattr.c @@ -722,8 +722,7 @@ int erofs_build_shared_xattrs_from_path(const char *path) }; item->next_shared_xattr = sorted_n[i + 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); |