Commit 4fc8728a authored by Al Viro's avatar Al Viro
Browse files

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: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Acked-by: default avatarJens Axboe <axboe@kernel.dk>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 3eb50369
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -443,7 +443,7 @@ prototypes::
	int (*direct_access) (struct block_device *, sector_t, void **,
				unsigned long *);
	void (*unlock_native_capacity) (struct gendisk *);
	int (*getgeo)(struct block_device *, struct hd_geometry *);
	int (*getgeo)(struct gendisk *, struct hd_geometry *);
	void (*swap_slot_free_notify) (struct block_device *, unsigned long);

locking rules:
+2 −2
Original line number Diff line number Diff line
@@ -77,9 +77,9 @@ static void nfhd_submit_bio(struct bio *bio)
	bio_endio(bio);
}

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

	geo->cylinders = dev->blocks >> (6 - dev->bshift);
	geo->heads = 4;
+3 −3
Original line number Diff line number Diff line
@@ -108,7 +108,7 @@ static DEFINE_MUTEX(ubd_lock);

static int ubd_ioctl(struct block_device *bdev, blk_mode_t mode,
		     unsigned int cmd, unsigned long arg);
static int ubd_getgeo(struct block_device *bdev, struct hd_geometry *geo);
static int ubd_getgeo(struct gendisk *disk, struct hd_geometry *geo);

#define MAX_DEV (16)

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

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

	geo->heads = 128;
	geo->sectors = 32;
+2 −2
Original line number Diff line number Diff line
@@ -481,7 +481,7 @@ static int blkdev_getgeo(struct block_device *bdev,
	 */
	memset(&geo, 0, sizeof(geo));
	geo.start = get_start_sect(bdev);
	ret = disk->fops->getgeo(bdev, &geo);
	ret = disk->fops->getgeo(disk, &geo);
	if (ret)
		return ret;
	if (copy_to_user(argp, &geo, sizeof(geo)))
@@ -515,7 +515,7 @@ static int compat_hdio_getgeo(struct block_device *bdev,
	 * want to override it.
	 */
	geo.start = get_start_sect(bdev);
	ret = disk->fops->getgeo(bdev, &geo);
	ret = disk->fops->getgeo(disk, &geo);
	if (ret)
		return ret;

+1 −1
Original line number Diff line number Diff line
@@ -358,7 +358,7 @@ int ibm_partition(struct parsed_partitions *state)
		goto out_nolab;
	/* set start if not filled by getgeo function e.g. virtblk */
	geo->start = get_start_sect(bdev);
	if (disk->fops->getgeo(bdev, geo))
	if (disk->fops->getgeo(disk, geo))
		goto out_freeall;
	if (!fn || fn(disk, info)) {
		kfree(info);
Loading