From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43926) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VgnBH-00025G-8R for qemu-devel@nongnu.org; Wed, 13 Nov 2013 22:01:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VgnB8-000801-Bb for qemu-devel@nongnu.org; Wed, 13 Nov 2013 22:01:19 -0500 Received: from e28smtp01.in.ibm.com ([122.248.162.1]:52878) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VgnB7-0007zm-M1 for qemu-devel@nongnu.org; Wed, 13 Nov 2013 22:01:10 -0500 Received: from /spool/local by e28smtp01.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 14 Nov 2013 08:31:02 +0530 Received: from d28relay01.in.ibm.com (d28relay01.in.ibm.com [9.184.220.58]) by d28dlp01.in.ibm.com (Postfix) with ESMTP id 3B9A6E0053 for ; Thu, 14 Nov 2013 08:32:53 +0530 (IST) Received: from d28av02.in.ibm.com (d28av02.in.ibm.com [9.184.220.64]) by d28relay01.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id rAE30rZc32505998 for ; Thu, 14 Nov 2013 08:30:54 +0530 Received: from d28av02.in.ibm.com (localhost [127.0.0.1]) by d28av02.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id rAE30wIr012994 for ; Thu, 14 Nov 2013 08:30:58 +0530 Message-ID: <52843CE9.40102@linux.vnet.ibm.com> Date: Thu, 14 Nov 2013 11:00:57 +0800 From: Wenchao Xia MIME-Version: 1.0 References: <1384371478-20021-1-git-send-email-mreitz@redhat.com> In-Reply-To: <1384371478-20021-1-git-send-email-mreitz@redhat.com> Content-Type: text/plain; charset=GB2312 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH] block/stream: Don't stream unbacked devices List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz , qemu-devel@nongnu.org Cc: Kevin Wolf , Paolo Bonzini , Stefan Hajnoczi ÓÚ 2013/11/14 3:37, Max Reitz дµÀ: > If a block device is unbacked, a streaming blockjob should immediately > finish instead of beginning to try to stream, then noticing the backing > file does not contain even the first sector (since it does not exist) > and then finishing normally. > > Signed-off-by: Max Reitz > --- > block/stream.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/block/stream.c b/block/stream.c > index 694fd42..46bec7d 100644 > --- a/block/stream.c > +++ b/block/stream.c > @@ -88,6 +88,11 @@ static void coroutine_fn stream_run(void *opaque) > int n = 0; > void *buf; > > + if (!bs->backing_hd) { > + block_job_completed(&s->common, 0); > + return; > + } > + > s->common.len = bdrv_getlength(bs); > if (s->common.len < 0) { > block_job_completed(&s->common, s->common.len); > Reviewed-by: Wenchao Xia