summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorPeter Lieven <pl@kamp.de>2014-04-28 17:11:33 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2014-04-29 11:14:41 +0200
commit5917af812e9c4bd6500927b26efe8d3e2f267bd0 (patch)
treecc4295ae30c40dd3ca8299deef5ca7f09a48774d
parentb03c38057b7ac4ffb60fa98a26dd4c8d5fa9c54c (diff)
downloadfocaccia-qemu-5917af812e9c4bd6500927b26efe8d3e2f267bd0.tar.gz
focaccia-qemu-5917af812e9c4bd6500927b26efe8d3e2f267bd0.zip
block/iscsi: clarify the meaning of ISCSI_CHECKALLOC_THRES
Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--block/iscsi.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/block/iscsi.c b/block/iscsi.c
index 6b8a0a34f7..e8d26bb781 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -95,7 +95,15 @@ typedef struct IscsiAIOCB {
 #define NOP_INTERVAL 5000
 #define MAX_NOP_FAILURES 3
 #define ISCSI_CMD_RETRIES 5
-#define ISCSI_CHECKALLOC_THRES 63
+
+/* this threshhold is a trade-off knob to choose between
+ * the potential additional overhead of an extra GET_LBA_STATUS request
+ * vs. unnecessarily reading a lot of zero sectors over the wire.
+ * If a read request is greater or equal than ISCSI_CHECKALLOC_THRES
+ * sectors we check the allocation status of the area covered by the
+ * request first if the allocationmap indicates that the area might be
+ * unallocated. */
+#define ISCSI_CHECKALLOC_THRES 64
 
 static void
 iscsi_bh_cb(void *p)
@@ -505,7 +513,7 @@ static int coroutine_fn iscsi_co_readv(BlockDriverState *bs,
     }
 
 #if defined(LIBISCSI_FEATURE_IOVECTOR)
-    if (iscsilun->lbprz && nb_sectors > ISCSI_CHECKALLOC_THRES &&
+    if (iscsilun->lbprz && nb_sectors >= ISCSI_CHECKALLOC_THRES &&
         !iscsi_allocationmap_is_allocated(iscsilun, sector_num, nb_sectors)) {
         int64_t ret;
         int pnum;