All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Lieven <pl@kamp.de>
To: qemu-block@nongnu.org
Cc: qemu-devel@nongnu.org, pbonzini@redhat.com, kwolf@redhat.com,
	mreitz@redhat.com, ronniesahlberg@gmail.com, famz@redhat.com,
	Peter Lieven <pl@kamp.de>
Subject: [Qemu-devel] [PATCH] block/iscsi: precache the allocation status of a target
Date: Thu, 30 Jun 2016 13:08:19 +0200	[thread overview]
Message-ID: <1467284899-22575-1-git-send-email-pl@kamp.de> (raw)

this fills up the allocationmap at iscsi_open. This helps
to reduce the number of get_block_status requests during runtime
significantly.

Signed-off-by: Peter Lieven <pl@kamp.de>
---
 block/iscsi.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/block/iscsi.c b/block/iscsi.c
index 0cdcedb..04fb0a3 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -1774,6 +1774,22 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags,
                                      iscsilun->block_size) >> BDRV_SECTOR_BITS;
         if (iscsilun->lbprz) {
             ret = iscsi_allocmap_init(iscsilun, bs->open_flags);
+            if (ret == 0) {
+                unsigned int max_reqs = 64;
+                int64_t sector_num = 0;
+                while (max_reqs-- && sector_num < bs->total_sectors) {
+                    int n;
+                    BlockDriverState *file;
+                    ret = bdrv_get_block_status(bs, sector_num,
+                                                BDRV_REQUEST_MAX_SECTORS,
+                                                &n, &file);
+                    if (ret < 0) {
+                        break;
+                    }
+                    sector_num += n;
+                    ret = 0;
+                }
+            }
         }
     }
 
-- 
1.9.1

             reply	other threads:[~2016-06-30 11:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-30 11:08 Peter Lieven [this message]
2016-06-30 15:59 ` [Qemu-devel] [PATCH] block/iscsi: precache the allocation status of a target Paolo Bonzini
2016-07-07 11:40   ` Peter Lieven
2016-07-07 12:21     ` Paolo Bonzini

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=1467284899-22575-1-git-send-email-pl@kamp.de \
    --to=pl@kamp.de \
    --cc=famz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=ronniesahlberg@gmail.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.