Mike Snitzer | 4cc9613 | 2016-05-12 16:28:10 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Internal header file for device mapper |
| 3 | * |
| 4 | * Copyright (C) 2016 Red Hat, Inc. All rights reserved. |
| 5 | * |
| 6 | * This file is released under the LGPL. |
| 7 | */ |
| 8 | |
| 9 | #ifndef DM_RQ_INTERNAL_H |
| 10 | #define DM_RQ_INTERNAL_H |
| 11 | |
| 12 | #include <linux/bio.h> |
| 13 | #include <linux/kthread.h> |
| 14 | |
| 15 | #include "dm-stats.h" |
| 16 | |
| 17 | struct mapped_device; |
| 18 | |
| 19 | /* |
| 20 | * One of these is allocated per request. |
| 21 | */ |
| 22 | struct dm_rq_target_io { |
| 23 | struct mapped_device *md; |
| 24 | struct dm_target *ti; |
| 25 | struct request *orig, *clone; |
| 26 | struct kthread_work work; |
Christoph Hellwig | 2a842ac | 2017-06-03 09:38:04 +0200 | [diff] [blame] | 27 | blk_status_t error; |
Mike Snitzer | 4cc9613 | 2016-05-12 16:28:10 -0400 | [diff] [blame] | 28 | union map_info info; |
| 29 | struct dm_stats_aux stats_aux; |
| 30 | unsigned long duration_jiffies; |
| 31 | unsigned n_sectors; |
Ming Lei | dc6364b | 2017-08-24 20:19:52 +0800 | [diff] [blame] | 32 | unsigned completed; |
Mike Snitzer | 4cc9613 | 2016-05-12 16:28:10 -0400 | [diff] [blame] | 33 | }; |
| 34 | |
| 35 | /* |
| 36 | * For request-based dm - the bio clones we allocate are embedded in these |
| 37 | * structs. |
| 38 | * |
| 39 | * We allocate these with bio_alloc_bioset, using the front_pad parameter when |
| 40 | * the bioset is created - this means the bio has to come at the end of the |
| 41 | * struct. |
| 42 | */ |
| 43 | struct dm_rq_clone_bio_info { |
| 44 | struct bio *orig; |
| 45 | struct dm_rq_target_io *tio; |
| 46 | struct bio clone; |
| 47 | }; |
| 48 | |
| 49 | bool dm_use_blk_mq_default(void); |
| 50 | bool dm_use_blk_mq(struct mapped_device *md); |
| 51 | |
Christoph Hellwig | eb8db83 | 2017-01-22 18:32:46 +0100 | [diff] [blame] | 52 | int dm_old_init_request_queue(struct mapped_device *md, struct dm_table *t); |
Mike Snitzer | e83068a | 2016-05-24 21:16:51 -0400 | [diff] [blame] | 53 | int dm_mq_init_request_queue(struct mapped_device *md, struct dm_table *t); |
Mike Snitzer | 4cc9613 | 2016-05-12 16:28:10 -0400 | [diff] [blame] | 54 | void dm_mq_cleanup_mapped_device(struct mapped_device *md); |
| 55 | |
| 56 | void dm_start_queue(struct request_queue *q); |
| 57 | void dm_stop_queue(struct request_queue *q); |
| 58 | |
Mike Snitzer | e0c1075 | 2016-09-14 10:36:39 -0400 | [diff] [blame] | 59 | void dm_mq_kick_requeue_list(struct mapped_device *md); |
| 60 | |
Mike Snitzer | 4cc9613 | 2016-05-12 16:28:10 -0400 | [diff] [blame] | 61 | unsigned dm_get_reserved_rq_based_ios(void); |
| 62 | |
| 63 | ssize_t dm_attr_rq_based_seq_io_merge_deadline_show(struct mapped_device *md, char *buf); |
| 64 | ssize_t dm_attr_rq_based_seq_io_merge_deadline_store(struct mapped_device *md, |
| 65 | const char *buf, size_t count); |
| 66 | |
| 67 | #endif |