]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
dm thin: include metadata_low_watermark threshold in pool status
authorAndy Grover <agrover@redhat.com>
Fri, 27 Jul 2018 22:51:57 +0000 (15:51 -0700)
committerMike Snitzer <snitzer@redhat.com>
Mon, 30 Jul 2018 15:49:08 +0000 (11:49 -0400)
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>
Documentation/device-mapper/thin-provisioning.txt
drivers/md/dm-thin.c

index b8a57b9cec19bb218aa011b2af03d25bbdbd752c..883e7ca5f74588aa54b8ad7a50750ca44224ca89 100644 (file)
@@ -281,7 +281,7 @@ ii) Status
     <transaction id> <used metadata blocks>/<total metadata blocks>
     <used data blocks>/<total data blocks> <held metadata root>
     ro|rw|out_of_data_space [no_]discard_passdown [error|queue]_if_no_space
-    needs_check|-
+    needs_check|- metadata_low_watermark
 
     transaction id:
        A 64-bit number used by userspace to help synchronise with metadata
@@ -328,6 +328,11 @@ ii) Status
        thin-pool can be made fully operational again.  '-' indicates
        needs_check is not set.
 
+    metadata_low_watermark:
+       Value of metadata low watermark in blocks.  The kernel sets this
+       value internally but userspace needs to know this value to
+       determine if an event was caused by crossing this threshold.
+
 iii) Messages
 
     create_thin <dev id>
index b900723bbd0fae4845a17ef67dadcf33dc5cc67b..c44477d7a9ea769200c4ab7a3df04eab9cef37a5 100644 (file)
@@ -3890,6 +3890,8 @@ static void pool_status(struct dm_target *ti, status_type_t type,
                else
                        DMEMIT("- ");
 
+               DMEMIT("%llu ", (unsigned long long)calc_metadata_threshold(pt));
+
                break;
 
        case STATUSTYPE_TABLE:
@@ -3979,7 +3981,7 @@ static struct target_type pool_target = {
        .name = "thin-pool",
        .features = DM_TARGET_SINGLETON | DM_TARGET_ALWAYS_WRITEABLE |
                    DM_TARGET_IMMUTABLE,
-       .version = {1, 19, 0},
+       .version = {1, 20, 0},
        .module = THIS_MODULE,
        .ctr = pool_ctr,
        .dtr = pool_dtr,
@@ -4353,7 +4355,7 @@ static void thin_io_hints(struct dm_target *ti, struct queue_limits *limits)
 
 static struct target_type thin_target = {
        .name = "thin",
-       .version = {1, 19, 0},
+       .version = {1, 20, 0},
        .module = THIS_MODULE,
        .ctr = thin_ctr,
        .dtr = thin_dtr,