Linux Documentation
 help / color / mirror / Atom feed
* [PATCH 0/2] dm thin: complete writes only after the metadata commit
@ 2026-11-25  4:33 Peng Yu
  2026-11-25  4:33 ` [PATCH 1/2] dm thin metadata: report uncommitted state and refuse commits after a failure Peng Yu
  2026-11-25  4:33 ` [PATCH 2/2] dm thin: add wait_for_commit pool feature Peng Yu
  0 siblings, 2 replies; 3+ messages in thread
From: Peng Yu @ 2026-11-25  4:33 UTC (permalink / raw)
  To: Alasdair Kergon, Mike Snitzer, Mikulas Patocka,
	Benjamin Marzinski
  Cc: Joe Thornber, dm-devel, linux-doc, linux-kernel, Peng Yu

This series adds a new option to the dm thin pool: wait_for_commit. When
wait_for_commit is enabled, a write or a discard will return after the
metadata is committed. By default, wait_for_commit is disabled, and the
thin pool behaves exactly as before.

Why we need wait_for_commit:

Assume there is a server A, and the underlying device of its thin pool
is an NVMe-oF device. Server A creates a thin device and exports the
thin device to a remote host via NVMe-oF too. When server A fails, a
control plane will rebuild the pool and thin device on a standby
server B, and server B will export the thin device to the same remote
host. When the remote host issues a FLUSH, server A fails, so the
metadata are not committed to the pool. The thin pool fails over to
server B, and then the NVMe-oF multipath resends the FLUSH to B.
B receives the command and finds nothing to flush. In this case, some
uncommitted data are lost, but the remote host can't get any error.

As the dm thin pool doc says: "the thin-provisioning target behaves like
a physical disk that has a volatile write cache". If the underlying disk
of a thin pool is a remote disk and we want to fail over the thin pool
from server A to server B, the "volatile write cache" is only on
server A, and server B doesn't know about it, so we will get a
consistency issue. The wait_for_commit option could fix this issue with
a performance penalty.

Below is a performance test on my laptop. We got the results in a VM on
loop devices.

1 MiB sequential first writes (no zero fill)
|                      | 1 job, depth 1           | 8 jobs, depth 8          |
|                      | MiB/s | mean ms | p99 ms | MiB/s | mean ms | p99 ms |
| no wait_for_commit   | 1307  | 0.65    | 1.59   | 1596  | 39.7    | 276    |
| with wait_for_commit | 131   | 7.57    | 17.7   | 776   | 78.2    | 148    |

4 KiB random writes, mostly to new blocks (allocation and zero fill)
|                      | 1 job, depth 1, 2000 writes | 8 jobs, depth 2, 10000 writes |
|                      | s       | IOPS   | p99 ms   | s       | IOPS    | p99 ms    |
| no wait_for_commit   | 1.16    | 1723   | 0.97     | 4.96    | 2066    | 15.3      |
| with wait_for_commit | 10.5    | 195    | 11.6     | 15.1    | 673     | 49.5      |

4 KiB random overwrites of mapped blocks, 4 jobs, depth 16
|                      | IOPS   | mean ms | p99 ms |
| no wait_for_commit   | 202095 | 0.31    | 1.12   |
| with wait_for_commit | 203293 | 0.31    | 1.13   |

Peng Yu (2):
  dm thin metadata: report uncommitted state and refuse commits after a
    failure
  dm thin: add wait_for_commit pool feature

 .../device-mapper/thin-provisioning.rst       |  25 +++-
 drivers/md/dm-thin-metadata.c                 |  61 +++++++--
 drivers/md/dm-thin-metadata.h                 |  14 +++
 drivers/md/dm-thin.c                          | 116 +++++++++++++++---
 4 files changed, 190 insertions(+), 26 deletions(-)


base-commit: 7475ea8b58616b33c04afb976cf0fbaad9dd63fb
-- 
2.43.0


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

end of thread, other threads:[~2026-11-25  4:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-25  4:33 [PATCH 0/2] dm thin: complete writes only after the metadata commit Peng Yu
2026-11-25  4:33 ` [PATCH 1/2] dm thin metadata: report uncommitted state and refuse commits after a failure Peng Yu
2026-11-25  4:33 ` [PATCH 2/2] dm thin: add wait_for_commit pool feature Peng Yu

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