Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux 5.11 compat #11390

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions config/kernel-acl.m4
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_POSIX_ACL_RELEASE], [
], [
struct posix_acl *tmp = posix_acl_alloc(1, 0);
posix_acl_release(tmp);
], [], [$ZFS_META_LICENSE])
], [], [ZFS_META_LICENSE])
])

AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_RELEASE], [
Expand Down Expand Up @@ -50,7 +50,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_SET_CACHED_ACL_USABLE], [
struct posix_acl *acl = posix_acl_alloc(1, 0);
set_cached_acl(ip, ACL_TYPE_ACCESS, acl);
forget_cached_acl(ip, ACL_TYPE_ACCESS);
], [], [$ZFS_META_LICENSE])
], [], [ZFS_META_LICENSE])
])

AC_DEFUN([ZFS_AC_KERNEL_SET_CACHED_ACL_USABLE], [
Expand Down
4 changes: 2 additions & 2 deletions config/kernel-bio.m4
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_SET_DEV], [
struct block_device *bdev = NULL;
struct bio *bio = NULL;
bio_set_dev(bio, bdev);
], [], [$ZFS_META_LICENSE])
], [], [ZFS_META_LICENSE])
])

AC_DEFUN([ZFS_AC_KERNEL_BIO_SET_DEV], [
Expand Down Expand Up @@ -347,7 +347,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKG_TRYGET], [
struct blkcg_gq blkg __attribute__ ((unused)) = {};
bool rc __attribute__ ((unused));
rc = blkg_tryget(&blkg);
], [], [$ZFS_META_LICENSE])
], [], [ZFS_META_LICENSE])
])

AC_DEFUN([ZFS_AC_KERNEL_BLKG_TRYGET], [
Expand Down
4 changes: 2 additions & 2 deletions config/kernel-blk-queue.m4
Original file line number Diff line number Diff line change
Expand Up @@ -179,15 +179,15 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLUSH], [
], [
struct request_queue *q = NULL;
(void) blk_queue_flush(q, REQ_FLUSH);
], [$NO_UNUSED_BUT_SET_VARIABLE], [$ZFS_META_LICENSE])
], [$NO_UNUSED_BUT_SET_VARIABLE], [ZFS_META_LICENSE])

ZFS_LINUX_TEST_SRC([blk_queue_write_cache], [
#include <linux/kernel.h>
#include <linux/blkdev.h>
], [
struct request_queue *q = NULL;
blk_queue_write_cache(q, true, true);
], [$NO_UNUSED_BUT_SET_VARIABLE], [$ZFS_META_LICENSE])
], [$NO_UNUSED_BUT_SET_VARIABLE], [ZFS_META_LICENSE])
])

AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_FLUSH], [
Expand Down
80 changes: 66 additions & 14 deletions config/kernel-blkdev.m4
Original file line number Diff line number Diff line change
Expand Up @@ -154,42 +154,69 @@ AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_INVALIDATE_BDEV], [
])

dnl #
dnl # 2.6.27, lookup_bdev() was exported.
dnl # 4.4.0-6.21 - lookup_bdev() takes 2 arguments.
dnl # 5.11 API, lookup_bdev() takes dev_t argument.
dnl # 2.6.27 API, lookup_bdev() was first exported.
dnl # 4.4.0-6.21 API, lookup_bdev() on Ubuntu takes mode argument.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_LOOKUP_BDEV], [
ZFS_LINUX_TEST_SRC([lookup_bdev_devt], [
#include <linux/blkdev.h>
], [
int error __attribute__ ((unused));
const char path[] = "/example/path";
dev_t dev;

error = lookup_bdev(path, &dev);
])

ZFS_LINUX_TEST_SRC([lookup_bdev_1arg], [
#include <linux/fs.h>
#include <linux/blkdev.h>
], [
lookup_bdev(NULL);
struct block_device *bdev __attribute__ ((unused));
const char path[] = "/example/path";

bdev = lookup_bdev(path);
])

ZFS_LINUX_TEST_SRC([lookup_bdev_2args], [
ZFS_LINUX_TEST_SRC([lookup_bdev_mode], [
#include <linux/fs.h>
], [
lookup_bdev(NULL, FMODE_READ);
struct block_device *bdev __attribute__ ((unused));
const char path[] = "/example/path";

bdev = lookup_bdev(path, FMODE_READ);
])
])

AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_LOOKUP_BDEV], [
AC_MSG_CHECKING([whether lookup_bdev() wants 1 arg])
ZFS_LINUX_TEST_RESULT_SYMBOL([lookup_bdev_1arg],
AC_MSG_CHECKING([whether lookup_bdev() wants dev_t arg])
ZFS_LINUX_TEST_RESULT_SYMBOL([lookup_bdev_devt],
[lookup_bdev], [fs/block_dev.c], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_1ARG_LOOKUP_BDEV, 1,
[lookup_bdev() wants 1 arg])
AC_DEFINE(HAVE_DEVT_LOOKUP_BDEV, 1,
[lookup_bdev() wants dev_t arg])
], [
AC_MSG_RESULT(no)

AC_MSG_CHECKING([whether lookup_bdev() wants 2 args])
ZFS_LINUX_TEST_RESULT_SYMBOL([lookup_bdev_2args],
AC_MSG_CHECKING([whether lookup_bdev() wants 1 arg])
ZFS_LINUX_TEST_RESULT_SYMBOL([lookup_bdev_1arg],
[lookup_bdev], [fs/block_dev.c], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_2ARGS_LOOKUP_BDEV, 1,
[lookup_bdev() wants 2 args])
AC_DEFINE(HAVE_1ARG_LOOKUP_BDEV, 1,
[lookup_bdev() wants 1 arg])
], [
ZFS_LINUX_TEST_ERROR([lookup_bdev()])
AC_MSG_RESULT(no)

AC_MSG_CHECKING([whether lookup_bdev() wants mode arg])
ZFS_LINUX_TEST_RESULT_SYMBOL([lookup_bdev_mode],
[lookup_bdev], [fs/block_dev.c], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_MODE_LOOKUP_BDEV, 1,
[lookup_bdev() wants mode arg])
], [
ZFS_LINUX_TEST_ERROR([lookup_bdev()])
])
])
])
])
Expand Down Expand Up @@ -244,6 +271,29 @@ AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_BDEV_LOGICAL_BLOCK_SIZE], [
])
])

dnl #
dnl # 5.11 API change
dnl # Added bdev_whole() helper.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_WHOLE], [
ZFS_LINUX_TEST_SRC([bdev_whole], [
#include <linux/blkdev.h>
],[
struct block_device *bdev = NULL;
bdev = bdev_whole(bdev);
])
])

AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_BDEV_WHOLE], [
AC_MSG_CHECKING([whether bdev_whole() is available])
ZFS_LINUX_TEST_RESULT([bdev_whole], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_BDEV_WHOLE, 1, [bdev_whole() is available])
],[
AC_MSG_RESULT(no)
])
])

AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV], [
ZFS_AC_KERNEL_SRC_BLKDEV_GET_BY_PATH
ZFS_AC_KERNEL_SRC_BLKDEV_PUT
Expand All @@ -254,6 +304,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV], [
ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_PHYSICAL_BLOCK_SIZE
ZFS_AC_KERNEL_SRC_BLKDEV_CHECK_DISK_CHANGE
ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_CHECK_MEDIA_CHANGE
ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_WHOLE
])

AC_DEFUN([ZFS_AC_KERNEL_BLKDEV], [
Expand All @@ -266,4 +317,5 @@ AC_DEFUN([ZFS_AC_KERNEL_BLKDEV], [
ZFS_AC_KERNEL_BLKDEV_BDEV_PHYSICAL_BLOCK_SIZE
ZFS_AC_KERNEL_BLKDEV_CHECK_DISK_CHANGE
ZFS_AC_KERNEL_BLKDEV_BDEV_CHECK_MEDIA_CHANGE
ZFS_AC_KERNEL_BLKDEV_BDEV_WHOLE
])
2 changes: 1 addition & 1 deletion config/kernel-config-defined.m4
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_CONFIG_DEBUG_LOCK_ALLOC], [
mutex_init(&lock);
mutex_lock(&lock);
mutex_unlock(&lock);
], [], [$ZFS_META_LICENSE])
], [], [ZFS_META_LICENSE])
])

AC_DEFUN([ZFS_AC_KERNEL_CONFIG_DEBUG_LOCK_ALLOC], [
Expand Down
4 changes: 2 additions & 2 deletions config/kernel-fpu.m4
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_FPU], [
], [
kernel_fpu_begin();
kernel_fpu_end();
], [], [$ZFS_META_LICENSE])
], [], [ZFS_META_LICENSE])

ZFS_LINUX_TEST_SRC([__kernel_fpu], [
#include <linux/types.h>
Expand All @@ -55,7 +55,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_FPU], [
], [
__kernel_fpu_begin();
__kernel_fpu_end();
], [], [$ZFS_META_LICENSE])
], [], [ZFS_META_LICENSE])

