From patchwork Fri Mar 18 18:21:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 8623021 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 77105C0553 for ; Fri, 18 Mar 2016 18:29:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D040E20225 for ; Fri, 18 Mar 2016 18:29:52 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id 173B7201FE for ; Fri, 18 Mar 2016 18:29:52 +0000 (UTC) Received: from localhost ([::1]:45631 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agz9j-0001vZ-Dt for patchwork-qemu-devel@patchwork.kernel.org; Fri, 18 Mar 2016 14:29:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36861) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agz2J-0004b4-Hc for qemu-devel@nongnu.org; Fri, 18 Mar 2016 14:22:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1agz2I-0007HQ-MB for qemu-devel@nongnu.org; Fri, 18 Mar 2016 14:22:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37600) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agz2G-0007GJ-Lr; Fri, 18 Mar 2016 14:22:08 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 5C8A0C0B5915; Fri, 18 Mar 2016 18:22:08 +0000 (UTC) Received: from noname.redhat.com (ovpn-116-83.ams2.redhat.com [10.36.116.83]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u2IILZOB021202; Fri, 18 Mar 2016 14:22:07 -0400 From: Kevin Wolf To: qemu-block@nongnu.org Date: Fri, 18 Mar 2016 19:21:29 +0100 Message-Id: <1458325289-17848-21-git-send-email-kwolf@redhat.com> In-Reply-To: <1458325289-17848-1-git-send-email-kwolf@redhat.com> References: <1458325289-17848-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com Subject: [Qemu-devel] [PATCH 20/20] block: Remove bdrv_(set_)enable_write_cache() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The only remaining users were block jobs (mirror and backup) which unconditionally enabled WCE on the BlockBackend of the target image. As these block jobs don't go through BlockBackend for their I/O requests, they aren't affected by this setting anyway but always get a writeback mode, so that call can be removed. Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz --- block.c | 16 ---------------- block/backup.c | 1 - block/mirror.c | 1 - include/block/block.h | 2 -- 4 files changed, 20 deletions(-) diff --git a/block.c b/block.c index 0e7cbb6..c22cb3f 100644 --- a/block.c +++ b/block.c @@ -2695,22 +2695,6 @@ int bdrv_is_sg(BlockDriverState *bs) return bs->sg; } -int bdrv_enable_write_cache(BlockDriverState *bs) -{ - if (bs->blk) { - return blk_enable_write_cache(bs->blk); - } else { - return true; - } -} - -void bdrv_set_enable_write_cache(BlockDriverState *bs, bool wce) -{ - if (bs->blk) { - blk_set_enable_write_cache(bs->blk, wce); - } -} - int bdrv_is_encrypted(BlockDriverState *bs) { if (bs->backing && bs->backing->bs->encrypted) { diff --git a/block/backup.c b/block/backup.c index ab3e345..10397e2 100644 --- a/block/backup.c +++ b/block/backup.c @@ -402,7 +402,6 @@ static void coroutine_fn backup_run(void *opaque) job->done_bitmap = bitmap_new(end); - bdrv_set_enable_write_cache(target, true); if (target->blk) { blk_set_on_error(target->blk, on_target_error, on_target_error); blk_iostatus_enable(target->blk); diff --git a/block/mirror.c b/block/mirror.c index 9635fa8..da18c0b 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -855,7 +855,6 @@ static void mirror_start_job(BlockDriverState *bs, BlockDriverState *target, bdrv_op_block_all(s->target, s->common.blocker); - bdrv_set_enable_write_cache(s->target, true); if (s->target->blk) { blk_set_on_error(s->target->blk, on_target_error, on_target_error); blk_iostatus_enable(s->target->blk); diff --git a/include/block/block.h b/include/block/block.h index bd596b1..3eb281a 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -393,8 +393,6 @@ int bdrv_is_allocated_above(BlockDriverState *top, BlockDriverState *base, int bdrv_is_read_only(BlockDriverState *bs); int bdrv_is_sg(BlockDriverState *bs); -int bdrv_enable_write_cache(BlockDriverState *bs); -void bdrv_set_enable_write_cache(BlockDriverState *bs, bool wce); bool bdrv_is_inserted(BlockDriverState *bs); int bdrv_media_changed(BlockDriverState *bs); void bdrv_lock_medium(BlockDriverState *bs, bool locked);