Skip to content

Commit 2cc9637

Browse files
oberparMartin Schwidefsky
authored andcommitted
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 5843492 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: Peter Oberparleiter <[email protected]> Reviewed-by: Stefan Haberland <[email protected]> Signed-off-by: Martin Schwidefsky <[email protected]>
1 parent 2d4ea4b commit 2cc9637

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/s390/block/dasd_eckd.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2004,14 +2004,14 @@ static int dasd_eckd_end_analysis(struct dasd_block *block)
20042004
blk_per_trk = recs_per_track(&private->rdc_data, 0, block->bp_block);
20052005

20062006
raw:
2007-
block->blocks = (private->real_cyl *
2007+
block->blocks = ((unsigned long) private->real_cyl *
20082008
private->rdc_data.trk_per_cyl *
20092009
blk_per_trk);
20102010

20112011
dev_info(&device->cdev->dev,
2012-
"DASD with %d KB/block, %d KB total size, %d KB/track, "
2012+
"DASD with %u KB/block, %lu KB total size, %u KB/track, "
20132013
"%s\n", (block->bp_block >> 10),
2014-
((private->real_cyl *
2014+
(((unsigned long) private->real_cyl *
20152015
private->rdc_data.trk_per_cyl *
20162016
blk_per_trk * (block->bp_block >> 9)) >> 1),
20172017
((blk_per_trk * block->bp_block) >> 10),

0 commit comments

Comments
 (0)