btrfs-progs: Support in-band de-duplication
Subsystems (3)
v5 cover btrfs-progs: Support in-band de-duplication
Preparation patchset for incoming (aimed for 4.6) kernel in-band de-duplication patchset.
New kernel dedup will has 2 different dedup backends and a ioctl interface to enable/disable dedup.
The ioctl interface and on-disk format (mostly) is determined, so submit this patchset first before de-duplication first.
The patchset can also be fetched from github:
https://github.com/adam900710/btrfs-progs.git dedup_20160205
v2:
Better objectid/offset format for dedup hash items
Output hash for dedup hash items
v3:
Keep dedup tree objectid and ro_flag the same with kernal, since the tree objectid 11 and ro_flag 1 are all taken by space cache tree v2.
Add dedup property support.
v4:
Better debug tree output for dedup tree
Update document to keep consist with new default values.
v5:
Minor documentation modification for 'btrfs dedup enable'
Qu Wenruo (7):
btrfs-progs: Basic framework for dedup command group
btrfs-progs: dedup: Add enable command for dedup command group
btrfs-progs: dedup: Add disable support for inband deduplication
btrfs-progs: dedup: Add status subcommand
btrfs-progs: Add dedup feature for mkfs and convert
btrfs-progs: Add show-super support for new DEDUP flag
btrfs-progs: debug-tree: Add dedup tree support
Wang Xiaoguang (1):
btrfs-progs: property: add a dedup property
Documentation/Makefile.in | 1 + Documentation/btrfs-dedup.asciidoc | 126 ++++++++++++++ Documentation/btrfs-property.asciidoc | 2 + Documentation/btrfs.asciidoc | 4 + Documentation/mkfs.btrfs.asciidoc | 9 + Makefile.in | 2 +- btrfs-convert.c | 19 ++- btrfs-debug-tree.c | 4 + btrfs-show-super.c | 17 ++ btrfs.c | 1 + cmds-dedup.c | 304 ++++++++++++++++++++++++++++++++++ commands.h | 2 + ctree.h | 42 ++++- dedup.h | 42 +++++ ioctl.h | 23 +++ mkfs.c | 8 +- print-tree.c | 94 +++++++++++ props.c | 73 ++++++++ utils.c | 47 ++++-- utils.h | 7 +- 20 files changed, 802 insertions(+), 25 deletions(-) create mode 100644 Documentation/btrfs-dedup.asciidoc create mode 100644 cmds-dedup.c create mode 100644 dedup.h
Signature · 1 line
2.7.0
PATCH v5 1/8 btrfs-progs: Basic framework for dedup command group
Add basic ioctl header and command group framework for later use. Alone with basic man page doc.
--- Documentation/Makefile.in | 1 + Documentation/btrfs-dedup.asciidoc | 39 +++++++++++++++++++++++++++++++ Documentation/btrfs.asciidoc | 4 ++++ Makefile.in | 2 +- btrfs.c | 1 + cmds-dedup.c | 48 ++++++++++++++++++++++++++++++++++++++ commands.h | 2 ++ ctree.h | 35 ++++++++++++++++++++++++++- dedup.h | 42 +++++++++++++++++++++++++++++++++ ioctl.h | 21 +++++++++++++++++ 10 files changed, 193 insertions(+), 2 deletions(-) create mode 100644 Documentation/btrfs-dedup.asciidoc create mode 100644 cmds-dedup.c create mode 100644 dedup.h
Documentation/Makefile.in +1 -0
@@ -30,6 +30,7 @@ MAN8_TXT += btrfs-qgroup.asciidoc MAN8_TXT += btrfs-replace.asciidoc MAN8_TXT += btrfs-restore.asciidoc MAN8_TXT += btrfs-property.asciidoc +MAN8_TXT += btrfs-dedup.asciidoc # Category 5 manual page MAN5_TXT += btrfs-man5.asciidoc
Documentation/btrfs-dedup.asciidoc new file +39 -0
@@ -0,0 +1,39 @@ +btrfs-dedup(8) +============== + +NAME +---- +btrfs-dedup - manage in-band (write time) de-duplication of a btrfs filesystem + +SYNOPSIS +-------- +*btrfs dedup* <subcommand> <args> + +DESCRIPTION +----------- +*btrfs dedup* is used to enable/disable or show current in-band de-duplication +status of a btrfs filesystem. + +Kernel support for in-band de-duplication starts from 4.6. + +WARNING: In-band de-duplication is still an experimental feautre of btrfs, +use with caution. + +SUBCOMMAND +---------- +Nothing yet + +EXIT STATUS +----------- +*btrfs dedup* returns a zero exit status if it succeeds. Non zero is +returned in case of failure. + +AVAILABILITY +------------ +*btrfs* is part of btrfs-progs. +Please refer to the btrfs wiki http://btrfs.wiki.kernel.org for +further details. + +SEE ALSO +-------- +`mkfs.btrfs`(8),
Documentation/btrfs.asciidoc +4 -0
@@ -43,6 +43,10 @@ COMMANDS Do off-line check on a btrfs filesystem. + See `btrfs-check`(8) for details. +*dedup*:: + Control btrfs in-band(write time) de-duplication. + + See `btrfs-dedup`(8) for details. + *device*:: Manage devices managed by btrfs, including add/delete/scan and so on. +
Makefile.in +1 -1
@@ -75,7 +75,7 @@ cmds_objects = cmds-subvolume.o cmds-filesystem.o cmds-device.o cmds-scrub.o \ cmds-inspect.o cmds-balance.o cmds-send.o cmds-receive.o \ cmds-quota.o cmds-qgroup.o cmds-replace.o cmds-check.o \ cmds-restore.o cmds-rescue.o chunk-recover.o super-recover.o \ - cmds-property.o cmds-fi-usage.o + cmds-property.o cmds-fi-usage.o cmds-dedup.o libbtrfs_objects = send-stream.o send-utils.o rbtree.o btrfs-list.o crc32c.o \ uuid-tree.o utils-lib.o rbtree-utils.o libbtrfs_headers = send-stream.h send-utils.h send.h rbtree.h btrfs-list.h \
btrfs.c +1 -0
@@ -199,6 +199,7 @@ static const struct cmd_group btrfs_cmd_group = { { "receive", cmd_receive, cmd_receive_usage, NULL, 0 }, { "quota", cmd_quota, NULL, "a_cmd_group, 0 }, { "qgroup", cmd_qgroup, NULL, &qgroup_cmd_group, 0 }, + { "dedup", cmd_dedup, NULL, &dedup_cmd_group, 0 }, { "replace", cmd_replace, NULL, &replace_cmd_group, 0 }, { "help", cmd_help, cmd_help_usage, NULL, 0 }, { "version", cmd_version, cmd_version_usage, NULL, 0 },
cmds-dedup.c new file +48 -0
48 lines not on this page · raw message
commands.h +2 -0
@@ -93,6 +93,7 @@ extern const struct cmd_group inspect_cmd_group;extern const struct cmd_group property_cmd_group;extern const struct cmd_group quota_cmd_group;extern const struct cmd_group qgroup_cmd_group; +extern const struct cmd_group dedup_cmd_group;extern const struct cmd_group replace_cmd_group;extern const struct cmd_group rescue_cmd_group;
@@ -118,6 +119,7 @@ int cmd_send(int argc, char **argv);int cmd_receive (int argc,char **argv);int cmd_quota (int argc,char **argv);int cmd_qgroup (int argc,char **argv); +int cmd_dedup (int argc,char **argv);int cmd_replace (int argc,char **argv);int cmd_restore (int argc,char **argv);int cmd_select_super (int argc,char **argv);
ctree.h +34 -1
@@ -457,6 +457,7 @@ struct btrfs_super_block {* ones specified below then we will fail to mount */ #define BTRFS_FEATURE_COMPAT_RO_FREE_SPACE_TREE (1ULL << 0) +#define BTRFS_FEATURE_COMPAT_RO_DEDUP (1ULL << 1)#define BTRFS_FEATURE_INCOMPAT_MIXED_BACKREF (1ULL << 0)#define BTRFS_FEATURE_INCOMPAT_DEFAULT_SUBVOL (1ULL << 1)
@@ -483,7 +484,9 @@ struct btrfs_super_block {#define BTRFS_FEATURE_COMPAT_SUPP 0ULL -#define BTRFS_FEATURE_COMPAT_RO_SUPP 0ULL +#define BTRFS_FEATURE_COMPAT_RO_SUPP \ + (BTRFS_FEATURE_COMPAT_RO_DEDUP | \ + BTRFS_FEATURE_COMPAT_RO_DEDUP)#define BTRFS_FEATURE_INCOMPAT_SUPP \ (BTRFS_FEATURE_INCOMPAT_MIXED_BACKREF | \
@@ -834,6 +837,23 @@ struct btrfs_csum_item {u8 csum; } __attribute__ ((__packed__)); +struct btrfs_dedup_status_item { +__le64 blocksize; +__le64 limit_nr; +__le16 hash_type; +__le16 backend; +} __attribute__ ((__packed__ )); + +struct btrfs_dedup_hash_item { +/* on disk length of dedup range */ +__le64 len; + +/* Spare space */ +u8 __unused[16 ]; + +/* Hash follows */ +} __attribute__ ((__packed__ )); +/* * We don't want to overwrite 1M at the beginning of device, even though * there is our 1st superblock at 64k. Some possible reasons:
@@ -2072,6 +2092,19 @@ static inline unsigned long btrfs_leaf_data(struct extent_buffer *l)return offsetof(struct btrfs_leaf , items); } +/* btrfs_dedup_status */ +BTRFS_SETGET_FUNCS(dedup_status_blocksize, struct btrfs_dedup_status_item, + blocksize,64 ); +BTRFS_SETGET_FUNCS(dedup_status_limit, struct btrfs_dedup_status_item, + limit_nr,64 ); +BTRFS_SETGET_FUNCS(dedup_status_hash_type, struct btrfs_dedup_status_item, + hash_type,16 ); +BTRFS_SETGET_FUNCS(dedup_status_backend, struct btrfs_dedup_status_item, + backend,16 ); + +/* btrfs_dedup_hash_item */ +BTRFS_SETGET_FUNCS(dedup_hash_len, struct btrfs_dedup_hash_item, len, 64); +/* struct btrfs_file_extent_item */ BTRFS_SETGET_FUNCS(file_extent_type, struct btrfs_file_extent_item, type, 8); BTRFS_SETGET_STACK_FUNCS(stack_file_extent_type, struct btrfs_file_extent_item, type, 8);
dedup.h new file +42 -0
42 lines not on this page · raw message
ioctl.h +21 -0
@@ -492,6 +492,27 @@ struct btrfs_ioctl_get_dev_stats {__u64 unused[128 -2 -BTRFS_DEV_STAT_VALUES_MAX ];/* pad to 1k */ }; +/* +* de-duplication control modes +* For re-config, enable will handle it +*/ +#define BTRFS_DEDUP_CTL_ENABLE 1 +#define BTRFS_DEDUP_CTL_DISABLE 2 +#define BTRFS_DEDUP_CTL_STATUS 3 +#define BTRFS_DEDUP_CTL_LAST 4 +struct btrfs_ioctl_dedup_args { +__u16 cmd;/* In: command(see above macro) */ +__u64 blocksize;/* In/Out: For enable/status */ +__u64 limit_nr;/* In/Out: For enable/status */ +__u64 limit_mem;/* In/Out: For enable/status */ +__u64 current_nr;/* Out: For status output */ +__u16 backend;/* In/Out: For enable/status */ +__u16 hash_type;/* In/Out: For enable/status */ +u8 status;/* Out: For status output */ +/* pad to 512 bytes */ +u8 __unused[473 ]; +}; +/* BTRFS_IOC_SNAP_CREATE is no longer used by the btrfs command */ #define BTRFS_QUOTA_CTL_ENABLE 1#define BTRFS_QUOTA_CTL_DISABLE 2
Signature · 1 line
2.7.0
PATCH v5 2/8 btrfs-progs: dedup: Add enable command for dedup command group
In reply to Qu WenruoAdd enable subcommand for dedup commmand group.
--- Documentation/btrfs-dedup.asciidoc | 81 +++++++++++++++++++++- cmds-dedup.c | 138 +++++++++++++++++++++++++++++++++++++ ioctl.h | 2 + 3 files changed, 220 insertions(+), 1 deletion(-)
Documentation/btrfs-dedup.asciidoc +80 -1
@@ -21,7 +21,86 @@ use with caution. SUBCOMMAND ---------- -Nothing yet +*enable* [options] <path>:: +Enable in-band de-duplication for a filesystem. ++ +`Options` ++ +-s|--storage-backend <BACKEND>:::: +Specify de-duplication hash storage backend. +Supported backends are 'ondisk' and 'inmemory'. +If not specified, default value is 'inmemory'. ++ +Refer to *BACKENDS* sector for more information. + +-b|--blocksize <BLOCKSIZE>:::: +Specify dedup block size. +Supported values are power of 2 from '16K' to '8M'. +Default value is '128K'. ++ +Refer to *BLOCKSIZE* sector for more information. + +-a|--hash-algorithm <HASH>:::: +Specify hash algorithm. +Only 'sha256' is supported yet. + +-l|--limit-hash <LIMIT>:::: +Specify maximum number of hashes stored in memory. +Only works for 'inmemory' backend. +Conflicts with '-m' option. +Default value is '32K' if using 'inmemory' backend. + +-m|--limit-memory <LIMIT>:::: +Specify maximum memory used for hashes. +Only works for 'inmemory' backend. +Conflicts with '-l' option. +No default value. + +BACKENDS +-------- +Btrfs in-band de-duplication support two different backends with their own +features. + +In-memory backend:: +This backend can be used on old btrfs(without '-O dedup' mkfs option) with +newer kernel(4.6+). +When used on old btrfs, this backend must be re-enabled after umount. ++ +Designed for speed, in-memory backend will keep all dedup hash in memory. +And only keeps a limit of number of hash in memory. +Hashes over the limit will be dropped following Last-Recent-Use behavior. +So this backend has a consistent overhead for given limit but can't ensure +any all duplicated blocks will be de-duplicated. ++ +After umount and mount, in-memory backend need to refill its hash table. + +On-disk backend:: +This backend needs '-O dedup' mkfs option to enable. ++ +Designed for de-duplication rate, on-disk backend will keep dedup hash on disk. +This behavior may cause extra disk IO for de-duplication under high memory +pressure, but will have a much higher dedup rate. ++ +After umount and mount, on-disk backend still has its hash on disk, no need to +refill its dedup hash table. + +BLOCKSIZE +--------- +Block in-band de-duplication is done at block size unit. +Any data smaller than dedup block size won't go through the dedup backends. + +Smaller block size will cause more fragments and lower performance, but a +higher dedup rate. + +Larger block size will cause less fragments and higher performance, but a +lower dedup rate. + +In-band de-duplication rate is highly related to the workload pattern. +So it's highly recommended to align de-duplication blocksize to the workload +blocksize to make full use of de-duplication. + +And blocksize larger than 128K will cause compression unavailable, as +compression only support maximum extent size of 128K. EXIT STATUS -----------
cmds-dedup.c +138 -0
152 lines not on this page · raw message
ioctl.h +2 -0
@@ -724,6 +724,8 @@ static inline char *btrfs_err_str(enum btrfs_err_code err_code) struct btrfs_ioctl_dev_replace_args)#define BTRFS_IOC_FILE_EXTENT_SAME _IOWR(BTRFS_IOCTL_MAGIC, 54, \ struct btrfs_ioctl_same_args) +#define BTRFS_IOC_DEDUP_CTL _IOWR(BTRFS_IOCTL_MAGIC, 55, \ + struct btrfs_ioctl_dedup_args)#define BTRFS_IOC_GET_FEATURES _IOR(BTRFS_IOCTL_MAGIC, 57, \ struct btrfs_ioctl_feature_flags)#define BTRFS_IOC_SET_FEATURES _IOW(BTRFS_IOCTL_MAGIC, 57, \
Signature · 1 line
2.7.0
PATCH v5 3/8 btrfs-progs: dedup: Add disable support for inband deduplication
In reply to Qu WenruoAdd disable subcommand for dedup command group.
--- Documentation/btrfs-dedup.asciidoc | 5 +++++ cmds-dedup.c | 42 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+)
Documentation/btrfs-dedup.asciidoc +5 -0
@@ -21,6 +21,11 @@ use with caution. SUBCOMMAND ---------- +*disable* <path>:: +Disable in-band de-duplication for a filesystem. ++ +This will trash all stored dedup hash. ++ *enable* [options] <path>:: Enable in-band de-duplication for a filesystem. +
cmds-dedup.c +42 -0
51 lines not on this page · raw message
Signature · 1 line
2.7.0
PATCH v5 4/8 btrfs-progs: dedup: Add status subcommand
In reply to Qu WenruoAdd status subcommand for dedup command group.
--- Documentation/btrfs-dedup.asciidoc | 3 ++ cmds-dedup.c | 76 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+)
Documentation/btrfs-dedup.asciidoc +3 -0
@@ -61,6 +61,9 @@ Only works for 'inmemory' backend. Conflicts with '-l' option. No default value. +*status* <path>:: +Show current in-band de-duplication status of a filesystem. + BACKENDS -------- Btrfs in-band de-duplication support two different backends with their own
cmds-dedup.c +76 -0
87 lines not on this page · raw message
Signature · 1 line
2.7.0
PATCH v5 5/8 btrfs-progs: Add dedup feature for mkfs and convert
In reply to Qu WenruoAdd new DEDUP ro compat flag and corresponding mkfs/convert flag 'dedup'.
Since dedup tree is completely isolated from fs tree, so even old kernel could do read mount.
So add it to RO compat flag instead of common incompat flags
--- Documentation/mkfs.btrfs.asciidoc | 9 ++++++++ btrfs-convert.c | 19 +++++++++++----- mkfs.c | 8 +++++-- utils.c | 47 +++++++++++++++++++++++++++++---------- utils.h | 7 +++--- 5 files changed, 67 insertions(+), 23 deletions(-)
Documentation/mkfs.btrfs.asciidoc +9 -0
@@ -208,6 +208,15 @@ reduced-size metadata for extent references, saves a few percent of metadata improved representation of file extents where holes are not explicitly stored as an extent, saves a few percent of metadata if sparse files are used +*dedup*:: +allow btrfs to use new on-disk format designed for in-band(write time) +de-duplication. ++ +on-disk storage backend and persist de-duplication status needs this feature. ++ +this feature is RO compat feature, means old kernel can still mount it +read-only. + BLOCK GROUPS, CHUNKS, RAID --------------------------
btrfs-convert.c +13 -6
@@ -2453,7 +2453,7 @@ static int convert_open_fs(const char *devname,static int do_convert (const char *devname,int datacsum,int packing,int noxattr,u32 nodesize,int copylabel,const char *fslabel,int progress, -u64 features) +u64 features,u64 ro_features) {int i, ret, blocks_per_node;int fd =-1 ;
@@ -2504,8 +2504,9 @@ static int do_convert(const char *devname, int datacsum, int packing, int noxattfprintf (stderr,"unable to open %s\n" , devname); goto fail; } -btrfs_parse_features_to_string (features_buf, features); -if (features ==BTRFS_MKFS_DEFAULT_FEATURES ) +btrfs_parse_features_to_string (features_buf, features, ro_features); +if (features ==BTRFS_MKFS_DEFAULT_FEATURES && + ro_features ==0 )strcat (features_buf," (default)" );printf ("create btrfs filesystem:\n" );
@@ -2521,6 +2522,7 @@ static int do_convert(const char *devname, int datacsum, int packing, int noxatt mkfs_cfg.sectorsize = blocksize; mkfs_cfg.stripesize = blocksize; mkfs_cfg.features = features; + mkfs_cfg.ro_features = ro_features; ret =make_btrfs (fd, &mkfs_cfg);if (ret) {
@@ -3071,6 +3073,7 @@ int main(int argc, char *argv[])char *file;char fslabel[BTRFS_LABEL_SIZE ];u64 features =BTRFS_MKFS_DEFAULT_FEATURES ; +u64 ro_features =0 ;while (1 ) {enum {GETOPT_VAL_NO_PROGRESS =256 };
@@ -3129,7 +3132,8 @@ int main(int argc, char *argv[])char *orig =strdup (optarg);char *tmp = orig; - tmp =btrfs_parse_fs_features (tmp, &features); + tmp =btrfs_parse_fs_features (tmp, &features, + &ro_features);if (tmp) { fprintf(stderr, "Unrecognized filesystem feature '%s'\n",
@@ -3147,7 +3151,9 @@ int main(int argc, char *argv[])char buf[64 ];btrfs_parse_features_to_string (buf, - features & ~BTRFS_CONVERT_ALLOWED_FEATURES ); + features & + ~BTRFS_CONVERT_ALLOWED_FEATURES , + ro_features);fprintf (stderr,"ERROR: features not allowed for convert: %s\n" , buf);
@@ -3198,7 +3204,8 @@ int main(int argc, char *argv[]) ret =do_rollback (file); }else { ret =do_convert (file, datacsum, packing, noxattr, nodesize, - copylabel, fslabel, progress, features); + copylabel, fslabel, progress, features, + ro_features); }if (ret)return 1 ;
mkfs.c +6 -2
@@ -1369,6 +1369,7 @@ int main(int ac, char **av)int saved_optind;char fs_uuid[BTRFS_UUID_UNPARSED_SIZE ] = {0 };u64 features =BTRFS_MKFS_DEFAULT_FEATURES ; +u64 ro_features =0 ;struct mkfs_allocation allocation = {0 };struct btrfs_mkfs_config mkfs_cfg;
@@ -1431,7 +1432,8 @@ int main(int ac, char **av)char *orig =strdup (optarg);char *tmp = orig; - tmp =btrfs_parse_fs_features (tmp, &features); + tmp =btrfs_parse_fs_features (tmp, &features, + &ro_features);if (tmp) { fprintf(stderr, "Unrecognized filesystem feature '%s'\n",
@@ -1674,6 +1676,7 @@ int main(int ac, char **av) mkfs_cfg.sectorsize = sectorsize; mkfs_cfg.stripesize = stripesize; mkfs_cfg.features = features; + mkfs_cfg.ro_features = ro_features; ret =make_btrfs (fd, &mkfs_cfg);if (ret) {
@@ -1828,7 +1831,8 @@ raid_groups:btrfs_group_profile_str (metadata_profile), pretty_size(allocation.system));printf ("SSD detected: %s\n" , ssd ?"yes" :"no" ); -btrfs_parse_features_to_string (features_buf, features); +btrfs_parse_features_to_string (features_buf, features, + ro_features);printf ("Incompat features: %s" , features_buf);printf ("\n" );
utils.c +35 -12
121 lines not on this page · raw message
utils.h +4 -3
@@ -102,9 +102,9 @@ void units_set_mode(unsigned *units, unsigned mode);void units_set_base (unsigned *units,unsigned base);void btrfs_list_all_fs_features (u64 mask_disallowed); -char *btrfs_parse_fs_features (char *namelist,u64 *flags); -void btrfs_process_fs_features (u64 flags); -void btrfs_parse_features_to_string (char *buf,u64 flags); +char *btrfs_parse_fs_features (char *namelist,u64 *flags,u64 *ro_flags); +void btrfs_process_fs_features (u64 flags,u64 ro_flags); +void btrfs_parse_features_to_string (char *buf,u64 flags,u64 ro_flags);struct btrfs_mkfs_config {char *label;
@@ -119,6 +119,7 @@ struct btrfs_mkfs_config {/* Super bytenr after make_btrfs */ u64 super_bytenr; +u64 ro_features; };int make_btrfs (int fd,struct btrfs_mkfs_config *cfg);
Signature · 1 line
2.7.0
PATCH v5 6/8 btrfs-progs: Add show-super support for new DEDUP flag
In reply to Qu WenruoNow btrfs-show-super can handle DEDUP ro compat flag.
--- btrfs-show-super.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
btrfs-show-super.c +17 -0
@@ -328,6 +328,15 @@ struct readable_flag_entry {u64 bit;char *output; }; +#define DEF_RO_COMPAT_FLAG_ENTRY (bit_name) \ + {BTRFS_FEATURE_COMPAT_RO_##bit_name, #bit_name} + +struct readable_flag_entry ro_compat_flags_array[] = { +DEF_RO_COMPAT_FLAG_ENTRY (DEDUP ) +}; + +static const int ro_compat_flags_num =sizeof (ro_compat_flags_array) / +sizeof (struct readable_flag_entry );#define DEF_INCOMPAT_FLAG_ENTRY (bit_name) \ {BTRFS_FEATURE_INCOMPAT_##bit_name, #bit_name}
@@ -400,6 +409,13 @@ static void __print_readable_flag(u64 flag, struct readable_flag_entry *array,printf (")\n" ); } +static void print_readable_ro_compat_flag (u64 ro_flag) +{ +return __print_readable_flag (ro_flag, ro_compat_flags_array, + ro_compat_flags_num, +BTRFS_FEATURE_COMPAT_RO_SUPP ); +} +static void print_readable_incompat_flag (u64 flag) { return __print_readable_flag(flag, incompat_flags_array,
@@ -491,6 +507,7 @@ static void dump_superblock(struct btrfs_super_block *sb, int full) (unsigned long long)btrfs_super_compat_flags(sb));printf ("compat_ro_flags\t\t0x%llx\n" , (unsigned long long )btrfs_super_compat_ro_flags (sb)); +print_readable_ro_compat_flag (btrfs_super_compat_ro_flags (sb));printf ("incompat_flags\t\t0x%llx\n" , (unsigned long long )btrfs_super_incompat_flags (sb));print_readable_incompat_flag (btrfs_super_incompat_flags (sb));
Signature · 1 line
2.7.0
PATCH v5 7/8 btrfs-progs: debug-tree: Add dedup tree support
In reply to Qu WenruoAdd dedup tree support for btrfs-debug-tree.
---
v2:
Add support to print hex objectid/offset for dedup hash. Add support to print hex hash.
--- btrfs-debug-tree.c | 4 +++ ctree.h | 7 ++++ print-tree.c | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 105 insertions(+)
btrfs-debug-tree.c +4 -0
@@ -408,6 +408,10 @@ again:printf ("multiple" ); }break ; +case BTRFS_DEDUP_TREE_OBJECTID : +if (!skip) +printf ("dedup" ); +break ;default :if (!skip) {printf ("file" );
ctree.h +7 -0
@@ -79,6 +79,9 @@ struct btrfs_free_space_ctl;/* tracks free space in block groups. */ #define BTRFS_FREE_SPACE_TREE_OBJECTID 10ULL +/* on-disk dedup tree (EXPERIMENTAL) */ +#define BTRFS_DEDUP_TREE_OBJECTID 11ULL +/* for storing balance parameters in the root tree */ #define BTRFS_BALANCE_OBJECTID -4ULL
@@ -1216,6 +1219,10 @@ struct btrfs_root {#define BTRFS_DEV_ITEM_KEY 216#define BTRFS_CHUNK_ITEM_KEY 228 +#define BTRFS_DEDUP_STATUS_ITEM_KEY 230 +#define BTRFS_DEDUP_HASH_ITEM_KEY 231 +#define BTRFS_DEDUP_BYTENR_ITEM_KEY 232 +#define BTRFS_BALANCE_ITEM_KEY 248/*
print-tree.c +94 -0
147 lines not on this page · raw message
Signature · 1 line
2.7.0
PATCH v5 8/8 btrfs-progs: property: add a dedup property
In reply to Qu WenruoFrom: Wang Xiaoguang <[email protected]>
Normally if we enable online dedup for a fs, it's filesystem wide de-duplication. With this property, we can explicitly disable data de-duplication for specified files.
--- Documentation/btrfs-property.asciidoc | 2 + props.c | 73 +++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+)
Documentation/btrfs-property.asciidoc +2 -0
@@ -44,6 +44,8 @@ label:::: label of device compression:::: compression setting for an inode: lzo, zlib, or "" (empty string) +dedup:::: +online dedup setting for an inode: disable or "" (empty string) *list* [-t <type>] <object>:: Lists available properties with their descriptions for the given object.
props.c +73 -0
84 lines not on this page · raw message
Signature · 1 line
2.7.0