Skip to contentSkip to conversation

btrfs: Add nossd_spread mount option

PATCH Superseded Howard McLauchlan 4 participants 5 messages Feb 21, 2018 – Mar 7, 2018 Btrfs file system

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 btrfs: Add nossd_spread mount option

Btrfs has two mount options for SSD optimizations: ssd and ssd_spread. Presently there is an option to disable all SSD optimizations, but there isn't an option to disable just ssd_spread.

This patch adds a mount option nossd_spread that disables ssd_spread only.

---
 fs/btrfs/super.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
fs/btrfs/super.c +9 -4
index 6e71a2a78363..4c0fcf5b3e7e 100644
@@ -310,10 +310,10 @@ static void btrfs_put_super(struct super_block *sb)
 enum {
 	Opt_degraded, Opt_subvol, Opt_subvolid, Opt_device, Opt_nodatasum,
 	Opt_nodatacow, Opt_max_inline, Opt_alloc_start, Opt_nobarrier, Opt_ssd,
-	Opt_nossd, Opt_ssd_spread, Opt_thread_pool, Opt_noacl, Opt_compress,
-	Opt_compress_type, Opt_compress_force, Opt_compress_force_type,
-	Opt_notreelog, Opt_ratio, Opt_flushoncommit, Opt_discard,
-	Opt_space_cache, Opt_space_cache_version, Opt_clear_cache,
+	Opt_nossd, Opt_ssd_spread, Opt_nossd_spread, Opt_thread_pool, Opt_noacl,
+	Opt_compress, Opt_compress_type, Opt_compress_force,
+	Opt_compress_force_type, Opt_notreelog, Opt_ratio, Opt_flushoncommit,
+	Opt_discard, Opt_space_cache, Opt_space_cache_version, Opt_clear_cache,
 	Opt_user_subvol_rm_allowed, Opt_enospc_debug, Opt_subvolrootid,
 	Opt_defrag, Opt_inode_cache, Opt_no_space_cache, Opt_recovery,
 	Opt_skip_balance, Opt_check_integrity,
@@ -353,6 +353,7 @@ static const match_table_t tokens = {
 	{Opt_ssd, "ssd"},
 	{Opt_ssd_spread, "ssd_spread"},
 	{Opt_nossd, "nossd"},
+	{Opt_nossd_spread, "nossd_spread"},
 	{Opt_acl, "acl"},
 	{Opt_noacl, "noacl"},
 	{Opt_notreelog, "notreelog"},
@@ -582,6 +583,10 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
 			btrfs_clear_and_info(info, SSD_SPREAD,
 					     "not using spread ssd allocation scheme");
 			break;
+		case Opt_nossd_spread:
+			btrfs_clear_and_info(info, SSD_SPREAD,
+					     "not using spread ssd allocation scheme");
+			break;
 		case Opt_barrier:
 			btrfs_clear_and_info(info, NOBARRIER,
 					     "turning on barriers");
Signature · 1 line
2.14.1
#1 lore raw
Quoted 32 lines · Howard McLauchlan

Btrfs has two mount options for SSD optimizations: ssd and ssd_spread. Presently there is an option to disable all SSD optimizations, but there isn't an option to disable just ssd_spread.

This patch adds a mount option nossd_spread that disables ssd_spread only.

---
 fs/btrfs/super.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
fs/btrfs/super.c +4 -4
index 6e71a2a78363..4c0fcf5b3e7e 100644
@@ -310,10 +310,10 @@ static void btrfs_put_super(struct super_block *sb)
 enum {
 	Opt_degraded, Opt_subvol, Opt_subvolid, Opt_device, Opt_nodatasum,
 	Opt_nodatacow, Opt_max_inline, Opt_alloc_start, Opt_nobarrier, Opt_ssd,
-	Opt_nossd, Opt_ssd_spread, Opt_thread_pool, Opt_noacl, Opt_compress,
-	Opt_compress_type, Opt_compress_force, Opt_compress_force_type,
-	Opt_notreelog, Opt_ratio, Opt_flushoncommit, Opt_discard,
-	Opt_space_cache, Opt_space_cache_version, Opt_clear_cache,
+	Opt_nossd, Opt_ssd_spread, Opt_nossd_spread, Opt_thread_pool, Opt_noacl,
+	Opt_compress, Opt_compress_type, Opt_compress_force,
+	Opt_compress_force_type, Opt_notreelog, Opt_ratio, Opt_flushoncommit,
+	Opt_discard, Opt_space_cache, Opt_space_cache_version, Opt_clear_cache,
 	Opt_user_subvol_rm_allowed, Opt_enospc_debug, Opt_subvolrootid,
 	Opt_defrag, Opt_inode_cache, Opt_no_space_cache, Opt_recovery,
 	Opt_skip_balance, Opt_check_integrity,

fs/btrfs/super.c static const match_table_t tokens = { · line 359

Quoted 7 lines
fs/btrfs/super.c +1 -0
@@ -353,6 +353,7 @@ static const match_table_t tokens = {
 	{Opt_ssd, "ssd"},
 	{Opt_ssd_spread, "ssd_spread"},
 	{Opt_nossd, "nossd"},
+	{Opt_nossd_spread, "nossd_spread"},
 	{Opt_acl, "acl"},
 	{Opt_noacl, "noacl"},
 	{Opt_notreelog, "notreelog"},

.oO(Why doesn't the enum just have one option per line, so the changelog is less invasive?)

fs/btrfs/super.c int btrfs_parse_options(struct btrfs_fs_info *info, char *options, · line 592

Quoted 12 lines
fs/btrfs/super.c +4 -0
@@ -582,6 +583,10 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
 			btrfs_clear_and_info(info, SSD_SPREAD,
 					     "not using spread ssd allocation scheme");
 			break;
+		case Opt_nossd_spread:
+			btrfs_clear_and_info(info, SSD_SPREAD,
+					     "not using spread ssd allocation scheme");
+			break;
 		case Opt_barrier:
 			btrfs_clear_and_info(info, NOBARRIER,
 					     "turning on barriers");

Related:
* https://www.spinics.net/lists/linux-btrfs/msg64247.html
* https://www.spinics.net/lists/linux-btrfs/msg64277.html
* https://www.spinics.net/lists/linux-btrfs/msg64499.html

Apparently that discussion never resulted in actual changes, so thanks for continuing it now.

The mount options are a bit weird, because ssd_spread also includes ssd, but doesn't show it.

I personally don't like all of them at all, and I should really finish and send my proposal to get them replaced by options that can choose extent allocator for data and metadata individually (instead of some setting that changes them both at the same time) because there are proper real life situations that e.g. benefit from nossd style 'tetris' data allocator with ssd_spread style 'contiguous' metadata extent allocator.

Signature · 1 line
Hans van Kranenburg
#2 lore raw
Quoted 68 lines · Hans van Kranenburg
Quoted 32 lines · Howard McLauchlan

Btrfs has two mount options for SSD optimizations: ssd and ssd_spread. Presently there is an option to disable all SSD optimizations, but there isn't an option to disable just ssd_spread.

This patch adds a mount option nossd_spread that disables ssd_spread only.

---
 fs/btrfs/super.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
fs/btrfs/super.c +4 -4
index 6e71a2a78363..4c0fcf5b3e7e 100644
@@ -310,10 +310,10 @@ static void btrfs_put_super(struct super_block *sb)
 enum {
 	Opt_degraded, Opt_subvol, Opt_subvolid, Opt_device, Opt_nodatasum,
 	Opt_nodatacow, Opt_max_inline, Opt_alloc_start, Opt_nobarrier, Opt_ssd,
-	Opt_nossd, Opt_ssd_spread, Opt_thread_pool, Opt_noacl, Opt_compress,
-	Opt_compress_type, Opt_compress_force, Opt_compress_force_type,
-	Opt_notreelog, Opt_ratio, Opt_flushoncommit, Opt_discard,
-	Opt_space_cache, Opt_space_cache_version, Opt_clear_cache,
+	Opt_nossd, Opt_ssd_spread, Opt_nossd_spread, Opt_thread_pool, Opt_noacl,
+	Opt_compress, Opt_compress_type, Opt_compress_force,
+	Opt_compress_force_type, Opt_notreelog, Opt_ratio, Opt_flushoncommit,
+	Opt_discard, Opt_space_cache, Opt_space_cache_version, Opt_clear_cache,
 	Opt_user_subvol_rm_allowed, Opt_enospc_debug, Opt_subvolrootid,
 	Opt_defrag, Opt_inode_cache, Opt_no_space_cache, Opt_recovery,
 	Opt_skip_balance, Opt_check_integrity,

fs/btrfs/super.c static const match_table_t tokens = { · line 359

Quoted 7 lines
fs/btrfs/super.c +1 -0
@@ -353,6 +353,7 @@ static const match_table_t tokens = {
 	{Opt_ssd, "ssd"},
 	{Opt_ssd_spread, "ssd_spread"},
 	{Opt_nossd, "nossd"},
+	{Opt_nossd_spread, "nossd_spread"},
 	{Opt_acl, "acl"},
 	{Opt_noacl, "noacl"},
 	{Opt_notreelog, "notreelog"},

.oO(Why doesn't the enum just have one option per line, so the changelog is less invasive?)

fs/btrfs/super.c int btrfs_parse_options(struct btrfs_fs_info *info, char *options, · line 592

Quoted 12 lines
fs/btrfs/super.c +4 -0
@@ -582,6 +583,10 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
 			btrfs_clear_and_info(info, SSD_SPREAD,
 					     "not using spread ssd allocation scheme");
 			break;
+		case Opt_nossd_spread:
+			btrfs_clear_and_info(info, SSD_SPREAD,
+					     "not using spread ssd allocation scheme");
+			break;
 		case Opt_barrier:
 			btrfs_clear_and_info(info, NOBARRIER,
 					     "turning on barriers");

Related:
* https://urldefense.proofpoint.com/v2/url?u=https-3A__www.spinics.net_lists_linux-2Dbtrfs_msg64247.html&d=DwIDaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=UA4c4GV4shA70-jKB4kwcF99U6K6bzKVYdicFvu-DtQ&m=oYU5SWdFSoawOXAWRYLqZvvDYpROHFkzMQLlAZEehaU&s=0LRSD37KWUOyo_i9ypRAaZrv7_8R_kJ0yHv9vNoqDB4&e=
* https://urldefense.proofpoint.com/v2/url?u=https-3A__www.spinics.net_lists_linux-2Dbtrfs_msg64277.html&d=DwIDaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=UA4c4GV4shA70-jKB4kwcF99U6K6bzKVYdicFvu-DtQ&m=oYU5SWdFSoawOXAWRYLqZvvDYpROHFkzMQLlAZEehaU&s=WB_Fyhm3SDx3XdaE71X6aYRxonuk0Q8Jr4f1ai6K2dI&e=
* https://urldefense.proofpoint.com/v2/url?u=https-3A__www.spinics.net_lists_linux-2Dbtrfs_msg64499.html&d=DwIDaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=UA4c4GV4shA70-jKB4kwcF99U6K6bzKVYdicFvu-DtQ&m=oYU5SWdFSoawOXAWRYLqZvvDYpROHFkzMQLlAZEehaU&s=FcKlny0UlOCTWEfvCgEz_QtGnYI20EiDF3weQVKPyDs&e=

Apparently that discussion never resulted in actual changes, so thanks for continuing it now.

The mount options are a bit weird, because ssd_spread also includes ssd, but doesn't show it.

Quoted 7 lines

I personally don't like all of them at all, and I should really finish and send my proposal to get them replaced by options that can choose extent allocator for data and metadata individually (instead of some setting that changes them both at the same time) because there are proper real life situations that e.g. benefit from nossd style 'tetris' data allocator with ssd_spread style 'contiguous' metadata extent allocator.

I agree; this change is just something very specific that came up in prod for us, so I decided to push a patch for it.

Reviewed-by on v1 1/1
#3 lore raw
In reply to Howard McLauchlan
Quoted 8 lines · Howard McLauchlan

Btrfs has two mount options for SSD optimizations: ssd and ssd_spread. Presently there is an option to disable all SSD optimizations, but there isn't an option to disable just ssd_spread.

This patch adds a mount option nossd_spread that disables ssd_spread only.

Thanks,

Josef

#4 lore raw
In reply to Howard McLauchlan
Quoted 40 lines · Howard McLauchlan

Btrfs has two mount options for SSD optimizations: ssd and ssd_spread. Presently there is an option to disable all SSD optimizations, but there isn't an option to disable just ssd_spread.

This patch adds a mount option nossd_spread that disables ssd_spread only.

---
 fs/btrfs/super.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
fs/btrfs/super.c +5 -4
index 6e71a2a78363..4c0fcf5b3e7e 100644
@@ -310,10 +310,10 @@ static void btrfs_put_super(struct super_block *sb)
 enum {
 	Opt_degraded, Opt_subvol, Opt_subvolid, Opt_device, Opt_nodatasum,
 	Opt_nodatacow, Opt_max_inline, Opt_alloc_start, Opt_nobarrier, Opt_ssd,
-	Opt_nossd, Opt_ssd_spread, Opt_thread_pool, Opt_noacl, Opt_compress,
-	Opt_compress_type, Opt_compress_force, Opt_compress_force_type,
-	Opt_notreelog, Opt_ratio, Opt_flushoncommit, Opt_discard,
-	Opt_space_cache, Opt_space_cache_version, Opt_clear_cache,
+	Opt_nossd, Opt_ssd_spread, Opt_nossd_spread, Opt_thread_pool, Opt_noacl,
+	Opt_compress, Opt_compress_type, Opt_compress_force,
+	Opt_compress_force_type, Opt_notreelog, Opt_ratio, Opt_flushoncommit,
+	Opt_discard, Opt_space_cache, Opt_space_cache_version, Opt_clear_cache,
 	Opt_user_subvol_rm_allowed, Opt_enospc_debug, Opt_subvolrootid,
 	Opt_defrag, Opt_inode_cache, Opt_no_space_cache, Opt_recovery,
 	Opt_skip_balance, Opt_check_integrity,
@@ -353,6 +353,7 @@ static const match_table_t tokens = {
 	{Opt_ssd, "ssd"},
 	{Opt_ssd_spread, "ssd_spread"},
 	{Opt_nossd, "nossd"},
+	{Opt_nossd_spread, "nossd_spread"},
 	{Opt_acl, "acl"},
 	{Opt_noacl, "noacl"},
 	{Opt_notreelog, "notreelog"},

fs/btrfs/super.c int btrfs_parse_options(struct btrfs_fs_info *info, char *options, · line 588

Quoted 6 lines
fs/btrfs/super.c +3 -0
@@ -582,6 +583,10 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
 			btrfs_clear_and_info(info, SSD_SPREAD,
 					     "not using spread ssd allocation scheme");
 			break;
+		case Opt_nossd_spread:
+			btrfs_clear_and_info(info, SSD_SPREAD,
+					     "not using spread ssd allocation scheme");

The message is the same as above adn the 2 cases can be merged.

Quoted 11 lines
fs/btrfs/super.c +1 -0
+			break;
 		case Opt_barrier:
 			btrfs_clear_and_info(info, NOBARRIER,
 					     "turning on barriers");
Signature · 6 lines
2.14.1

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html