aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/device-mapper.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/device-mapper.h')
-rw-r--r--include/linux/device-mapper.h56
1 files changed, 11 insertions, 45 deletions
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index a5538433c927..da83f64952e7 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -28,6 +28,7 @@ enum dm_queue_mode {
28 DM_TYPE_REQUEST_BASED = 2, 28 DM_TYPE_REQUEST_BASED = 2,
29 DM_TYPE_MQ_REQUEST_BASED = 3, 29 DM_TYPE_MQ_REQUEST_BASED = 3,
30 DM_TYPE_DAX_BIO_BASED = 4, 30 DM_TYPE_DAX_BIO_BASED = 4,
31 DM_TYPE_NVME_BIO_BASED = 5,
31}; 32};
32 33
33typedef enum { STATUSTYPE_INFO, STATUSTYPE_TABLE } status_type_t; 34typedef enum { STATUSTYPE_INFO, STATUSTYPE_TABLE } status_type_t;
@@ -221,14 +222,6 @@ struct target_type {
221#define dm_target_is_wildcard(type) ((type)->features & DM_TARGET_WILDCARD) 222#define dm_target_is_wildcard(type) ((type)->features & DM_TARGET_WILDCARD)
222 223
223/* 224/*
224 * Some targets need to be sent the same WRITE bio severals times so
225 * that they can send copies of it to different devices. This function
226 * examines any supplied bio and returns the number of copies of it the
227 * target requires.
228 */
229typedef unsigned (*dm_num_write_bios_fn) (struct dm_target *ti, struct bio *bio);
230
231/*
232 * A target implements own bio data integrity. 225 * A target implements own bio data integrity.
233 */ 226 */
234#define DM_TARGET_INTEGRITY 0x00000010 227#define DM_TARGET_INTEGRITY 0x00000010
@@ -291,13 +284,6 @@ struct dm_target {
291 */ 284 */
292 unsigned per_io_data_size; 285 unsigned per_io_data_size;
293 286
294 /*
295 * If defined, this function is called to find out how many
296 * duplicate bios should be sent to the target when writing
297 * data.
298 */
299 dm_num_write_bios_fn num_write_bios;
300
301 /* target specific data */ 287 /* target specific data */
302 void *private; 288 void *private;
303 289
@@ -329,35 +315,9 @@ struct dm_target_callbacks {
329 int (*congested_fn) (struct dm_target_callbacks *, int); 315 int (*congested_fn) (struct dm_target_callbacks *, int);
330}; 316};
331 317
332/* 318void *dm_per_bio_data(struct bio *bio, size_t data_size);
333 * For bio-based dm. 319struct bio *dm_bio_from_per_bio_data(void *data, size_t data_size);
334 * One of these is allocated for each bio. 320unsigned dm_bio_get_target_bio_nr(const struct bio *bio);
335 * This structure shouldn't be touched directly by target drivers.
336 * It is here so that we can inline dm_per_bio_data and
337 * dm_bio_from_per_bio_data
338 */
339struct dm_target_io {
340 struct dm_io *io;
341 struct dm_target *ti;
342 unsigned target_bio_nr;
343 unsigned *len_ptr;
344 struct bio clone;
345};
346
347static inline void *dm_per_bio_data(struct bio *bio, size_t data_size)
348{
349 return (char *)bio - offsetof(struct dm_target_io, clone) - data_size;
350}
351
352static inline struct bio *dm_bio_from_per_bio_data(void *data, size_t data_size)
353{
354 return (struct bio *)((char *)data + data_size + offsetof(struct dm_target_io, clone));
355}
356
357static inline unsigned dm_bio_get_target_bio_nr(const struct bio *bio)
358{
359 return container_of(bio, struct dm_target_io, clone)->target_bio_nr;
360}
361 321
362int dm_register_target(struct target_type *t); 322int dm_register_target(struct target_type *t);
363void dm_unregister_target(struct target_type *t); 323void dm_unregister_target(struct target_type *t);
@@ -500,6 +460,11 @@ void dm_table_set_type(struct dm_table *t, enum dm_queue_mode type);
500int dm_table_complete(struct dm_table *t); 460int dm_table_complete(struct dm_table *t);
501 461
502/* 462/*
463 * Destroy the table when finished.
464 */
465void dm_table_destroy(struct dm_table *t);
466
467/*
503 * Target may require that it is never sent I/O larger than len. 468 * Target may require that it is never sent I/O larger than len.
504 */ 469 */
505int __must_check dm_set_target_max_io_len(struct dm_target *ti, sector_t len); 470int __must_check dm_set_target_max_io_len(struct dm_target *ti, sector_t len);
@@ -585,6 +550,7 @@ do { \
585#define DM_ENDIO_DONE 0 550#define DM_ENDIO_DONE 0
586#define DM_ENDIO_INCOMPLETE 1 551#define DM_ENDIO_INCOMPLETE 1
587#define DM_ENDIO_REQUEUE 2 552#define DM_ENDIO_REQUEUE 2
553#define DM_ENDIO_DELAY_REQUEUE 3
588 554
589/* 555/*
590 * Definitions of return values from target map function. 556 * Definitions of return values from target map function.
@@ -592,7 +558,7 @@ do { \
592#define DM_MAPIO_SUBMITTED 0 558#define DM_MAPIO_SUBMITTED 0
593#define DM_MAPIO_REMAPPED 1 559#define DM_MAPIO_REMAPPED 1
594#define DM_MAPIO_REQUEUE DM_ENDIO_REQUEUE 560#define DM_MAPIO_REQUEUE DM_ENDIO_REQUEUE
595#define DM_MAPIO_DELAY_REQUEUE 3 561#define DM_MAPIO_DELAY_REQUEUE DM_ENDIO_DELAY_REQUEUE
596#define DM_MAPIO_KILL 4 562#define DM_MAPIO_KILL 4
597 563
598#define dm_sector_div64(x, y)( \ 564#define dm_sector_div64(x, y)( \