Skip to contentSkip to conversation

block: Don't ignore flags in blk_aio_write_zeroes()

PATCH In review Kevin Wolf 2 participants 3 messages Apr 15, 2016 Block layer

lore
Share & tools
lore

Kevin Wolf

author
#0 lore raw

PATCH 1/1 block: Don't ignore flags in blk_aio_write_zeroes()

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).

---
 block/block-backend.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
block/block-backend.c +2 -1
index 140c3f7..83cec29 100644
@@ -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)
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 15 lines · Kevin Wolf

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).

---
 block/block-backend.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
block/block-backend.c +0 -0
index 140c3f7..83cec29 100644

block/block-backend.c BlockAIOCB *blk_aio_write_zeroes(BlockBackend *blk, int64_t sector_num, · line 948

Quoted 8 lines
block/block-backend.c +2 -1
@@ -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:

block/block-backend.c +0 -0
index 140c3f7..c99f4ee 100644
@@ -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)

Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
author
#2 lore raw

Am 15.04.2016 um 15:59 hat Eric Blake geschrieben:

Quoted 32 lines · Kevin Wolf
Quoted 15 lines

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).

---
 block/block-backend.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
block/block-backend.c +0 -0
index 140c3f7..83cec29 100644

block/block-backend.c BlockAIOCB *blk_aio_write_zeroes(BlockBackend *blk, int64_t sector_num, · line 948

Quoted 8 lines
block/block-backend.c +2 -1
@@ -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:

block/block-backend.c +0 -0
index 140c3f7..c99f4ee 100644

block/block-backend.c int blk_write_zeroes(BlockBackend *blk, int64_t · line 825

Quoted 7 lines
block/block-backend.c +1 -1
@@ -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