erofs-utils: lib: read i_ino in erofs_read_inode_from_disk()
authorJingbo Xu <jefflexu@linux.alibaba.com>
Wed, 16 Aug 2023 02:13:38 +0000 (10:13 +0800)
committerGao Xiang <hsiangkao@linux.alibaba.com>
Mon, 21 Aug 2023 00:01:19 +0000 (08:01 +0800)
i_ino[0] is a unique inode serial number in the erofs filesystem to
count inodes one by one, while i_ino[1] is a unique number identifying
the source inode in the source directory, which is usually derived from
st->st_ino.

Read on-disk ino and store it in i_ino[0] given the above background.

Fixes: 5e35b75ad499 ("erofs-utils: introduce fuse implementation")
Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Signed-off-by: Jingbo Xu <jefflexu@linux.alibaba.com>
Link: https://lore.kernel.org/r/20230816021347.126886-4-jefflexu@linux.alibaba.com
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
lib/namei.c

index 1023a9aa3dde2404594f15f89a7fcc6b13eb8e02..2bb1d4c764a5a1d1122b22f8f2bb24a34b162619 100644 (file)
@@ -60,6 +60,7 @@ int erofs_read_inode_from_disk(struct erofs_inode *vi)
                die = (struct erofs_inode_extended *)buf;
                vi->xattr_isize = erofs_xattr_ibody_size(die->i_xattr_icount);
                vi->i_mode = le16_to_cpu(die->i_mode);
+               vi->i_ino[0] = le32_to_cpu(die->i_ino);
 
                switch (vi->i_mode & S_IFMT) {
                case S_IFREG:
@@ -95,6 +96,7 @@ int erofs_read_inode_from_disk(struct erofs_inode *vi)
                vi->inode_isize = sizeof(struct erofs_inode_compact);
                vi->xattr_isize = erofs_xattr_ibody_size(dic->i_xattr_icount);
                vi->i_mode = le16_to_cpu(dic->i_mode);
+               vi->i_ino[0] = le32_to_cpu(dic->i_ino);
 
                switch (vi->i_mode & S_IFMT) {
                case S_IFREG: