Commit 2cc9637c authored by Peter Oberparleiter's avatar Peter Oberparleiter Committed by Martin Schwidefsky

s390/dasd: Fix capacity calculation for large volumes

The DASD driver incorrectly limits the maximum number of blocks of ECKD
DASD volumes to 32 bit numbers. Volumes with a capacity greater than
2^32-1 blocks are incorrectly recognized as smaller volumes.

This results in the following volume capacity limits depending on the
formatted block size:

  BLKSIZE  MAX_GB   MAX_CYL
      512    2047   5843492c
     1024    4095   8676701
     2048    8191  13634816
     4096   16383  23860929

The same problem occurs when a volume with more than 17895697 cylinders
is accessed in raw-track-access mode.

Fix this problem by adding an explicit type cast when calculating the
maximum number of blocks.
Signed-off-by: default avatarPeter Oberparleiter <oberpar@linux.ibm.com>
Reviewed-by: default avatarStefan Haberland <sth@linux.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 2d4ea4b9
...@@ -2004,14 +2004,14 @@ static int dasd_eckd_end_analysis(struct dasd_block *block) ...@@ -2004,14 +2004,14 @@ static int dasd_eckd_end_analysis(struct dasd_block *block)
blk_per_trk = recs_per_track(&private->rdc_data, 0, block->bp_block); blk_per_trk = recs_per_track(&private->rdc_data, 0, block->bp_block);
raw: raw:
block->blocks = (private->real_cyl * block->blocks = ((unsigned long) private->real_cyl *
private->rdc_data.trk_per_cyl * private->rdc_data.trk_per_cyl *
blk_per_trk); blk_per_trk);
dev_info(&device->cdev->dev, dev_info(&device->cdev->dev,
"DASD with %d KB/block, %d KB total size, %d KB/track, " "DASD with %u KB/block, %lu KB total size, %u KB/track, "
"%s\n", (block->bp_block >> 10), "%s\n", (block->bp_block >> 10),
((private->real_cyl * (((unsigned long) private->real_cyl *
private->rdc_data.trk_per_cyl * private->rdc_data.trk_per_cyl *
blk_per_trk * (block->bp_block >> 9)) >> 1), blk_per_trk * (block->bp_block >> 9)) >> 1),
((blk_per_trk * block->bp_block) >> 10), ((blk_per_trk * block->bp_block) >> 10),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment