All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/4] dm-bufio: per-client retain target, sysfs and dm-verity cache control
@ 2026-11-18 17:21 Yongpeng Yang
  2026-11-18 17:21 ` [PATCH v2 1/4] dm-bufio: make the retain target per client Yongpeng Yang
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Yongpeng Yang @ 2026-11-18 17:21 UTC (permalink / raw)
  To: agk, bmarzins, dm-devel, mpatocka, snitzer; +Cc: yangyongpeng

From: Yongpeng Yang <yangyongpeng@xiaomi.com>

Device-mapper's verity targets read their hash trees, and FEC parity
when FEC is enabled, through dm-bufio.  dm-bufio has a single
module-wide retain_bytes value shared by every client, no way to see
or change one client's memory use, and no way to warm the cache ahead
of the reads that need it.

That fits poorly systems with many verified devices of very different
sizes, such as Android, which mounts a dozen verity partitions plus
per-app verified images: a large partition's hash tree (tens of MB) is
evicted and re-read under memory pressure with the 256 KiB default,
while raising the global value would make every small, idle verity
device hold memory it does not need, and would still be the wrong size
for most of them.  The same system also wants to preload a device's
hash blocks at boot and to release the memory when the device is no
longer in use, which today requires dropping caches globally.

This series adds per-client granularity to dm-bufio and lets dm-verity
size and manage its caches:

 1. Move the retain target into struct dm_bufio_client, initialized
    from the module parameter at creation.  The parameter keeps its
    meaning as the default for new clients.

 2. Add dm_bufio_client_sysfs_add(), publishing a client in sysfs
    under a caller-chosen kobject and name, with a writable
    retain_bytes and the rest of the state read-only.  It is opt-in,
    so targets that do not want it pay nothing.

 3. dm-verity: size the hash client's retain target as
    hash_retain_percent (default 10) of the hash area, and register
    the hash, FEC parity and FEC data clients under
    /sys/block/dm-N/dm-bufio/<hash|fec|fec-data>/.

 4. dm-verity: add messages to report or set a client's retain target
    and to prefetch or drop hash blocks, for warming the cache ahead
    of use and releasing it afterwards.

Nothing changes for existing users: every client starts with the value
the module parameter holds, and only dm-verity opts into sysfs.

Changes since v1 [1]:
 - Publish the sysfs directories from ->resume and detach them in
   ->presuspend, keeping the kobjects until the table is destroyed.
   A table reload then publishes its directories synchronously with
   no collision, and no kernfs drain ever runs while the queue is
   frozen, which would deadlock against userspace (udev) probing the
   suspended device.
 - Round a non-zero retain target up to a block boundary, so the
   target keeps at least as many bytes as requested (Benjamin
   Marzinski).
 - Compute the percentage with mul_u64_u32_div() and clamp the result
   at ULONG_MAX, the same way dm-bufio sizes its own cache, so a
   large area cannot truncate to near-zero on 32-bit.
 - Zero the kobject after a failed dm_bufio_client_sysfs_add() so a
   retried call cannot free the already-freed name again.
 - Destroy the FEC bufio clients before releasing the data and hash
   devices in verity_dtr(), so a concurrent sysfs read cannot
   dereference the block device after it is put.
 - Reject prefetch_hash on try_verify_in_tasklet devices
   (-EOPNOTSUPP): their no-sleep bufio client cannot evict or wait
   for a buffer still being read.
 - Accept prefetch_hash/drop_hash with no hash blocks (levels == 0)
   as a no-op instead of failing.
 - Document dm_verity.hash_retain_percent= in kernel-parameters.txt.

Tested on a VM running v7.4-rc1: message and sysfs write paths, the
shrinker retain floor under memory pressure, suspend/resume cycles,
table reloads, 100 create/destroy cycles watching slab counters for
leaks, and error-path injection.  No kernel warnings.

[1] https://lore.kernel.org/all/20261117131918.2745193-1-yangyongpeng.storage@gmail.com/

Comments welcome.

Signed-off-by: Yongpeng Yang <yangyongpeng@xiaomi.com>
Assisted-by: LLM

Yongpeng Yang (4):
  dm-bufio: make the retain target per client
  dm-bufio: allow exposing a client in sysfs under a caller-chosen
    kobject
  dm-verity: size the hash retain target from the hash area
  dm-verity: add messages to inspect, prefetch and drop hash blocks

 .../ABI/testing/sysfs-kernel-dm-bufio         |  76 +++++
 .../admin-guide/device-mapper/dm-bufio.rst    |  54 ++++
 .../admin-guide/device-mapper/index.rst       |   1 +
 .../admin-guide/device-mapper/verity.rst      |  43 +++
 .../admin-guide/kernel-parameters.txt         |   6 +
 drivers/md/dm-bufio.c                         | 200 +++++++++++-
 drivers/md/dm-verity-target.c                 | 292 +++++++++++++++++-
 drivers/md/dm-verity.h                        |   2 +
 include/linux/dm-bufio.h                      |  16 +
 9 files changed, 688 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/ABI/testing/sysfs-kernel-dm-bufio
 create mode 100644 Documentation/admin-guide/device-mapper/dm-bufio.rst

-- 
2.43.0


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

* [PATCH v2 1/4] dm-bufio: make the retain target per client
  2026-11-18 17:21 [PATCH v2 0/4] dm-bufio: per-client retain target, sysfs and dm-verity cache control Yongpeng Yang
@ 2026-11-18 17:21 ` Yongpeng Yang
  2026-11-18 17:21 ` [PATCH v2 2/4] dm-bufio: allow exposing a client in sysfs under a caller-chosen kobject Yongpeng Yang
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Yongpeng Yang @ 2026-11-18 17:21 UTC (permalink / raw)
  To: agk, bmarzins, dm-devel, mpatocka, snitzer; +Cc: yangyongpeng

From: Yongpeng Yang <yangyongpeng@xiaomi.com>

dm_bufio_retain_bytes is a module-wide value shared by every dm-bufio
user, so raising it to keep one device's metadata cached also makes
every small, idle device hold on to memory it does not need.

Give each client its own target, initialized from the module parameter
at creation.  The parameter keeps its meaning as the default for new
clients; clients that already exist are not affected.

Signed-off-by: Yongpeng Yang <yangyongpeng@xiaomi.com>
Assisted-by: LLM
---
v2:
- Round a non-zero target up to a block boundary instead of down, so
  it keeps at least as many bytes as requested.
---
 drivers/md/dm-bufio.c    | 32 +++++++++++++++++++++++++++++++-
 include/linux/dm-bufio.h |  7 +++++++
 2 files changed, 38 insertions(+), 1 deletion(-)

diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c
index 3b66cf1cb931..367f878c17dc 100644
--- a/drivers/md/dm-bufio.c
+++ b/drivers/md/dm-bufio.c
@@ -994,6 +994,8 @@ struct dm_bufio_client {
 
 	unsigned int minimum_buffers;
 
+	unsigned long retain_bytes;	/* READ_ONCE/WRITE_ONCE, no lock needed */
+
 	sector_t start;
 
 	struct shrinker *shrinker;
@@ -2284,6 +2286,33 @@ void dm_bufio_set_minimum_buffers(struct dm_bufio_client *c, unsigned int n)
 }
 EXPORT_SYMBOL_GPL(dm_bufio_set_minimum_buffers);
 
+/*
+ * Set the number of bytes this client tries to keep cached; 0 resets it
+ * to the module default.  Non-zero values are rounded up to a block
+ * boundary, so the target keeps at least as many bytes as requested.
+ */
+void dm_bufio_set_retain_bytes(struct dm_bufio_client *c, unsigned long bytes)
+{
+	if (!bytes) {
+		WRITE_ONCE(c->retain_bytes, READ_ONCE(dm_bufio_retain_bytes));
+		return;
+	}
+
+	/* clamp so the round-up below cannot overflow */
+	if (bytes > ULONG_MAX - c->block_size + 1)
+		bytes = ULONG_MAX - c->block_size + 1;
+
+	WRITE_ONCE(c->retain_bytes,
+		   DIV_ROUND_UP(bytes, c->block_size) * c->block_size);
+}
+EXPORT_SYMBOL_GPL(dm_bufio_set_retain_bytes);
+
+unsigned long dm_bufio_get_retain_bytes(struct dm_bufio_client *c)
+{
+	return READ_ONCE(c->retain_bytes);
+}
+EXPORT_SYMBOL_GPL(dm_bufio_get_retain_bytes);
+
 unsigned int dm_bufio_get_block_size(struct dm_bufio_client *c)
 {
 	return c->block_size;
@@ -2389,7 +2418,7 @@ static void drop_buffers(struct dm_bufio_client *c)
 
 static unsigned long get_retain_buffers(struct dm_bufio_client *c)
 {
-	unsigned long retain_bytes = READ_ONCE(dm_bufio_retain_bytes);
+	unsigned long retain_bytes = READ_ONCE(c->retain_bytes);
 
 	if (likely(c->sectors_per_block_bits >= 0))
 		retain_bytes >>= c->sectors_per_block_bits + SECTOR_SHIFT;
@@ -2522,6 +2551,7 @@ struct dm_bufio_client *dm_bufio_client_create(struct block_device *bdev, unsign
 
 	mutex_init(&c->lock);
 	spin_lock_init(&c->spinlock);
+	c->retain_bytes = READ_ONCE(dm_bufio_retain_bytes);
 	INIT_LIST_HEAD(&c->reserved_buffers);
 	c->need_reserved_buffers = reserved_buffers;
 
diff --git a/include/linux/dm-bufio.h b/include/linux/dm-bufio.h
index d1503b815a78..9bf3f805c43c 100644
--- a/include/linux/dm-bufio.h
+++ b/include/linux/dm-bufio.h
@@ -158,6 +158,13 @@ void dm_bufio_forget_buffers(struct dm_bufio_client *c, sector_t block, sector_t
  */
 void dm_bufio_set_minimum_buffers(struct dm_bufio_client *c, unsigned int n);
 
+/*
+ * Configure and query the per-client retain target; 0 resets the
+ * module default.
+ */
+void dm_bufio_set_retain_bytes(struct dm_bufio_client *c, unsigned long bytes);
+unsigned long dm_bufio_get_retain_bytes(struct dm_bufio_client *c);
+
 unsigned int dm_bufio_get_block_size(struct dm_bufio_client *c);
 sector_t dm_bufio_get_device_size(struct dm_bufio_client *c);
 struct dm_io_client *dm_bufio_get_dm_io_client(struct dm_bufio_client *c);
-- 
2.43.0


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

* [PATCH v2 2/4] dm-bufio: allow exposing a client in sysfs under a caller-chosen kobject
  2026-11-18 17:21 [PATCH v2 0/4] dm-bufio: per-client retain target, sysfs and dm-verity cache control Yongpeng Yang
  2026-11-18 17:21 ` [PATCH v2 1/4] dm-bufio: make the retain target per client Yongpeng Yang
@ 2026-11-18 17:21 ` Yongpeng Yang
  2026-11-18 17:57   ` sashiko-bot
  2026-11-18 17:21 ` [PATCH v2 3/4] dm-verity: size the hash retain target from the hash area Yongpeng Yang
  2026-11-18 17:21 ` [PATCH v2 4/4] dm-verity: add messages to inspect, prefetch and drop hash blocks Yongpeng Yang
  3 siblings, 1 reply; 8+ messages in thread
From: Yongpeng Yang @ 2026-11-18 17:21 UTC (permalink / raw)
  To: agk, bmarzins, dm-devel, mpatocka, snitzer; +Cc: yangyongpeng

From: Yongpeng Yang <yangyongpeng@xiaomi.com>

There is no way to see how much memory a particular dm-bufio client is
using, or to change one client's retain target without also affecting
every future client.

Add dm_bufio_client_sysfs_add(), which publishes a client as <name>
under a kobject supplied by its user, with the retain target writable
and the rest of its state read-only.  Callers that have no use for it
simply never call it.

The kobject is embedded in the client, which is therefore freed only
after the release method runs, as in dm-sysfs.

Signed-off-by: Yongpeng Yang <yangyongpeng@xiaomi.com>
Assisted-by: LLM
---
v2:
- Zero the kobject after a failed dm_bufio_client_sysfs_add() so a
  retried call cannot free the already-freed name again.
---
 .../ABI/testing/sysfs-kernel-dm-bufio         |  76 ++++++++
 .../admin-guide/device-mapper/dm-bufio.rst    |  54 ++++++
 .../admin-guide/device-mapper/index.rst       |   1 +
 drivers/md/dm-bufio.c                         | 168 ++++++++++++++++++
 include/linux/dm-bufio.h                      |   9 +
 5 files changed, 308 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-kernel-dm-bufio
 create mode 100644 Documentation/admin-guide/device-mapper/dm-bufio.rst

diff --git a/Documentation/ABI/testing/sysfs-kernel-dm-bufio b/Documentation/ABI/testing/sysfs-kernel-dm-bufio
new file mode 100644
index 000000000000..bccd679c1b60
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-kernel-dm-bufio
@@ -0,0 +1,76 @@
+What:		/sys/block/<dm-device>/dm-bufio/<name>/
+Date:		November 2026
+KernelVersion:	7.4
+Contact:	dm-devel@lists.linux.dev
+Description:
+		Directory exposing one dm-bufio client whose user opted in
+		through dm_bufio_client_sysfs_add().  <name> is chosen by that
+		user; dm-verity, which places the directory under the block
+		device of its own dm device, uses <name> "hash" for the hash
+		tree client, "fec" for the FEC parity client and "fec-data"
+		for the FEC data client.  The directory lives from
+		registration until the client is destroyed, independently of
+		any device-mapper table loaded on the device, so a suspend or
+		table reload never leaves dangling entries behind.  The
+		read-only counters are instantaneous snapshots and may be
+		approximate.
+
+What:		/sys/block/<dm-device>/dm-bufio/<name>/bdev
+Date:		November 2026
+KernelVersion:	7.4
+Contact:	dm-devel@lists.linux.dev
+Description:
+		Major and minor of the client's block device, in the form
+		<major>:<minor>.  Read-only.
+
+What:		/sys/block/<dm-device>/dm-bufio/<name>/bdev_name
+Date:		November 2026
+KernelVersion:	7.4
+Contact:	dm-devel@lists.linux.dev
+Description:
+		Name of the client's block device.  Read-only.
+
+What:		/sys/block/<dm-device>/dm-bufio/<name>/block_size
+Date:		November 2026
+KernelVersion:	7.4
+Contact:	dm-devel@lists.linux.dev
+Description:
+		Block size of the client in bytes.  Read-only.
+
+What:		/sys/block/<dm-device>/dm-bufio/<name>/retain_bytes
+Date:		November 2026
+KernelVersion:	7.4
+Contact:	dm-devel@lists.linux.dev
+Description:
+		Number of bytes dm-bufio tries to keep cached for this
+		client.  It is a floor applied by the memory shrinker, not a
+		cap, so the cache may grow past it when memory is plentiful.
+
+		Writable.  A non-zero value is rounded up to a block
+		boundary, so the target keeps at least as many bytes as
+		requested; zero restores the dm-bufio default.  Writing it
+		affects only this client, not the retain_bytes module
+		parameter and not other clients.
+
+What:		/sys/block/<dm-device>/dm-bufio/<name>/current_bytes
+Date:		November 2026
+KernelVersion:	7.4
+Contact:	dm-devel@lists.linux.dev
+Description:
+		Number of bytes currently cached by this client.  Read-only.
+
+What:		/sys/block/<dm-device>/dm-bufio/<name>/buffers
+Date:		November 2026
+KernelVersion:	7.4
+Contact:	dm-devel@lists.linux.dev
+Description:
+		Number of buffers currently cached by this client.
+		Read-only.
+
+What:		/sys/block/<dm-device>/dm-bufio/<name>/minimum_buffers
+Date:		November 2026
+KernelVersion:	7.4
+Contact:	dm-devel@lists.linux.dev
+Description:
+		Minimum number of buffers the client keeps before cleanup
+		happens.  Read-only.
diff --git a/Documentation/admin-guide/device-mapper/dm-bufio.rst b/Documentation/admin-guide/device-mapper/dm-bufio.rst
new file mode 100644
index 000000000000..c35e415acacd
--- /dev/null
+++ b/Documentation/admin-guide/device-mapper/dm-bufio.rst
@@ -0,0 +1,54 @@
+========
+dm-bufio
+========
+
+dm-bufio caches small metadata blocks on block devices for several
+device-mapper targets (dm-verity, dm-thin, dm-cache, dm-integrity and
+dm-ebs among others).  Each user creates clients on a block device; the
+caches are independent, even for clients on the same device.
+
+Retain target
+=============
+
+dm-bufio bounds nothing by itself: buffers live until the memory shrinker
+evicts them, and the shrinker stops once a client is back down to its
+retain target.  The target is a floor under memory pressure, not a cap,
+so a fully warmed cache may hold far more.
+
+The default is the ``retain_bytes`` module parameter of dm_bufio
+(256 KiB), which only affects clients created after it is changed.  One
+client changes its own target through the ``retain_bytes`` attribute of
+its sysfs directory or a target-specific message.
+
+sysfs interface
+===============
+
+A client may be published in sysfs with dm_bufio_client_sysfs_add(),
+passing the parent kobject and the directory name; dm-bufio does not
+choose where it lives.  The directory lives until the client is
+destroyed.  dm-verity registers its clients under the block device of
+its own dm device::
+
+  /sys/block/dm-N/dm-bufio/hash/        the hash tree client
+  /sys/block/dm-N/dm-bufio/fec/         the FEC parity client
+  /sys/block/dm-N/dm-bufio/fec-data/    the FEC data client
+
+The attributes, including the read-write ``retain_bytes``, are documented
+in Documentation/ABI/testing/sysfs-kernel-dm-bufio.
+
+Example
+=======
+
+Inspect the hash client of a dm-verity device::
+
+  # ls /sys/block/dm-1/dm-bufio/
+  fec  fec-data  hash
+
+  # cat /sys/block/dm-1/dm-bufio/hash/retain_bytes
+  2535424
+
+  # echo 8388608 > /sys/block/dm-1/dm-bufio/hash/retain_bytes
+  # cat /sys/block/dm-1/dm-bufio/hash/retain_bytes
+  8388608
+
+The other clients keep their own targets.
diff --git a/Documentation/admin-guide/device-mapper/index.rst b/Documentation/admin-guide/device-mapper/index.rst
index 73c1f2002134..3b6c348f71f5 100644
--- a/Documentation/admin-guide/device-mapper/index.rst
+++ b/Documentation/admin-guide/device-mapper/index.rst
@@ -8,6 +8,7 @@ Device Mapper
     cache-policies
     cache
     delay
