Re: [RFC PATCH 01/18] block: add and use init disk helper

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/10/22 00:59, Christoph Hellwig wrote:
> On Tue, Oct 04, 2022 at 10:00:10PM -0700, Chaitanya Kulkarni wrote:
>> +void init_disk(struct gendisk *disk, int major, int first_minor,
>> +		int minors, sector_t sectors, void *private_data,
>> +		const struct block_device_operations *fops)
>> +{
>> +	disk->major = major;
>> +	disk->first_minor = first_minor;
>> +	disk->minors = minors;
>> +	set_capacity(disk, sectors);
>> +	disk->private_data = private_data;
>> +	disk->fops = fops;
> 
> I don't like this at all.  For one major/first_minor/minors are
> optional and discouraged for new drivers.  Setting the capacity is
> a different thing and is done by helpers also used for revalidation
> in many drivers.
> 
> It might make sense to pass the fops (and maybe private_data) to
> blk_mq_alloc_disk / blk_alloc_disk, but even then I'm not quite
> sure it is worth the churn.

Okay I'll drop this, and see if I can get something meaningful
with fops and private data.

-ck





[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux