[Devel] [PATCH RHEL7 COMMIT] ploop: Show whether device supports native discard
Konstantin Khorenko
khorenko at virtuozzo.com
Tue May 21 17:44:31 MSK 2019
The commit is pushed to "branch-rh7-3.10.0-957.12.2.vz7.96.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-957.12.2.vz7.96.1
------>
commit ac7df67d45761b1d03e089b98da7455bb656762f
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date: Tue May 21 17:44:29 2019 +0300
ploop: Show whether device supports native discard
... or not support discard at all.
Shown in: /sys/block/ploopXXX/pstate/discard_mode
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
=====================
Patchset description:
ploop: Return maintaince mode
This patch set enables it for vstorage.
Also, added file /sys/block/ploopXXX/pstate/native_discard,
which shows, whether we should use maintaince-mode based
discard or not.
https://jira.sw.ru/browse/PSBM-94662
Kirill Tkhai (8):
Revert "ploop: Remove now unused PLOOP_E_ZERO_INDEX and PLOOP_E_DELTA_ZERO_INDEX branches"
Revert "ploop: Remove now unused PLOOP_REQ_RELOC_S branches"
Revert "ploop: Remove now unused PLOOP_REQ_DISCARD branches"
Revert "ploop: Remove now unused PLOOP_REQ_ZERO branches"
Revert "ploop: Remove obsolete ioctls"
Partial revert "ploop: Enable native discard support for kaio engine"
ploop: Return maintaince mode ioctls again
ploop: Show whether device supports native discard
---
drivers/block/ploop/sysfs.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/block/ploop/sysfs.c b/drivers/block/ploop/sysfs.c
index b2203d152c2c..705ad36b6e41 100644
--- a/drivers/block/ploop/sysfs.c
+++ b/drivers/block/ploop/sysfs.c
@@ -484,6 +484,17 @@ static u32 show_freeze_state(struct ploop_device * plo)
return plo->freeze_state;
}
+static u32 show_discard_mode(struct ploop_device *plo)
+{
+ /*
+ * 0 - discard disabled (not implemented)
+ * 1 - maintaince mode-based discard
+ * 2 - hole-based discard
+ * 3 - move-tail-block discard (not implemented)
+ */
+ return test_bit(PLOOP_S_NO_FALLOC_DISCARD, &plo->state) ? 1 : 2;
+}
+
#define _TUNE_U32(_name) \
static u32 show_##_name(struct ploop_device * plo) \
{ \
@@ -571,6 +582,7 @@ static struct attribute *state_attributes[] = {
_A(blockable_reqs),
_A(blocked_bios),
_A(freeze_state),
+ _A(discard_mode),
NULL
};
More information about the Devel
mailing list