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

Submitted by Kirill Tkhai on May 21, 2019, 10:36 a.m.

Details

Message ID 155843498809.28886.7049385899768304793.stgit@localhost.localdomain
State New
Series "Revert "ploop: Disable ioctl(PLOOP_IOC_BALLOON)""
Headers show

Commit Message

Kirill Tkhai May 21, 2019, 10:36 a.m.
Shown in: /sys/block/ploopXXX/pstate/native_discard

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

Patch hide | download patch | download mbox

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
 };
 

Comments

Kirill Tkhai May 21, 2019, 11:26 a.m.
I'll send V2 of this patch.

On 21.05.2019 13:36, Kirill Tkhai wrote:
> Shown in: /sys/block/ploopXXX/pstate/native_discard
> 
> Signed-off-by: Kirill Tkhai <ktkhai@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
>  };
>  
>