提交 14ef1e48 编写于 作者: C Christoph Hellwig 提交者: Jens Axboe

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: NChristoph Hellwig <hch@lst.de>
Signed-off-by: NMike Snitzer <snitzer@redhat.com>
Signed-off-by: NJens Axboe <axboe@fb.com>
上级 36ffc6c1
...@@ -1510,24 +1510,24 @@ static int multipath_end_io(struct dm_target *ti, struct request *clone, ...@@ -1510,24 +1510,24 @@ static int multipath_end_io(struct dm_target *ti, struct request *clone,
return r; return r;
} }
static int do_end_io_bio(struct multipath *m, struct bio *clone, static int multipath_end_io_bio(struct dm_target *ti, struct bio *clone, int error)
int error, struct dm_mpath_io *mpio)
{ {
struct multipath *m = ti->private;
struct dm_mpath_io *mpio = get_mpio_from_bio(clone);
struct pgpath *pgpath = mpio->pgpath;
unsigned long flags; unsigned long flags;
if (!error) if (!error || noretry_error(error))
return 0; /* I/O complete */ goto done;
if (noretry_error(error))
return error;
if (mpio->pgpath) if (pgpath)
fail_path(mpio->pgpath); fail_path(pgpath);
if (atomic_read(&m->nr_valid_paths) == 0 && if (atomic_read(&m->nr_valid_paths) == 0 &&
!test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags)) { !test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags)) {
dm_report_EIO(m); dm_report_EIO(m);
return -EIO; error = -EIO;
goto done;
} }
/* Queue for the daemon to resubmit */ /* Queue for the daemon to resubmit */
...@@ -1539,28 +1539,16 @@ static int do_end_io_bio(struct multipath *m, struct bio *clone, ...@@ -1539,28 +1539,16 @@ static int do_end_io_bio(struct multipath *m, struct bio *clone,
if (!test_bit(MPATHF_QUEUE_IO, &m->flags)) if (!test_bit(MPATHF_QUEUE_IO, &m->flags))
queue_work(kmultipathd, &m->process_queued_bios); queue_work(kmultipathd, &m->process_queued_bios);
return DM_ENDIO_INCOMPLETE; error = DM_ENDIO_INCOMPLETE;
} done:
static int multipath_end_io_bio(struct dm_target *ti, struct bio *clone, int error)
{
struct multipath *m = ti->private;
struct dm_mpath_io *mpio = get_mpio_from_bio(clone);
struct pgpath *pgpath;
struct path_selector *ps;
int r;
BUG_ON(!mpio);
r = do_end_io_bio(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;
} }
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册