From patchwork Thu Jun 16 16:09:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Denis V. Lunev" X-Patchwork-Id: 9181321 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1AC8E60760 for ; Thu, 16 Jun 2016 16:17:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 09B6C28359 for ; Thu, 16 Jun 2016 16:17:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EF60B28362; Thu, 16 Jun 2016 16:17:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6DCB828359 for ; Thu, 16 Jun 2016 16:17:03 +0000 (UTC) Received: from localhost ([::1]:50629 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDZyY-0002S2-Hu for patchwork-qemu-devel@patchwork.kernel.org; Thu, 16 Jun 2016 12:17:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53196) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDZrm-00046o-Bp for qemu-devel@nongnu.org; Thu, 16 Jun 2016 12:10:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bDZrj-0007jQ-45 for qemu-devel@nongnu.org; Thu, 16 Jun 2016 12:10:02 -0400 Received: from mailhub.sw.ru ([195.214.232.25]:28424 helo=relay.sw.ru) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDZri-0007iG-Mv for qemu-devel@nongnu.org; Thu, 16 Jun 2016 12:09:59 -0400 Received: from irbis.sw.ru ([10.30.2.139]) by relay.sw.ru (8.13.4/8.13.4) with ESMTP id u5GG9fIn004214; Thu, 16 Jun 2016 19:09:48 +0300 (MSK) From: "Denis V. Lunev" To: qemu-devel@nongnu.org, qemu-block@nongnu.org Date: Thu, 16 Jun 2016 19:09:41 +0300 Message-Id: <1466093381-6120-4-git-send-email-den@openvz.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1466093381-6120-1-git-send-email-den@openvz.org> References: <1466093381-6120-1-git-send-email-den@openvz.org> X-detected-operating-system: by eggs.gnu.org: OpenBSD 3.x X-Received-From: 195.214.232.25 Subject: [Qemu-devel] [PATCH 3/3] block: process before_write_notifiers in bdrv_co_discard X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , den@openvz.org, Fam Zheng , Stefan Hajnoczi , Max Reitz Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 CC: Fam Zheng CC: Stefan Hajnoczi CC: Kevin Wolf CC: Max Reitz --- block/io.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/block/io.c b/block/io.c index 11fcfcb..2177cc6 100644 --- a/block/io.c +++ b/block/io.c @@ -2264,6 +2264,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;