1dnl # 2dnl # Check for generic io accounting interface. 3dnl # 4AC_DEFUN([ZFS_AC_KERNEL_SRC_GENERIC_IO_ACCT], [ 5 ZFS_LINUX_TEST_SRC([disk_io_acct], [ 6 #include <linux/blkdev.h> 7 ], [ 8 struct gendisk *disk = NULL; 9 struct bio *bio = NULL; 10 unsigned long start_time; 11 12 start_time = disk_start_io_acct(disk, bio_sectors(bio), bio_op(bio)); 13 disk_end_io_acct(disk, bio_op(bio), start_time); 14 ]) 15 16 ZFS_LINUX_TEST_SRC([bio_io_acct], [ 17 #include <linux/blkdev.h> 18 ], [ 19 struct bio *bio = NULL; 20 unsigned long start_time; 21 22 start_time = bio_start_io_acct(bio); 23 bio_end_io_acct(bio, start_time); 24 ]) 25 26 ZFS_LINUX_TEST_SRC([generic_acct_3args], [ 27 #include <linux/bio.h> 28 29 void (*generic_start_io_acct_f)(int, unsigned long, 30 struct hd_struct *) = &generic_start_io_acct; 31 void (*generic_end_io_acct_f)(int, struct hd_struct *, 32 unsigned long) = &generic_end_io_acct; 33 ], [ 34 generic_start_io_acct(0, 0, NULL); 35 generic_end_io_acct(0, NULL, 0); 36 ]) 37 38 ZFS_LINUX_TEST_SRC([generic_acct_4args], [ 39 #include <linux/bio.h> 40 41 void (*generic_start_io_acct_f)(struct request_queue *, int, 42 unsigned long, struct hd_struct *) = &generic_start_io_acct; 43 void (*generic_end_io_acct_f)(struct request_queue *, int, 44 struct hd_struct *, unsigned long) = &generic_end_io_acct; 45 ], [ 46 generic_start_io_acct(NULL, 0, 0, NULL); 47 generic_end_io_acct(NULL, 0, NULL, 0); 48 ]) 49]) 50 51AC_DEFUN([ZFS_AC_KERNEL_GENERIC_IO_ACCT], [ 52 dnl # 53 dnl # 5.12 API, 54 dnl # 55 dnl # bio_start_io_acct() and bio_end_io_acct() became GPL-exported 56 dnl # so use disk_start_io_acct() and disk_end_io_acct() instead 57 dnl # 58 AC_MSG_CHECKING([whether generic disk_*_io_acct() are available]) 59 ZFS_LINUX_TEST_RESULT([disk_io_acct], [ 60 AC_MSG_RESULT(yes) 61 AC_DEFINE(HAVE_DISK_IO_ACCT, 1, [disk_*_io_acct() available]) 62 ], [ 63 AC_MSG_RESULT(no) 64 65 dnl # 66 dnl # 5.7 API, 67 dnl # 68 dnl # Added bio_start_io_acct() and bio_end_io_acct() helpers. 69 dnl # 70 AC_MSG_CHECKING([whether generic bio_*_io_acct() are available]) 71 ZFS_LINUX_TEST_RESULT([bio_io_acct], [ 72 AC_MSG_RESULT(yes) 73 AC_DEFINE(HAVE_BIO_IO_ACCT, 1, [bio_*_io_acct() available]) 74 ], [ 75 AC_MSG_RESULT(no) 76 77 dnl # 78 dnl # 4.14 API, 79 dnl # 80 dnl # generic_start_io_acct/generic_end_io_acct now require 81 dnl # request_queue to be provided. No functional changes, 82 dnl # but preparation for inflight accounting. 83 dnl # 84 AC_MSG_CHECKING([whether generic_*_io_acct wants 4 args]) 85 ZFS_LINUX_TEST_RESULT_SYMBOL([generic_acct_4args], 86 [generic_start_io_acct], [block/bio.c], [ 87 AC_MSG_RESULT(yes) 88 AC_DEFINE(HAVE_GENERIC_IO_ACCT_4ARG, 1, 89 [generic_*_io_acct() 4 arg available]) 90 ], [ 91 AC_MSG_RESULT(no) 92 93 dnl # 94 dnl # 3.19 API addition 95 dnl # 96 dnl # torvalds/linux@394ffa50 allows us to increment 97 dnl # iostat counters without generic_make_request(). 98 dnl # 99 AC_MSG_CHECKING( 100 [whether generic_*_io_acct wants 3 args]) 101 ZFS_LINUX_TEST_RESULT_SYMBOL([generic_acct_3args], 102 [generic_start_io_acct], [block/bio.c], [ 103 AC_MSG_RESULT(yes) 104 AC_DEFINE(HAVE_GENERIC_IO_ACCT_3ARG, 1, 105 [generic_*_io_acct() 3 arg available]) 106 ], [ 107 AC_MSG_RESULT(no) 108 ]) 109 ]) 110 ]) 111 ]) 112]) 113