1dnl # 2dnl # Check for generic io accounting interface. 3dnl # 4AC_DEFUN([ZFS_AC_KERNEL_SRC_GENERIC_IO_ACCT], [ 5 ZFS_LINUX_TEST_SRC([bdev_io_acct], [ 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_sectors(bio), 14 bio_op(bio), passed_time); 15 bdev_end_io_acct(bdev, bio_op(bio), start_time); 16 ]) 17 18 ZFS_LINUX_TEST_SRC([disk_io_acct], [ 19 #include <linux/blkdev.h> 20 ], [ 21 struct gendisk *disk = NULL; 22 struct bio *bio = NULL; 23 unsigned long start_time; 24 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); 27 ]) 28 29 ZFS_LINUX_TEST_SRC([bio_io_acct], [ 30 #include <linux/blkdev.h> 31 ], [ 32 struct bio *bio = NULL; 33 unsigned long start_time; 34 35 start_time = bio_start_io_acct(bio); 36 bio_end_io_acct(bio, start_time); 37 ]) 38 39 ZFS_LINUX_TEST_SRC([generic_acct_3args], [ 40 #include <linux/bio.h> 41 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; 46 ], [ 47 generic_start_io_acct(0, 0, NULL); 48 generic_end_io_acct(0, NULL, 0); 49 ]) 50 51 ZFS_LINUX_TEST_SRC([generic_acct_4args], [ 52 #include <linux/bio.h> 53 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; 58 ], [ 59 generic_start_io_acct(NULL, 0, 0, NULL); 60 generic_end_io_acct(NULL, 0, NULL, 0); 61 ]) 62]) 63 64AC_DEFUN([ZFS_AC_KERNEL_GENERIC_IO_ACCT], [ 65 dnl # 66 dnl # 5.19 API, 67 dnl # 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(). 70 dnl # 71 AC_MSG_CHECKING([whether generic bdev_*_io_acct() are available]) 72 ZFS_LINUX_TEST_RESULT([bdev_io_acct], [ 73 AC_MSG_RESULT(yes) 74 AC_DEFINE(HAVE_BDEV_IO_ACCT, 1, [bdev_*_io_acct() available]) 75 ], [ 76 AC_MSG_RESULT(no) 77 78 dnl # 79 dnl # 5.12 API, 80 dnl # 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 83 dnl # 84 AC_MSG_CHECKING([whether generic disk_*_io_acct() are available]) 85 ZFS_LINUX_TEST_RESULT([disk_io_acct], [ 86 AC_MSG_RESULT(yes) 87 AC_DEFINE(HAVE_DISK_IO_ACCT, 1, [disk_*_io_acct() available]) 88 ], [ 89 AC_MSG_RESULT(no) 90 91 dnl # 92 dnl # 5.7 API, 93 dnl # 94 dnl # Added bio_start_io_acct() and bio_end_io_acct() helpers. 95 dnl # 96 AC_MSG_CHECKING([whether generic bio_*_io_acct() are available]) 97 ZFS_LINUX_TEST_RESULT([bio_io_acct], [ 98 AC_MSG_RESULT(yes) 99 AC_DEFINE(HAVE_BIO_IO_ACCT, 1, [bio_*_io_acct() available]) 100 ], [ 101 AC_MSG_RESULT(no) 102 103 dnl # 104 dnl # 4.14 API, 105 dnl # 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. 109 dnl # 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], [ 113 AC_MSG_RESULT(yes) 114 AC_DEFINE(HAVE_GENERIC_IO_ACCT_4ARG, 1, 115 [generic_*_io_acct() 4 arg available]) 116 ], [ 117 AC_MSG_RESULT(no) 118 119 dnl # 120 dnl # 3.19 API addition 121 dnl # 122 dnl # torvalds/linux@394ffa50 allows us to increment 123 dnl # iostat counters without generic_make_request(). 124 dnl # 125 AC_MSG_CHECKING( 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], [ 129 AC_MSG_RESULT(yes) 130 AC_DEFINE(HAVE_GENERIC_IO_ACCT_3ARG, 1, 131 [generic_*_io_acct() 3 arg available]) 132 ], [ 133 AC_MSG_RESULT(no) 134 ]) 135 ]) 136 ]) 137 ]) 138 ]) 139]) 140