Skip to contentSkip to conversation

Fix incorrect calculation of iscsi number of blocks

PATCH New Ronnie Sahlberg 2 participants 3 messages May 4, 2012 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix incorrect calculation of iscsi number of blocks

List,

READCAPACITY16 returns the LBA of the last accessible block. Number of blocks is one greater than this.

This patch fixes the incorrect calculation of total sectors that Paolo spotted and reported. Sorry,

regards
ronnie sahlberg

#1 lore raw

PATCH 1/1 ISCSI: Readcapacity retruned the lba of the last sector. Total number of sectors is one more.

Thanks to Paolo for spotting.

---
 block/iscsi.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
block/iscsi.c +1 -1
index eb49093..7c1970d 100644
@@ -482,7 +482,7 @@ iscsi_readcapacity16_cb(struct iscsi_context *iscsi, int status,
 
     itask->iscsilun->block_size = rc16->block_length;
     itask->iscsilun->num_blocks = rc16->returned_lba;
-    itask->bs->total_sectors    = rc16->returned_lba *
+    itask->bs->total_sectors    = (rc16->returned_lba + 1) *
                                rc16->block_length / BDRV_SECTOR_SIZE ;
 
     itask->status   = 0;
Signature · 1 line
1.7.3.1
#2 lore raw

Re: [Qemu-devel] [PATCH] ISCSI: Readcapacity retruned the lba of the last sector. Total number of sectors is one more.

Il 04/05/2012 10:15, Ronnie Sahlberg ha scritto:

block/iscsi.c iscsi_readcapacity16_cb(struct iscsi_context *iscsi, int status, · line 485

Quoted 3 lines
     itask->iscsilun->num_blocks = rc16->returned_lba;
block/iscsi.c +1 -1
-    itask->bs->total_sectors    = rc16->returned_lba *
+    itask->bs->total_sectors    = (rc16->returned_lba + 1) *

What about itask->iscsilun->num_blocks? :) No need to resend, I fixed this locally.