diff mbox series

btrfs: relax bg_reclaim_threshold for debug purpose

Message ID d04a158f989de1f564cd007f05fd51b6b154c006.1678693572.git.naohiro.aota@wdc.com (mailing list archive)
State New, archived
Headers show
Series btrfs: relax bg_reclaim_threshold for debug purpose | expand

Commit Message

Naohiro Aota March 13, 2023, 7:46 a.m. UTC
Currently, /sys/fs/btrfs/<UUID>/bg_reclaim_threshold is limited to 0
(disable) or [50 .. 100]%, so we need to fill 50% of a device to start the
auto reclaim process. It is cumbersome to do so when we want to shake out
possible race issues of normal write vs reclaim.

Relax the threshold check under the BTRFS_DEBUG option.

Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
---
 fs/btrfs/sysfs.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Johannes Thumshirn March 13, 2023, 8:44 a.m. UTC | #1
On 13.03.23 08:47, Naohiro Aota wrote:
> Currently, /sys/fs/btrfs/<UUID>/bg_reclaim_threshold is limited to 0
> (disable) or [50 .. 100]%, so we need to fill 50% of a device to start the
> auto reclaim process. It is cumbersome to do so when we want to shake out
> possible race issues of normal write vs reclaim.
> 
> Relax the threshold check under the BTRFS_DEBUG option.
> 
> Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>

Fine by me,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
David Sterba March 14, 2023, 5:45 p.m. UTC | #2
On Mon, Mar 13, 2023 at 04:46:54PM +0900, Naohiro Aota wrote:
> Currently, /sys/fs/btrfs/<UUID>/bg_reclaim_threshold is limited to 0
> (disable) or [50 .. 100]%, so we need to fill 50% of a device to start the
> auto reclaim process. It is cumbersome to do so when we want to shake out
> possible race issues of normal write vs reclaim.
> 
> Relax the threshold check under the BTRFS_DEBUG option.
> 
> Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>

Added to misc-next, thanks.
diff mbox series

Patch

diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
index 37fc58a7f27e..25294e624851 100644
--- a/fs/btrfs/sysfs.c
+++ b/fs/btrfs/sysfs.c
@@ -1262,8 +1262,13 @@  static ssize_t btrfs_bg_reclaim_threshold_store(struct kobject *kobj,
 	if (ret)
 		return ret;
 
+#ifdef CONFIG_BTRFS_DEBUG
+	if (thresh != 0 && (thresh > 100))
+		return -EINVAL;
+#else
 	if (thresh != 0 && (thresh <= 50 || thresh > 100))
 		return -EINVAL;
+#endif
 
 	WRITE_ONCE(fs_info->bg_reclaim_threshold, thresh);