Skip to content

Commit 41463f2

Browse files
Christoph Hellwigaxboe
authored andcommitted
dasd: cleamup dasd_state_basic_to_ready
Reflow dasd_state_basic_to_ready a bit to make it easier to modify. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Stefan Haberland <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 38b4353 commit 41463f2

File tree

1 file changed

+26
-28
lines changed

1 file changed

+26
-28
lines changed

drivers/s390/block/dasd.c

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -307,39 +307,37 @@ static int dasd_state_basic_to_known(struct dasd_device *device)
307307
*/
308308
static int dasd_state_basic_to_ready(struct dasd_device *device)
309309
{
310-
int rc;
311-
struct dasd_block *block;
312-
struct gendisk *disk;
310+
struct dasd_block *block = device->block;
311+
int rc = 0;
313312

314-
rc = 0;
315-
block = device->block;
316313
/* make disk known with correct capacity */
317-
if (block) {
318-
if (block->base->discipline->do_analysis != NULL)
319-
rc = block->base->discipline->do_analysis(block);
320-
if (rc) {
321-
if (rc != -EAGAIN) {
322-
device->state = DASD_STATE_UNFMT;
323-
disk = device->block->gdp;
324-
kobject_uevent(&disk_to_dev(disk)->kobj,
325-
KOBJ_CHANGE);
326-
goto out;
327-
}
328-
return rc;
329-
}
330-
if (device->discipline->setup_blk_queue)
331-
device->discipline->setup_blk_queue(block);
332-
set_capacity(block->gdp,
333-
block->blocks << block->s2b_shift);
314+
if (!block) {
334315
device->state = DASD_STATE_READY;
335-
rc = dasd_scan_partitions(block);
336-
if (rc) {
337-
device->state = DASD_STATE_BASIC;
316+
goto out;
317+
}
318+
319+
if (block->base->discipline->do_analysis != NULL)
320+
rc = block->base->discipline->do_analysis(block);
321+
if (rc) {
322+
if (rc == -EAGAIN)
338323
return rc;
339-
}
340-
} else {
341-
device->state = DASD_STATE_READY;
324+
device->state = DASD_STATE_UNFMT;
325+
kobject_uevent(&disk_to_dev(device->block->gdp)->kobj,
326+
KOBJ_CHANGE);
327+
goto out;
342328
}
329+
330+
if (device->discipline->setup_blk_queue)
331+
device->discipline->setup_blk_queue(block);
332+
set_capacity(block->gdp, block->blocks << block->s2b_shift);
333+
device->state = DASD_STATE_READY;
334+
335+
rc = dasd_scan_partitions(block);
336+
if (rc) {
337+
device->state = DASD_STATE_BASIC;
338+
return rc;
339+
}
340+
343341
out:
344342
if (device->discipline->basic_to_ready)
345343
rc = device->discipline->basic_to_ready(device);

0 commit comments

Comments
 (0)