diff --git a/Documentation/mkfs.btrfs.asciidoc b/Documentation/mkfs.btrfs.asciidoc index b3fef735..7ced7672 100644 --- a/Documentation/mkfs.btrfs.asciidoc +++ b/Documentation/mkfs.btrfs.asciidoc @@ -53,15 +53,28 @@ Specify the profile for the metadata block groups. Valid values are 'raid0', 'raid1', 'raid1c3', 'raid1c4', 'raid5', 'raid6', 'raid10', 'single' or 'dup' (case does not matter). + -Default on a single device filesystem is 'DUP', unless an SSD is detected, in which -case it will default to 'single'. The detection is based on the value of -`/sys/block/DEV/queue/rotational`, where 'DEV' is the short name of the device. +Default on a single device filesystem is 'DUP' and is recommended for metadata +in general. The duplication might not be necessary in some use cases and it's +up to the user to changed that at mkfs time or later. This depends on hardware +that could potentially deduplicate the blocks again but this cannot be detected +at mkfs time. + +[NOTE] +.NOTE +==== +Up to version 5.14 there was a detection of a SSD device (more precisely +if it's a rotational device, determined by the contents of file +`/sys/block/DEV/queue/rotational`) that used to select 'single'. This has +changed in version 5.15 to be always 'dup'. + Note that the rotational status can be arbitrarily set by the underlying block device driver and may not reflect the true status (network block device, memory-backed -SCSI devices etc). It's recommended to options '--data/--metadata' to avoid confusion. -+ +SCSI devices, real block device behind some additonal device mapper layer, +etc). It's recommended to always set the options '--data/--metadata' to avoid +confusion and unexpected results. + See 'DUP PROFILES ON A SINGLE DEVICE' for more details. +==== + On multiple devices the default is 'raid1'. diff --git a/mkfs/common.h b/mkfs/common.h index f31b4ae4..66c9d9d0 100644 --- a/mkfs/common.h +++ b/mkfs/common.h @@ -33,7 +33,6 @@ */ #define BTRFS_MKFS_DEFAULT_DATA_ONE_DEVICE 0 /* SINGLE */ #define BTRFS_MKFS_DEFAULT_META_ONE_DEVICE BTRFS_BLOCK_GROUP_DUP -#define BTRFS_MKFS_DEFAULT_META_ONE_DEVICE_SSD 0 /* SINGLE */ #define BTRFS_MKFS_DEFAULT_DATA_MULTI_DEVICE 0 /* SINGLE */ #define BTRFS_MKFS_DEFAULT_META_MULTI_DEVICE BTRFS_BLOCK_GROUP_RAID1 diff --git a/mkfs/main.c b/mkfs/main.c index 144316c5..9dd618ce 100644 --- a/mkfs/main.c +++ b/mkfs/main.c @@ -1131,19 +1131,10 @@ int BOX_MAIN(mkfs)(int argc, char **argv) u64 tmp; if (!metadata_profile_opt) { - if (dev_cnt == 1 && ssd && bconf.verbose) - printf("Detected a SSD, turning off metadata " - "duplication. Mkfs with -m dup if you want to " - "force metadata duplication.\n"); - - if (dev_cnt > 1) { + if (dev_cnt > 1) tmp = BTRFS_MKFS_DEFAULT_META_MULTI_DEVICE; - } else { - if (ssd) - tmp = BTRFS_MKFS_DEFAULT_META_ONE_DEVICE_SSD; - else - tmp = BTRFS_MKFS_DEFAULT_META_ONE_DEVICE; - } + else + tmp = BTRFS_MKFS_DEFAULT_META_ONE_DEVICE; metadata_profile = tmp; } if (!data_profile_opt) {