Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

scsi: switch scsi_bios_ptable() and scsi_partsize() to gendisk

Both helpers are reading the partition table of the disk specified
by block_device of some partition on it; result depends only upon
the disk in question, so we might as well pass the struct gendisk
instead.

Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Acked-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Al Viro 1fd143c2 8f5ae30d

+18 -17
+2 -2
Documentation/scsi/scsi_mid_low_api.rst
··· 380 380 381 381 /** 382 382 * scsi_bios_ptable - return copy of block device's partition table 383 - * @dev: pointer to block device 383 + * @dev: pointer to gendisk 384 384 * 385 385 * Returns pointer to partition table, or NULL for failure 386 386 * ··· 390 390 * 391 391 * Defined in: drivers/scsi/scsicam.c 392 392 **/ 393 - unsigned char *scsi_bios_ptable(struct block_device *dev) 393 + unsigned char *scsi_bios_ptable(struct gendisk *dev) 394 394 395 395 396 396 /**
+1 -1
drivers/scsi/BusLogic.c
··· 3261 3261 diskparam->sectors = 32; 3262 3262 } 3263 3263 diskparam->cylinders = (unsigned long) capacity / (diskparam->heads * diskparam->sectors); 3264 - buf = scsi_bios_ptable(dev); 3264 + buf = scsi_bios_ptable(dev->bd_disk); 3265 3265 if (buf == NULL) 3266 3266 return 0; 3267 3267 /*
+1 -1
drivers/scsi/aacraid/linit.c
··· 324 324 * entry whose end_head matches one of the standard geometry 325 325 * translations ( 64/32, 128/32, 255/63 ). 326 326 */ 327 - buf = scsi_bios_ptable(bdev); 327 + buf = scsi_bios_ptable(bdev->bd_disk); 328 328 if (!buf) 329 329 return 0; 330 330 if (*(__le16 *)(buf + 0x40) == cpu_to_le16(MSDOS_LABEL_MAGIC)) {
+1 -1
drivers/scsi/aic7xxx/aic79xx_osm.c
··· 731 731 732 732 ahd = *((struct ahd_softc **)sdev->host->hostdata); 733 733 734 - if (scsi_partsize(bdev, capacity, geom)) 734 + if (scsi_partsize(bdev->bd_disk, capacity, geom)) 735 735 return 0; 736 736 737 737 heads = 64;
+1 -1
drivers/scsi/aic7xxx/aic7xxx_osm.c
··· 696 696 ahc = *((struct ahc_softc **)sdev->host->hostdata); 697 697 channel = sdev_channel(sdev); 698 698 699 - if (scsi_partsize(bdev, capacity, geom)) 699 + if (scsi_partsize(bdev->bd_disk, capacity, geom)) 700 700 return 0; 701 701 702 702 heads = 64;
+1 -1
drivers/scsi/arcmsr/arcmsr_hba.c
··· 381 381 { 382 382 int heads, sectors, cylinders, total_capacity; 383 383 384 - if (scsi_partsize(bdev, capacity, geom)) 384 + if (scsi_partsize(bdev->bd_disk, capacity, geom)) 385 385 return 0; 386 386 387 387 total_capacity = capacity;
+1 -1
drivers/scsi/fdomain.c
··· 472 472 struct block_device *bdev, sector_t capacity, 473 473 int geom[]) 474 474 { 475 - unsigned char *p = scsi_bios_ptable(bdev); 475 + unsigned char *p = scsi_bios_ptable(bdev->bd_disk); 476 476 477 477 if (p && p[65] == 0xaa && p[64] == 0x55 /* Partition table valid */ 478 478 && p[4]) { /* Partition type */
+1 -1
drivers/scsi/megaraid.c
··· 2813 2813 geom[2] = cylinders; 2814 2814 } 2815 2815 else { 2816 - if (scsi_partsize(bdev, capacity, geom)) 2816 + if (scsi_partsize(bdev->bd_disk, capacity, geom)) 2817 2817 return 0; 2818 2818 2819 2819 dev_info(&adapter->dev->dev,
+6 -6
drivers/scsi/scsicam.c
··· 30 30 * starting at offset %0x1be. 31 31 * Returns: partition table in kmalloc(GFP_KERNEL) memory, or NULL on error. 32 32 */ 33 - unsigned char *scsi_bios_ptable(struct block_device *dev) 33 + unsigned char *scsi_bios_ptable(struct gendisk *dev) 34 34 { 35 - struct address_space *mapping = bdev_whole(dev)->bd_mapping; 35 + struct address_space *mapping = dev->part0->bd_mapping; 36 36 unsigned char *res = NULL; 37 37 struct folio *folio; 38 38 ··· 48 48 49 49 /** 50 50 * scsi_partsize - Parse cylinders/heads/sectors from PC partition table 51 - * @bdev: block device to parse 51 + * @disk: gendisk of the disk to parse 52 52 * @capacity: size of the disk in sectors 53 53 * @geom: output in form of [hds, cylinders, sectors] 54 54 * ··· 57 57 * 58 58 * Returns: %false on failure, %true on success. 59 59 */ 60 - bool scsi_partsize(struct block_device *bdev, sector_t capacity, int geom[3]) 60 + bool scsi_partsize(struct gendisk *disk, sector_t capacity, int geom[3]) 61 61 { 62 62 int cyl, ext_cyl, end_head, end_cyl, end_sector; 63 63 unsigned int logical_end, physical_end, ext_physical_end; ··· 65 65 void *buf; 66 66 int ret = false; 67 67 68 - buf = scsi_bios_ptable(bdev); 68 + buf = scsi_bios_ptable(disk); 69 69 if (!buf) 70 70 return false; 71 71 ··· 221 221 int ret = 0; 222 222 223 223 /* try to infer mapping from partition table */ 224 - if (scsi_partsize(bdev, capacity, ip)) 224 + if (scsi_partsize(bdev->bd_disk, capacity, ip)) 225 225 return 0; 226 226 227 227 if (capacity64 < (1ULL << 32)) {
+3 -2
include/scsi/scsicam.h
··· 13 13 14 14 #ifndef SCSICAM_H 15 15 #define SCSICAM_H 16 + struct gendisk; 16 17 int scsicam_bios_param(struct block_device *bdev, sector_t capacity, int *ip); 17 - bool scsi_partsize(struct block_device *bdev, sector_t capacity, int geom[3]); 18 - unsigned char *scsi_bios_ptable(struct block_device *bdev); 18 + bool scsi_partsize(struct gendisk *disk, sector_t capacity, int geom[3]); 19 + unsigned char *scsi_bios_ptable(struct gendisk *disk); 19 20 #endif /* def SCSICAM_H */