]>
Commit | Line | Data |
---|---|---|
8198d18c | 1 | dnl # |
608f8749 | 2 | dnl # Check for generic io accounting interface. |
8198d18c | 3 | dnl # |
608f8749 | 4 | AC_DEFUN([ZFS_AC_KERNEL_SRC_GENERIC_IO_ACCT], [ |
ae0b1f66 RE |
5 | ZFS_LINUX_TEST_SRC([bdev_io_acct_63], [ |
6 | #include <linux/blkdev.h> | |
7 | ], [ | |
8 | struct block_device *bdev = NULL; | |
9 | struct bio *bio = NULL; | |
10 | unsigned long passed_time = 0; | |
11 | unsigned long start_time; | |
12 | ||
13 | start_time = bdev_start_io_acct(bdev, bio_op(bio), | |
14 | passed_time); | |
15 | bdev_end_io_acct(bdev, bio_op(bio), bio_sectors(bio), start_time); | |
16 | ]) | |
17 | ||
18 | ZFS_LINUX_TEST_SRC([bdev_io_acct_old], [ | |
d41e8641 BB |
19 | #include <linux/blkdev.h> |
20 | ], [ | |
21 | struct block_device *bdev = NULL; | |
22 | struct bio *bio = NULL; | |
23 | unsigned long passed_time = 0; | |
24 | unsigned long start_time; | |
25 | ||
26 | start_time = bdev_start_io_acct(bdev, bio_sectors(bio), | |
27 | bio_op(bio), passed_time); | |
28 | bdev_end_io_acct(bdev, bio_op(bio), start_time); | |
29 | ]) | |
30 | ||
778fa36e CK |
31 | ZFS_LINUX_TEST_SRC([disk_io_acct], [ |
32 | #include <linux/blkdev.h> | |
33 | ], [ | |
34 | struct gendisk *disk = NULL; | |
35 | struct bio *bio = NULL; | |
36 | unsigned long start_time; | |
37 | ||
38 | start_time = disk_start_io_acct(disk, bio_sectors(bio), bio_op(bio)); | |
39 | disk_end_io_acct(disk, bio_op(bio), start_time); | |
40 | ]) | |
41 | ||
a970f059 BB |
42 | ZFS_LINUX_TEST_SRC([bio_io_acct], [ |
43 | #include <linux/blkdev.h> | |
44 | ], [ | |
45 | struct bio *bio = NULL; | |
46 | unsigned long start_time; | |
47 | ||
48 | start_time = bio_start_io_acct(bio); | |
49 | bio_end_io_acct(bio, start_time); | |
50 | ]) | |
51 | ||
608f8749 | 52 | ZFS_LINUX_TEST_SRC([generic_acct_3args], [ |
8198d18c RY |
53 | #include <linux/bio.h> |
54 | ||
55 | void (*generic_start_io_acct_f)(int, unsigned long, | |
56 | struct hd_struct *) = &generic_start_io_acct; | |
57 | void (*generic_end_io_acct_f)(int, struct hd_struct *, | |
58 | unsigned long) = &generic_end_io_acct; | |
59 | ], [ | |
60 | generic_start_io_acct(0, 0, NULL); | |
61 | generic_end_io_acct(0, NULL, 0); | |
787acae0 | 62 | ]) |
787acae0 | 63 | |
608f8749 | 64 | ZFS_LINUX_TEST_SRC([generic_acct_4args], [ |
787acae0 GDN |
65 | #include <linux/bio.h> |
66 | ||
67 | void (*generic_start_io_acct_f)(struct request_queue *, int, | |
68 | unsigned long, struct hd_struct *) = &generic_start_io_acct; | |
69 | void (*generic_end_io_acct_f)(struct request_queue *, int, | |
70 | struct hd_struct *, unsigned long) = &generic_end_io_acct; | |
71 | ], [ | |
72 | generic_start_io_acct(NULL, 0, 0, NULL); | |
73 | generic_end_io_acct(NULL, 0, NULL, 0); | |
608f8749 BB |
74 | ]) |
75 | ]) | |
76 | ||
77 | AC_DEFUN([ZFS_AC_KERNEL_GENERIC_IO_ACCT], [ | |
78 | dnl # | |
ae0b1f66 RE |
79 | dnl # Linux 6.3, and then backports thereof, changed |
80 | dnl # the signatures on bdev_start_io_acct/bdev_end_io_acct | |
608f8749 | 81 | dnl # |
ae0b1f66 RE |
82 | AC_MSG_CHECKING([whether 6.3+ bdev_*_io_acct() are available]) |
83 | ZFS_LINUX_TEST_RESULT([bdev_io_acct_63], [ | |
787acae0 | 84 | AC_MSG_RESULT(yes) |
ae0b1f66 | 85 | AC_DEFINE(HAVE_BDEV_IO_ACCT_63, 1, [bdev_*_io_acct() available]) |
8198d18c RY |
86 | ], [ |
87 | AC_MSG_RESULT(no) | |
608f8749 BB |
88 | |
89 | dnl # | |
ae0b1f66 | 90 | dnl # 5.19 API, |
608f8749 | 91 | dnl # |
ae0b1f66 RE |
92 | dnl # disk_start_io_acct() and disk_end_io_acct() have been replaced by |
93 | dnl # bdev_start_io_acct() and bdev_end_io_acct(). | |
608f8749 | 94 | dnl # |
ae0b1f66 RE |
95 | AC_MSG_CHECKING([whether pre-6.3 bdev_*_io_acct() are available]) |
96 | ZFS_LINUX_TEST_RESULT([bdev_io_acct_old], [ | |
608f8749 | 97 | AC_MSG_RESULT(yes) |
ae0b1f66 | 98 | AC_DEFINE(HAVE_BDEV_IO_ACCT_OLD, 1, [bdev_*_io_acct() available]) |
608f8749 BB |
99 | ], [ |
100 | AC_MSG_RESULT(no) | |
a970f059 | 101 | dnl # |
ae0b1f66 | 102 | dnl # 5.12 API, |
a970f059 | 103 | dnl # |
ae0b1f66 RE |
104 | dnl # bio_start_io_acct() and bio_end_io_acct() became GPL-exported |
105 | dnl # so use disk_start_io_acct() and disk_end_io_acct() instead | |
a970f059 | 106 | dnl # |
ae0b1f66 RE |
107 | AC_MSG_CHECKING([whether generic disk_*_io_acct() are available]) |
108 | ZFS_LINUX_TEST_RESULT([disk_io_acct], [ | |
a970f059 | 109 | AC_MSG_RESULT(yes) |
ae0b1f66 | 110 | AC_DEFINE(HAVE_DISK_IO_ACCT, 1, [disk_*_io_acct() available]) |
a970f059 BB |
111 | ], [ |
112 | AC_MSG_RESULT(no) | |
778fa36e CK |
113 | |
114 | dnl # | |
ae0b1f66 | 115 | dnl # 5.7 API, |
778fa36e | 116 | dnl # |
ae0b1f66 | 117 | dnl # Added bio_start_io_acct() and bio_end_io_acct() helpers. |
778fa36e | 118 | dnl # |
ae0b1f66 RE |
119 | AC_MSG_CHECKING([whether generic bio_*_io_acct() are available]) |
120 | ZFS_LINUX_TEST_RESULT([bio_io_acct], [ | |
778fa36e | 121 | AC_MSG_RESULT(yes) |
ae0b1f66 | 122 | AC_DEFINE(HAVE_BIO_IO_ACCT, 1, [bio_*_io_acct() available]) |
778fa36e CK |
123 | ], [ |
124 | AC_MSG_RESULT(no) | |
d41e8641 BB |
125 | |
126 | dnl # | |
ae0b1f66 | 127 | dnl # 4.14 API, |
d41e8641 | 128 | dnl # |
ae0b1f66 RE |
129 | dnl # generic_start_io_acct/generic_end_io_acct now require |
130 | dnl # request_queue to be provided. No functional changes, | |
131 | dnl # but preparation for inflight accounting. | |
d41e8641 | 132 | dnl # |
ae0b1f66 RE |
133 | AC_MSG_CHECKING([whether generic_*_io_acct wants 4 args]) |
134 | ZFS_LINUX_TEST_RESULT_SYMBOL([generic_acct_4args], | |
d41e8641 BB |
135 | [generic_start_io_acct], [block/bio.c], [ |
136 | AC_MSG_RESULT(yes) | |
ae0b1f66 RE |
137 | AC_DEFINE(HAVE_GENERIC_IO_ACCT_4ARG, 1, |
138 | [generic_*_io_acct() 4 arg available]) | |
d41e8641 BB |
139 | ], [ |
140 | AC_MSG_RESULT(no) | |
ae0b1f66 RE |
141 | |
142 | dnl # | |
143 | dnl # 3.19 API addition | |
144 | dnl # | |
145 | dnl # torvalds/linux@394ffa50 allows us to increment | |
146 | dnl # iostat counters without generic_make_request(). | |
147 | dnl # | |
148 | AC_MSG_CHECKING( | |
149 | [whether generic_*_io_acct wants 3 args]) | |
150 | ZFS_LINUX_TEST_RESULT_SYMBOL([generic_acct_3args], | |
151 | [generic_start_io_acct], [block/bio.c], [ | |
152 | AC_MSG_RESULT(yes) | |
153 | AC_DEFINE(HAVE_GENERIC_IO_ACCT_3ARG, 1, | |
154 | [generic_*_io_acct() 3 arg available]) | |
155 | ], [ | |
156 | AC_MSG_RESULT(no) | |
157 | ]) | |
d41e8641 | 158 | ]) |
778fa36e | 159 | ]) |
a970f059 | 160 | ]) |
608f8749 | 161 | ]) |
8198d18c RY |
162 | ]) |
163 | ]) |