[Devel] [PATCH 8/8] ploop: Show whether device supports native discard

Kirill Tkhai ktkhai at virtuozzo.com
Tue May 21 13:36:28 MSK 2019


Shown in: /sys/block/ploopXXX/pstate/native_discard

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 drivers/block/ploop/sysfs.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/block/ploop/sysfs.c b/drivers/block/ploop/sysfs.c
index b2203d152c2c..f3ef1ae7c064 100644
--- a/drivers/block/ploop/sysfs.c
+++ b/drivers/block/ploop/sysfs.c
@@ -484,6 +484,11 @@ static u32 show_freeze_state(struct ploop_device * plo)
 	return plo->freeze_state;
 }
 
+static u32 show_native_discard(struct ploop_device * plo)
+{
+	return !test_bit(PLOOP_S_NO_FALLOC_DISCARD, &plo->state);
+}
+
 #define _TUNE_U32(_name)				\
 static u32 show_##_name(struct ploop_device * plo)	\
 {							\
@@ -571,6 +576,7 @@ static struct attribute *state_attributes[] = {
 	_A(blockable_reqs),
 	_A(blocked_bios),
 	_A(freeze_state),
+	_A(native_discard),
 	NULL
 };
 



More information about the Devel mailing list