btrfs-progs: cmds: filesystem: introduce reflink command
Subsystems (2)
RFC PATCH 1/1 btrfs-progs: cmds: filesystem: introduce reflink command
Hi, I'm trying to handle btrfs-progs issue #396. This is incomplete code for solving problem. Because it doesn't copy file properies like compression. I read some code in btrfs-props/props.h but it seems that there is no convenient way to copy props. Is there any good way to copy props? Thanks for reading.
This patch handles btrfs-progs issue #396. This command does a reflink from A to B and copies its fileattrs. And it can make reflink with source ranges to target ranges. This code gets paths and ranges of both source and targets. it make reflink by calling ioctl FICLONERANGE and also it copies fileattrs.
--- Makefile | 2 +- cmds/commands.h | 1 + cmds/filesystem-reflink.c | 124 +++++++++++++++++++++++++++ cmds/filesystem-reflink.c~ | 73 ++++++++++++++++ cmds/filesystem.c | 1 + cmds/inspect-dump-fiemap.c~ | 0 cmds/inspect-dump-file-extents.c~ | 135 ++++++++++++++++++++++++++++++ 7 files changed, 335 insertions(+), 1 deletion(-) create mode 100644 cmds/filesystem-reflink.c create mode 100644 cmds/filesystem-reflink.c~ create mode 100644 cmds/inspect-dump-fiemap.c~ create mode 100644 cmds/inspect-dump-file-extents.c~
Makefile +1 -1
@@ -156,7 +156,7 @@ cmds_objects = cmds/subvolume.o cmds/filesystem.o cmds/device.o cmds/scrub.o \ cmds/restore.o cmds/rescue.o cmds/rescue-chunk-recover.o \ cmds/rescue-super-recover.o \ cmds/property.o cmds/filesystem-usage.o cmds/inspect-dump-tree.o \ - cmds/inspect-dump-super.o cmds/inspect-tree-stats.o cmds/filesystem-du.o \ + cmds/inspect-dump-super.o cmds/inspect-tree-stats.o cmds/filesystem-du.o cmds/filesystem-reflink.o \ mkfs/common.o check/mode-common.o check/mode-lowmem.o libbtrfs_objects = common/send-stream.o common/send-utils.o kernel-lib/rbtree.o btrfs-list.o \ kernel-lib/radix-tree.o common/extent-cache.o kernel-shared/extent_io.o \
cmds/commands.h +1 -0
@@ -133,6 +133,7 @@ DECLARE_COMMAND(subvolume);DECLARE_COMMAND (filesystem);DECLARE_COMMAND (filesystem_du);DECLARE_COMMAND (filesystem_usage); +DECLARE_COMMAND (filesystem_reflink);DECLARE_COMMAND (balance);DECLARE_COMMAND (device);DECLARE_COMMAND (scrub);
cmds/filesystem-reflink.c new file +124 -0
124 lines not on this page · raw message
cmds/filesystem-reflink.c~ new file +73 -0
73 lines not on this page · raw message
cmds/filesystem.c +1 -0
@@ -1381,6 +1381,7 @@ static const struct cmd_group filesystem_cmd_group = { &cmd_struct_filesystem_resize, &cmd_struct_filesystem_label, &cmd_struct_filesystem_usage, + &cmd_struct_filesystem_reflink, NULL } };
cmds/inspect-dump-fiemap.c~ new file +0 -0
cmds/inspect-dump-file-extents.c~ new file +135 -0
135 lines not on this page · raw message
Signature · 1 line
2.25.1