ZFS_LINUX_TEST_SRC([fpu_internal], [
#if defined(__x86_64) || defined(__x86_64__) || \
Expand Down
47 changes: 35 additions & 12 deletions config/kernel-generic_io_acct.m4
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@ dnl #
dnl # Check for generic io accounting interface.
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_GENERIC_IO_ACCT], [
ZFS_LINUX_TEST_SRC([bio_io_acct], [
#include <linux/blkdev.h>
], [
struct bio *bio = NULL;
unsigned long start_time;

start_time = bio_start_io_acct(bio);
bio_end_io_acct(bio, start_time);
])

ZFS_LINUX_TEST_SRC([generic_acct_3args], [
#include <linux/bio.h>

Expand Down Expand Up @@ -29,36 +39,49 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_GENERIC_IO_ACCT], [

AC_DEFUN([ZFS_AC_KERNEL_GENERIC_IO_ACCT], [
dnl #
dnl # 3.19 API addition
dnl # 5.7 API,
dnl #
dnl # torvalds/linux@394ffa50 allows us to increment iostat
dnl # counters without generic_make_request().
dnl # Added bio_start_io_acct() and bio_end_io_acct() helpers.
dnl #
AC_MSG_CHECKING([whether generic IO accounting wants 3 args])
ZFS_LINUX_TEST_RESULT_SYMBOL([generic_acct_3args],
[generic_start_io_acct], [block/bio.c], [
AC_MSG_CHECKING([whether generic bio_*_io_acct() are available])
ZFS_LINUX_TEST_RESULT([bio_io_acct], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_GENERIC_IO_ACCT_3ARG, 1,
[generic_start_io_acct()/generic_end_io_acct() available])
AC_DEFINE(HAVE_BIO_IO_ACCT, 1, [bio_*_io_acct() available])
], [
AC_MSG_RESULT(no)

dnl #
dnl # Linux 4.14 API,
dnl # 4.14 API,
dnl #
dnl # generic_start_io_acct/generic_end_io_acct now require
dnl # request_queue to be provided. No functional changes,
dnl # but preparation for inflight accounting.
dnl #
AC_MSG_CHECKING([whether generic IO accounting wants 4 args])
AC_MSG_CHECKING([whether generic_*_io_acct wants 4 args])
ZFS_LINUX_TEST_RESULT_SYMBOL([generic_acct_4args],
[generic_start_io_acct], [block/bio.c], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_GENERIC_IO_ACCT_4ARG, 1,
[generic_start_io_acct()/generic_end_io_acct() ]
[4 arg available])
[generic_*_io_acct() 4 arg available])
], [
AC_MSG_RESULT(no)

dnl #
dnl # 3.19 API addition
dnl #
dnl # torvalds/linux@394ffa50 allows us to increment
dnl # iostat counters without generic_make_request().
dnl #
AC_MSG_CHECKING(
[whether generic_*_io_acct wants 3 args])
ZFS_LINUX_TEST_RESULT_SYMBOL([generic_acct_3args],
[generic_start_io_acct], [block/bio.c], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_GENERIC_IO_ACCT_3ARG, 1,
[generic_*_io_acct() 3 arg available])
], [
AC_MSG_RESULT(no)
])
])
])
])
24 changes: 0 additions & 24 deletions config/kernel-get-disk-and-module.m4

This file was deleted.

28 changes: 25 additions & 3 deletions config/kernel-revalidate-disk-size.m4
Original file line number Diff line number Diff line change
@@ -1,24 +1,46 @@
dnl #
dnl # 5.11 API change
dnl # revalidate_disk_size() has been removed entirely.
dnl #
dnl # 5.10 API change
dnl # revalidate_disk() was replaced by revalidate_disk_size()
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_REVALIDATE_DISK_SIZE], [
AC_DEFUN([ZFS_AC_KERNEL_SRC_REVALIDATE_DISK], [

ZFS_LINUX_TEST_SRC([revalidate_disk_size], [
#include <linux/genhd.h>
], [
struct gendisk *disk = NULL;
(void) revalidate_disk_size(disk, false);
])

ZFS_LINUX_TEST_SRC([revalidate_disk], [
#include <linux/genhd.h>
], [
struct gendisk *disk = NULL;
(void) revalidate_disk(disk);
])
])

AC_DEFUN([ZFS_AC_KERNEL_REVALIDATE_DISK_SIZE], [
AC_DEFUN([ZFS_AC_KERNEL_REVALIDATE_DISK], [

AC_MSG_CHECKING([whether revalidate_disk_size() is available])
ZFS_LINUX_TEST_RESULT_SYMBOL([revalidate_disk_size],
[revalidate_disk_size], [block/genhd.c], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_REVALIDATE_DISK_SIZE, 1,
[revalidate_disk_size() is available])
[revalidate_disk_size() is available])
], [
AC_MSG_RESULT(no)

AC_MSG_CHECKING([whether revalidate_disk() is available])
ZFS_LINUX_TEST_RESULT_SYMBOL([revalidate_disk],
[revalidate_disk], [block/genhd.c], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_REVALIDATE_DISK, 1,
[revalidate_disk() is available])
], [
AC_MSG_RESULT(no)
])
])
])
Loading