Skip to content

Commit 14ef1e4

Browse files
Christoph Hellwigaxboe
authored andcommitted
dm mpath: merge do_end_io_bio into multipath_end_io_bio
This simplifies the code and especially the error passing a bit and will help with the next patch. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Mike Snitzer <snitzer@redhat.com> Signed-off-by: Jens Axboe <axboe@fb.com>
1 parent 36ffc6c commit 14ef1e4

File tree

1 file changed

+15
-27
lines changed

1 file changed

+15
-27
lines changed

drivers/md/dm-mpath.c

Lines changed: 15 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1510,24 +1510,24 @@ static int multipath_end_io(struct dm_target *ti, struct request *clone,
15101510
return r;
15111511
}
15121512

1513-
static int do_end_io_bio(struct multipath *m, struct bio *clone,
1514-
int error, struct dm_mpath_io *mpio)
1513+
static int multipath_end_io_bio(struct dm_target *ti, struct bio *clone, int error)
15151514
{
1515+
struct multipath *m = ti->private;
1516+
struct dm_mpath_io *mpio = get_mpio_from_bio(clone);
1517+
struct pgpath *pgpath = mpio->pgpath;
15161518
unsigned long flags;
15171519

1518-
if (!error)
1519-
return 0; /* I/O complete */
1520-
1521-
if (noretry_error(error))
1522-
return error;
1520+
if (!error || noretry_error(error))
1521+
goto done;
15231522

1524-
if (mpio->pgpath)
1525-
fail_path(mpio->pgpath);
1523+
if (pgpath)
1524+
fail_path(pgpath);
15261525

15271526
if (atomic_read(&m->nr_valid_paths) == 0 &&
15281527
!test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags)) {
15291528
dm_report_EIO(m);
1530-
return -EIO;
1529+
error = -EIO;
1530+
goto done;
15311531
}
15321532

15331533
/* Queue for the daemon to resubmit */
@@ -1539,28 +1539,16 @@ static int do_end_io_bio(struct multipath *m, struct bio *clone,
15391539
if (!test_bit(MPATHF_QUEUE_IO, &m->flags))
15401540
queue_work(kmultipathd, &m->process_queued_bios);
15411541

1542-
return DM_ENDIO_INCOMPLETE;
1543-
}
1544-
1545-
static int multipath_end_io_bio(struct dm_target *ti, struct bio *clone, int error)
1546-
{
1547-
struct multipath *m = ti->private;
1548-
struct dm_mpath_io *mpio = get_mpio_from_bio(clone);
1549-
struct pgpath *pgpath;
1550-
struct path_selector *ps;
1551-
int r;
1552-
1553-
BUG_ON(!mpio);
1554-
1555-
r = do_end_io_bio(m, clone, error, mpio);
1556-
pgpath = mpio->pgpath;
1542+
error = DM_ENDIO_INCOMPLETE;
1543+
done:
15571544
if (pgpath) {
1558-
ps = &pgpath->pg->ps;
1545+
struct path_selector *ps = &pgpath->pg->ps;
1546+
15591547
if (ps->type->end_io)
15601548
ps->type->end_io(ps, &pgpath->path, mpio->nr_bytes);
15611549
}
15621550

1563-
return r;
1551+
return error;
15641552
}
15651553

15661554
/*

0 commit comments

Comments
 (0)