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