From patchwork Wed Apr 27 13:27:34 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 93044 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id C1BBC1007D7 for ; Wed, 27 Apr 2011 23:28:23 +1000 (EST) Received: from localhost ([::1]:42203 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QF4mx-00068B-Vm for incoming@patchwork.ozlabs.org; Wed, 27 Apr 2011 09:28:20 -0400 Received: from eggs.gnu.org ([140.186.70.92]:58654) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QF4mS-00063f-9t for qemu-devel@nongnu.org; Wed, 27 Apr 2011 09:27:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QF4mR-0005c5-AA for qemu-devel@nongnu.org; Wed, 27 Apr 2011 09:27:48 -0400 Received: from mtagate1.uk.ibm.com ([194.196.100.161]:43862) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QF4mQ-0005bs-UJ for qemu-devel@nongnu.org; Wed, 27 Apr 2011 09:27:47 -0400 Received: from d06nrmr1307.portsmouth.uk.ibm.com (d06nrmr1307.portsmouth.uk.ibm.com [9.149.38.129]) by mtagate1.uk.ibm.com (8.13.1/8.13.1) with ESMTP id p3RDRjmq004810 for ; Wed, 27 Apr 2011 13:27:45 GMT Received: from d06av04.portsmouth.uk.ibm.com (d06av04.portsmouth.uk.ibm.com [9.149.37.216]) by d06nrmr1307.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p3RDSnCn1650692 for ; Wed, 27 Apr 2011 14:28:49 +0100 Received: from d06av04.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av04.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p3RDRi7s031810 for ; Wed, 27 Apr 2011 07:27:45 -0600 Received: from stefanha-thinkpad.ibm.com (sig-9-145-204-45.de.ibm.com [9.145.204.45]) by d06av04.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p3RDRcjc031186; Wed, 27 Apr 2011 07:27:44 -0600 From: Stefan Hajnoczi To: Date: Wed, 27 Apr 2011 14:27:34 +0100 Message-Id: <1303910855-28999-8-git-send-email-stefanha@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.4.4 In-Reply-To: <1303910855-28999-1-git-send-email-stefanha@linux.vnet.ibm.com> References: <1303910855-28999-1-git-send-email-stefanha@linux.vnet.ibm.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Received-From: 194.196.100.161 Cc: Kevin Wolf , Anthony Liguori , Stefan Hajnoczi Subject: [Qemu-devel] [PATCH 7/8] qed: Add QED_CF_STREAM flag to auto-enable streaming 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The QED_CF_STREAM flag can be set to automatically stream from the backing file. Signed-off-by: Stefan Hajnoczi --- block/qed.c | 5 +++++ block/qed.h | 6 +++++- 2 files changed, 10 insertions(+), 1 deletions(-) diff --git a/block/qed.c b/block/qed.c index 2c155d9..a61cee9 100644 --- a/block/qed.c +++ b/block/qed.c @@ -373,6 +373,11 @@ static int bdrv_qed_open(BlockDriverState *bs, int flags) if (s->header.features & QED_F_BACKING_FORMAT_NO_PROBE) { pstrcpy(bs->backing_format, sizeof(bs->backing_format), "raw"); } + + if ((s->header.compat_features & QED_CF_STREAM) && + !bdrv_is_read_only(bs->file)) { + bs->stream = 1; + } } /* Reset unknown autoclear feature bits. This is a backwards diff --git a/block/qed.h b/block/qed.h index 8e9e415..23a9bde 100644 --- a/block/qed.h +++ b/block/qed.h @@ -59,13 +59,17 @@ enum { /* Reads to the backing file should populate the image file */ QED_CF_COPY_ON_READ = 0x01, + /* Stream until the backing image is no longer needed */ + QED_CF_STREAM = 0x02, + /* Supported feature bits */ QED_FEATURE_MASK = QED_F_BACKING_FILE | QED_F_NEED_CHECK | QED_F_BACKING_FORMAT_NO_PROBE, /* Supported compat feature bits */ - QED_COMPAT_FEATURE_MASK = QED_CF_COPY_ON_READ, + QED_COMPAT_FEATURE_MASK = QED_CF_COPY_ON_READ | + QED_CF_STREAM, /* Supported autoclear feature bits */ QED_AUTOCLEAR_FEATURE_MASK = 0,