Patchwork [PATCHv2,11/20] iscsi: add bdrv_has_discard_zeroes and bdrv_has_discard_write_zeroes

login
register
mail settings
Submitter Peter Lieven
Date Sept. 17, 2013, 1:48 p.m.
Message ID <1379425736-11326-12-git-send-email-pl@kamp.de>
Download mbox | patch
Permalink /patch/275474/
State New
Headers show

Comments

Peter Lieven - Sept. 17, 2013, 1:48 p.m.
Signed-off-by: Peter Lieven <pl@kamp.de>
---
 block/iscsi.c |   16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
Eric Blake - Sept. 19, 2013, 8:17 p.m.
On 09/17/2013 07:48 AM, Peter Lieven wrote:
> Signed-off-by: Peter Lieven <pl@kamp.de>
> ---
>  block/iscsi.c |   16 +++++++++++++++-
>  1 file changed, 15 insertions(+), 1 deletion(-)
> 

> @@ -1522,7 +1534,9 @@ static BlockDriver bdrv_iscsi = {
>      .bdrv_aio_writev = iscsi_aio_writev,
>      .bdrv_aio_flush  = iscsi_aio_flush,
>  
> -    .bdrv_has_zero_init = iscsi_has_zero_init,
> +    .bdrv_has_zero_init            = iscsi_has_zero_init,
> +    .bdrv_has_discard_zeroes       = iscsi_has_discard_zeroes ,

Spurious space before ','.  As that's trivial to fix, feel free to add:

Reviewed-by: Eric Blake <eblake@redhat.com>

Patch

diff --git a/block/iscsi.c b/block/iscsi.c
index 21b1ecf..46c7c8d 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -1440,6 +1440,18 @@  static int iscsi_has_zero_init(BlockDriverState *bs)
     return 0;
 }
 
+static int iscsi_has_discard_zeroes(BlockDriverState *bs)
+{
+    IscsiLun *iscsilun = bs->opaque;
+    return iscsilun->lbprz;
+}
+
+static int iscsi_has_discard_write_zeroes(BlockDriverState *bs)
+{
+    IscsiLun *iscsilun = bs->opaque;
+    return iscsilun->lbprz && iscsilun->lbp.lbpws;
+}
+
 static int iscsi_create(const char *filename, QEMUOptionParameter *options)
 {
     int ret = 0;
@@ -1522,7 +1534,9 @@  static BlockDriver bdrv_iscsi = {
     .bdrv_aio_writev = iscsi_aio_writev,
     .bdrv_aio_flush  = iscsi_aio_flush,
 
-    .bdrv_has_zero_init = iscsi_has_zero_init,
+    .bdrv_has_zero_init            = iscsi_has_zero_init,
+    .bdrv_has_discard_zeroes       = iscsi_has_discard_zeroes ,
+    .bdrv_has_discard_write_zeroes = iscsi_has_discard_write_zeroes,
 
 #ifdef __linux__
     .bdrv_ioctl       = iscsi_ioctl,