Skip to content

Commit 4fc8728

Browse files
author
Al Viro
committed
block: switch ->getgeo() to struct gendisk
Instances are happier that way and it makes more sense anyway - the only part of the result that is related to partition we are given is the start sector, and that has been filled in by the caller. Everything else is a function of the disk. Only one instance (DASD) is ever looking at anything other than bdev->bd_disk and that one is trivial to adjust. 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>
1 parent 3eb5036 commit 4fc8728

File tree

27 files changed

+59
-59
lines changed

27 files changed

+59
-59
lines changed

Documentation/filesystems/locking.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ prototypes::
443443
int (*direct_access) (struct block_device *, sector_t, void **,
444444
unsigned long *);
445445
void (*unlock_native_capacity) (struct gendisk *);
446-
int (*getgeo)(struct block_device *, struct hd_geometry *);
446+
int (*getgeo)(struct gendisk *, struct hd_geometry *);
447447
void (*swap_slot_free_notify) (struct block_device *, unsigned long);
448448

449449
locking rules:

arch/m68k/emu/nfblock.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ static void nfhd_submit_bio(struct bio *bio)
7777
bio_endio(bio);
7878
}
7979

80-
static int nfhd_getgeo(struct block_device *bdev, struct hd_geometry *geo)
80+
static int nfhd_getgeo(struct gendisk *disk, struct hd_geometry *geo)
8181
{
82-
struct nfhd_device *dev = bdev->bd_disk->private_data;
82+
struct nfhd_device *dev = disk->private_data;
8383

8484
geo->cylinders = dev->blocks >> (6 - dev->bshift);
8585
geo->heads = 4;

arch/um/drivers/ubd_kern.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ static DEFINE_MUTEX(ubd_lock);
108108

109109
static int ubd_ioctl(struct block_device *bdev, blk_mode_t mode,
110110
unsigned int cmd, unsigned long arg);
111-
static int ubd_getgeo(struct block_device *bdev, struct hd_geometry *geo);
111+
static int ubd_getgeo(struct gendisk *disk, struct hd_geometry *geo);
112112

113113
#define MAX_DEV (16)
114114

@@ -1324,9 +1324,9 @@ static blk_status_t ubd_queue_rq(struct blk_mq_hw_ctx *hctx,
13241324
return res;
13251325
}
13261326

1327-
static int ubd_getgeo(struct block_device *bdev, struct hd_geometry *geo)
1327+
static int ubd_getgeo(struct gendisk *disk, struct hd_geometry *geo)
13281328
{
1329-
struct ubd *ubd_dev = bdev->bd_disk->private_data;
1329+
struct ubd *ubd_dev = disk->private_data;
13301330

13311331
geo->heads = 128;
13321332
geo->sectors = 32;

block/ioctl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ static int blkdev_getgeo(struct block_device *bdev,
481481
*/
482482
memset(&geo, 0, sizeof(geo));
483483
geo.start = get_start_sect(bdev);
484-
ret = disk->fops->getgeo(bdev, &geo);
484+
ret = disk->fops->getgeo(disk, &geo);
485485
if (ret)
486486
return ret;
487487
if (copy_to_user(argp, &geo, sizeof(geo)))
@@ -515,7 +515,7 @@ static int compat_hdio_getgeo(struct block_device *bdev,
515515
* want to override it.
516516
*/
517517
geo.start = get_start_sect(bdev);
518-
ret = disk->fops->getgeo(bdev, &geo);
518+
ret = disk->fops->getgeo(disk, &geo);
519519
if (ret)
520520
return ret;
521521

block/partitions/ibm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ int ibm_partition(struct parsed_partitions *state)
358358
goto out_nolab;
359359
/* set start if not filled by getgeo function e.g. virtblk */
360360
geo->start = get_start_sect(bdev);
361-
if (disk->fops->getgeo(bdev, geo))
361+
if (disk->fops->getgeo(disk, geo))
362362
goto out_freeall;
363363
if (!fn || fn(disk, info)) {
364364
kfree(info);

drivers/block/amiflop.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1523,13 +1523,13 @@ static blk_status_t amiflop_queue_rq(struct blk_mq_hw_ctx *hctx,
15231523
return BLK_STS_OK;
15241524
}
15251525

1526-
static int fd_getgeo(struct block_device *bdev, struct hd_geometry *geo)
1526+
static int fd_getgeo(struct gendisk *disk, struct hd_geometry *geo)
15271527
{
1528-
int drive = MINOR(bdev->bd_dev) & 3;
1528+
struct amiga_floppy_struct *p = disk->private_data;
15291529

1530-
geo->heads = unit[drive].type->heads;
1531-
geo->sectors = unit[drive].dtype->sects * unit[drive].type->sect_mult;
1532-
geo->cylinders = unit[drive].type->tracks;
1530+
geo->heads = p->type->heads;
1531+
geo->sectors = p->dtype->sects * p->type->sect_mult;
1532+
geo->cylinders = p->type->tracks;
15331533
return 0;
15341534
}
15351535

drivers/block/aoe/aoeblk.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,9 +269,9 @@ static blk_status_t aoeblk_queue_rq(struct blk_mq_hw_ctx *hctx,
269269
}
270270

271271
static int
272-
aoeblk_getgeo(struct block_device *bdev, struct hd_geometry *geo)
272+
aoeblk_getgeo(struct gendisk *disk, struct hd_geometry *geo)
273273
{
274-
struct aoedev *d = bdev->bd_disk->private_data;
274+
struct aoedev *d = disk->private_data;
275275

276276
if ((d->flags & DEVFL_UP) == 0) {
277277
printk(KERN_ERR "aoe: disk not up\n");

drivers/block/floppy.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3363,9 +3363,9 @@ static int get_floppy_geometry(int drive, int type, struct floppy_struct **g)
33633363
return 0;
33643364
}
33653365

3366-
static int fd_getgeo(struct block_device *bdev, struct hd_geometry *geo)
3366+
static int fd_getgeo(struct gendisk *disk, struct hd_geometry *geo)
33673367
{
3368-
int drive = (long)bdev->bd_disk->private_data;
3368+
int drive = (long)disk->private_data;
33693369
int type = ITYPE(drive_state[drive].fd_device);
33703370
struct floppy_struct *g;
33713371
int ret;

drivers/block/mtip32xx/mtip32xx.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3148,17 +3148,17 @@ static int mtip_block_compat_ioctl(struct block_device *dev,
31483148
* that each partition is also 4KB aligned. Non-aligned partitions adversely
31493149
* affects performance.
31503150
*
3151-
* @dev Pointer to the block_device strucutre.
3151+
* @disk Pointer to the gendisk strucutre.
31523152
* @geo Pointer to a hd_geometry structure.
31533153
*
31543154
* return value
31553155
* 0 Operation completed successfully.
31563156
* -ENOTTY An error occurred while reading the drive capacity.
31573157
*/
3158-
static int mtip_block_getgeo(struct block_device *dev,
3158+
static int mtip_block_getgeo(struct gendisk *disk,
31593159
struct hd_geometry *geo)
31603160
{
3161-
struct driver_data *dd = dev->bd_disk->private_data;
3161+
struct driver_data *dd = disk->private_data;
31623162
sector_t capacity;
31633163

31643164
if (!dd)

drivers/block/rnbd/rnbd-clt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -942,11 +942,11 @@ static void rnbd_client_release(struct gendisk *gen)
942942
rnbd_clt_put_dev(dev);
943943
}
944944

945-
static int rnbd_client_getgeo(struct block_device *block_device,
945+
static int rnbd_client_getgeo(struct gendisk *disk,
946946
struct hd_geometry *geo)
947947
{
948948
u64 size;
949-
struct rnbd_clt_dev *dev = block_device->bd_disk->private_data;
949+
struct rnbd_clt_dev *dev = disk->private_data;
950950
struct queue_limits *limit = &dev->queue->limits;
951951

952952
size = dev->size * (limit->logical_block_size / SECTOR_SIZE);

0 commit comments

Comments
 (0)