+    dm-bufio
     dm-clone
     dm-crypt
     dm-dust
diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c
index 367f878c17dc..a2991dcd532f 100644
--- a/drivers/md/dm-bufio.c
+++ b/drivers/md/dm-bufio.c
@@ -20,6 +20,9 @@
 #include <linux/rbtree.h>
 #include <linux/stacktrace.h>
 #include <linux/jump_label.h>
+#include <linux/kobject.h>
+#include <linux/sysfs.h>
+#include <linux/completion.h>
 
 #include "dm.h"
 
@@ -995,6 +998,9 @@ struct dm_bufio_client {
 	unsigned int minimum_buffers;
 
 	unsigned long retain_bytes;	/* READ_ONCE/WRITE_ONCE, no lock needed */
+	bool sysfs_added;
+	struct kobject kobj;
+	struct completion kobj_unregister;
 
 	sector_t start;
 
@@ -2505,6 +2511,165 @@ static unsigned long dm_bufio_shrink_count(struct shrinker *shrink, struct shrin
 	return count;
 }
 
+/*
+ * A client may be published in sysfs with dm_bufio_client_sysfs_add();
+ * the directory lives until the client is destroyed.
+ */
+
+static ssize_t dm_bufio_attr_show(struct kobject *kobj, struct attribute *attr,
+				  char *buf);
+static ssize_t dm_bufio_attr_store(struct kobject *kobj, struct attribute *attr,
+				   const char *buf, size_t size);
+
+#define DM_BUFIO_ATTR_RO(_name)						\
+	static struct attribute dm_bufio_attr_##_name =			\
+		{ .name = #_name, .mode = 0444 }
+
+#define DM_BUFIO_ATTR_RW(_name)						\
+	static struct attribute dm_bufio_attr_##_name =			\
+		{ .name = #_name, .mode = 0644 }
+
+DM_BUFIO_ATTR_RO(bdev);
+DM_BUFIO_ATTR_RO(bdev_name);
+DM_BUFIO_ATTR_RO(block_size);
+DM_BUFIO_ATTR_RW(retain_bytes);
+DM_BUFIO_ATTR_RO(current_bytes);
+DM_BUFIO_ATTR_RO(buffers);
+DM_BUFIO_ATTR_RO(minimum_buffers);
+
+static ssize_t dm_bufio_attr_show(struct kobject *kobj, struct attribute *attr,
+				  char *buf)
+{
+	struct dm_bufio_client *c = container_of(kobj, struct dm_bufio_client, kobj);
+
+	if (attr == &dm_bufio_attr_bdev)
+		return sysfs_emit(buf, "%d:%d\n", MAJOR(c->bdev->bd_dev),
+				  MINOR(c->bdev->bd_dev));
+	if (attr == &dm_bufio_attr_bdev_name)
+		return sysfs_emit(buf, "%pg\n", c->bdev);
+	if (attr == &dm_bufio_attr_block_size)
+		return sysfs_emit(buf, "%u\n", c->block_size);
+	if (attr == &dm_bufio_attr_retain_bytes)
+		return sysfs_emit(buf, "%lu\n", READ_ONCE(c->retain_bytes));
+	if (attr == &dm_bufio_attr_current_bytes)
+		return sysfs_emit(buf, "%llu\n",
+				  (u64)cache_total(&c->cache) * c->block_size);
+	if (attr == &dm_bufio_attr_buffers)
+		return sysfs_emit(buf, "%lu\n", cache_total(&c->cache));
+	if (attr == &dm_bufio_attr_minimum_buffers)
+		return sysfs_emit(buf, "%u\n", c->minimum_buffers);
+
+	return -EINVAL;
+}
+
+static ssize_t dm_bufio_attr_store(struct kobject *kobj, struct attribute *attr,
+				   const char *buf, size_t size)
+{
+	struct dm_bufio_client *c = container_of(kobj, struct dm_bufio_client, kobj);
+
+	if (attr == &dm_bufio_attr_retain_bytes) {
+		unsigned long new;
+
+		if (kstrtoul(buf, 0, &new))
+			return -EINVAL;
+
+		dm_bufio_set_retain_bytes(c, new);
+
+		return size;
+	}
+
+	return -EINVAL;
+}
+
+static struct attribute *dm_bufio_attrs[] = {
+	&dm_bufio_attr_bdev,
+	&dm_bufio_attr_bdev_name,
+	&dm_bufio_attr_block_size,
+	&dm_bufio_attr_retain_bytes,
+	&dm_bufio_attr_current_bytes,
+	&dm_bufio_attr_buffers,
+	&dm_bufio_attr_minimum_buffers,
+	NULL,
+};
+ATTRIBUTE_GROUPS(dm_bufio);
+
+static const struct sysfs_ops dm_bufio_sysfs_ops = {
+	.show	= dm_bufio_attr_show,
+	.store	= dm_bufio_attr_store,
+};
+
+static void dm_bufio_kobj_release(struct kobject *kobj)
+{
+	struct dm_bufio_client *c = container_of(kobj, struct dm_bufio_client, kobj);
+
+	/*
+	 * The client is freed only after this completes, as in dm-sysfs.
+	 */
+	complete(&c->kobj_unregister);
+}
+
+static const struct kobj_type dm_bufio_ktype = {
+	.sysfs_ops	= &dm_bufio_sysfs_ops,
+	.default_groups	= dm_bufio_groups,
+	.release	= dm_bufio_kobj_release,
+};
+
+static int dm_bufio_kobj_add(struct dm_bufio_client *c, struct kobject *parent,
+			     const char *name)
+{
+	init_completion(&c->kobj_unregister);
+
+	return kobject_init_and_add(&c->kobj, &dm_bufio_ktype, parent, "%s",
+				    name);
+}
+
+/* Drop the sysfs reference and wait for the release method to run. */
+static void dm_bufio_kobj_del(struct dm_bufio_client *c)
+{
+	kobject_put(&c->kobj);
+	wait_for_completion(&c->kobj_unregister);
+}
+
+int dm_bufio_client_sysfs_add(struct dm_bufio_client *c, struct kobject *parent,
+			      const char *name)
+{
+	int r;
+
+	if (c->sysfs_added) {
+		if (c->kobj.state_in_sysfs)
+			return -EBUSY;
+		/* re-attaching after dm_bufio_client_sysfs_detach() */
+		init_completion(&c->kobj_unregister);
+		return kobject_add(&c->kobj, parent, "%s", name);
+	}
+
+	r = dm_bufio_kobj_add(c, parent, name);
+	if (r) {
+		/* kobject_cleanup() freed kobj.name; clear the kobject so
+		 * a retried add does not free the dangling pointer again. */
+		dm_bufio_kobj_del(c);
+		memset(&c->kobj, 0, sizeof(c->kobj));
+		return r;
+	}
+
+	c->sysfs_added = true;
+	return 0;
+}
+EXPORT_SYMBOL_GPL(dm_bufio_client_sysfs_add);
+
+/*
+ * Remove the directory from sysfs without releasing the kobject; it is
+ * released in dm_bufio_client_destroy().  dm_bufio_client_sysfs_add()
+ * puts the directory back.
+ */
+void dm_bufio_client_sysfs_detach(struct dm_bufio_client *c)
+{
+	if (c->sysfs_added && c->kobj.state_in_sysfs)
+		kobject_del(&c->kobj);
+}
+EXPORT_SYMBOL_GPL(dm_bufio_client_sysfs_detach);
+
+
 /*
  * Create the buffering interface
  */
@@ -2661,6 +2826,9 @@ void dm_bufio_client_destroy(struct dm_bufio_client *c)
 {
 	unsigned int i;
 
+	if (c->sysfs_added)
+		dm_bufio_kobj_del(c);
+
 	drop_buffers(c);
 
 	shrinker_free(c->shrinker);
diff --git a/include/linux/dm-bufio.h b/include/linux/dm-bufio.h
index 9bf3f805c43c..ac168ac797e4 100644
--- a/include/linux/dm-bufio.h
+++ b/include/linux/dm-bufio.h
@@ -17,6 +17,7 @@
 
 struct dm_bufio_client;
 struct dm_buffer;
+struct kobject;
 
 /*
  * Flags for dm_bufio_client_create
@@ -165,6 +166,14 @@ void dm_bufio_set_minimum_buffers(struct dm_bufio_client *c, unsigned int n);
 void dm_bufio_set_retain_bytes(struct dm_bufio_client *c, unsigned long bytes);
 unsigned long dm_bufio_get_retain_bytes(struct dm_bufio_client *c);
 
+/*
+ * Publish the client as <name> under <parent> in sysfs; removed in
+ * dm_bufio_client_destroy().
+ */
+int dm_bufio_client_sysfs_add(struct dm_bufio_client *c, struct kobject *parent,
+			      const char *name);
+void dm_bufio_client_sysfs_detach(struct dm_bufio_client *c);
+
 unsigned int dm_bufio_get_block_size(struct dm_bufio_client *c);
 sector_t dm_bufio_get_device_size(struct dm_bufio_client *c);
 struct dm_io_client *dm_bufio_get_dm_io_client(struct dm_bufio_client *c);
-- 
2.43.0


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

* [PATCH v2 3/4] dm-verity: size the hash retain target from the hash area
  2026-11-18 17:21 [PATCH v2 0/4] dm-bufio: per-client retain target, sysfs and dm-verity cache control Yongpeng Yang
  2026-11-18 17:21 ` [PATCH v2 1/4] dm-bufio: make the retain target per client Yongpeng Yang
  2026-11-18 17:21 ` [PATCH v2 2/4] dm-bufio: allow exposing a client in sysfs under a caller-chosen kobject Yongpeng Yang
@ 2026-11-18 17:21 ` Yongpeng Yang
  2026-11-18 17:50   ` sashiko-bot
  2026-11-18 17:21 ` [PATCH v2 4/4] dm-verity: add messages to inspect, prefetch and drop hash blocks Yongpeng Yang
  3 siblings, 1 reply; 8+ messages in thread
From: Yongpeng Yang @ 2026-11-18 17:21 UTC (permalink / raw)
  To: agk, bmarzins, dm-devel, mpatocka, snitzer; +Cc: yangyongpeng

From: Yongpeng Yang <yangyongpeng@xiaomi.com>

With the dm-bufio default of 256 KiB a large device re-reads hash
blocks evicted under memory pressure, while a small device holds far
more than it needs.

Set the hash client's target to hash_retain_percent (default 10) of
the hash area, computed with mul_u64_u32_div() and clamped at
ULONG_MAX so a large area cannot truncate to near-zero on 32-bit.  A
percentage above 100 is ignored, leaving the dm-bufio default.

Publish the clients under /sys/block/dm-N/dm-bufio/<name>.
Registration runs from ->resume, not ->ctr, because the dm device's
block device does not exist until the table is loaded; the directories
are detached again in ->presuspend, which frees the names but keeps
the kobjects until the table is destroyed.  A reloaded table can then
publish its own directories synchronously from ->resume, with no
collision and no kernfs drain while the queue is frozen.  The
parameter only affects devices created afterwards.

Signed-off-by: Yongpeng Yang <yangyongpeng@xiaomi.com>
Assisted-by: LLM
---
v2:
- Destroy the FEC bufio clients before putting the data and hash
  devices in verity_dtr().
- Compute the percentage with mul_u64_u32_div() and clamp it at
  ULONG_MAX, so a large area cannot truncate to near-zero on 32-bit.
- Detach the sysfs directories in ->presuspend (names freed, kobjects
  kept until the table is destroyed) so a table reload publishes its
  directories synchronously from ->resume; add
  dm_bufio_client_sysfs_detach() and re-attachment in
  dm_bufio_client_sysfs_add().
- Document dm_verity.hash_retain_percent= in kernel-parameters.txt.
---
 .../admin-guide/kernel-parameters.txt         |   6 +
 drivers/md/dm-verity-target.c                 | 123 +++++++++++++++++-
 drivers/md/dm-verity.h                        |   2 +
 3 files changed, 130 insertions(+), 1 deletion(-)

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 0b3c140babd9..914da403c5de 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -1351,6 +1351,12 @@ Kernel parameters
 			For details see:
 			Documentation/admin-guide/hw-vuln/reg-file-data-sampling.rst
 
+	dm_verity.hash_retain_percent=
+			[DM] Percentage of the hash area that dm-verity
+			asks dm-bufio to keep cached for a new device.
+			Defaults to 10; 0 or a value above 100 leaves the
+			dm-bufio default.
+
 	dm_verity.keyring_unsealed=
 			[KNL] When set to 1, leave the dm-verity keyring
 			unsealed after initialization so userspace can
diff --git a/drivers/md/dm-verity-target.c b/drivers/md/dm-verity-target.c
index 451c75e30a8f..8059c842b9f9 100644
--- a/drivers/md/dm-verity-target.c
+++ b/drivers/md/dm-verity-target.c
@@ -32,6 +32,8 @@
 #define DM_VERITY_DEFAULT_PREFETCH_SIZE	262144
 #define DM_VERITY_USE_BH_DEFAULT_BYTES	8192
 
+#define DM_VERITY_DEFAULT_HASH_RETAIN_PERCENT	10
+
 #define DM_VERITY_MAX_CORRUPTED_ERRS	100
 
 #define DM_VERITY_OPT_LOGGING		"ignore_corruption"
@@ -50,6 +52,13 @@ static unsigned int dm_verity_prefetch_cluster = DM_VERITY_DEFAULT_PREFETCH_SIZE
 
 module_param_named(prefetch_cluster, dm_verity_prefetch_cluster, uint, 0644);
 
+/* Default fraction of the hash tree that dm-bufio is asked to keep cached. */
+static unsigned int dm_verity_hash_retain_percent = DM_VERITY_DEFAULT_HASH_RETAIN_PERCENT;
+
+module_param_named(hash_retain_percent, dm_verity_hash_retain_percent, uint, 0644);
+MODULE_PARM_DESC(hash_retain_percent,
+	"Percentage of the hash area to keep cached by default");
+
 static unsigned int dm_verity_use_bh_bytes[4] = {
 	DM_VERITY_USE_BH_DEFAULT_BYTES,	// IOPRIO_CLASS_NONE
 	DM_VERITY_USE_BH_DEFAULT_BYTES,	// IOPRIO_CLASS_RT
@@ -1084,13 +1093,19 @@ static void verity_dtr(struct dm_target *ti)
 
 	kfree(v->alg_name);
 
+	verity_fec_dtr(v);
+
 	if (v->hash_dev)
 		dm_put_device(ti, v->hash_dev);
 
 	if (v->data_dev)
 		dm_put_device(ti, v->data_dev);
 
-	verity_fec_dtr(v);
+	if (v->bufio_kobj) {
+		if (v->bufio_kobj->state_in_sysfs)
+			kobject_del(v->bufio_kobj);
+		kobject_put(v->bufio_kobj);
+	}
 
 	kfree(v->signature_key_desc);
 
@@ -1421,6 +1436,7 @@ static int verity_ctr(struct dm_target *ti, unsigned int argc, char **argv)
 	struct dm_verity_sig_opts verify_args = {0};
 	struct dm_arg_set as;
 	unsigned int num;
+	unsigned int hash_retain_percent;
 	unsigned long long num_ll;
 	int r;
 	int i;
@@ -1638,6 +1654,18 @@ static int verity_ctr(struct dm_target *ti, unsigned int argc, char **argv)
 		goto bad;
 	}
 
+	/* Keep a configurable fraction of the hash tree cached by default. */
+	hash_retain_percent = READ_ONCE(dm_verity_hash_retain_percent);
+	if (hash_retain_percent <= 100) {
+		u64 retain = mul_u64_u32_div((u64)(v->hash_end - v->hash_start) <<
+					     v->hash_dev_block_bits,
+					     hash_retain_percent, 100);
+
+		if (retain > ULONG_MAX)
+			retain = ULONG_MAX;
+		dm_bufio_set_retain_bytes(v->bufio, retain);
+	}
+
 	/*
 	 * Using WQ_HIGHPRI improves throughput and completion latency by
 	 * reducing wait times when reading from a dm-verity device.
@@ -1806,6 +1834,49 @@ static inline void verity_security_clear_integrity(struct dm_target *ti)
 
 #endif /* CONFIG_SECURITY */
 
+/* Detach the dm-bufio directories from sysfs, keeping the kobjects. */
+static void verity_detach_bufio_sysfs(struct dm_verity *v)
+{
+	dm_bufio_client_sysfs_detach(v->bufio);
+	if (verity_fec_is_enabled(v)) {
+		dm_bufio_client_sysfs_detach(v->fec->bufio);
+		dm_bufio_client_sysfs_detach(v->fec->data_bufio);
+	}
+
+	if (v->bufio_kobj && v->bufio_kobj->state_in_sysfs)
+		kobject_del(v->bufio_kobj);
+}
+
+/*
+ * Free the directory names before a table reload resumes a new
+ * instance.  Presuspend runs before the queue is frozen, so the kernfs
+ * drain cannot block on I/O.
+ */
+static void verity_presuspend(struct dm_target *ti)
+{
+	verity_detach_bufio_sysfs(ti->private);
+}
+
+static void verity_presuspend_undo(struct dm_target *ti)
+{
+	struct dm_verity *v = ti->private;
+	struct mapped_device *md = dm_table_get_md(v->ti->table);
+	struct kobject *parent = &disk_to_dev(dm_disk(md))->kobj;
+
+	if (!v->bufio_kobj)
+		return;
+
+	if (!v->bufio_kobj->state_in_sysfs &&
+	    kobject_add(v->bufio_kobj, parent, "%s", "dm-bufio"))
+		DMERR("cannot re-attach dm-bufio sysfs directory");
+
+	(void)dm_bufio_client_sysfs_add(v->bufio, v->bufio_kobj, "hash");
+	if (verity_fec_is_enabled(v)) {
+		(void)dm_bufio_client_sysfs_add(v->fec->bufio, v->bufio_kobj, "fec");
+		(void)dm_bufio_client_sysfs_add(v->fec->data_bufio, v->bufio_kobj, "fec-data");
+	}
+}
+
 static void verity_postsuspend(struct dm_target *ti)
 {
 	struct dm_verity *v = ti->private;
@@ -1815,6 +1886,53 @@ static void verity_postsuspend(struct dm_target *ti)
 	verity_security_clear_integrity(ti);
 }
 
+/*
+ * Publish the bufio clients under /sys/block/dm-N/dm-bufio/.  This runs
+ * from ->resume, not ->ctr, because the dm device's block device does not
+ * exist until the table is loaded.
+ */
+static void verity_register_bufio_sysfs(struct dm_verity *v)
+{
+	struct mapped_device *md = dm_table_get_md(v->ti->table);
+	struct kobject *parent = &disk_to_dev(dm_disk(md))->kobj;
+
+	if (v->bufio_kobj)
+		return;
+
+	v->bufio_kobj = kobject_create_and_add("dm-bufio", parent);
+	if (!v->bufio_kobj) {
+		DMERR("cannot create dm-bufio sysfs directory");
+		return;
+	}
+
+	if (dm_bufio_client_sysfs_add(v->bufio, v->bufio_kobj, "hash"))
+		DMERR("cannot register hash bufio client in sysfs");
+
+	if (verity_fec_is_enabled(v)) {
+		if (dm_bufio_client_sysfs_add(v->fec->bufio, v->bufio_kobj, "fec"))
+			DMERR("cannot register FEC bufio client in sysfs");
+		if (dm_bufio_client_sysfs_add(v->fec->data_bufio, v->bufio_kobj, "fec-data"))
+			DMERR("cannot register FEC data bufio client in sysfs");
+	}
+}
+
+static void verity_resume(struct dm_target *ti)
+{
+	struct dm_verity *v = ti->private;
+
+	if (v->bufio_kobj) {
+		/* detached by presuspend, or re-attached by presuspend_undo */
+		if (v->bufio_kobj->state_in_sysfs)
+			kobject_del(v->bufio_kobj);
+		kobject_put(v->bufio_kobj);
+		v->bufio_kobj = NULL;
+	}
+
+	verity_register_bufio_sysfs(v);
+}
+
+static void verity_register_bufio_sysfs(struct dm_verity *v);
+
 static struct target_type verity_target = {
 	.name		= "verity",
 /* Note: the LSMs depend on the singleton and immutable features */
@@ -1824,7 +1942,10 @@ static struct target_type verity_target = {
 	.ctr		= verity_ctr,
 	.dtr		= verity_dtr,
 	.map		= verity_map,
+	.presuspend	= verity_presuspend,
+	.presuspend_undo = verity_presuspend_undo,
 	.postsuspend	= verity_postsuspend,
+	.resume		= verity_resume,
 	.status		= verity_status,
 	.prepare_ioctl	= verity_prepare_ioctl,
 	.iterate_devices = verity_iterate_devices,
diff --git a/drivers/md/dm-verity.h b/drivers/md/dm-verity.h
index e104a651c657..1bd625f5b45a 100644
--- a/drivers/md/dm-verity.h
+++ b/drivers/md/dm-verity.h
@@ -82,6 +82,8 @@ struct dm_verity {
 
 	struct dm_io_client *io;
 	mempool_t recheck_pool;
+
+	struct kobject *bufio_kobj;	/* /sys/block/dm-N/dm-bufio, or NULL */
 };
 
 struct pending_block {
-- 
2.43.0


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

* [PATCH v2 4/4] dm-verity: add messages to inspect, prefetch and drop hash blocks
  2026-11-18 17:21 [PATCH v2 0/4] dm-bufio: per-client retain target, sysfs and dm-verity cache control Yongpeng Yang
                   ` (2 preceding siblings ...)
  2026-11-18 17:21 ` [PATCH v2 3/4] dm-verity: size the hash retain target from the hash area Yongpeng Yang
@ 2026-11-18 17:21 ` Yongpeng Yang
  2026-11-18 17:43   ` sashiko-bot
  3 siblings, 1 reply; 8+ messages in thread
From: Yongpeng Yang @ 2026-11-18 17:21 UTC (permalink / raw)
  To: agk, bmarzins, dm-devel, mpatocka, snitzer; +Cc: yangyongpeng

From: Yongpeng Yang <yangyongpeng@xiaomi.com>

Nothing lets a user warm a verity device's cache ahead of the reads
that will need it, or release the memory a device no longer needs.

Add three messages.  retain_bytes <hash|fec> [<bytes>] reports or sets
a client's retain target.  prefetch_hash [<start> <count>] starts
reading hash blocks asynchronously; it is not limited by the retain
target, which only applies to eviction.  drop_hash [<start> <count>]
drops hash blocks, keeping those that are in use or dirty.

prefetch_hash and drop_hash are unsupported on try_verify_in_tasklet
devices (-EOPNOTSUPP), whose bufio client cannot evict or wait for a
buffer that is still being read.

Signed-off-by: Yongpeng Yang <yangyongpeng@xiaomi.com>
Assisted-by: LLM
---
v2:
- Reject prefetch_hash on try_verify_in_tasklet devices
  (-EOPNOTSUPP), same as drop_hash.
- Accept prefetch_hash/drop_hash with an empty hash area
  (levels == 0) as a no-op instead of failing.
---
 .../admin-guide/device-mapper/verity.rst      |  43 +++++
 drivers/md/dm-verity-target.c                 | 169 ++++++++++++++++++
 2 files changed, 212 insertions(+)

diff --git a/Documentation/admin-guide/device-mapper/verity.rst b/Documentation/admin-guide/device-mapper/verity.rst
index 9e9d4b8157c0..ec29cc6b6dc7 100644
--- a/Documentation/admin-guide/device-mapper/verity.rst
+++ b/Documentation/admin-guide/device-mapper/verity.rst
@@ -328,6 +328,49 @@ Status
 2. Number of corrected blocks by Forward Error Correction.
    '-' if Forward Error Correction is not enabled.
 
+Metadata caching
+================
+
+The hash blocks, and the FEC parity blocks when FEC is enabled, are cached in
+memory by dm-bufio.  How much of the hash tree is kept cached is controlled by
+the ``hash_retain_percent`` module parameter (default 10), settable at boot
+time with ``dm_verity.hash_retain_percent=<0-100>`` or at run time through
+``/sys/module/dm_verity/parameters/hash_retain_percent``.  A value of 0 or
+above 100 leaves the dm-bufio default (256 KiB), which is also what the FEC
+clients keep.  Only devices created afterwards are affected.
+
+Each client's retain target and memory use are visible under
+``/sys/block/dm-N/dm-bufio/<hash|fec|fec-data>/`` on the verity device's own
+block device, and the target can be changed by writing that directory's
+``retain_bytes`` attribute; see
+Documentation/admin-guide/device-mapper/dm-bufio.rst.  The directories are
+created when the device is activated and removed when it is suspended, so a
+table reload always finds the new table's directories in place.
+
+Messages
+========
+
+``retain_bytes <hash|fec> [<bytes>]``
+    Report the retain target of the hash or FEC parity client, or set it
+    (0 resets to the dm-bufio default).  ``fec`` requires FEC to be
+    enabled.  The reply is ``retain_bytes=<bytes>``.
+
+``prefetch_hash [<start> <count>]``
+    Start reading hash blocks into the cache; without arguments, the whole
+    hash area.  The read is asynchronous and is not limited by the retain
+    target, which only applies to eviction.  Not supported on devices
+    created with ``try_verify_in_tasklet`` (``-EOPNOTSUPP``), whose bufio
+    client cannot evict or wait for a buffer that is still being read.
+
+``drop_hash [<start> <count>]``
+    Drop hash blocks from the cache, keeping blocks that are in use or
+    dirty.  Not supported on devices created with ``try_verify_in_tasklet``
+    (``-EOPNOTSUPP``), whose bufio client cannot drop buffers.
+
+Both cache commands still work while the device is suspended: prefetch
+reads are queued and complete on resume, and ``drop_hash`` finds an empty
+cache because verity resets the bufio client on suspend.
+
 Example
 =======
 Set up a device::
diff --git a/drivers/md/dm-verity-target.c b/drivers/md/dm-verity-target.c
index 8059c842b9f9..94ace13c6091 100644
--- a/drivers/md/dm-verity-target.c
+++ b/drivers/md/dm-verity-target.c
@@ -1933,6 +1933,174 @@ static void verity_resume(struct dm_target *ti)
 
 static void verity_register_bufio_sysfs(struct dm_verity *v);
 
+static int verity_prefetch_hash(struct dm_verity *v, unsigned int argc,
+				char **argv, char *result, unsigned int maxlen)
+{
+	sector_t total = v->hash_end - v->hash_start;
+	sector_t start, n;
+	unsigned long long value;
+	unsigned int sz = 0;
+
+	/*
+	 * On a no_sleep client a buffer being read cannot be evicted or
+	 * waited for, so an unfinished prefetch would outlive a suspend or
+	 * teardown; drop_hash rejects this case for the same reason.
+	 */
+	if (v->use_bh_wq) {
+		DMERR("prefetch_hash unsupported on tasklet-verifying device");
+		return -EOPNOTSUPP;
+	}
+
+	if (argc == 1) {
+		start = 0;
+		n = total;
+	} else if (argc == 3) {
+		if (kstrtoull(argv[1], 0, &value) || (sector_t)value != value)
+			return -EINVAL;
+		start = value;
+
+		if (kstrtoull(argv[2], 0, &value) || (sector_t)value != value)
+			return -EINVAL;
+		n = value;
+	} else {
+		return -EINVAL;
+	}
+
+	if (start >= total) {
+		if (!total) {
+			n = 0;
+			goto out;
+		}
+		DMERR("prefetch_hash start %llu beyond hash area (%llu blocks)",
+		      (unsigned long long)start, (unsigned long long)total);
+		return -EINVAL;
+	}
+
+	n = min(n, total - start);
+	n = min_t(sector_t, n, UINT_MAX);
+
+out:
+	dm_bufio_prefetch(v->bufio, v->hash_start + start, n);
+
+	DMEMIT("prefetch_hash: started %llu blocks", (unsigned long long)n);
+
+	return 1;
+}
+
+static int verity_drop_hash(struct dm_verity *v, unsigned int argc,
+			    char **argv, char *result, unsigned int maxlen)
+{
+	sector_t total = v->hash_end - v->hash_start;
+	sector_t start, n;
+	unsigned long long value;
+	unsigned int sz = 0;
+
+	/*
+	 * dm_bufio_forget_buffers() ends up in cache_remove_range(), which
+	 * cannot run on a client created with DM_BUFIO_CLIENT_NO_SLEEP.
+	 */
+	if (v->use_bh_wq) {
+		DMERR("drop_hash unsupported on tasklet-verifying device");
+		return -EOPNOTSUPP;
+	}
+
+	if (argc == 1) {
+		start = 0;
+		n = total;
+	} else if (argc == 3) {
+		if (kstrtoull(argv[1], 0, &value) || (sector_t)value != value)
+			return -EINVAL;
+		start = value;
+
+		if (kstrtoull(argv[2], 0, &value) || (sector_t)value != value)
+			return -EINVAL;
+		n = value;
+	} else {
+		return -EINVAL;
+	}
+
+	if (start >= total) {
+		if (!total) {
+			n = 0;
+			goto out;
+		}
+		DMERR("drop_hash start %llu beyond hash area (%llu blocks)",
+		      (unsigned long long)start, (unsigned long long)total);
+		return -EINVAL;
+	}
+
+	n = min(n, total - start);
+
+out:
+	dm_bufio_forget_buffers(v->bufio, v->hash_start + start, n);
+
+	DMEMIT("drop_hash: dropped %llu", (unsigned long long)n);
+
+	return 1;
+}
+
+/*
+ * retain_bytes <hash|fec> [<bytes>]
+ *
+ * Report the selected client's retain target, or set it (0 resets to the
+ * dm-bufio default, non-zero is rounded up to a block boundary).
+ */
+static int verity_retain_bytes(struct dm_verity *v, unsigned int argc,
+			       char **argv, char *result, unsigned int maxlen)
+{
+	struct dm_bufio_client *bufio;
+	unsigned long long value;
+	unsigned int sz = 0;
+
+	if (argc < 2 || argc > 3)
+		return -EINVAL;
+
+	if (!strcasecmp(argv[1], "hash")) {
+		bufio = v->bufio;
+	} else if (!strcasecmp(argv[1], "fec")) {
+		if (!verity_fec_is_enabled(v)) {
+			DMERR("FEC is not enabled");
+			return -EINVAL;
+		}
+		bufio = v->fec->bufio;
+	} else {
+		return -EINVAL;
+	}
+
+	if (argc == 3) {
+		if (kstrtoull(argv[2], 0, &value) ||
+		    (unsigned long)value != value)
+			return -EINVAL;
+		dm_bufio_set_retain_bytes(bufio, value);
+	}
+
+	DMEMIT("retain_bytes=%lu", dm_bufio_get_retain_bytes(bufio));
+
+	return 1;
+}
+
+static int verity_message(struct dm_target *ti, unsigned int argc, char **argv,
+			  char *result, unsigned int maxlen)
+{
+	struct dm_verity *v = ti->private;
+
+	if (!argc)
+		return -EINVAL;
+
+	if (!strcasecmp(argv[0], "retain_bytes"))
+		return verity_retain_bytes(v, argc, argv, result, maxlen);
+
+	if (!strcasecmp(argv[0], "prefetch_hash"))
+		return verity_prefetch_hash(v, argc, argv, result, maxlen);
+
+	if (!strcasecmp(argv[0], "drop_hash"))
+		return verity_drop_hash(v, argc, argv, result, maxlen);
+
+	DMERR("unknown message '%s'", argv[0]);
+
+	return -EINVAL;
+}
+
 static struct target_type verity_target = {
 	.name		= "verity",
 /* Note: the LSMs depend on the singleton and immutable features */
@@ -1947,6 +2115,7 @@ static struct target_type verity_target = {
 	.postsuspend	= verity_postsuspend,
 	.resume		= verity_resume,
 	.status		= verity_status,
+	.message	= verity_message,
 	.prepare_ioctl	= verity_prepare_ioctl,
 	.iterate_devices = verity_iterate_devices,
 	.io_hints	= verity_io_hints,
-- 
2.43.0


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

* Re: [PATCH v2 4/4] dm-verity: add messages to inspect, prefetch and drop hash blocks
  2026-11-18 17:21 ` [PATCH v2 4/4] dm-verity: add messages to inspect, prefetch and drop hash blocks Yongpeng Yang
@ 2026-11-18 17:43   ` sashiko-bot
  0 siblings, 0 replies; 8+ messages in thread
From: sashiko-bot @ 2026-11-18 17:43 UTC (permalink / raw)
  To: Yongpeng Yang, agk, bmarzins, dm-devel, mpatocka, snitzer; +Cc: yangyongpeng

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] dm-verity: unsynchronized prefetch in verity_prefetch_hash()
  across suspend
- [Low] dm-verity: unchecked start when total is 0 and duplicated range
  parsing
--

commit 836508fe811e1c71a731130ee4c4606452302695
Author: Yongpeng Yang <yangyongpeng@xiaomi.com>

dm-verity: add messages to inspect, prefetch and drop hash blocks

This commit adds target messages to dm-verity to inspect or set the bufio
retain target (retain_bytes), asynchronously prefetch hash blocks
(prefetch_hash), and evict cached hash blocks (drop_hash), along with
documentation in verity.rst.

> diff --git a/Documentation/admin-guide/device-mapper/verity.rst b/Documentation/admin-guide/device-mapper/verity.rst
> index 9e9d4b8157c03..ec29cc6b6dc73 100644
> --- a/Documentation/admin-guide/device-mapper/verity.rst
> +++ b/Documentation/admin-guide/device-mapper/verity.rst
> @@ -328,6 +328,49 @@ Status

[ ... ]

> +Both cache commands still work while the device is suspended: prefetch
> +reads are queued and complete on resume, and ``drop_hash`` finds an empty
> +cache because verity resets the bufio client on suspend.
> +
>  Example
>  =======
>  Set up a device::
> diff --git a/drivers/md/dm-verity-target.c b/drivers/md/dm-verity-target.c
> index 15dee27d58a7a..78ae2e6bff186 100644
> --- a/drivers/md/dm-verity-target.c
> +++ b/drivers/md/dm-verity-target.c
> @@ -1924,6 +1924,174 @@ static void verity_resume(struct dm_target *ti)
>  
>  static void verity_register_bufio_sysfs(struct dm_verity *v);
>  
> +static int verity_prefetch_hash(struct dm_verity *v, unsigned int argc,
> +				char **argv, char *result, unsigned int maxlen)
> +{
> +	sector_t total = v->hash_end - v->hash_start;
> +	sector_t start, n;
> +	unsigned long long value;
> +	unsigned int sz = 0;
> +
> +	/*
> +	 * On a no_sleep client a buffer being read cannot be evicted or
> +	 * waited for, so an unfinished prefetch would outlive a suspend or
> +	 * teardown; drop_hash rejects this case for the same reason.
> +	 */
> +	if (v->use_bh_wq) {
> +		DMERR("prefetch_hash unsupported on tasklet-verifying device");
> +		return -EOPNOTSUPP;
> +	}
> +
> +	if (argc == 1) {
> +		start = 0;
> +		n = total;
> +	} else if (argc == 3) {
> +		if (kstrtoull(argv[1], 0, &value) || (sector_t)value != value)
> +			return -EINVAL;
> +		start = value;
> +
> +		if (kstrtoull(argv[2], 0, &value) || (sector_t)value != value)
> +			return -EINVAL;
> +		n = value;
> +	} else {
> +		return -EINVAL;
> +	}
> +
> +	if (start >= total) {
> +		if (!total) {
> +			n = 0;
> +			goto out;
> +		}
> +		DMERR("prefetch_hash start %llu beyond hash area (%llu blocks)",
> +		      (unsigned long long)start, (unsigned long long)total);
> +		return -EINVAL;
> +	}
> +
> +	n = min(n, total - start);
> +	n = min_t(sector_t, n, UINT_MAX);
> +
> +out:
> +	dm_bufio_prefetch(v->bufio, v->hash_start + start, n);

[Severity: Medium]
Can verity_prefetch_hash() race with verity_postsuspend() or submit reads
while the target is suspended?

target_message() runs under the live table SRCU lock without holding
md->suspend_lock or checking dm_suspended(ti).  Unlike verity_prefetch_io(),
which queues work on v->verify_wq that verity_postsuspend() drains before
calling dm_bufio_client_reset(v->bufio), verity_prefetch_hash() calls
dm_bufio_prefetch() directly in the ioctl context:

CPU0                              CPU1
target_message()
  verity_prefetch_hash()
    __dm_bufio_prefetch()
      dm_bufio_lock(c)
      b = __bufio_new(c, block, ...)
        /* b->hold_count = 1 */
      dm_bufio_unlock(c)
                                  dm_suspend()
                                    verity_postsuspend()
                                      flush_workqueue(v->verify_wq)
                                      dm_bufio_client_reset(v->bufio)
                                        drop_buffers(c)
                                          cache_iterate(..., warn_leak, ...)
                                            WARN_ON(!(*warned))
      submit_io(b, ...)
      dm_bufio_release(b)

drop_buffers() sees b->hold_count == 1 and triggers WARN_ON in warn_leak()
and WARN_ON(cache_count(&c->cache, i)); with
CONFIG_DM_DEBUG_BLOCK_STACK_TRACING enabled, warn_leak() also resets
b->hold_count to 0 and drop_buffers() frees b while CPU0 still passes b to
submit_io() and dm_bufio_release(), causing a use-after-free and
BUG_ON(!atomic_read(&b->hold_count)).

In addition, because v->bufio is backed by v->hash_dev->bdev rather than
the dm-verity mapped_device, calling prefetch_hash while suspended
immediately submits read BIOs to v->hash_dev->bdev and populates v->bufio
(which a subsequent drop_hash while suspended can then drop), rather than
queueing reads until resume as described in verity.rst and expected by
2de510fccbca ("dm-verity: fix prefetch-vs-suspend race").

> +
> +	DMEMIT("prefetch_hash: started %llu blocks", (unsigned long long)n);
> +
> +	return 1;
> +}
> +
> +static int verity_drop_hash(struct dm_verity *v, unsigned int argc,
> +			    char **argv, char *result, unsigned int maxlen)
> +{
> +	sector_t total = v->hash_end - v->hash_start;
> +	sector_t start, n;
> +	unsigned long long value;
> +	unsigned int sz = 0;
> +
> +	/*
> +	 * dm_bufio_forget_buffers() ends up in cache_remove_range(), which
> +	 * cannot run on a client created with DM_BUFIO_CLIENT_NO_SLEEP.
> +	 */
> +	if (v->use_bh_wq) {
> +		DMERR("drop_hash unsupported on tasklet-verifying device");
> +		return -EOPNOTSUPP;
> +	}
> +
> +	if (argc == 1) {
> +		start = 0;
> +		n = total;
> +	} else if (argc == 3) {
> +		if (kstrtoull(argv[1], 0, &value) || (sector_t)value != value)
> +			return -EINVAL;
> +		start = value;
> +
> +		if (kstrtoull(argv[2], 0, &value) || (sector_t)value != value)
> +			return -EINVAL;
> +		n = value;
> +	} else {
> +		return -EINVAL;
> +	}
> +
> +	if (start >= total) {
> +		if (!total) {
> +			n = 0;
> +			goto out;
> +		}
> +		DMERR("drop_hash start %llu beyond hash area (%llu blocks)",
> +		      (unsigned long long)start, (unsigned long long)total);
> +		return -EINVAL;
> +	}

[Severity: Low]
When total is 0 (levels == 0), should a non-zero start argument such as
"prefetch_hash 100 10" or "drop_hash 100 10" still be rejected with
-EINVAL?

Both verity_prefetch_hash() and verity_drop_hash() take the !total branch
even when start > 0, jumping to out: and computing v->hash_start + start
with an unvalidated start offset.  Factoring the tasklet check, argument
parsing, and range clamping into a shared helper that only treats
(!start && !total) as an empty-range no-op would also remove the
duplicated parsing code between the two functions.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261118172133.689163-2-yangyongpeng.storage@gmail.com?part=4

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

* Re: [PATCH v2 3/4] dm-verity: size the hash retain target from the hash area
  2026-11-18 17:21 ` [PATCH v2 3/4] dm-verity: size the hash retain target from the hash area Yongpeng Yang
@ 2026-11-18 17:50   ` sashiko-bot
  0 siblings, 0 replies; 8+ messages in thread
From: sashiko-bot @ 2026-11-18 17:50 UTC (permalink / raw)
  To: Yongpeng Yang, agk, bmarzins, dm-devel, mpatocka, snitzer; +Cc: yangyongpeng

Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [Low] dm-verity: missing return on kobject_add() error in
  verity_presuspend_undo()
- [Low] dm-verity: redundant post-definition
  verity_register_bufio_sysfs() prototype
- [Low] dm-verity: dead code and redundant kobject reallocation in
  verity_resume()
--

commit 2adf10b9bb56217937bcf599cad99cc4d02fedf6
Author: Yongpeng Yang <yangyongpeng@xiaomi.com>

dm-verity: size the hash retain target from the hash area

This commit sets the default dm-bufio retain target for a dm-verity hash
client to a configurable percentage of the hash area and publishes the
dm-bufio clients in sysfs under /sys/block/dm-N/dm-bufio/.

> diff --git a/drivers/md/dm-verity-target.c b/drivers/md/dm-verity-target.c
> index 6d589867623c0..15dee27d58a7a 100644
> --- a/drivers/md/dm-verity-target.c
> +++ b/drivers/md/dm-verity-target.c

[ ... ]

> @@ -1797,6 +1825,49 @@ static inline void verity_security_clear_integrity(struct dm_target *ti)
>  
>  #endif /* CONFIG_SECURITY */
>  
> +/* Detach the dm-bufio directories from sysfs, keeping the kobjects. */
> +static void verity_detach_bufio_sysfs(struct dm_verity *v)
> +{
> +	dm_bufio_client_sysfs_detach(v->bufio);
> +	if (verity_fec_is_enabled(v)) {
> +		dm_bufio_client_sysfs_detach(v->fec->bufio);
> +		dm_bufio_client_sysfs_detach(v->fec->data_bufio);
> +	}
> +
> +	if (v->bufio_kobj && v->bufio_kobj->state_in_sysfs)
> +		kobject_del(v->bufio_kobj);
> +}
> +
> +/*
> + * Free the directory names before a table reload resumes a new
> + * instance.  Presuspend runs before the queue is frozen, so the kernfs
> + * drain cannot block on I/O.
> + */
> +static void verity_presuspend(struct dm_target *ti)
> +{
> +	verity_detach_bufio_sysfs(ti->private);
> +}
> +
> +static void verity_presuspend_undo(struct dm_target *ti)
> +{
> +	struct dm_verity *v = ti->private;
> +	struct mapped_device *md = dm_table_get_md(v->ti->table);
> +	struct kobject *parent = &disk_to_dev(dm_disk(md))->kobj;
> +
> +	if (!v->bufio_kobj)
> +		return;
> +
> +	if (!v->bufio_kobj->state_in_sysfs &&
> +	    kobject_add(v->bufio_kobj, parent, "%s", "dm-bufio"))
> +		DMERR("cannot re-attach dm-bufio sysfs directory");
> +
> +	(void)dm_bufio_client_sysfs_add(v->bufio, v->bufio_kobj, "hash");
> +	if (verity_fec_is_enabled(v)) {
> +		(void)dm_bufio_client_sysfs_add(v->fec->bufio, v->bufio_kobj, "fec");
> +		(void)dm_bufio_client_sysfs_add(v->fec->data_bufio, v->bufio_kobj, "fec-data");
> +	}
> +}

[Severity: Low]
Should verity_presuspend_undo() return early when kobject_add() fails to
re-attach v->bufio_kobj?  Falling through passes the unattached
v->bufio_kobj (with a NULL kernfs node) as the parent to
dm_bufio_client_sysfs_add(), causing each child registration to fail with
-ENOENT and emit additional kobject error messages.  Also, the client
registration sequence here duplicates verity_register_bufio_sysfs().

>  static void verity_postsuspend(struct dm_target *ti)
>  {
>  	struct dm_verity *v = ti->private;
> @@ -1806,6 +1877,53 @@ static void verity_postsuspend(struct dm_target *ti)
>  	verity_security_clear_integrity(ti);
>  }
>  
> +/*
> + * Publish the bufio clients under /sys/block/dm-N/dm-bufio/.  This runs
> + * from ->resume, not ->ctr, because the dm device's block device does not
> + * exist until the table is loaded.
> + */
> +static void verity_register_bufio_sysfs(struct dm_verity *v)
> +{
> +	struct mapped_device *md = dm_table_get_md(v->ti->table);
> +	struct kobject *parent = &disk_to_dev(dm_disk(md))->kobj;
> +
> +	if (v->bufio_kobj)
> +		return;
> +
> +	v->bufio_kobj = kobject_create_and_add("dm-bufio", parent);
> +	if (!v->bufio_kobj) {
> +		DMERR("cannot create dm-bufio sysfs directory");
> +		return;
> +	}
> +
> +	if (dm_bufio_client_sysfs_add(v->bufio, v->bufio_kobj, "hash"))
> +		DMERR("cannot register hash bufio client in sysfs");
> +
> +	if (verity_fec_is_enabled(v)) {
> +		if (dm_bufio_client_sysfs_add(v->fec->bufio, v->bufio_kobj, "fec"))
> +			DMERR("cannot register FEC bufio client in sysfs");
> +		if (dm_bufio_client_sysfs_add(v->fec->data_bufio, v->bufio_kobj, "fec-data"))
> +			DMERR("cannot register FEC data bufio client in sysfs");
> +	}
> +}
> +
> +static void verity_resume(struct dm_target *ti)
> +{
> +	struct dm_verity *v = ti->private;
> +
> +	if (v->bufio_kobj) {
> +		/* detached by presuspend, or re-attached by presuspend_undo */
> +		if (v->bufio_kobj->state_in_sysfs)
> +			kobject_del(v->bufio_kobj);
> +		kobject_put(v->bufio_kobj);
> +		v->bufio_kobj = NULL;
> +	}
> +
> +	verity_register_bufio_sysfs(v);
> +}

[Severity: Low]
Why does verity_resume() drop and reallocate v->bufio_kobj instead of
re-attaching it?

The commit message notes that presuspend keeps the kobjects until the
table is destroyed, and verity_register_bufio_sysfs() checks if
v->bufio_kobj is already allocated, which is dead code because
verity_resume() is its only caller and always clears v->bufio_kobj first.
In addition, if v->bufio_kobj->state_in_sysfs were ever set on entry to
verity_resume(), calling kobject_del(v->bufio_kobj) without detaching the
child client kobjects first would leave their state_in_sysfs flags set and
cause the subsequent dm_bufio_client_sysfs_add() calls to fail with
-EBUSY.

> +
> +static void verity_register_bufio_sysfs(struct dm_verity *v);

[Severity: Low]
This isn't a bug, but this forward declaration of
verity_register_bufio_sysfs() is placed after both its definition and its
caller.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261118172133.689163-2-yangyongpeng.storage@gmail.com?part=3

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

* Re: [PATCH v2 2/4] dm-bufio: allow exposing a client in sysfs under a caller-chosen kobject
  2026-11-18 17:21 ` [PATCH v2 2/4] dm-bufio: allow exposing a client in sysfs under a caller-chosen kobject Yongpeng Yang
@ 2026-11-18 17:57   ` sashiko-bot
  0 siblings, 0 replies; 8+ messages in thread
From: sashiko-bot @ 2026-11-18 17:57 UTC (permalink / raw)
  To: Yongpeng Yang, agk, bmarzins, dm-devel, mpatocka, snitzer; +Cc: yangyongpeng

Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [High] dm-bufio: sysfs client exposure retained despite maintainer
  direction
- [Medium] dm-bufio: module unload race in dm_bufio_kobj_release()
- [Low] dm-bufio: undocumented dm_bufio_client_sysfs_detach() and
  lifetime claims
--

commit a1c1b2bd57f6306f0bce7f21a188c32909bec5c3
Author: Yongpeng Yang <yangyongpeng@xiaomi.com>

dm-bufio: allow exposing a client in sysfs under a caller-chosen kobject

This commit adds dm_bufio_client_sysfs_add() and
dm_bufio_client_sysfs_detach() to expose a dm-bufio client's attributes and
writable retain_bytes target in sysfs under a caller-supplied kobject.

> diff --git a/Documentation/ABI/testing/sysfs-kernel-dm-bufio b/Documentation/ABI/testing/sysfs-kernel-dm-bufio
> new file mode 100644
> index 0000000000000..bccd679c1b607
> --- /dev/null
> +++ b/Documentation/ABI/testing/sysfs-kernel-dm-bufio
> @@ -0,0 +1,76 @@
> +What:		/sys/block/<dm-device>/dm-bufio/<name>/
> +Date:		November 2026
> +KernelVersion:	7.4
> +Contact:	dm-devel@lists.linux.dev
> +Description:
> +		Directory exposing one dm-bufio client whose user opted in
> +		through dm_bufio_client_sysfs_add().  <name> is chosen by that
> +		user; dm-verity, which places the directory under the block
> +		device of its own dm device, uses <name> "hash" for the hash
> +		tree client, "fec" for the FEC parity client and "fec-data"
> +		for the FEC data client.  The directory lives from
> +		registration until the client is destroyed, independently of
> +		any device-mapper table loaded on the device, so a suspend or
> +		table reload never leaves dangling entries behind.  The
> +		read-only counters are instantaneous snapshots and may be
> +		approximate.

[Severity: High]
As reported by Mikulas Patocka on v1 [1], should dm-bufio clients be
exposed in sysfs at all?

Multiple targets in a device-mapper table would clash under the same
/sys/block/<dm-device>/dm-bufio/ directory, and reloading a table creates a
new dm_bufio_client and discards any retain_bytes value configured in
sysfs.  The maintainer requested configuring dm-bufio parameters through
device-mapper target messages or constructor arguments instead.

[ ... ]

> diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c
> index 367f878c17dc1..a2991dcd532fb 100644
> --- a/drivers/md/dm-bufio.c
> +++ b/drivers/md/dm-bufio.c
[ ... ]
> @@ -2505,6 +2511,165 @@ static unsigned long dm_bufio_shrink_count(struct shrinker *shrink, struct shrin
[ ... ]
> +static void dm_bufio_kobj_release(struct kobject *kobj)
> +{
> +	struct dm_bufio_client *c = container_of(kobj, struct dm_bufio_client, kobj);
> +
> +	/*
> +	 * The client is freed only after this completes, as in dm-sysfs.
> +	 */
> +	complete(&c->kobj_unregister);
> +}
> +
> +static const struct kobj_type dm_bufio_ktype = {
> +	.sysfs_ops	= &dm_bufio_sysfs_ops,
> +	.default_groups	= dm_bufio_groups,
> +	.release	= dm_bufio_kobj_release,
> +};
> +
> +static int dm_bufio_kobj_add(struct dm_bufio_client *c, struct kobject *parent,
> +			     const char *name)
> +{
> +	init_completion(&c->kobj_unregister);
> +
> +	return kobject_init_and_add(&c->kobj, &dm_bufio_ktype, parent, "%s",
> +				    name);
> +}
> +
> +/* Drop the sysfs reference and wait for the release method to run. */
> +static void dm_bufio_kobj_del(struct dm_bufio_client *c)
> +{
> +	kobject_put(&c->kobj);
> +	wait_for_completion(&c->kobj_unregister);
> +}

[Severity: Medium]
Can dm-bufio.ko be unloaded while dm_bufio_kobj_release() is still
executing?

CONFIG_DM_BUFIO is tristate, and when the release callback runs
asynchronously (for example via kobject_delayed_cleanup() under
CONFIG_DEBUG_KOBJECT_RELEASE=y, or when another task drops the last kobject
reference), the caller waiting in dm_bufio_kobj_del() unblocks as soon as
complete() is called:

CPU0                              CPU1
dm_bufio_client_destroy()
  dm_bufio_kobj_del()
    kobject_put(&c->kobj)
    wait_for_completion()
                                  kobject_release()
                                    dm_bufio_kobj_release()
                                      complete(&c->kobj_unregister)
                                      <preempted>
  kfree(c)
sys_delete_module("dm_bufio")
                                      return;  <-- unmapped module text

2995fa78e423 ("dm sysfs: fix a module unload race") added
dm_kobject_release() in drivers/md/dm-builtin.c (always built into vmlinux
when CONFIG_BLK_DEV_DM is enabled) so kobject release callbacks that signal
a completion do not reside in unloadable module text.

> diff --git a/include/linux/dm-bufio.h b/include/linux/dm-bufio.h
> index 9bf3f805c43c2..ac168ac797e4f 100644
> --- a/include/linux/dm-bufio.h
> +++ b/include/linux/dm-bufio.h
[ ... ]
> @@ -165,6 +166,14 @@ void dm_bufio_set_minimum_buffers(struct dm_bufio_client *c, unsigned int n);
>  void dm_bufio_set_retain_bytes(struct dm_bufio_client *c, unsigned long bytes);
>  unsigned long dm_bufio_get_retain_bytes(struct dm_bufio_client *c);
>  
> +/*
> + * Publish the client as <name> under <parent> in sysfs; removed in
> + * dm_bufio_client_destroy().
> + */
> +int dm_bufio_client_sysfs_add(struct dm_bufio_client *c, struct kobject *parent,
> +			      const char *name);
> +void dm_bufio_client_sysfs_detach(struct dm_bufio_client *c);

[Severity: Low]
This comment, the commit message, Documentation/ABI/testing/sysfs-kernel-dm-bufio,
and Documentation/admin-guide/device-mapper/dm-bufio.rst all state that the
sysfs directory lives from registration until the client is destroyed in
dm_bufio_client_destroy(), without mentioning dm_bufio_client_sysfs_detach()
or that dm_bufio_client_sysfs_add() can re-attach a detached directory
across suspend and table reload.

[1] https://lore.kernel.org/r/d4fc9150-4768-f747-ca97-688bc9bebc46@redhat.com

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261118172133.689163-2-yangyongpeng.storage@gmail.com?part=2

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

end of thread, other threads:[~2026-11-18 17:57 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-18 17:21 [PATCH v2 0/4] dm-bufio: per-client retain target, sysfs and dm-verity cache control Yongpeng Yang
2026-11-18 17:21 ` [PATCH v2 1/4] dm-bufio: make the retain target per client Yongpeng Yang
2026-11-18 17:21 ` [PATCH v2 2/4] dm-bufio: allow exposing a client in sysfs under a caller-chosen kobject Yongpeng Yang
2026-11-18 17:57   ` sashiko-bot
2026-11-18 17:21 ` [PATCH v2 3/4] dm-verity: size the hash retain target from the hash area Yongpeng Yang
2026-11-18 17:50   ` sashiko-bot
2026-11-18 17:21 ` [PATCH v2 4/4] dm-verity: add messages to inspect, prefetch and drop hash blocks Yongpeng Yang
2026-11-18 17:43   ` sashiko-bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.