dm mpath: merge do_end_io into multipath_end_io
This simplifies the I/O completion path a bit. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
This commit is contained in:
parent
7e25a76061
commit
b79f10eefd
@ -1464,12 +1464,12 @@ static int noretry_error(int error)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
static int multipath_end_io(struct dm_target *ti, struct request *clone,
|
||||||
* end_io handling
|
int error, union map_info *map_context)
|
||||||
*/
|
|
||||||
static int do_end_io(struct multipath *m, struct request *clone,
|
|
||||||
int error, struct dm_mpath_io *mpio)
|
|
||||||
{
|
{
|
||||||
|
struct dm_mpath_io *mpio = get_mpio(map_context);
|
||||||
|
struct pgpath *pgpath = mpio->pgpath;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We don't queue any clone request inside the multipath target
|
* We don't queue any clone request inside the multipath target
|
||||||
* during end I/O handling, since those clone requests don't have
|
* during end I/O handling, since those clone requests don't have
|
||||||
@ -1481,44 +1481,27 @@ static int do_end_io(struct multipath *m, struct request *clone,
|
|||||||
* request into dm core, which will remake a clone request and
|
* request into dm core, which will remake a clone request and
|
||||||
* clone bios for it and resubmit it later.
|
* clone bios for it and resubmit it later.
|
||||||
*/
|
*/
|
||||||
int r = DM_ENDIO_REQUEUE;
|
if (error && !noretry_error(error)) {
|
||||||
|
struct multipath *m = ti->private;
|
||||||
|
|
||||||
if (!error)
|
error = DM_ENDIO_REQUEUE;
|
||||||
return 0; /* I/O complete */
|
|
||||||
|
|
||||||
if (noretry_error(error))
|
if (pgpath)
|
||||||
return error;
|
fail_path(pgpath);
|
||||||
|
|
||||||
if (mpio->pgpath)
|
if (atomic_read(&m->nr_valid_paths) == 0 &&
|
||||||
fail_path(mpio->pgpath);
|
!test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags))
|
||||||
|
error = dm_report_EIO(m);
|
||||||
|
}
|
||||||
|
|
||||||
if (atomic_read(&m->nr_valid_paths) == 0 &&
|
|
||||||
!test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags))
|
|
||||||
r = dm_report_EIO(m);
|
|
||||||
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int multipath_end_io(struct dm_target *ti, struct request *clone,
|
|
||||||
int error, union map_info *map_context)
|
|
||||||
{
|
|
||||||
struct multipath *m = ti->private;
|
|
||||||
struct dm_mpath_io *mpio = get_mpio(map_context);
|
|
||||||
struct pgpath *pgpath;
|
|
||||||
struct path_selector *ps;
|
|
||||||
int r;
|
|
||||||
|
|
||||||
BUG_ON(!mpio);
|
|
||||||
|
|
||||||
r = do_end_io(m, clone, error, mpio);
|
|
||||||
pgpath = mpio->pgpath;
|
|
||||||
if (pgpath) {
|
if (pgpath) {
|
||||||
ps = &pgpath->pg->ps;
|
struct path_selector *ps = &pgpath->pg->ps;
|
||||||
|
|
||||||
if (ps->type->end_io)
|
if (ps->type->end_io)
|
||||||
ps->type->end_io(ps, &pgpath->path, mpio->nr_bytes);
|
ps->type->end_io(ps, &pgpath->path, mpio->nr_bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
return r;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int do_end_io_bio(struct multipath *m, struct bio *clone,
|
static int do_end_io_bio(struct multipath *m, struct bio *clone,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user