diff mbox

[for-2.6] block: Don't ignore flags in blk_aio_write_zeroes()

Message ID 5710F3CF.70402@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Eric Blake April 15, 2016, 1:59 p.m. UTC
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:

 static void error_callback_bh(void *opaque)

Comments

Kevin Wolf April 15, 2016, 2:50 p.m. UTC | #1
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
diff mbox

Patch

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