diff options
author | Andy Grover <agrover@redhat.com> | 2018-07-27 18:51:57 -0400 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2018-07-30 11:49:08 -0400 |
commit | 63c8ecb6261abcb79191a264778e8dae222e67cf (patch) | |
tree | c40e72bd99cdac2f87fea33df6cf666740c0d0cf | |
parent | 9ff07e7d634cb005e7c5dc5e2c28a06508eb4fbf (diff) |
dm thin: include metadata_low_watermark threshold in pool status
The metadata low watermark threshold is set by the kernel. But the
kernel depends on userspace to extend the thinpool metadata device when
the threshold is crossed.
Since the metadata low watermark threshold is not visible to userspace,
upon receiving an event, userspace cannot tell that the kernel wants the
metadata device extended, instead of some other eventing condition.
Making it visible (but not settable) enables userspace to affirmatively
know the kernel is asking for a metadata device extension, by comparing
metadata_low_watermark against nr_free_blocks_metadata, also reported in
status.
Current solutions like dmeventd have their own thresholds for extending
the data and metadata devices, and both devices are checked against
their thresholds on each event. This lessens the value of the kernel-set
threshold, since userspace will either extend the metadata device sooner,
when receiving another event; or will receive the metadata lowater event
and do nothing, if dmeventd's threshold is less than the kernel's.
(This second case is dangerous. The metadata lowater event will not be
re-sent, so no further event will be generated before the metadata
device is out if space, unless some other event causes userspace to
recheck its thresholds.)
Signed-off-by: Andy Grover <agrover@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
-rw-r--r-- | Documentation/device-mapper/thin-provisioning.txt | 7 | ||||
-rw-r--r-- | drivers/md/dm-thin.c | 6 |
2 files changed, 10 insertions, 3 deletions
diff --git a/Documentation/device-mapper/thin-provisioning.txt b/Documentation/device-mapper/thin-provisioning.txt index b8a57b9cec19..883e7ca5f745 100644 --- a/Documentation/device-mapper/thin-provisioning.txt +++ b/Documentation/device-mapper/thin-provisioning.txt | |||
@@ -281,7 +281,7 @@ ii) Status | |||
281 | <transaction id> <used metadata blocks>/<total metadata blocks> | 281 | <transaction id> <used metadata blocks>/<total metadata blocks> |
282 | <used data blocks>/<total data blocks> <held metadata root> | 282 | <used data blocks>/<total data blocks> <held metadata root> |
283 | ro|rw|out_of_data_space [no_]discard_passdown [error|queue]_if_no_space | 283 | ro|rw|out_of_data_space [no_]discard_passdown [error|queue]_if_no_space |
284 | needs_check|- | 284 | needs_check|- metadata_low_watermark |
285 | 285 | ||
286 | transaction id: | 286 | transaction id: |
287 | A 64-bit number used by userspace to help synchronise with metadata | 287 | A 64-bit number used by userspace to help synchronise with metadata |
@@ -328,6 +328,11 @@ ii) Status | |||
328 | thin-pool can be made fully operational again. '-' indicates | 328 | thin-pool can be made fully operational again. '-' indicates |
329 | needs_check is not set. | 329 | needs_check is not set. |
330 | 330 | ||
331 | metadata_low_watermark: | ||
332 | Value of metadata low watermark in blocks. The kernel sets this | ||
333 | value internally but userspace needs to know this value to | ||
334 | determine if an event was caused by crossing this threshold. | ||
335 | |||
331 | iii) Messages | 336 | iii) Messages |
332 | 337 | ||
333 | create_thin <dev id> | 338 | create_thin <dev id> |
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c index b900723bbd0f..c44477d7a9ea 100644 --- a/drivers/md/dm-thin.c +++ b/drivers/md/dm-thin.c | |||
@@ -3890,6 +3890,8 @@ static void pool_status(struct dm_target *ti, status_type_t type, | |||
3890 | else | 3890 | else |
3891 | DMEMIT("- "); | 3891 | DMEMIT("- "); |
3892 | 3892 | ||
3893 | DMEMIT("%llu ", (unsigned long long)calc_metadata_threshold(pt)); | ||
3894 | |||
3893 | break; | 3895 | break; |
3894 | 3896 | ||
3895 | case STATUSTYPE_TABLE: | 3897 | case STATUSTYPE_TABLE: |
@@ -3979,7 +3981,7 @@ static struct target_type pool_target = { | |||
3979 | .name = "thin-pool", | 3981 | .name = "thin-pool", |
3980 | .features = DM_TARGET_SINGLETON | DM_TARGET_ALWAYS_WRITEABLE | | 3982 | .features = DM_TARGET_SINGLETON | DM_TARGET_ALWAYS_WRITEABLE | |
3981 | DM_TARGET_IMMUTABLE, | 3983 | DM_TARGET_IMMUTABLE, |
3982 | .version = {1, 19, 0}, | 3984 | .version = {1, 20, 0}, |
3983 | .module = THIS_MODULE, | 3985 | .module = THIS_MODULE, |
3984 | .ctr = pool_ctr, | 3986 | .ctr = pool_ctr, |
3985 | .dtr = pool_dtr, | 3987 | .dtr = pool_dtr, |
@@ -4353,7 +4355,7 @@ static void thin_io_hints(struct dm_target *ti, struct queue_limits *limits) | |||
4353 | 4355 | ||
4354 | static struct target_type thin_target = { | 4356 | static struct target_type thin_target = { |
4355 | .name = "thin", | 4357 | .name = "thin", |
4356 | .version = {1, 19, 0}, | 4358 | .version = {1, 20, 0}, |
4357 | .module = THIS_MODULE, | 4359 | .module = THIS_MODULE, |
4358 | .ctr = thin_ctr, | 4360 | .ctr = thin_ctr, |
4359 | .dtr = thin_dtr, | 4361 | .dtr = thin_dtr, |