Skip to contentSkip to conversation

btrfs: Implement warning for commit values exceeding 300

PATCH In review [email protected] 4 participants 4 messages May 9, 2025 – May 12, 2025 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 btrfs: Implement warning for commit values exceeding 300

From: Kyoji Ogasawara <[email protected]>

The Btrfs documentation states that if the commit value is greater than 300 a warning should be issued. This commit implements that functionality. For more details, visit:
https://btrfs.readthedocs.io/en/latest/Administration.html#btrfs-specific-mount-options

Fixes 6941823cc878 ("btrfs: remove old mount API code")
---
 fs/btrfs/fs.h    | 1 +
 fs/btrfs/super.c | 4 ++++
 2 files changed, 5 insertions(+)
fs/btrfs/fs.h +1 -0
index bcca43046064..7baa2ed45198 100644
@@ -300,6 +300,7 @@ enum {
 #define BTRFS_FEATURE_INCOMPAT_SAFE_CLEAR		0ULL
 
 #define BTRFS_DEFAULT_COMMIT_INTERVAL	(30)
+#define BTRFS_WARNING_COMMIT_INTERVAL	(300)
 #define BTRFS_DEFAULT_MAX_INLINE	(2048)
 
 struct btrfs_dev_replace {
fs/btrfs/super.c +4 -0
index 7121d8c7a318..23e230052941 100644
@@ -569,6 +569,10 @@ static int btrfs_parse_param(struct fs_context *fc, struct fs_parameter *param)
 		break;
 	case Opt_commit_interval:
 		ctx->commit_interval = result.uint_32;
+		if (ctx->commit_interval > BTRFS_WARNING_COMMIT_INTERVAL) {
+			btrfs_warn(NULL, "excessive commit interval %u, use with care",
+				  ctx->commit_interval);
+		}
 		if (ctx->commit_interval == 0)
 			ctx->commit_interval = BTRFS_DEFAULT_COMMIT_INTERVAL;
 		break;
Signature · 1 line
2.49.0
Reviewed-by on v2 1/1
#1 lore raw
Quoted 9 lines · 在 2025/5/9 19:56, [email protected] 写道:

From: Kyoji Ogasawara <[email protected]>

The Btrfs documentation states that if the commit value is greater than 300 a warning should be issued. This commit implements that functionality. For more details, visit:
https://btrfs.readthedocs.io/en/latest/Administration.html#btrfs-specific-mount-options

Fixes 6941823cc878 ("btrfs: remove old mount API code")

Thanks,
Qu

Quoted 32 lines
---
  fs/btrfs/fs.h    | 1 +
  fs/btrfs/super.c | 4 ++++
  2 files changed, 5 insertions(+)
fs/btrfs/fs.h +1 -0
index bcca43046064..7baa2ed45198 100644
@@ -300,6 +300,7 @@ enum {
  #define BTRFS_FEATURE_INCOMPAT_SAFE_CLEAR		0ULL
 
  #define BTRFS_DEFAULT_COMMIT_INTERVAL	(30)
+#define BTRFS_WARNING_COMMIT_INTERVAL	(300)
  #define BTRFS_DEFAULT_MAX_INLINE	(2048)
 
  struct btrfs_dev_replace {
fs/btrfs/super.c +4 -0
index 7121d8c7a318..23e230052941 100644
@@ -569,6 +569,10 @@ static int btrfs_parse_param(struct fs_context *fc, struct fs_parameter *param)
  		break;
  	case Opt_commit_interval:
  		ctx->commit_interval = result.uint_32;
+		if (ctx->commit_interval > BTRFS_WARNING_COMMIT_INTERVAL) {
+			btrfs_warn(NULL, "excessive commit interval %u, use with care",
+				  ctx->commit_interval);
+		}
  		if (ctx->commit_interval == 0)
  			ctx->commit_interval = BTRFS_DEFAULT_COMMIT_INTERVAL;
  		break;
#3 lore raw
In reply to [email protected]
Quoted 9 lines · On Fri, May 09, 2025 at 07:26:31PM +0900, [email protected] wrote:

From: Kyoji Ogasawara <[email protected]>

The Btrfs documentation states that if the commit value is greater than 300 a warning should be issued. This commit implements that functionality. For more details, visit:
https://btrfs.readthedocs.io/en/latest/Administration.html#btrfs-specific-mount-options

Fixes 6941823cc878 ("btrfs: remove old mount API code")

Added to for-next, thanks.