From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37881) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yqggo-00052s-07 for qemu-devel@nongnu.org; Fri, 08 May 2015 07:43:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yqggm-0006vr-NC for qemu-devel@nongnu.org; Fri, 08 May 2015 07:43:33 -0400 Message-ID: <554CA157.4000407@redhat.com> Date: Fri, 08 May 2015 13:43:19 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1431085109-19677-1-git-send-email-dimara@arrikto.com> <1431085109-19677-3-git-send-email-dimara@arrikto.com> In-Reply-To: <1431085109-19677-3-git-send-email-dimara@arrikto.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 2/4] block: Use bdrv_is_sg() everywhere List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Dimitris Aragiorgis , qemu-devel@nongnu.org Cc: kwolf@redhat.com, stefanha@redhat.com, qemu-block@nongnu.org On 08/05/2015 13:38, Dimitris Aragiorgis wrote: > Instead of checking bs->sg use bdrv_is_sg() consistently throughout > the code. > > Signed-off-by: Dimitris Aragiorgis > --- > block.c | 6 +++--- > block/iscsi.c | 2 +- > block/raw-posix.c | 4 ++-- > 3 files changed, 6 insertions(+), 6 deletions(-) > > diff --git a/block.c b/block.c > index 7904098..d651b57 100644 > --- a/block.c > +++ b/block.c > @@ -566,7 +566,7 @@ static int find_image_format(BlockDriverState *bs, const char *filename, > int ret = 0; > > /* Return the raw BlockDriver * to scsi-generic devices or empty drives */ > - if (bs->sg || !bdrv_is_inserted(bs) || bdrv_getlength(bs) == 0) { > + if (bdrv_is_sg(bs) || !bdrv_is_inserted(bs) || bdrv_getlength(bs) == 0) { > *pdrv = &bdrv_raw; > return ret; > } > @@ -598,7 +598,7 @@ static int refresh_total_sectors(BlockDriverState *bs, int64_t hint) > BlockDriver *drv = bs->drv; > > /* Do not attempt drv->bdrv_getlength() on scsi-generic devices */ > - if (bs->sg) > + if (bdrv_is_sg(bs)) > return 0; > > /* query actual device if possible, otherwise just trust the hint */ > @@ -890,7 +890,7 @@ static int bdrv_open_common(BlockDriverState *bs, BlockDriverState *file, > } > > assert(bdrv_opt_mem_align(bs) != 0); > - assert((bs->request_alignment != 0) || bs->sg); > + assert((bs->request_alignment != 0) || bdrv_is_sg(bs)); > return 0; > > free_and_fail: > diff --git a/block/iscsi.c b/block/iscsi.c > index 8fca1d3..502a81f 100644 > --- a/block/iscsi.c > +++ b/block/iscsi.c > @@ -627,7 +627,7 @@ static int coroutine_fn iscsi_co_flush(BlockDriverState *bs) > IscsiLun *iscsilun = bs->opaque; > struct IscsiTask iTask; > > - if (bs->sg) { > + if (bdrv_is_sg(bs)) { > return 0; > } > > diff --git a/block/raw-posix.c b/block/raw-posix.c > index 24d8582..24b061f 100644 > --- a/block/raw-posix.c > +++ b/block/raw-posix.c > @@ -302,9 +302,9 @@ static void raw_probe_alignment(BlockDriverState *bs, int fd, Error **errp) > BDRVRawState *s = bs->opaque; > char *buf; > > - /* For /dev/sg devices the alignment is not really used. > + /* For SG devices the alignment is not really used. > With buffered I/O, we don't have any restrictions. */ > - if (bs->sg || !s->needs_alignment) { > + if (bdrv_is_sg(bs) || !s->needs_alignment) { > bs->request_alignment = 1; > s->buf_align = 1; > return; > Reviewed-by: Paolo Bonzini