2 dnl # Check for generic io accounting interface.
4 AC_DEFUN([ZFS_AC_KERNEL_SRC_GENERIC_IO_ACCT], [
5 ZFS_LINUX_TEST_SRC([bdev_io_acct], [
6 #include <linux/blkdev.h>
8 struct block_device *bdev = NULL;
9 struct bio *bio = NULL;
10 unsigned long passed_time = 0;
11 unsigned long start_time;
13 start_time = bdev_start_io_acct(bdev, bio_sectors(bio),
14 bio_op(bio), passed_time);
15 bdev_end_io_acct(bdev, bio_op(bio), start_time);
18 ZFS_LINUX_TEST_SRC([disk_io_acct], [
19 #include <linux/blkdev.h>
21 struct gendisk *disk = NULL;
22 struct bio *bio = NULL;
23 unsigned long start_time;
25 start_time = disk_start_io_acct(disk, bio_sectors(bio), bio_op(bio));
26 disk_end_io_acct(disk, bio_op(bio), start_time);
29 ZFS_LINUX_TEST_SRC([bio_io_acct], [
30 #include <linux/blkdev.h>
32 struct bio *bio = NULL;
33 unsigned long start_time;
35 start_time = bio_start_io_acct(bio);
36 bio_end_io_acct(bio, start_time);
39 ZFS_LINUX_TEST_SRC([generic_acct_3args], [
40 #include <linux/bio.h>
42 void (*generic_start_io_acct_f)(int, unsigned long,
43 struct hd_struct *) = &generic_start_io_acct;
44 void (*generic_end_io_acct_f)(int, struct hd_struct *,
45 unsigned long) = &generic_end_io_acct;
47 generic_start_io_acct(0, 0, NULL);
48 generic_end_io_acct(0, NULL, 0);
51 ZFS_LINUX_TEST_SRC([generic_acct_4args], [
52 #include <linux/bio.h>
54 void (*generic_start_io_acct_f)(struct request_queue *, int,
55 unsigned long, struct hd_struct *) = &generic_start_io_acct;
56 void (*generic_end_io_acct_f)(struct request_queue *, int,
57 struct hd_struct *, unsigned long) = &generic_end_io_acct;
59 generic_start_io_acct(NULL, 0, 0, NULL);
60 generic_end_io_acct(NULL, 0, NULL, 0);
64 AC_DEFUN([ZFS_AC_KERNEL_GENERIC_IO_ACCT], [
68 dnl # disk_start_io_acct() and disk_end_io_acct() have been replaced by
69 dnl # bdev_start_io_acct() and bdev_end_io_acct().
71 AC_MSG_CHECKING([whether generic bdev_*_io_acct() are available])
72 ZFS_LINUX_TEST_RESULT([bdev_io_acct], [
74 AC_DEFINE(HAVE_BDEV_IO_ACCT, 1, [bdev_*_io_acct() available])
81 dnl # bio_start_io_acct() and bio_end_io_acct() became GPL-exported
82 dnl # so use disk_start_io_acct() and disk_end_io_acct() instead
84 AC_MSG_CHECKING([whether generic disk_*_io_acct() are available])
85 ZFS_LINUX_TEST_RESULT([disk_io_acct], [
87 AC_DEFINE(HAVE_DISK_IO_ACCT, 1, [disk_*_io_acct() available])
94 dnl # Added bio_start_io_acct() and bio_end_io_acct() helpers.
96 AC_MSG_CHECKING([whether generic bio_*_io_acct() are available])
97 ZFS_LINUX_TEST_RESULT([bio_io_acct], [
99 AC_DEFINE(HAVE_BIO_IO_ACCT, 1, [bio_*_io_acct() available])
106 dnl # generic_start_io_acct/generic_end_io_acct now require
107 dnl # request_queue to be provided. No functional changes,
108 dnl # but preparation for inflight accounting.
110 AC_MSG_CHECKING([whether generic_*_io_acct wants 4 args])
111 ZFS_LINUX_TEST_RESULT_SYMBOL([generic_acct_4args],
112 [generic_start_io_acct], [block/bio.c], [
114 AC_DEFINE(HAVE_GENERIC_IO_ACCT_4ARG, 1,
115 [generic_*_io_acct() 4 arg available])
120 dnl # 3.19 API addition
122 dnl # torvalds/linux@394ffa50 allows us to increment
123 dnl # iostat counters without generic_make_request().
126 [whether generic_*_io_acct wants 3 args])
127 ZFS_LINUX_TEST_RESULT_SYMBOL([generic_acct_3args],
128 [generic_start_io_acct], [block/bio.c], [
130 AC_DEFINE(HAVE_GENERIC_IO_ACCT_3ARG, 1,
131 [generic_*_io_acct() 3 arg available])