mirror of
				https://git.proxmox.com/git/mirror_zfs.git
				synced 2025-10-26 18:05:04 +03:00 
			
		
		
		
	Linux 5.19 compat: bdev_start_io_acct() / bdev_end_io_acct()
As of the Linux 5.19 kernel the disk_*_io_acct() helper functions have been replaced by the bdev_*_io_acct() functions. Reviewed-by: Tony Hutter <hutter2@llnl.gov> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #13515
This commit is contained in:
		
							parent
							
								
									fec407fb69
								
							
						
					
					
						commit
						ee84970d4f
					
				| @ -2,6 +2,19 @@ dnl # | |||||||
| dnl # Check for generic io accounting interface. | dnl # Check for generic io accounting interface. | ||||||
| dnl # | dnl # | ||||||
| AC_DEFUN([ZFS_AC_KERNEL_SRC_GENERIC_IO_ACCT], [ | AC_DEFUN([ZFS_AC_KERNEL_SRC_GENERIC_IO_ACCT], [ | ||||||
|  | 	ZFS_LINUX_TEST_SRC([bdev_io_acct], [ | ||||||
|  | 		#include <linux/blkdev.h> | ||||||
|  | 	], [ | ||||||
|  | 		struct block_device *bdev = NULL; | ||||||
|  | 		struct bio *bio = NULL; | ||||||
|  | 		unsigned long passed_time = 0; | ||||||
|  | 		unsigned long start_time; | ||||||
|  | 
 | ||||||
|  | 		start_time = bdev_start_io_acct(bdev, bio_sectors(bio), | ||||||
|  | 		    bio_op(bio), passed_time); | ||||||
|  | 		bdev_end_io_acct(bdev, bio_op(bio), start_time); | ||||||
|  | 	]) | ||||||
|  | 
 | ||||||
| 	ZFS_LINUX_TEST_SRC([disk_io_acct], [ | 	ZFS_LINUX_TEST_SRC([disk_io_acct], [ | ||||||
| 		#include <linux/blkdev.h> | 		#include <linux/blkdev.h> | ||||||
| 	], [ | 	], [ | ||||||
| @ -49,6 +62,19 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_GENERIC_IO_ACCT], [ | |||||||
| ]) | ]) | ||||||
| 
 | 
 | ||||||
| AC_DEFUN([ZFS_AC_KERNEL_GENERIC_IO_ACCT], [ | AC_DEFUN([ZFS_AC_KERNEL_GENERIC_IO_ACCT], [ | ||||||
|  | 	dnl # | ||||||
|  | 	dnl # 5.19 API, | ||||||
|  | 	dnl # | ||||||
|  | 	dnl # disk_start_io_acct() and disk_end_io_acct() have been replaced by | ||||||
|  | 	dnl # bdev_start_io_acct() and bdev_end_io_acct(). | ||||||
|  | 	dnl # | ||||||
|  | 	AC_MSG_CHECKING([whether generic bdev_*_io_acct() are available]) | ||||||
|  | 	ZFS_LINUX_TEST_RESULT([bdev_io_acct], [ | ||||||
|  | 		AC_MSG_RESULT(yes) | ||||||
|  | 		AC_DEFINE(HAVE_BDEV_IO_ACCT, 1, [bdev_*_io_acct() available]) | ||||||
|  | 	], [ | ||||||
|  | 		AC_MSG_RESULT(no) | ||||||
|  | 
 | ||||||
| 		dnl # | 		dnl # | ||||||
| 		dnl # 5.12 API, | 		dnl # 5.12 API, | ||||||
| 		dnl # | 		dnl # | ||||||
| @ -109,4 +135,5 @@ AC_DEFUN([ZFS_AC_KERNEL_GENERIC_IO_ACCT], [ | |||||||
| 				]) | 				]) | ||||||
| 			]) | 			]) | ||||||
| 		]) | 		]) | ||||||
|  | 	]) | ||||||
| ]) | ]) | ||||||
|  | |||||||
| @ -551,7 +551,10 @@ blk_generic_start_io_acct(struct request_queue *q __attribute__((unused)), | |||||||
|     struct gendisk *disk __attribute__((unused)), |     struct gendisk *disk __attribute__((unused)), | ||||||
|     int rw __attribute__((unused)), struct bio *bio) |     int rw __attribute__((unused)), struct bio *bio) | ||||||
| { | { | ||||||
| #if defined(HAVE_DISK_IO_ACCT) | #if defined(HAVE_BDEV_IO_ACCT) | ||||||
|  | 	return (bdev_start_io_acct(bio->bi_bdev, bio_sectors(bio), | ||||||
|  | 	    bio_op(bio), jiffies)); | ||||||
|  | #elif defined(HAVE_DISK_IO_ACCT) | ||||||
| 	return (disk_start_io_acct(disk, bio_sectors(bio), bio_op(bio))); | 	return (disk_start_io_acct(disk, bio_sectors(bio), bio_op(bio))); | ||||||
| #elif defined(HAVE_BIO_IO_ACCT) | #elif defined(HAVE_BIO_IO_ACCT) | ||||||
| 	return (bio_start_io_acct(bio)); | 	return (bio_start_io_acct(bio)); | ||||||
| @ -574,7 +577,9 @@ blk_generic_end_io_acct(struct request_queue *q __attribute__((unused)), | |||||||
|     struct gendisk *disk __attribute__((unused)), |     struct gendisk *disk __attribute__((unused)), | ||||||
|     int rw __attribute__((unused)), struct bio *bio, unsigned long start_time) |     int rw __attribute__((unused)), struct bio *bio, unsigned long start_time) | ||||||
| { | { | ||||||
| #if defined(HAVE_DISK_IO_ACCT) | #if defined(HAVE_BDEV_IO_ACCT) | ||||||
|  | 	bdev_end_io_acct(bio->bi_bdev, bio_op(bio), start_time); | ||||||
|  | #elif defined(HAVE_DISK_IO_ACCT) | ||||||
| 	disk_end_io_acct(disk, bio_op(bio), start_time); | 	disk_end_io_acct(disk, bio_op(bio), start_time); | ||||||
| #elif defined(HAVE_BIO_IO_ACCT) | #elif defined(HAVE_BIO_IO_ACCT) | ||||||
| 	bio_end_io_acct(bio, start_time); | 	bio_end_io_acct(bio, start_time); | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Brian Behlendorf
						Brian Behlendorf