From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:55969) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RT8lj-0004ji-Dv for qemu-devel@nongnu.org; Wed, 23 Nov 2011 04:05:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RT8lh-00010M-Vd for qemu-devel@nongnu.org; Wed, 23 Nov 2011 04:05:27 -0500 Received: from mail-ww0-f53.google.com ([74.125.82.53]:44851) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RT8lh-00010G-PX for qemu-devel@nongnu.org; Wed, 23 Nov 2011 04:05:25 -0500 Received: by wwf27 with SMTP id 27so1758208wwf.10 for ; Wed, 23 Nov 2011 01:05:25 -0800 (PST) MIME-Version: 1.0 In-Reply-To: References: <1321537232-799-1-git-send-email-stefanha@linux.vnet.ibm.com> <1321537232-799-8-git-send-email-stefanha@linux.vnet.ibm.com> Date: Wed, 23 Nov 2011 09:05:24 +0000 Message-ID: From: Stefan Hajnoczi Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v2 7/8] block: core copy-on-read logic List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Zhi Yong Wu Cc: Kevin Wolf , Paolo Bonzini , Marcelo Tosatti , Stefan Hajnoczi , qemu-devel@nongnu.org On Wed, Nov 23, 2011 at 3:42 AM, Zhi Yong Wu wrote: > On Thu, Nov 17, 2011 at 9:40 PM, Stefan Hajnoczi > wrote: >> =A0 =A0 tracked_request_begin(&req, bs, sector_num, nb_sectors, false); >> + >> + =A0 =A0if (bs->copy_on_read) { > Why is =A0tracked_request_begin/end() not put inside the brace around > bs->copy_on_read? > If this COR function is not enabled, i guess that request tracing > function should not be need. It's not safe to put the calls inside the "if (bs->copy_on_read) {" body because turning off copy_on_read while a request is pending would leave the request in the tracked list forever! In a previous version of the series there was a flag to turn request tracking on/off. Pending requests would still remove themselves from the list even after request tracking was disabled. But request tracking is cheap - it involves filling in fields on the stack and adding them to a linked list. So to keep things simple we always maintain this list. Stefan