Skip to content

Commit

Permalink
Copy a tree using parallel restore library.
Browse files Browse the repository at this point in the history
This tool compies a source tree (whether it's scoutfs or not)
into an offline scoutfs meta device. It has only those 2 parameters
and does a single-process walk of the tree to restore all items
while preservice as much of the metadata as possible.

Signed-off-by: Hunter Shaffer <[email protected]>
Signed-off-by: Auke Kok <[email protected]>
  • Loading branch information
aversecat committed Dec 17, 2024
1 parent ef36e4f commit a2364f2
Show file tree
Hide file tree
Showing 5 changed files with 1,127 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ BIN := src/createmany \
src/fragmented_data_extents \
src/o_tmpfile_umask \
src/o_tmpfile_linkat \
src/parallel_restore
src/parallel_restore \
src/restore_copy

DEPS := $(wildcard src/*.d)

Expand All @@ -26,6 +27,8 @@ endif

src/parallel_restore_cflags := ../utils/src/scoutfs_parallel_restore.a -lm
src/parallel_restore: ../utils/src/scoutfs_parallel_restore.a
src/restore_copy_cflags := ../utils/src/scoutfs_parallel_restore.a -lm
src/restore_copy : ../utils/src/scoutfs_parallel_restore.a

$(BIN): %: %.c Makefile
gcc $(CFLAGS) -MD -MP -MF $*.d $< -o $@ $($(@)_cflags)
Expand Down
64 changes: 64 additions & 0 deletions tests/golden/restore_copy
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
== restore_copy content verification
d /mnt/test/data/d
f /mnt/test/data/f
l /mnt/test/data/l -> broken
f /mnt/test/data/h
l /mnt/test/data/F -> f
b /mnt/test/data/b
c /mnt/test/data/c
c /mnt/test/data/u
p /mnt/test/data/p
f /mnt/test/data/f4096
f /mnt/test/data/falloc
f /mnt/test/data/truncate
s /mnt/test/data/s
f /mnt/test/data/mode_t
f /mnt/test/data/uidgid
f /mnt/test/data/retention
f /mnt/test/data/proj
d /mnt/test/data
Quota rule: 7 13,L,- 0,L,- 0,L,- I 33 -
Quota rule: 7 11,L,- 0,L,- 0,L,- I 33 -
Quota rule: 7 12,L,- 0,L,- 0,L,- I 33 -
Quota rule: 7 10,L,- 0,L,- 0,L,- I 33 -
Quota rule: 7 15,L,- 0,L,- 0,L,- I 33 -
Quota rule: 7 14,L,- 0,L,- 0,L,- I 33 -
Wrote 1 directories, 0 files, 458752 bytes total
== verify metadata bits on restored fs
total 16516
-rw-r--r--. 1 33333 33333 0 uidgid
crw-r--r--. 1 0 0 2, 2 u
-rw-r--r--. 1 0 0 16777216 truncate
srwxr-xr-x. 1 0 0 0 s
-rw-r--r--. 1 0 0 0 retention
-rw-r--r--. 1 0 0 0 proj
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--. 1 0 0 131072 falloc
-rw-r--r--. 1 0 0 4096 f4096
-rw-r--r--. 1 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
lrwxrwxrwx. 1 0 0 2 F -> f
1
12345
0: offset: 0 length: 1 flags: O.L
extents: 1
0: offset: 0 length: 32 flags: O.L
extents: 1
0: offset: 0 length: 4096 flags: O.L
extents: 1
7 15,L,- 0,L,- 0,L,- I 33 -
7 14,L,- 0,L,- 0,L,- I 33 -
7 13,L,- 0,L,- 0,L,- I 33 -
7 12,L,- 0,L,- 0,L,- I 33 -
7 11,L,- 0,L,- 0,L,- I 33 -
7 10,L,- 0,L,- 0,L,- I 33 -
Type Size Total Used Free Use%
MetaData 64KB 4194304 34698 4159606 0
Data 4KB 67108864 64 67108800 0
== umount restored fs and check
== cleanup
1 change: 1 addition & 0 deletions tests/sequence
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,5 @@ block-stale-reads.sh
inode-deletion.sh
renameat2-noreplace.sh
parallel_restore.sh
restore_copy.sh
xfstests.sh
Loading

0 comments on commit a2364f2

Please sign in to comment.