diff options
author | Peter Lieven <pl@kamp.de> | 2013-11-27 11:07:03 +0100 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@redhat.com> | 2013-12-05 11:45:24 +0100 |
commit | 1c0704a556dbb004a3b82791779760f418053951 (patch) | |
tree | 9f44874b5a0b32ced3500a48e1f2170b46998e2f /block | |
parent | 049b09825fe479f4caa013ccde0ff87fc9d82856 (diff) | |
download | qemu-1c0704a556dbb004a3b82791779760f418053951.tar.gz qemu-1c0704a556dbb004a3b82791779760f418053951.tar.bz2 qemu-1c0704a556dbb004a3b82791779760f418053951.zip |
block/iscsi: set bdi->cluster_size
this patch aims to set bdi->cluster_size to the internal page size
of the iscsi target so that enabled callers can align requests
properly.
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/iscsi.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/block/iscsi.c b/block/iscsi.c index 93fee6d1df..75d6b875e4 100644 --- a/block/iscsi.c +++ b/block/iscsi.c @@ -1580,6 +1580,13 @@ static int iscsi_get_info(BlockDriverState *bs, BlockDriverInfo *bdi) IscsiLun *iscsilun = bs->opaque; bdi->unallocated_blocks_are_zero = !!iscsilun->lbprz; bdi->can_write_zeroes_with_unmap = iscsilun->lbprz && iscsilun->lbp.lbpws; + /* Guess the internal cluster (page) size of the iscsi target by the means + * of opt_unmap_gran. Transfer the unmap granularity only if it has a + * reasonable size for bdi->cluster_size */ + if (iscsilun->bl.opt_unmap_gran * iscsilun->block_size >= 64 * 1024 && + iscsilun->bl.opt_unmap_gran * iscsilun->block_size <= 16 * 1024 * 1024) { + bdi->cluster_size = iscsilun->bl.opt_unmap_gran * iscsilun->block_size; + } return 0; } |