- Cleanups to request-based DM and DM multipath from Christoph that
prepare for his block core error code type checking improvements. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAABAgAGBQJZB7R5AAoJEMUj8QotnQNaCFMIAKcE+xFMAf5D6en6Ys5V1Lm6 L6/MdUnbH2j7wZ7CnNgkmDExdJ8dpENyjhy8r4rgXs+BufiVeZ8uGOYsuiXGjOG2 wZ4M4haBbBDsWStyn3C5K3QxpN7ksuxHZC7XR25fDDDIBmJW2/bL7B7kyE9lp6LR SmP7O0x36twCMrwWrC043NwhCS+lQH+EIqTTX4Q18swtXz/CCAtNDxgGsjxvwfxH YkCAxzbQlva3nYv29tcKpc89RJK1hWfdkXqb/TW4pPxspexnEjVUFyh019DxEoRr KPi6hhT6nx2JjMSvJykFasRPAdoyEoUzTNjrGk6WeD6hfzkxsHq/FutbH9BGj8Q= =h45q -----END PGP SIGNATURE----- Merge tag 'for-4.12/dm-post-merge-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm Pull additional device mapper updates from Mike Snitzer: "Here are some changes from Christoph that needed to be rebased ontop of changes that were already merged into the device mapper tree. In addition, these changes depend on the 'for-4.12/block' changes that you've already merged. - Cleanups to request-based DM and DM multipath from Christoph that prepare for his block core error code type checking improvements" * tag 'for-4.12/dm-post-merge-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm: dm: introduce a new DM_MAPIO_KILL return value dm rq: change ->rq_end_io calling conventions dm mpath: merge do_end_io into multipath_end_io
This commit is contained in:
commit
7b66f13207
|
@ -1464,12 +1464,13 @@ static int noretry_error(int error)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* end_io handling
|
||||
*/
|
||||
static int do_end_io(struct multipath *m, struct request *clone,
|
||||
int error, struct dm_mpath_io *mpio)
|
||||
static int multipath_end_io(struct dm_target *ti, struct request *clone,
|
||||
int error, union map_info *map_context)
|
||||
{
|
||||
struct dm_mpath_io *mpio = get_mpio(map_context);
|
||||
struct pgpath *pgpath = mpio->pgpath;
|
||||
int r = DM_ENDIO_DONE;
|
||||
|
||||
/*
|
||||
* We don't queue any clone request inside the multipath target
|
||||
* during end I/O handling, since those clone requests don't have
|
||||
|
@ -1481,39 +1482,26 @@ static int do_end_io(struct multipath *m, struct request *clone,
|
|||
* request into dm core, which will remake a clone request and
|
||||
* 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)
|
||||
return 0; /* I/O complete */
|
||||
r = DM_ENDIO_REQUEUE;
|
||||
|
||||
if (noretry_error(error))
|
||||
return error;
|
||||
if (pgpath)
|
||||
fail_path(pgpath);
|
||||
|
||||
if (mpio->pgpath)
|
||||
fail_path(mpio->pgpath);
|
||||
if (atomic_read(&m->nr_valid_paths) == 0 &&
|
||||
!test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags)) {
|
||||
if (error == -EIO)
|
||||
error = dm_report_EIO(m);
|
||||
/* complete with the original error */
|
||||
r = DM_ENDIO_DONE;
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
ps = &pgpath->pg->ps;
|
||||
struct path_selector *ps = &pgpath->pg->ps;
|
||||
|
||||
if (ps->type->end_io)
|
||||
ps->type->end_io(ps, &pgpath->path, mpio->nr_bytes);
|
||||
}
|
||||
|
|
|
@ -287,7 +287,7 @@ static void dm_requeue_original_request(struct dm_rq_target_io *tio, bool delay_
|
|||
|
||||
static void dm_done(struct request *clone, int error, bool mapped)
|
||||
{
|
||||
int r = error;
|
||||
int r = DM_ENDIO_DONE;
|
||||
struct dm_rq_target_io *tio = clone->end_io_data;
|
||||
dm_request_endio_fn rq_end_io = NULL;
|
||||
|
||||
|
@ -298,7 +298,7 @@ static void dm_done(struct request *clone, int error, bool mapped)
|
|||
r = rq_end_io(tio->ti, clone, error, &tio->info);
|
||||
}
|
||||
|
||||
if (unlikely(r == -EREMOTEIO)) {
|
||||
if (unlikely(error == -EREMOTEIO)) {
|
||||
if (req_op(clone) == REQ_OP_WRITE_SAME &&
|
||||
!clone->q->limits.max_write_same_sectors)
|
||||
disable_write_same(tio->md);
|
||||
|
@ -307,16 +307,19 @@ static void dm_done(struct request *clone, int error, bool mapped)
|
|||
disable_write_zeroes(tio->md);
|
||||
}
|
||||
|
||||
if (r <= 0)
|
||||
switch (r) {
|
||||
case DM_ENDIO_DONE:
|
||||
/* The target wants to complete the I/O */
|
||||
dm_end_request(clone, r);
|
||||
else if (r == DM_ENDIO_INCOMPLETE)
|
||||
dm_end_request(clone, error);
|
||||
break;
|
||||
case DM_ENDIO_INCOMPLETE:
|
||||
/* The target will handle the I/O */
|
||||
return;
|
||||
else if (r == DM_ENDIO_REQUEUE)
|
||||
case DM_ENDIO_REQUEUE:
|
||||
/* The target wants to requeue the I/O */
|
||||
dm_requeue_original_request(tio, false);
|
||||
else {
|
||||
break;
|
||||
default:
|
||||
DMWARN("unimplemented target endio return value: %d", r);
|
||||
BUG();
|
||||
}
|
||||
|
@ -501,14 +504,12 @@ static int map_request(struct dm_rq_target_io *tio)
|
|||
/* The target wants to requeue the I/O after a delay */
|
||||
dm_requeue_original_request(tio, true);
|
||||
break;
|
||||
default:
|
||||
if (r > 0) {
|
||||
DMWARN("unimplemented target map return value: %d", r);
|
||||
BUG();
|
||||
}
|
||||
|
||||
case DM_MAPIO_KILL:
|
||||
/* The target wants to complete the I/O */
|
||||
dm_kill_unmapped_request(rq, r);
|
||||
dm_kill_unmapped_request(rq, -EIO);
|
||||
default:
|
||||
DMWARN("unimplemented target map return value: %d", r);
|
||||
BUG();
|
||||
}
|
||||
|
||||
return r;
|
||||
|
|
|
@ -135,7 +135,7 @@ static int io_err_clone_and_map_rq(struct dm_target *ti, struct request *rq,
|
|||
union map_info *map_context,
|
||||
struct request **clone)
|
||||
{
|
||||
return -EIO;
|
||||
return DM_MAPIO_KILL;
|
||||
}
|
||||
|
||||
static void io_err_release_clone_rq(struct request *clone)
|
||||
|
|
|
@ -593,6 +593,7 @@ extern struct ratelimit_state dm_ratelimit_state;
|
|||
/*
|
||||
* Definitions of return values from target end_io function.
|
||||
*/
|
||||
#define DM_ENDIO_DONE 0
|
||||
#define DM_ENDIO_INCOMPLETE 1
|
||||
#define DM_ENDIO_REQUEUE 2
|
||||
|
||||
|
@ -603,6 +604,7 @@ extern struct ratelimit_state dm_ratelimit_state;
|
|||
#define DM_MAPIO_REMAPPED 1
|
||||
#define DM_MAPIO_REQUEUE DM_ENDIO_REQUEUE
|
||||
#define DM_MAPIO_DELAY_REQUEUE 3
|
||||
#define DM_MAPIO_KILL 4
|
||||
|
||||
#define dm_sector_div64(x, y)( \
|
||||
{ \
|
||||
|
|
Loading…
Reference in New Issue