Commit 41463f2d authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

dasd: cleamup dasd_state_basic_to_ready

Reflow dasd_state_basic_to_ready a bit to make it easier to modify.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarStefan Haberland <sth@linux.ibm.com>
Link: https://lore.kernel.org/r/20240228133742.806274-2-hch@lst.deSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 38b43539
...@@ -307,39 +307,37 @@ static int dasd_state_basic_to_known(struct dasd_device *device) ...@@ -307,39 +307,37 @@ static int dasd_state_basic_to_known(struct dasd_device *device)
*/ */
static int dasd_state_basic_to_ready(struct dasd_device *device) static int dasd_state_basic_to_ready(struct dasd_device *device)
{ {
int rc; struct dasd_block *block = device->block;
struct dasd_block *block; int rc = 0;
struct gendisk *disk;
rc = 0;
block = device->block;
/* make disk known with correct capacity */ /* make disk known with correct capacity */
if (block) { if (!block) {
if (block->base->discipline->do_analysis != NULL)
rc = block->base->discipline->do_analysis(block);
if (rc) {
if (rc != -EAGAIN) {
device->state = DASD_STATE_UNFMT;
disk = device->block->gdp;
kobject_uevent(&disk_to_dev(disk)->kobj,
KOBJ_CHANGE);
goto out;
}
return rc;
}
if (device->discipline->setup_blk_queue)
device->discipline->setup_blk_queue(block);
set_capacity(block->gdp,
block->blocks << block->s2b_shift);
device->state = DASD_STATE_READY; device->state = DASD_STATE_READY;
rc = dasd_scan_partitions(block); goto out;
if (rc) { }
device->state = DASD_STATE_BASIC;
if (block->base->discipline->do_analysis != NULL)
rc = block->base->discipline->do_analysis(block);
if (rc) {
if (rc == -EAGAIN)
return rc; return rc;
} device->state = DASD_STATE_UNFMT;
} else { kobject_uevent(&disk_to_dev(device->block->gdp)->kobj,
device->state = DASD_STATE_READY; KOBJ_CHANGE);
goto out;
} }
if (device->discipline->setup_blk_queue)
device->discipline->setup_blk_queue(block);
set_capacity(block->gdp, block->blocks << block->s2b_shift);
device->state = DASD_STATE_READY;
rc = dasd_scan_partitions(block);
if (rc) {
device->state = DASD_STATE_BASIC;
return rc;
}
out: out:
if (device->discipline->basic_to_ready) if (device->discipline->basic_to_ready)
rc = device->discipline->basic_to_ready(device); rc = device->discipline->basic_to_ready(device);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment