From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45904) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ar78u-0003z9-J8 for qemu-devel@nongnu.org; Fri, 15 Apr 2016 13:02:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ar78t-0003qc-D8 for qemu-devel@nongnu.org; Fri, 15 Apr 2016 13:02:52 -0400 From: Kevin Wolf Date: Fri, 15 Apr 2016 19:02:13 +0200 Message-Id: <1460739742-5315-11-git-send-email-kwolf@redhat.com> In-Reply-To: <1460739742-5315-1-git-send-email-kwolf@redhat.com> References: <1460739742-5315-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PULL 10/19] block: Don't ignore flags in blk_{, co, aio}_write_zeroes() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-block@nongnu.org Cc: kwolf@redhat.com, qemu-devel@nongnu.org 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). Commit fc1453cd introduced the same bug for blk_write_zeroes(). This is used for 'qemu-img convert' without has_zero_init (e.g. on a block device) and for preallocation=falloc in parallels. Commit 8896e088 is the version for blk_co_write_zeroes(). This function is only used in qemu-io. Reported-by: Max Reitz Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake --- block/block-backend.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/block/block-backend.c b/block/block-backend.c index 140c3f7..16c9d5e 100644 --- a/block/block-backend.c +++ b/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) @@ -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) @@ -1452,7 +1453,7 @@ int coroutine_fn blk_co_write_zeroes(BlockBackend *blk, int64_t sector_num, return blk_co_pwritev(blk, sector_num << BDRV_SECTOR_BITS, nb_sectors << BDRV_SECTOR_BITS, NULL, - BDRV_REQ_ZERO_WRITE); + flags | BDRV_REQ_ZERO_WRITE); } int blk_write_compressed(BlockBackend *blk, int64_t sector_num, -- 1.8.3.1