public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs: start gc on zonegc_low_space attribute updates
@ 2026-03-20 13:02 Hans Holmberg
  2026-03-20 14:39 ` Darrick J. Wong
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Hans Holmberg @ 2026-03-20 13:02 UTC (permalink / raw)
  To: Carlos Maiolino
  Cc: Dave Chinner, Darrick J . Wong, Christoph Hellwig, Damien Le Moal,
	linux-xfs, Hans Holmberg

Start gc if the agressiveness of zone garbage collection is changed
by the user (if the file system is not read only).

Without this change, the new setting will not be taken into account
until the gc thread is woken up by e.g. a write.

Signed-off-by: Hans Holmberg <hans.holmberg@wdc.com>
---

 fs/xfs/xfs_sysfs.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/fs/xfs/xfs_sysfs.c b/fs/xfs/xfs_sysfs.c
index 6c7909838234..ac1329944049 100644
--- a/fs/xfs/xfs_sysfs.c
+++ b/fs/xfs/xfs_sysfs.c
@@ -14,6 +14,7 @@
 #include "xfs_log_priv.h"
 #include "xfs_mount.h"
 #include "xfs_zones.h"
+#include "xfs_zone_alloc.h"
 
 struct xfs_sysfs_attr {
 	struct attribute attr;
@@ -724,6 +725,7 @@ zonegc_low_space_store(
 	const char		*buf,
 	size_t			count)
 {
+	struct xfs_mount	*mp = zoned_to_mp(kobj);
 	int			ret;
 	unsigned int		val;
 
@@ -734,7 +736,11 @@ zonegc_low_space_store(
 	if (val > 100)
 		return -EINVAL;
 
-	zoned_to_mp(kobj)->m_zonegc_low_space = val;
+	if (mp->m_zonegc_low_space != val) {
+		mp->m_zonegc_low_space = val;
+		if (!xfs_is_readonly(mp))
+			xfs_zone_gc_start(mp);
+	}
 
 	return count;
 }
-- 
2.34.1


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

end of thread, other threads:[~2026-03-25  6:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-20 13:02 [PATCH] xfs: start gc on zonegc_low_space attribute updates Hans Holmberg
2026-03-20 14:39 ` Darrick J. Wong
2026-03-23 10:01   ` Hans Holmberg
2026-03-20 23:28 ` Damien Le Moal
2026-03-23  6:36 ` Christoph Hellwig
2026-03-23 10:32   ` Hans Holmberg
2026-03-25  6:04     ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox