From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:54646) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RDuqH-0005iF-NK for qemu-devel@nongnu.org; Wed, 12 Oct 2011 05:11:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RDuqC-0001Aq-4K for qemu-devel@nongnu.org; Wed, 12 Oct 2011 05:11:13 -0400 Received: from mail-gy0-f173.google.com ([209.85.160.173]:51338) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RDuqC-0001AX-1q for qemu-devel@nongnu.org; Wed, 12 Oct 2011 05:11:08 -0400 Received: by gyf3 with SMTP id 3so605825gyf.4 for ; Wed, 12 Oct 2011 02:11:06 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <1317831427-477-1-git-send-email-stefanha@linux.vnet.ibm.com> <1317831427-477-4-git-send-email-stefanha@linux.vnet.ibm.com> Date: Wed, 12 Oct 2011 17:11:06 +0800 Message-ID: From: Zhi Yong Wu Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 3/6] block: switch bdrv_read()/bdrv_write() to coroutines List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Kevin Wolf , Anthony Liguori , Stefan Hajnoczi , Marcelo Tosatti , qemu-devel@nongnu.org, Zhi Yong Wu , Avi Kivity , Christoph Hellwig On Wed, Oct 12, 2011 at 5:03 PM, Stefan Hajnoczi wrote= : > On Tue, Oct 11, 2011 at 7:44 AM, Zhi Yong Wu wrote= : >> On Thu, Oct 6, 2011 at 12:17 AM, Stefan Hajnoczi >> wrote: >>> @@ -1101,36 +1144,7 @@ static void set_dirty_bitmap(BlockDriverState *b= s, int64_t sector_num, >>> =A0int bdrv_write(BlockDriverState *bs, int64_t sector_num, >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0const uint8_t *buf, int nb_sectors) >>> =A0{ >>> - =A0 =A0BlockDriver *drv =3D bs->drv; >>> - >>> - =A0 =A0if (!bs->drv) >>> - =A0 =A0 =A0 =A0return -ENOMEDIUM; >>> - >>> - =A0 =A0if (bdrv_has_async_rw(drv) && qemu_in_coroutine()) { >>> - =A0 =A0 =A0 =A0QEMUIOVector qiov; >>> - =A0 =A0 =A0 =A0struct iovec iov =3D { >>> - =A0 =A0 =A0 =A0 =A0 =A0.iov_base =3D (void *)buf, >>> - =A0 =A0 =A0 =A0 =A0 =A0.iov_len =3D nb_sectors * BDRV_SECTOR_SIZE, >>> - =A0 =A0 =A0 =A0}; >>> - >>> - =A0 =A0 =A0 =A0qemu_iovec_init_external(&qiov, &iov, 1); >>> - =A0 =A0 =A0 =A0return bdrv_co_writev(bs, sector_num, nb_sectors, &qio= v); >>> - =A0 =A0} >>> - >>> - =A0 =A0if (bs->read_only) >>> - =A0 =A0 =A0 =A0return -EACCES; >>> - =A0 =A0if (bdrv_check_request(bs, sector_num, nb_sectors)) >>> - =A0 =A0 =A0 =A0return -EIO; How about the above four lines of codes? >>> - >>> - =A0 =A0if (bs->dirty_bitmap) { >>> - =A0 =A0 =A0 =A0set_dirty_bitmap(bs, sector_num, nb_sectors, 1); >>> - =A0 =A0} >>> - >>> - =A0 =A0if (bs->wr_highest_sector < sector_num + nb_sectors - 1) { >>> - =A0 =A0 =A0 =A0bs->wr_highest_sector =3D sector_num + nb_sectors - 1; >>> - =A0 =A0} >> The above codes are removed, will it be safe? > > If you are checking that removing bs->wr_highest_sector code is okay, > then yes, it is safe because bdrv_co_do_writev() does the dirty bitmap > and wr_highest_sector updates. =A0We haven't lost any code by unifying OK. got it. thanks. > request processing - bdrv_co_do_writev() must do everything that > bdrv_aio_writev() and bdrv_write() did. > > Stefan > --=20 Regards, Zhi Yong Wu