From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47701) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bEzq1-0007u9-6z for qemu-devel@nongnu.org; Mon, 20 Jun 2016 10:06:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bEzpz-000768-C4 for qemu-devel@nongnu.org; Mon, 20 Jun 2016 10:06:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60706) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bEzpz-00075k-3N for qemu-devel@nongnu.org; Mon, 20 Jun 2016 10:06:03 -0400 From: Stefan Hajnoczi Date: Mon, 20 Jun 2016 15:05:23 +0100 Message-Id: <1466431531-17806-13-git-send-email-stefanha@redhat.com> In-Reply-To: <1466431531-17806-1-git-send-email-stefanha@redhat.com> References: <1466431531-17806-1-git-send-email-stefanha@redhat.com> Subject: [Qemu-devel] [PULL 12/20] block: process before_write_notifiers in bdrv_co_discard List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , "Denis V. Lunev" , Fam Zheng , Stefan Hajnoczi , Kevin Wolf , Max Reitz From: "Denis V. Lunev" This is mandatory for correct backup creation. In the other case the content under this area would be lost. Dirty bits are set exactly like in bdrv_aligned_pwritev, i.e. they are set even if notifier has returned a error. Signed-off-by: Denis V. Lunev Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Fam Zheng Reviewed-by: Eric Blake Message-id: 1466093381-6120-4-git-send-email-den@openvz.org CC: Fam Zheng CC: Stefan Hajnoczi CC: Kevin Wolf CC: Max Reitz Signed-off-by: Stefan Hajnoczi --- block/io.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/block/io.c b/block/io.c index 8ab6f95..7cf3645 100644 --- a/block/io.c +++ b/block/io.c @@ -2350,6 +2350,11 @@ int coroutine_fn bdrv_co_discard(BlockDriverState *bs, int64_t sector_num, tracked_request_begin(&req, bs, sector_num << BDRV_SECTOR_BITS, nb_sectors << BDRV_SECTOR_BITS, BDRV_TRACKED_DISCARD); + ret = notifier_with_return_list_notify(&bs->before_write_notifiers, &req); + if (ret < 0) { + goto out; + } + max_discard = MIN_NON_ZERO(bs->bl.max_discard, BDRV_REQUEST_MAX_SECTORS); while (nb_sectors > 0) { int ret; -- 2.5.5