diff --git a/tests/golden/restore_copy b/tests/golden/restore_copy index 186b7e0d..a3144fec 100644 --- a/tests/golden/restore_copy +++ b/tests/golden/restore_copy @@ -35,10 +35,10 @@ srwxr-xr-x. 1 0 0 0 s prw-r--r--. 1 0 0 0 p -rwsrwsrwx. 1 0 0 0 mode_t lrwxrwxrwx. 1 0 0 7 l -> broken --rw-r--r--. 1 0 0 0 h +-rw-r--r--. 2 0 0 0 h -rw-r--r--. 1 0 0 131072 falloc -rw-r--r--. 1 0 0 4096 f4096 --rw-r--r--. 1 0 0 0 f +-rw-r--r--. 2 0 0 0 f drwxr-xr-x. 2 0 0 0 d crw-r--r--. 1 0 0 0, 0 c brw-r--r--. 1 0 0 1, 1 b diff --git a/tests/src/restore_copy.c b/tests/src/restore_copy.c index f474aa2d..f894bcfd 100644 --- a/tests/src/restore_copy.c +++ b/tests/src/restore_copy.c @@ -349,6 +349,7 @@ static struct scoutfs_parallel_restore_inode *read_inode_data(char *path, u64 in inode->ctime = st.st_ctim; inode->mtime = st.st_mtim; inode->size = st.st_size; + inode->nlink = st.st_nlink; inode->rdev = st.st_rdev; diff --git a/utils/src/parallel_restore.c b/utils/src/parallel_restore.c index e575011c..8ca7fde4 100644 --- a/utils/src/parallel_restore.c +++ b/utils/src/parallel_restore.c @@ -813,7 +813,7 @@ static spr_err_t insert_inode_items(struct scoutfs_parallel_restore_writer *wri, si->next_readdir_pos = 0; si->next_xattr_id = cpu_to_le64(inode->nr_xattrs + 1); si->version = cpu_to_le64(1); - si->nlink = cpu_to_le32(1); + si->nlink = cpu_to_le32(inode->nlink ? inode->nlink : 1); si->uid = cpu_to_le32(inode->uid); si->gid = cpu_to_le32(inode->gid); si->mode = cpu_to_le32(inode->mode); diff --git a/utils/src/parallel_restore.h b/utils/src/parallel_restore.h index 51fcf4b2..8865e842 100644 --- a/utils/src/parallel_restore.h +++ b/utils/src/parallel_restore.h @@ -58,6 +58,7 @@ struct scoutfs_parallel_restore_inode { u64 data_version; u64 size; bool offline; + u32 nlink; /* only used for directories */ u64 nr_subdirs;