qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH for-2.6] block: Don't ignore flags in blk_aio_write_zeroes()
@ 2016-04-15  8:27 Kevin Wolf
  2016-04-15 13:59 ` Eric Blake
  0 siblings, 1 reply; 3+ messages in thread
From: Kevin Wolf @ 2016-04-15  8:27 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, mreitz, qemu-devel

Commit 57d6a428 neglected to pass the given flags to blk_aio_prwv(),
which broke discard by WRITE SAME for scsi-disk (the UNMAP bit would be
ignored).

Reported-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/block-backend.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/block/block-backend.c b/block/block-backend.c
index 140c3f7..83cec29 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -942,7 +942,8 @@ BlockAIOCB *blk_aio_write_zeroes(BlockBackend *blk, int64_t sector_num,
 
     return blk_aio_prwv(blk, sector_num << BDRV_SECTOR_BITS,
                         nb_sectors << BDRV_SECTOR_BITS, NULL,
-                        blk_aio_write_entry, BDRV_REQ_ZERO_WRITE, cb, opaque);
+                        blk_aio_write_entry, flags | BDRV_REQ_ZERO_WRITE,
+                        cb, opaque);
 }
 
 int blk_pread(BlockBackend *blk, int64_t offset, void *buf, int count)
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH for-2.6] block: Don't ignore flags in blk_aio_write_zeroes()
  2016-04-15  8:27 [Qemu-devel] [PATCH for-2.6] block: Don't ignore flags in blk_aio_write_zeroes() Kevin Wolf
@ 2016-04-15 13:59 ` Eric Blake
  2016-04-15 14:50   ` Kevin Wolf
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Blake @ 2016-04-15 13:59 UTC (permalink / raw)
  To: Kevin Wolf, qemu-block; +Cc: qemu-devel, mreitz

[-- Attachment #1: Type: text/plain, Size: 1649 bytes --]

On 04/15/2016 02:27 AM, Kevin Wolf wrote:
> Commit 57d6a428 neglected to pass the given flags to blk_aio_prwv(),
> which broke discard by WRITE SAME for scsi-disk (the UNMAP bit would be
> ignored).
> 
> Reported-by: Max Reitz <mreitz@redhat.com>
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
>  block/block-backend.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/block/block-backend.c b/block/block-backend.c
> index 140c3f7..83cec29 100644
> --- a/block/block-backend.c
> +++ b/block/block-backend.c
> @@ -942,7 +942,8 @@ BlockAIOCB *blk_aio_write_zeroes(BlockBackend *blk, int64_t sector_num,
>  
>      return blk_aio_prwv(blk, sector_num << BDRV_SECTOR_BITS,
>                          nb_sectors << BDRV_SECTOR_BITS, NULL,
> -                        blk_aio_write_entry, BDRV_REQ_ZERO_WRITE, cb, opaque);
> +                        blk_aio_write_entry, flags | BDRV_REQ_ZERO_WRITE,
> +                        cb, opaque);
>  }
>  

Don't you also want:

diff --git i/block/block-backend.c w/block/block-backend.c
index 140c3f7..c99f4ee 100644
--- i/block/block-backend.c
+++ w/block/block-backend.c
@@ -820,7 +820,7 @@ int blk_write_zeroes(BlockBackend *blk, int64_t
sector_num,
                      int nb_sectors, BdrvRequestFlags flags)
 {
     return blk_rw(blk, sector_num, NULL, nb_sectors, blk_write_entry,
-                  BDRV_REQ_ZERO_WRITE);
+                  flags | BDRV_REQ_ZERO_WRITE);
 }

 static void error_callback_bh(void *opaque)

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH for-2.6] block: Don't ignore flags in blk_aio_write_zeroes()
  2016-04-15 13:59 ` Eric Blake
@ 2016-04-15 14:50   ` Kevin Wolf
  0 siblings, 0 replies; 3+ messages in thread
From: Kevin Wolf @ 2016-04-15 14:50 UTC (permalink / raw)
  To: Eric Blake; +Cc: qemu-block, qemu-devel, mreitz

[-- Attachment #1: Type: text/plain, Size: 1692 bytes --]

Am 15.04.2016 um 15:59 hat Eric Blake geschrieben:
> On 04/15/2016 02:27 AM, Kevin Wolf wrote:
> > Commit 57d6a428 neglected to pass the given flags to blk_aio_prwv(),
> > which broke discard by WRITE SAME for scsi-disk (the UNMAP bit would be
> > ignored).
> > 
> > Reported-by: Max Reitz <mreitz@redhat.com>
> > Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> > ---
> >  block/block-backend.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/block/block-backend.c b/block/block-backend.c
> > index 140c3f7..83cec29 100644
> > --- a/block/block-backend.c
> > +++ b/block/block-backend.c
> > @@ -942,7 +942,8 @@ BlockAIOCB *blk_aio_write_zeroes(BlockBackend *blk, int64_t sector_num,
> >  
> >      return blk_aio_prwv(blk, sector_num << BDRV_SECTOR_BITS,
> >                          nb_sectors << BDRV_SECTOR_BITS, NULL,
> > -                        blk_aio_write_entry, BDRV_REQ_ZERO_WRITE, cb, opaque);
> > +                        blk_aio_write_entry, flags | BDRV_REQ_ZERO_WRITE,
> > +                        cb, opaque);
> >  }
> >  
> 
> Don't you also want:
> 
> diff --git i/block/block-backend.c w/block/block-backend.c
> index 140c3f7..c99f4ee 100644
> --- i/block/block-backend.c
> +++ w/block/block-backend.c
> @@ -820,7 +820,7 @@ int blk_write_zeroes(BlockBackend *blk, int64_t
> sector_num,
>                       int nb_sectors, BdrvRequestFlags flags)
>  {
>      return blk_rw(blk, sector_num, NULL, nb_sectors, blk_write_entry,
> -                  BDRV_REQ_ZERO_WRITE);
> +                  flags | BDRV_REQ_ZERO_WRITE);
>  }

I guess I should want that. And blk_co_write_zeroes(), too.

Kevin

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-04-15 14:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-15  8:27 [Qemu-devel] [PATCH for-2.6] block: Don't ignore flags in blk_aio_write_zeroes() Kevin Wolf
2016-04-15 13:59 ` Eric Blake
2016-04-15 14:50   ` Kevin Wolf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).