diff options
author | Mike Snitzer <snitzer@redhat.com> | 2013-08-23 02:21:38 +0400 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2013-09-06 04:46:05 +0400 |
commit | 169e2cc279c443085f7e423561eb1fe6158ade44 (patch) | |
tree | 109acfea689865bb69e1c12a3ad36d34b8293429 /drivers/md/dm-target.c | |
parent | eb18cba78c2b9250663021e17e1e9cc34630e92a (diff) | |
download | linux-169e2cc279c443085f7e423561eb1fe6158ade44.tar.xz |
dm: allow error target to replace bio-based and request-based targets
It may be useful to switch a request-based table to the "error" target.
Enhance the DM core to allow a hybrid target_type which is capable of
handling either bios (via .map) or requests (via .map_rq).
Add a request-based map function (.map_rq) to the "error" target_type;
making it DM's first hybrid target. Train dm_table_set_type() to prefer
the mapped device's established type (request-based or bio-based). If
the mapped device doesn't have an established type default to making the
table with the hybrid target(s) bio-based.
Tested 'dmsetup wipe_table' to work on both bio-based and request-based
devices.
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Joe Jin <joe.jin@oracle.com>
Signed-off-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com>
Acked-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md/dm-target.c')
-rw-r--r-- | drivers/md/dm-target.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/md/dm-target.c b/drivers/md/dm-target.c index 37ba5db71cd9..242e3cec397a 100644 --- a/drivers/md/dm-target.c +++ b/drivers/md/dm-target.c @@ -131,12 +131,19 @@ static int io_err_map(struct dm_target *tt, struct bio *bio) return -EIO; } +static int io_err_map_rq(struct dm_target *ti, struct request *clone, + union map_info *map_context) +{ + return -EIO; +} + static struct target_type error_target = { .name = "error", - .version = {1, 1, 0}, + .version = {1, 2, 0}, .ctr = io_err_ctr, .dtr = io_err_dtr, .map = io_err_map, + .map_rq = io_err_map_rq, }; int __init dm_target_init(void) |