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>
};
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);