All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] btrfs-progs: mkfs: Warn user for minimal RAID5/6 devices setup
@ 2016-09-02  1:41 Qu Wenruo
  2016-09-02  1:41 ` [PATCH 2/2] btrfs-progs: Doc: Add warning for build RAID btrfs on partions from the same device Qu Wenruo
  2016-09-02  1:59 ` [PATCH 1/2] btrfs-progs: mkfs: Warn user for minimal RAID5/6 devices setup Steven Haigh
  0 siblings, 2 replies; 5+ messages in thread
From: Qu Wenruo @ 2016-09-02  1:41 UTC (permalink / raw)
  To: linux-btrfs

For RAID5, 2 devices setup is just RAID1 with more overhead.
For RAID6, 3 devices setup is RAID1 with 3 copies, not what most user
want.

So warn user at mkfs time for such case, and add explain in man pages.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
---
 Documentation/mkfs.btrfs.asciidoc | 15 +++++++++++----
 utils.c                           | 10 ++++++++--
 2 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/Documentation/mkfs.btrfs.asciidoc b/Documentation/mkfs.btrfs.asciidoc
index 98fe694..846c08f 100644
--- a/Documentation/mkfs.btrfs.asciidoc
+++ b/Documentation/mkfs.btrfs.asciidoc
@@ -263,18 +263,25 @@ There are the following block group types available:
 .2+^.<h| Profile   3+^.^h| Redundancy           .2+^.<h| Min/max devices
       ^.^h| Copies   ^.^h| Parity     ^.<h| Striping
 | single  | 1            |                |            | 1/any
-| DUP     | 2 / 1 device |                |            | 1/any ^(see note)^
+| DUP     | 2 / 1 device |                |            | 1/any ^(see note1)^
 | RAID0   |              |                | 1 to N     | 2/any
 | RAID1   | 2            |                |            | 2/any
 | RAID10  | 2            |                | 1 to N     | 4/any
-| RAID5   | 1            | 1              | 2 to N - 1 | 2/any
-| RAID6   | 1            | 2              | 3 to N - 2 | 3/any
+| RAID5   | 1            | 1              | 2 to N - 1 | 2/any ^(see note2)^
+| RAID6   | 1            | 2              | 3 to N - 2 | 3/any ^(see note3)^
 |=============================================================
 
-'Note:' DUP may exist on more than 1 device if it starts on a single device and
+'Note1:' DUP may exist on more than 1 device if it starts on a single device and
 another one is added. Since version 4.5.1, *mkfs.btrfs* will let you create DUP
 on multiple devices.
 
+'Note2:' It's not recommended to use 2 devices RAID5. In that case,
+parity stripe will contains the same data of data stripe, making RAID5 degraded
+to RAID1 with more overhead.
+
+'Note3:' It's also not recommended to use 3 devices RAID6, unless one wants to
+get 3 copies RAID1, which btrfs doesn't provide yet.
+
 DUP PROFILES ON A SINGLE DEVICE
 -------------------------------
 
