]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
btrfs: add back warning for mount option commit values exceeding 300
authorKyoji Ogasawara <sawara04.o@gmail.com>
Fri, 9 May 2025 10:26:31 +0000 (19:26 +0900)
committerDavid Sterba <dsterba@suse.com>
Mon, 12 May 2025 19:39:34 +0000 (21:39 +0200)
The Btrfs documentation states that if the commit value is greater than
300 a warning should be issued. The warning was accidentally lost in the
new mount API update.

Fixes: 6941823cc878 ("btrfs: remove old mount API code")
CC: stable@vger.kernel.org # 6.12+
Reviewed-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Kyoji Ogasawara <sawara04.o@gmail.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/fs.h
fs/btrfs/super.c

index bcca43046064b8898e86422c54baaa0e7dcf5fa0..7baa2ed45198f92c43c56b17e0909538926dac69 100644 (file)
@@ -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 {
index 7121d8c7a318ec2d4db959d5f69d06be2f75f974..7310e2fa85262149d9e176b195d1d4335169fefa 100644 (file)
@@ -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;