dm request: extend target interface

This patch adds the following target interfaces for request-based dm.

map_rq : for mapping a request

rq_end_io : for finishing a request

busy : for avoiding performance regression from bio-based dm.
Target can tell dm core not to map requests now, and
that may help requests in the block layer queue to be
bigger by I/O merging.
In bio-based dm, this behavior is done by device
drivers managing the block layer queue.
But in request-based dm, dm core has to do that
since dm core manages the block layer queue.

Signed-off-by: Kiyoshi Ueda <k-ueda@ct.jp.nec.com>
Signed-off-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>

authored by

Kiyoshi Ueda and committed by
Alasdair G Kergon
7d76345d 8fbf26ad

+15
+15
include/linux/device-mapper.h
··· 45 45 */ 46 46 typedef int (*dm_map_fn) (struct dm_target *ti, struct bio *bio, 47 47 union map_info *map_context); 48 + typedef int (*dm_map_request_fn) (struct dm_target *ti, struct request *clone, 49 + union map_info *map_context); 48 50 49 51 /* 50 52 * Returns: ··· 59 57 typedef int (*dm_endio_fn) (struct dm_target *ti, 60 58 struct bio *bio, int error, 61 59 union map_info *map_context); 60 + typedef int (*dm_request_endio_fn) (struct dm_target *ti, 61 + struct request *clone, int error, 62 + union map_info *map_context); 62 63 63 64 typedef void (*dm_flush_fn) (struct dm_target *ti); 64 65 typedef void (*dm_presuspend_fn) (struct dm_target *ti); ··· 79 74 80 75 typedef int (*dm_merge_fn) (struct dm_target *ti, struct bvec_merge_data *bvm, 81 76 struct bio_vec *biovec, int max_size); 77 + 78 + /* 79 + * Returns: 80 + * 0: The target can handle the next I/O immediately. 81 + * 1: The target can't handle the next I/O immediately. 82 + */ 83 + typedef int (*dm_busy_fn) (struct dm_target *ti); 82 84 83 85 void dm_error(const char *message); 84 86 ··· 119 107 dm_ctr_fn ctr; 120 108 dm_dtr_fn dtr; 121 109 dm_map_fn map; 110 + dm_map_request_fn map_rq; 122 111 dm_endio_fn end_io; 112 + dm_request_endio_fn rq_end_io; 123 113 dm_flush_fn flush; 124 114 dm_presuspend_fn presuspend; 125 115 dm_postsuspend_fn postsuspend; ··· 131 117 dm_message_fn message; 132 118 dm_ioctl_fn ioctl; 133 119 dm_merge_fn merge; 120 + dm_busy_fn busy; 134 121 }; 135 122 136 123 struct io_restrictions {