diff --git a/utils.c b/utils.c
index 82f3376..1d6879a 100644
--- a/utils.c
+++ b/utils.c
@@ -3314,6 +3314,7 @@ int test_num_disk_vs_raid(u64 metadata_profile, u64 data_profile,
 	u64 dev_cnt, int mixed, int ssd)
 {
 	u64 allowed = 0;
+	u64 profile = metadata_profile | data_profile;
 
 	switch (dev_cnt) {
 	default:
@@ -3328,8 +3329,7 @@ int test_num_disk_vs_raid(u64 metadata_profile, u64 data_profile,
 		allowed |= BTRFS_BLOCK_GROUP_DUP;
 	}
 
-	if (dev_cnt > 1 &&
-	    ((metadata_profile | data_profile) & BTRFS_BLOCK_GROUP_DUP)) {
+	if (dev_cnt > 1 && profile & BTRFS_BLOCK_GROUP_DUP) {
 		warning("DUP is not recommended on filesystem with multiple devices");
 	}
 	if (metadata_profile & ~allowed) {
@@ -3349,6 +3349,12 @@ int test_num_disk_vs_raid(u64 metadata_profile, u64 data_profile,
 		return 1;
 	}
 
+	if (dev_cnt == 3 && profile & BTRFS_BLOCK_GROUP_RAID6) {
+		warning("RAID6 is not recommended on filesystem with 3 devices only");
+	}
+	if (dev_cnt == 2 && profile & BTRFS_BLOCK_GROUP_RAID5) {
+		warning("RAID5 is not recommended on filesystem with 2 devices only");
+	}
 	warning_on(!mixed && (data_profile & BTRFS_BLOCK_GROUP_DUP) && ssd,
 		   "DUP may not actually lead to 2 copies on the device, see manual page");
 
-- 
2.9.3




^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] btrfs-progs: Doc: Add warning for build RAID btrfs on partions from the same device
  2016-09-02  1:41 [PATCH 1/2] btrfs-progs: mkfs: Warn user for minimal RAID5/6 devices setup Qu Wenruo
@ 2016-09-02  1:41 ` Qu Wenruo
  2016-09-06 15:40   ` David Sterba
  2016-09-02  1:59 ` [PATCH 1/2] btrfs-progs: mkfs: Warn user for minimal RAID5/6 devices setup Steven Haigh
  1 sibling, 1 reply; 5+ messages in thread
From: Qu Wenruo @ 2016-09-02  1:41 UTC (permalink / raw)
  To: linux-btrfs

Quite a common sense for any RAID-like multi-device setup, just in case.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
---
 Documentation/mkfs.btrfs.asciidoc | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Documentation/mkfs.btrfs.asciidoc b/Documentation/mkfs.btrfs.asciidoc
index 846c08f..c291714 100644
--- a/Documentation/mkfs.btrfs.asciidoc
+++ b/Documentation/mkfs.btrfs.asciidoc
@@ -271,6 +271,10 @@ There are the following block group types available:
 | RAID6   | 1            | 2              | 3 to N - 2 | 3/any ^(see note3)^
 |=============================================================
 
+WARNING: It's not recommended to build btrfs with RAID0/1/10/5/6 prfiles on
+partitions from the same disk.
+Neither redundancy nor performance will be improved.
+
 'Note1:' DUP may exist on more than 1 device if it starts on a single device and
 another one is added. Since version 4.5.1, *mkfs.btrfs* will let you create DUP
 on multiple devices.
-- 
2.9.3




^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] btrfs-progs: mkfs: Warn user for minimal RAID5/6 devices setup
  2016-09-02  1:41 [PATCH 1/2] btrfs-progs: mkfs: Warn user for minimal RAID5/6 devices setup Qu Wenruo
  2016-09-02  1:41 ` [PATCH 2/2] btrfs-progs: Doc: Add warning for build RAID btrfs on partions from the same device Qu Wenruo
@ 2016-09-02  1:59 ` Steven Haigh
  2016-09-05 16:48   ` David Sterba
  1 sibling, 1 reply; 5+ messages in thread
From: Steven Haigh @ 2016-09-02  1:59 UTC (permalink / raw)
  To: linux-btrfs


[-- Attachment #1.1: Type: text/plain, Size: 3974 bytes --]

Is it worthwhile adding a note that RAID5 / RAID6 may very well eat your
data at this stage?

On 02/09/16 11:41, Qu Wenruo wrote:
> For RAID5, 2 devices setup is just RAID1 with more overhead.
> For RAID6, 3 devices setup is RAID1 with 3 copies, not what most user
> want.
> 
> So warn user at mkfs time for such case, and add explain in man pages.
> 
> Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
> ---
>  Documentation/mkfs.btrfs.asciidoc | 15 +++++++++++----
>  utils.c                           | 10 ++++++++--
>  2 files changed, 19 insertions(+), 6 deletions(-)
> 
> diff --git a/Documentation/mkfs.btrfs.asciidoc b/Documentation/mkfs.btrfs.asciidoc
> index 98fe694..846c08f 100644
> --- a/Documentation/mkfs.btrfs.asciidoc
> +++ b/Documentation/mkfs.btrfs.asciidoc
> @@ -263,18 +263,25 @@ There are the following block group types available:
>  .2+^.<h| Profile   3+^.^h| Redundancy           .2+^.<h| Min/max devices
>        ^.^h| Copies   ^.^h| Parity     ^.<h| Striping
>  | single  | 1            |                |            | 1/any
> -| DUP     | 2 / 1 device |                |            | 1/any ^(see note)^
> +| DUP     | 2 / 1 device |                |            | 1/any ^(see note1)^
>  | RAID0   |              |                | 1 to N     | 2/any
>  | RAID1   | 2            |                |            | 2/any
>  | RAID10  | 2            |                | 1 to N     | 4/any
> -| RAID5   | 1            | 1              | 2 to N - 1 | 2/any
> -| RAID6   | 1            | 2              | 3 to N - 2 | 3/any
> +| RAID5   | 1            | 1              | 2 to N - 1 | 2/any ^(see note2)^
> +| RAID6   | 1            | 2              | 3 to N - 2 | 3/any ^(see note3)^
>  |=============================================================
>  
> -'Note:' DUP may exist on more than 1 device if it starts on a single device and
> +'Note1:' DUP may exist on more than 1 device if it starts on a single device and
>  another one is added. Since version 4.5.1, *mkfs.btrfs* will let you create DUP
>  on multiple devices.
>  
> +'Note2:' It's not recommended to use 2 devices RAID5. In that case,
> +parity stripe will contains the same data of data stripe, making RAID5 degraded
> +to RAID1 with more overhead.
> +
> +'Note3:' It's also not recommended to use 3 devices RAID6, unless one wants to
> +get 3 copies RAID1, which btrfs doesn't provide yet.
> +
>  DUP PROFILES ON A SINGLE DEVICE
>  -------------------------------
>  
> diff --git a/utils.c b/utils.c
> index 82f3376..1d6879a 100644
> --- a/utils.c
> +++ b/utils.c
> @@ -3314,6 +3314,7 @@ int test_num_disk_vs_raid(u64 metadata_profile, u64 data_profile,
>  	u64 dev_cnt, int mixed, int ssd)
>  {
>  	u64 allowed = 0;
> +	u64 profile = metadata_profile | data_profile;
>  
>  	switch (dev_cnt) {
>  	default:
> @@ -3328,8 +3329,7 @@ int test_num_disk_vs_raid(u64 metadata_profile, u64 data_profile,
>  		allowed |= BTRFS_BLOCK_GROUP_DUP;
>  	}
>  
> -	if (dev_cnt > 1 &&
> -	    ((metadata_profile | data_profile) & BTRFS_BLOCK_GROUP_DUP)) {
> +	if (dev_cnt > 1 && profile & BTRFS_BLOCK_GROUP_DUP) {
>  		warning("DUP is not recommended on filesystem with multiple devices");
>  	}
>  	if (metadata_profile & ~allowed) {
> @@ -3349,6 +3349,12 @@ int test_num_disk_vs_raid(u64 metadata_profile, u64 data_profile,
>  		return 1;
>  	}
>  
> +	if (dev_cnt == 3 && profile & BTRFS_BLOCK_GROUP_RAID6) {
> +		warning("RAID6 is not recommended on filesystem with 3 devices only");
> +	}
> +	if (dev_cnt == 2 && profile & BTRFS_BLOCK_GROUP_RAID5) {
> +		warning("RAID5 is not recommended on filesystem with 2 devices only");
> +	}
>  	warning_on(!mixed && (data_profile & BTRFS_BLOCK_GROUP_DUP) && ssd,
>  		   "DUP may not actually lead to 2 copies on the device, see manual page");
>  
> 

-- 
Steven Haigh

Email: netwiz@crc.id.au
Web: https://www.crc.id.au
Phone: (03) 9001 6090 - 0412 935 897


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] btrfs-progs: mkfs: Warn user for minimal RAID5/6 devices setup
  2016-09-02  1:59 ` [PATCH 1/2] btrfs-progs: mkfs: Warn user for minimal RAID5/6 devices setup Steven Haigh
@ 2016-09-05 16:48   ` David Sterba
  0 siblings, 0 replies; 5+ messages in thread
From: David Sterba @ 2016-09-05 16:48 UTC (permalink / raw)
  To: Steven Haigh; +Cc: linux-btrfs

On Fri, Sep 02, 2016 at 11:59:07AM +1000, Steven Haigh wrote:
> Is it worthwhile adding a note that RAID5 / RAID6 may very well eat your
> data at this stage?

This depends on the kernel implementation, so it needs to take that into
account. There's a patchset in the works to automatically select mkfs
features based on kernel so a warning for features like raid56 will be
built on top of that.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] btrfs-progs: Doc: Add warning for build RAID btrfs on partions from the same device
  2016-09-02  1:41 ` [PATCH 2/2] btrfs-progs: Doc: Add warning for build RAID btrfs on partions from the same device Qu Wenruo
@ 2016-09-06 15:40   ` David Sterba
  0 siblings, 0 replies; 5+ messages in thread
From: David Sterba @ 2016-09-06 15:40 UTC (permalink / raw)
  To: Qu Wenruo; +Cc: linux-btrfs

On Fri, Sep 02, 2016 at 09:41:45AM +0800, Qu Wenruo wrote:
> Quite a common sense for any RAID-like multi-device setup, just in case.
> 
> Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>

Both applied, thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-09-06 15:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-02  1:41 [PATCH 1/2] btrfs-progs: mkfs: Warn user for minimal RAID5/6 devices setup Qu Wenruo
2016-09-02  1:41 ` [PATCH 2/2] btrfs-progs: Doc: Add warning for build RAID btrfs on partions from the same device Qu Wenruo
2016-09-06 15:40   ` David Sterba
2016-09-02  1:59 ` [PATCH 1/2] btrfs-progs: mkfs: Warn user for minimal RAID5/6 devices setup Steven Haigh
2016-09-05 16:48   ` David Sterba

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.