[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPcyv4jrWp4BKuSyxarTMy4eeezLTos6-MZMup5b4enKkE4N1w@mail.gmail.com>
Date: Thu, 10 Mar 2016 07:15:19 -0800
From: Dan Williams <dan.j.williams@...el.com>
To: Christoph Hellwig <hch@....de>
Cc: Jens Axboe <axboe@...com>, linux-block@...r.kernel.org,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Al Viro <viro@...iv.linux.org.uk>
Subject: Re: [PATCH 1/3] block: introduce device_add_disk()
On Thu, Mar 10, 2016 at 12:09 AM, Christoph Hellwig <hch@....de> wrote:
>> /**
>> - * add_disk - add partitioning information to kernel list
>> + * device_add_disk - add partitioning information to kernel list
>> + * @parent: parent device for the disk
>> * @disk: per-device partitioning information
>> *
>> * This function registers the partitioning information in @disk
>> @@ -581,7 +582,7 @@ exit:
>> *
>> * FIXME: error handling
>> */
>> -void add_disk(struct gendisk *disk)
>> +int device_add_disk(struct device *parent, struct gendisk *disk)
>> {
>> struct backing_dev_info *bdi;
>> dev_t devt;
>> @@ -597,10 +598,8 @@ void add_disk(struct gendisk *disk)
>> disk->flags |= GENHD_FL_UP;
>>
>> retval = blk_alloc_devt(&disk->part0, &devt);
>> - if (retval) {
>> - WARN_ON(1);
>> - return;
>> - }
>> + if (retval)
>> + return retval;
>> disk_to_dev(disk)->devt = devt;
>>
>> /* ->major and ->first_minor aren't supposed to be
>> @@ -617,7 +616,7 @@ void add_disk(struct gendisk *disk)
>>
>> blk_register_region(disk_devt(disk), disk->minors, NULL,
>> exact_match, exact_lock, disk);
>> - register_disk(disk);
>> + register_disk(parent, disk);
>> blk_register_queue(disk);
>>
>> /*
>> @@ -628,12 +627,11 @@ void add_disk(struct gendisk *disk)
>>
>> retval = sysfs_create_link(&disk_to_dev(disk)->kobj, &bdi->dev->kobj,
>> "bdi");
>> - WARN_ON(retval);
>> -
>> disk_add_events(disk);
>> blk_integrity_add(disk);
>> + return retval;
>
> How are the callers expected to unwind after already having added the
> disk?
True, I overlooked making add_disk() unwind-able, will re-spin...
Powered by blists - more mailing lists