All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dimitris Aragiorgis <dimara@arrikto.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, pbonzini@redhat.com, qemu-block@nongnu.org,
	stefanha@redhat.com
Subject: [Qemu-devel] [PATCH v5 1/5] block: Use bdrv_is_sg() everywhere
Date: Tue, 23 Jun 2015 13:44:56 +0300	[thread overview]
Message-ID: <1435056300-14924-2-git-send-email-dimara@arrikto.com> (raw)
In-Reply-To: <1435056300-14924-1-git-send-email-dimara@arrikto.com>

Instead of checking bs->sg use bdrv_is_sg() consistently throughout
the code.

Signed-off-by: Dimitris Aragiorgis <dimara@arrikto.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 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 dd4f58d..f04b2a1 100644
--- a/block.c
+++ b/block.c
@@ -583,7 +583,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;
     }
@@ -615,7 +615,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 */
@@ -946,7 +946,7 @@ static int bdrv_open_common(BlockDriverState *bs, BlockDriverState *file,
 
     assert(bdrv_opt_mem_align(bs) != 0);
     assert(bdrv_min_mem_align(bs) != 0);
-    assert((bs->request_alignment != 0) || bs->sg);
+    assert((bs->request_alignment != 0) || bdrv_is_sg(bs));
 
     qemu_opts_del(opts);
     return 0;
diff --git a/block/iscsi.c b/block/iscsi.c
index 14e97a6..000528c 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 44ade8c..3ee3bd6 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -303,9 +303,9 @@ static void raw_probe_alignment(BlockDriverState *bs, int fd, Error **errp)
     char *buf;
     size_t max_align = MAX(MAX_BLOCKSIZE, getpagesize());
 
-    /* For /dev/sg devices the alignment is not really used.
+    /* For SCSI generic 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;
-- 
1.7.10.4

  reply	other threads:[~2015-06-23 10:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-23 10:44 [Qemu-devel] [PATCH v5 0/5] Some fixes related to scsi-generic Dimitris Aragiorgis
2015-06-23 10:44 ` Dimitris Aragiorgis [this message]
2015-06-23 10:44 ` [Qemu-devel] [PATCH v5 2/5] Fix migration in case of scsi-generic Dimitris Aragiorgis
2015-06-23 10:44 ` [Qemu-devel] [PATCH v5 3/5] raw-posix: DPRINTF instead of DEBUG_BLOCK_PRINT Dimitris Aragiorgis
2015-06-23 10:44 ` [Qemu-devel] [PATCH v5 4/5] raw-posix: Use DPRINTF for DEBUG_FLOPPY Dimitris Aragiorgis
2015-06-23 10:45 ` [Qemu-devel] [PATCH v5 5/5] raw-posix: Introduce hdev_is_sg() Dimitris Aragiorgis
2015-06-23 14:03   ` Stefan Hajnoczi
2015-06-23 14:37 ` [Qemu-devel] [PATCH v5 0/5] Some fixes related to scsi-generic Stefan Hajnoczi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1435056300-14924-2-git-send-email-dimara@arrikto.com \
    --to=dimara@arrikto.com \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.