]> Git Repo - qemu.git/commitdiff
block: Use bdrv_is_sg() everywhere
authorDimitris Aragiorgis <[email protected]>
Tue, 23 Jun 2015 10:44:56 +0000 (13:44 +0300)
committerStefan Hajnoczi <[email protected]>
Tue, 23 Jun 2015 14:08:52 +0000 (15:08 +0100)
Instead of checking bs->sg use bdrv_is_sg() consistently throughout
the code.

Signed-off-by: Dimitris Aragiorgis <[email protected]>
Reviewed-by: Paolo Bonzini <[email protected]>
Reviewed-by: Stefan Hajnoczi <[email protected]>
Message-id: 1435056300[email protected]
Signed-off-by: Stefan Hajnoczi <[email protected]>
block.c
block/iscsi.c
block/raw-posix.c

diff --git a/block.c b/block.c
index 71685759098ca4e5ce8a00db8e7fe81140e29fb0..81233beaab5eb67c7624546803bc77233a9e6efb 100644 (file)
--- a/block.c
+++ b/block.c
@@ -585,7 +585,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;
     }
@@ -617,7 +617,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 */
@@ -948,7 +948,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;
index 5f7b60c99b24f23328bf10e91b600e4341ca592a..aff8198d3fa31a6beb707fd2ccd109274c67d101 100644 (file)
@@ -628,7 +628,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;
     }
 
index a967464000882e468b771f7f25438576abac23a7..b2097fc7964a3cd969946924d216444a6eb4a249 100644 (file)
@@ -305,9 +305,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;
This page took 0.030363 seconds and 4 git commands to generate.