aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm.h
diff options
context:
space:
mode:
authorMike Snitzer <snitzer@redhat.com>2013-08-22 18:21:38 -0400
committerMike Snitzer <snitzer@redhat.com>2013-09-05 20:46:05 -0400
commit169e2cc279c443085f7e423561eb1fe6158ade44 (patch)
tree109acfea689865bb69e1c12a3ad36d34b8293429 /drivers/md/dm.h
parenteb18cba78c2b9250663021e17e1e9cc34630e92a (diff)
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.h')
-rw-r--r--drivers/md/dm.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/md/dm.h b/drivers/md/dm.h
index 45b97da1bd06..8b4c075d9a2f 100644
--- a/drivers/md/dm.h
+++ b/drivers/md/dm.h
@@ -89,10 +89,21 @@ int dm_setup_md_queue(struct mapped_device *md);
89#define dm_target_is_valid(t) ((t)->table) 89#define dm_target_is_valid(t) ((t)->table)
90 90
91/* 91/*
92 * To check whether the target type is bio-based or not (request-based).
93 */
94#define dm_target_bio_based(t) ((t)->type->map != NULL)
95
96/*
92 * To check whether the target type is request-based or not (bio-based). 97 * To check whether the target type is request-based or not (bio-based).
93 */ 98 */
94#define dm_target_request_based(t) ((t)->type->map_rq != NULL) 99#define dm_target_request_based(t) ((t)->type->map_rq != NULL)
95 100
101/*
102 * To check whether the target type is a hybrid (capable of being
103 * either request-based or bio-based).
104 */
105#define dm_target_hybrid(t) (dm_target_bio_based(t) && dm_target_request_based(t))
106
96/*----------------------------------------------------------------- 107/*-----------------------------------------------------------------
97 * A registry of target types. 108 * A registry of target types.
98 *---------------------------------------------------------------*/ 109 *---------------------------------------------------------------*/