diff --git a/config/kernel-lookup-bdev.m4 b/config/kernel-lookup-bdev.m4 new file mode 100644 index 000000000000..245f95f041f8 --- /dev/null +++ b/config/kernel-lookup-bdev.m4 @@ -0,0 +1,17 @@ +dnl # +dnl # 2.6.27 API change +dnl # lookup_bdev() was exported. +dnl # +AC_DEFUN([ZFS_AC_KERNEL_LOOKUP_BDEV], + [AC_MSG_CHECKING([whether lookup_bdev() is available]) + ZFS_LINUX_TRY_COMPILE_SYMBOL([ + #include + ], [ + lookup_bdev(NULL); + ], [lookup_bdev], [fs/block_dev.c], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_LOOKUP_BDEV, 1, [lookup_bdev() is available]) + ], [ + AC_MSG_RESULT(no) + ]) +]) diff --git a/config/kernel.m4 b/config/kernel.m4 index fd6ab1f9a71d..6d28074d0bbb 100644 --- a/config/kernel.m4 +++ b/config/kernel.m4 @@ -12,6 +12,7 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [ ZFS_AC_KERNEL_3ARG_BLKDEV_GET ZFS_AC_KERNEL_BLKDEV_GET_BY_PATH ZFS_AC_KERNEL_OPEN_BDEV_EXCLUSIVE + ZFS_AC_KERNEL_LOOKUP_BDEV ZFS_AC_KERNEL_INVALIDATE_BDEV_ARGS ZFS_AC_KERNEL_BDEV_LOGICAL_BLOCK_SIZE ZFS_AC_KERNEL_BDEV_PHYSICAL_BLOCK_SIZE diff --git a/include/linux/blkdev_compat.h b/include/linux/blkdev_compat.h index 1ff8eeaf329e..9d3e6f07cefc 100644 --- a/include/linux/blkdev_compat.h +++ b/include/linux/blkdev_compat.h @@ -392,6 +392,15 @@ bio_set_flags_failfast(struct block_device *bdev, int *flags) # define vdev_bdev_invalidate(bdev) invalidate_bdev(bdev, 1) #endif /* HAVE_1ARG_INVALIDATE_BDEV */ +/* + * 2.6.27 API change + * The function was exported for use, prior to this it existed by the + * symbol was not exported. + */ +#ifndef HAVE_LOOKUP_BDEV +# define lookup_bdev(path) ERR_PTR(-ENOTSUP) +#endif + /* * 2.6.30 API change * To ensure good performance preferentially use the physical block size