From 1f918def34ee95c2fdcc4981b1badf6d1b0260bc Mon Sep 17 00:00:00 2001 From: David Sterba Date: Wed, 29 Sep 2021 15:12:21 +0200 Subject: [PATCH] btrfs-progs: mkfs: enable NO_HOLES by default The no-holes feature reduces consumption of metadata by not representing file holes. Reducing metadata is a good thing in general, this is the main goal to enable this by default. There's a drawback, related to the missing information about holes. The 'check' tool cannot use it to cross-reference extent information and in some cases may not be able to detect a problem. The no-hole feature can be also enabled by 'btrfstune -n' on an unmounted filesystem. Issue: #405 Signed-off-by: David Sterba --- Documentation/mkfs.btrfs.asciidoc | 2 +- common/fsfeatures.c | 2 +- common/fsfeatures.h | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Documentation/mkfs.btrfs.asciidoc b/Documentation/mkfs.btrfs.asciidoc index b8fcecd1..0380e82f 100644 --- a/Documentation/mkfs.btrfs.asciidoc +++ b/Documentation/mkfs.btrfs.asciidoc @@ -241,7 +241,7 @@ are selected reduced-size metadata for extent references, saves a few percent of metadata *no-holes*:: -(kernel support since 3.14) +(default since btrfs-progs 5.15, kernel support since 3.14) + 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 diff --git a/common/fsfeatures.c b/common/fsfeatures.c index c1b3bbb2..e48d8892 100644 --- a/common/fsfeatures.c +++ b/common/fsfeatures.c @@ -110,7 +110,7 @@ static const struct btrfs_feature mkfs_features[] = { .sysfs_name = "no_holes", VERSION_TO_STRING2(compat, 3,14), VERSION_TO_STRING2(safe, 4,0), - VERSION_NULL(default), + VERSION_TO_STRING2(default, 5,15), .desc = "no explicit hole extents for files" }, { .name = "raid1c34", diff --git a/common/fsfeatures.h b/common/fsfeatures.h index f8588800..ec452bc3 100644 --- a/common/fsfeatures.h +++ b/common/fsfeatures.h @@ -22,6 +22,7 @@ #define BTRFS_MKFS_DEFAULT_NODE_SIZE SZ_16K #define BTRFS_MKFS_DEFAULT_FEATURES \ (BTRFS_FEATURE_INCOMPAT_EXTENDED_IREF \ + | BTRFS_FEATURE_INCOMPAT_NO_HOLES \ | BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA) /*