From 61e909608d15dc6900a710a0ceab6e101a68ac5a Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Tue, 22 Feb 2011 12:15:13 -0800 Subject: Linux 2.6.x compat, blkdev_compat.h For legacy reasons the zvol.c and vdev_disk.c Linux compatibility code ended up in sys/blkdev.h and sys/vdev_disk.h headers. While there are worse places for this code to live it should be in a linux/blkdev_compat.h header. This change moves this block device Linux compatibility code in to the linux/blkdev_compat.h header and updates all the correct #include locations. This is not a functional change or bug fix, it is just code cleanup. --- include/linux/blkdev_compat.h | 323 ++++++++++++++++++++++++++++++++++++++++++ include/sys/Makefile.am | 1 - include/sys/Makefile.in | 2 - include/sys/blkdev.h | 264 ---------------------------------- include/sys/dmu.h | 4 +- include/sys/vdev_disk.h | 50 +------ include/sys/zvol.h | 2 - module/zfs/zvol.c | 1 + 8 files changed, 326 insertions(+), 321 deletions(-) create mode 100644 include/linux/blkdev_compat.h delete mode 100644 include/sys/blkdev.h diff --git a/include/linux/blkdev_compat.h b/include/linux/blkdev_compat.h new file mode 100644 index 000000000..f841c6c00 --- /dev/null +++ b/include/linux/blkdev_compat.h @@ -0,0 +1,323 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ + +/* + * Copyright (C) 2011 Lawrence Livermore National Security, LLC. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Brian Behlendorf . + * LLNL-CODE-403049. + */ + +#ifndef _ZFS_BLKDEV_H +#define _ZFS_BLKDEV_H + +#include +#include + +#ifndef HAVE_FMODE_T +typedef unsigned __bitwise__ fmode_t; +#endif /* HAVE_FMODE_T */ + +#ifndef HAVE_BLK_FETCH_REQUEST +static inline struct request * +blk_fetch_request(struct request_queue *q) +{ + struct request *req; + + req = elv_next_request(q); + if (req) + blkdev_dequeue_request(req); + + return req; +} +#endif /* HAVE_BLK_FETCH_REQUEST */ + +#ifndef HAVE_BLK_REQUEUE_REQUEST +static inline void +blk_requeue_request(request_queue_t *q, struct request *req) +{ + elv_requeue_request(q, req); +} +#endif /* HAVE_BLK_REQUEUE_REQUEST */ + +#ifndef HAVE_BLK_END_REQUEST +static inline bool +__blk_end_request(struct request *req, int error, unsigned int nr_bytes) +{ + LIST_HEAD(list); + + /* + * Request has already been dequeued but 2.6.18 version of + * end_request() unconditionally dequeues the request so we + * add it to a local list to prevent hitting the BUG_ON. + */ + list_add(&req->queuelist, &list); + + /* + * The old API required the driver to end each segment and not + * the entire request. In our case we always need to end the + * entire request partial requests are not supported. + */ + req->hard_cur_sectors = nr_bytes >> 9; + end_request(req, ((error == 0) ? 1 : error)); + + return 0; +} + +static inline bool +blk_end_request(struct request *req, int error, unsigned int nr_bytes) +{ + struct request_queue *q = req->q; + bool rc; + + spin_lock_irq(q->queue_lock); + rc = __blk_end_request(req, error, nr_bytes); + spin_unlock_irq(q->queue_lock); + + return rc; +} +#else +# ifdef HAVE_BLK_END_REQUEST_GPL_ONLY +/* + * Define required to avoid conflicting 2.6.29 non-static prototype for a + * GPL-only version of the helper. As of 2.6.31 the helper is available + * to non-GPL modules and is not explicitly exported GPL-only. + */ +# define __blk_end_request __blk_end_request_x +# define blk_end_request blk_end_request_x + +static inline bool +__blk_end_request_x(struct request *req, int error, unsigned int nr_bytes) +{ + /* + * The old API required the driver to end each segment and not + * the entire request. In our case we always need to end the + * entire request partial requests are not supported. + */ + req->hard_cur_sectors = nr_bytes >> 9; + end_request(req, ((error == 0) ? 1 : error)); + + return 0; +} +static inline bool +blk_end_request_x(struct request *req, int error, unsigned int nr_bytes) +{ + struct request_queue *q = req->q; + bool rc; + + spin_lock_irq(q->queue_lock); + rc = __blk_end_request_x(req, error, nr_bytes); + spin_unlock_irq(q->queue_lock); + + return rc; +} +# endif /* HAVE_BLK_END_REQUEST_GPL_ONLY */ +#endif /* HAVE_BLK_END_REQUEST */ + +#ifndef HAVE_BLK_RQ_POS +static inline sector_t +blk_rq_pos(struct request *req) +{ + return req->sector; +} +#endif /* HAVE_BLK_RQ_POS */ + +#ifndef HAVE_BLK_RQ_SECTORS +static inline unsigned int +blk_rq_sectors(struct request *req) +{ + return req->nr_sectors; +} +#endif /* HAVE_BLK_RQ_SECTORS */ + +#if !defined(HAVE_BLK_RQ_BYTES) || defined(HAVE_BLK_RQ_BYTES_GPL_ONLY) +/* + * Define required to avoid conflicting 2.6.29 non-static prototype for a + * GPL-only version of the helper. As of 2.6.31 the helper is available + * to non-GPL modules in the form of a static inline in the header. + */ +#define blk_rq_bytes __blk_rq_bytes +static inline unsigned int +__blk_rq_bytes(struct request *req) +{ + return blk_rq_sectors(req) << 9; +} +#endif /* !HAVE_BLK_RQ_BYTES || HAVE_BLK_RQ_BYTES_GPL_ONLY */ + +/* + * Most of the blk_* macros were removed in 2.6.36. Ostensibly this was + * done to improve readability and allow easier grepping. However, from + * a portability stand point the macros are helpful. Therefore the needed + * macros are redefined here if they are missing from the kernel. + */ +#ifndef blk_fs_request +#define blk_fs_request(rq) ((rq)->cmd_type == REQ_TYPE_FS) +#endif + +#ifndef HAVE_GET_DISK_RO +static inline int +get_disk_ro(struct gendisk *disk) +{ + int policy = 0; + + if (disk->part[0]) + policy = disk->part[0]->policy; + + return policy; +} +#endif /* HAVE_GET_DISK_RO */ + +#ifndef HAVE_RQ_IS_SYNC +static inline bool +rq_is_sync(struct request *req) +{ + return (req->flags & REQ_RW_SYNC); +} +#endif /* HAVE_RQ_IS_SYNC */ + +#ifndef HAVE_RQ_FOR_EACH_SEGMENT +struct req_iterator { + int i; + struct bio *bio; +}; + +# define for_each_bio(_bio) \ + for (; _bio; _bio = _bio->bi_next) + +# define __rq_for_each_bio(_bio, rq) \ + if ((rq->bio)) \ + for (_bio = (rq)->bio; _bio; _bio = _bio->bi_next) + +# define rq_for_each_segment(bvl, _rq, _iter) \ + __rq_for_each_bio(_iter.bio, _rq) \ + bio_for_each_segment(bvl, _iter.bio, _iter.i) +#endif /* HAVE_RQ_FOR_EACH_SEGMENT */ + +/* + * Portable helper for correctly setting the FAILFAST flags. The + * correct usage has changed 3 times from 2.6.12 to 2.6.38. + */ +static inline void +bio_set_flags_failfast(struct block_device *bdev, int *flags) +{ +#ifdef CONFIG_BUG + /* + * Disable FAILFAST for loopback devices because of the + * following incorrect BUG_ON() in loop_make_request(). + * This support is also disabled for md devices because the + * test suite layers md devices on top of loopback devices. + * This may be removed when the loopback driver is fixed. + * + * BUG_ON(!lo || (rw != READ && rw != WRITE)); + */ + if ((MAJOR(bdev->bd_dev) == LOOP_MAJOR) || + (MAJOR(bdev->bd_dev) == MD_MAJOR)) + return; + +#ifdef BLOCK_EXT_MAJOR + if (MAJOR(bdev->bd_dev) == BLOCK_EXT_MAJOR) + return; +#endif /* BLOCK_EXT_MAJOR */ +#endif /* CONFIG_BUG */ + +#ifdef HAVE_BIO_RW_FAILFAST_DTD + /* BIO_RW_FAILFAST_* preferred interface from 2.6.28 - 2.6.35 */ + *flags |= + ((1 << BIO_RW_FAILFAST_DEV) | + (1 << BIO_RW_FAILFAST_TRANSPORT) | + (1 << BIO_RW_FAILFAST_DRIVER)); +#else +# ifdef HAVE_BIO_RW_FAILFAST + /* BIO_RW_FAILFAST preferred interface from 2.6.12 - 2.6.27 */ + *flags |= (1 << BIO_RW_FAILFAST); +# else +# ifdef HAVE_REQ_FAILFAST_MASK + /* REQ_FAILFAST_* preferred interface from 2.6.36 - 2.6.xx, + * the BIO_* and REQ_* flags were unified under REQ_* flags. */ + *flags |= REQ_FAILFAST_MASK; +# endif /* HAVE_REQ_FAILFAST_MASK */ +# endif /* HAVE_BIO_RW_FAILFAST */ +#endif /* HAVE_BIO_RW_FAILFAST_DTD */ +} + +/* + * Maximum disk label length, it may be undefined for some kernels. + */ +#ifndef DISK_NAME_LEN +#define DISK_NAME_LEN 32 +#endif /* DISK_NAME_LEN */ + +/* + * 2.6.24 API change, + * The bio_end_io() prototype changed slightly. These are helper + * macro's to ensure the prototype and return value are handled. + */ +#ifdef HAVE_2ARGS_BIO_END_IO_T +# define BIO_END_IO_PROTO(fn, x, y, z) static void fn(struct bio *x, int z) +# define BIO_END_IO_RETURN(rc) return +#else +# define BIO_END_IO_PROTO(fn, x, y, z) static int fn(struct bio *x, \ + unsigned int y, int z) +# define BIO_END_IO_RETURN(rc) return rc +#endif /* HAVE_2ARGS_BIO_END_IO_T */ + +/* + * 2.6.28 API change + * Used to exclusively open a block device from within the kernel. + */ +#ifdef HAVE_OPEN_BDEV_EXCLUSIVE +# define vdev_bdev_open(path, md, hld) open_bdev_exclusive(path, md, hld) +# define vdev_bdev_close(bdev, md) close_bdev_exclusive(bdev, md) +#else +# define vdev_bdev_open(path, md, hld) open_bdev_excl(path, md, hld) +# define vdev_bdev_close(bdev, md) close_bdev_excl(bdev) +#endif /* HAVE_OPEN_BDEV_EXCLUSIVE */ + +/* + * 2.6.22 API change + * The function invalidate_bdev() lost it's second argument because + * it was unused. + */ +#ifdef HAVE_1ARG_INVALIDATE_BDEV +# define vdev_bdev_invalidate(bdev) invalidate_bdev(bdev) +#else +# define vdev_bdev_invalidate(bdev) invalidate_bdev(bdev, 1) +#endif /* HAVE_1ARG_INVALIDATE_BDEV */ + +/* + * 2.6.30 API change + * Change to make it explicit there this is the logical block size. + */ +#ifdef HAVE_BDEV_LOGICAL_BLOCK_SIZE +# define vdev_bdev_block_size(bdev) bdev_logical_block_size(bdev) +#else +# define vdev_bdev_block_size(bdev) bdev_hardsect_size(bdev) +#endif + +/* + * Default Linux IO Scheduler, + * Setting the scheduler to noop will allow the Linux IO scheduler to + * still perform front and back merging, while leaving the request + * ordering and prioritization to the ZFS IO scheduler. + */ +#define VDEV_SCHEDULER "noop" + +#endif /* _ZFS_BLKDEV_H */ diff --git a/include/sys/Makefile.am b/include/sys/Makefile.am index bde71b75e..7b95d8e91 100644 --- a/include/sys/Makefile.am +++ b/include/sys/Makefile.am @@ -72,7 +72,6 @@ COMMON_H = \ $(top_srcdir)/include/sys/zrlock.h KERNEL_H = \ - $(top_srcdir)/include/sys/blkdev.h \ $(top_srcdir)/include/sys/zfs_ioctl.h \ $(top_srcdir)/include/sys/zfs_onexit.h \ ${top_srcdir}/include/sys/zpl.h \ diff --git a/include/sys/Makefile.in b/include/sys/Makefile.in index 37339e255..daf68b3a9 100644 --- a/include/sys/Makefile.in +++ b/include/sys/Makefile.in @@ -163,7 +163,6 @@ am__kernel_HEADERS_DIST = $(top_srcdir)/include/sys/arc.h \ $(top_srcdir)/include/sys/zio.h \ $(top_srcdir)/include/sys/zio_impl.h \ $(top_srcdir)/include/sys/zrlock.h \ - $(top_srcdir)/include/sys/blkdev.h \ $(top_srcdir)/include/sys/zfs_ioctl.h \ $(top_srcdir)/include/sys/zfs_onexit.h \ ${top_srcdir}/include/sys/zpl.h \ @@ -532,7 +531,6 @@ COMMON_H = \ $(top_srcdir)/include/sys/zrlock.h KERNEL_H = \ - $(top_srcdir)/include/sys/blkdev.h \ $(top_srcdir)/include/sys/zfs_ioctl.h \ $(top_srcdir)/include/sys/zfs_onexit.h \ ${top_srcdir}/include/sys/zpl.h \ diff --git a/include/sys/blkdev.h b/include/sys/blkdev.h deleted file mode 100644 index 7f242202a..000000000 --- a/include/sys/blkdev.h +++ /dev/null @@ -1,264 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright (C) 2008-2010 Lawrence Livermore National Security, LLC. - * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by Brian Behlendorf . - * LLNL-CODE-403049. - */ - -#ifndef _SYS_BLKDEV_H -#define _SYS_BLKDEV_H - -#ifdef _KERNEL - -#include -#include - -#ifndef HAVE_FMODE_T -typedef unsigned __bitwise__ fmode_t; -#endif /* HAVE_FMODE_T */ - -#ifndef HAVE_BLK_FETCH_REQUEST -static inline struct request * -blk_fetch_request(struct request_queue *q) -{ - struct request *req; - - req = elv_next_request(q); - if (req) - blkdev_dequeue_request(req); - - return req; -} -#endif /* HAVE_BLK_FETCH_REQUEST */ - -#ifndef HAVE_BLK_REQUEUE_REQUEST -static inline void -blk_requeue_request(request_queue_t *q, struct request *req) -{ - elv_requeue_request(q, req); -} -#endif /* HAVE_BLK_REQUEUE_REQUEST */ - -#ifndef HAVE_BLK_END_REQUEST -static inline bool -__blk_end_request(struct request *req, int error, unsigned int nr_bytes) -{ - LIST_HEAD(list); - - /* - * Request has already been dequeued but 2.6.18 version of - * end_request() unconditionally dequeues the request so we - * add it to a local list to prevent hitting the BUG_ON. - */ - list_add(&req->queuelist, &list); - - /* - * The old API required the driver to end each segment and not - * the entire request. In our case we always need to end the - * entire request partial requests are not supported. - */ - req->hard_cur_sectors = nr_bytes >> 9; - end_request(req, ((error == 0) ? 1 : error)); - - return 0; -} - -static inline bool -blk_end_request(struct request *req, int error, unsigned int nr_bytes) -{ - struct request_queue *q = req->q; - bool rc; - - spin_lock_irq(q->queue_lock); - rc = __blk_end_request(req, error, nr_bytes); - spin_unlock_irq(q->queue_lock); - - return rc; -} -#else -# ifdef HAVE_BLK_END_REQUEST_GPL_ONLY -/* - * Define required to avoid conflicting 2.6.29 non-static prototype for a - * GPL-only version of the helper. As of 2.6.31 the helper is available - * to non-GPL modules and is not explicitly exported GPL-only. - */ -# define __blk_end_request __blk_end_request_x -# define blk_end_request blk_end_request_x - -static inline bool -__blk_end_request_x(struct request *req, int error, unsigned int nr_bytes) -{ - /* - * The old API required the driver to end each segment and not - * the entire request. In our case we always need to end the - * entire request partial requests are not supported. - */ - req->hard_cur_sectors = nr_bytes >> 9; - end_request(req, ((error == 0) ? 1 : error)); - - return 0; -} -static inline bool -blk_end_request_x(struct request *req, int error, unsigned int nr_bytes) -{ - struct request_queue *q = req->q; - bool rc; - - spin_lock_irq(q->queue_lock); - rc = __blk_end_request_x(req, error, nr_bytes); - spin_unlock_irq(q->queue_lock); - - return rc; -} -# endif /* HAVE_BLK_END_REQUEST_GPL_ONLY */ -#endif /* HAVE_BLK_END_REQUEST */ - -#ifndef HAVE_BLK_RQ_POS -static inline sector_t -blk_rq_pos(struct request *req) -{ - return req->sector; -} -#endif /* HAVE_BLK_RQ_POS */ - -#ifndef HAVE_BLK_RQ_SECTORS -static inline unsigned int -blk_rq_sectors(struct request *req) -{ - return req->nr_sectors; -} -#endif /* HAVE_BLK_RQ_SECTORS */ - -#if !defined(HAVE_BLK_RQ_BYTES) || defined(HAVE_BLK_RQ_BYTES_GPL_ONLY) -/* - * Define required to avoid conflicting 2.6.29 non-static prototype for a - * GPL-only version of the helper. As of 2.6.31 the helper is available - * to non-GPL modules in the form of a static inline in the header. - */ -#define blk_rq_bytes __blk_rq_bytes -static inline unsigned int -__blk_rq_bytes(struct request *req) -{ - return blk_rq_sectors(req) << 9; -} -#endif /* !HAVE_BLK_RQ_BYTES || HAVE_BLK_RQ_BYTES_GPL_ONLY */ - -/* - * Most of the blk_* macros were removed in 2.6.36. Ostensibly this was - * done to improve readability and allow easier grepping. However, from - * a portability stand point the macros are helpful. Therefore the needed - * macros are redefined here if they are missing from the kernel. - */ -#ifndef blk_fs_request -#define blk_fs_request(rq) ((rq)->cmd_type == REQ_TYPE_FS) -#endif - -#ifndef HAVE_GET_DISK_RO -static inline int -get_disk_ro(struct gendisk *disk) -{ - int policy = 0; - - if (disk->part[0]) - policy = disk->part[0]->policy; - - return policy; -} -#endif /* HAVE_GET_DISK_RO */ - -#ifndef HAVE_RQ_IS_SYNC -static inline bool -rq_is_sync(struct request *req) -{ - return (req->flags & REQ_RW_SYNC); -} -#endif /* HAVE_RQ_IS_SYNC */ - -#ifndef HAVE_RQ_FOR_EACH_SEGMENT -struct req_iterator { - int i; - struct bio *bio; -}; - -# define for_each_bio(_bio) \ - for (; _bio; _bio = _bio->bi_next) - -# define __rq_for_each_bio(_bio, rq) \ - if ((rq->bio)) \ - for (_bio = (rq)->bio; _bio; _bio = _bio->bi_next) - -# define rq_for_each_segment(bvl, _rq, _iter) \ - __rq_for_each_bio(_iter.bio, _rq) \ - bio_for_each_segment(bvl, _iter.bio, _iter.i) -#endif /* HAVE_RQ_FOR_EACH_SEGMENT */ - -static inline void -bio_set_flags_failfast(struct block_device *bdev, int *flags) -{ -#ifdef CONFIG_BUG - /* - * Disable FAILFAST for loopback devices because of the - * following incorrect BUG_ON() in loop_make_request(). - * This support is also disabled for md devices because the - * test suite layers md devices on top of loopback devices. - * This may be removed when the loopback driver is fixed. - * - * BUG_ON(!lo || (rw != READ && rw != WRITE)); - */ - if ((MAJOR(bdev->bd_dev) == LOOP_MAJOR) || - (MAJOR(bdev->bd_dev) == MD_MAJOR)) - return; - -#ifdef BLOCK_EXT_MAJOR - if (MAJOR(bdev->bd_dev) == BLOCK_EXT_MAJOR) - return; -#endif /* BLOCK_EXT_MAJOR */ -#endif /* CONFIG_BUG */ - -#ifdef HAVE_BIO_RW_FAILFAST_DTD - /* BIO_RW_FAILFAST_* preferred interface from 2.6.28 - 2.6.35 */ - *flags |= - ((1 << BIO_RW_FAILFAST_DEV) | - (1 << BIO_RW_FAILFAST_TRANSPORT) | - (1 << BIO_RW_FAILFAST_DRIVER)); -#else -# ifdef HAVE_BIO_RW_FAILFAST - /* BIO_RW_FAILFAST preferred interface from 2.6.12 - 2.6.27 */ - *flags |= (1 << BIO_RW_FAILFAST); -# else -# ifdef HAVE_REQ_FAILFAST_MASK - /* REQ_FAILFAST_* preferred interface from 2.6.36 - 2.6.xx, - * the BIO_* and REQ_* flags were unified under REQ_* flags. */ - *flags |= REQ_FAILFAST_MASK; -# endif /* HAVE_REQ_FAILFAST_MASK */ -# endif /* HAVE_BIO_RW_FAILFAST */ -#endif /* HAVE_BIO_RW_FAILFAST_DTD */ -} - -#ifndef DISK_NAME_LEN -#define DISK_NAME_LEN 32 -#endif /* DISK_NAME_LEN */ - -#endif /* KERNEL */ - -#endif /* _SYS_BLKDEV_H */ diff --git a/include/sys/dmu.h b/include/sys/dmu.h index 7040b6740..20733f502 100644 --- a/include/sys/dmu.h +++ b/include/sys/dmu.h @@ -41,9 +41,6 @@ #include #include #include -#ifdef _KERNEL -#include -#endif #ifdef __cplusplus extern "C" { @@ -514,6 +511,7 @@ void dmu_write(objset_t *os, uint64_t object, uint64_t offset, uint64_t size, void dmu_prealloc(objset_t *os, uint64_t object, uint64_t offset, uint64_t size, dmu_tx_t *tx); #ifdef _KERNEL +#include int dmu_read_req(objset_t *os, uint64_t object, struct request *req); int dmu_write_req(objset_t *os, uint64_t object, struct request *req, dmu_tx_t *tx); diff --git a/include/sys/vdev_disk.h b/include/sys/vdev_disk.h index 03e7048ac..daefed718 100644 --- a/include/sys/vdev_disk.h +++ b/include/sys/vdev_disk.h @@ -28,15 +28,8 @@ #ifndef _SYS_VDEV_DISK_H #define _SYS_VDEV_DISK_H -#ifdef __cplusplus -extern "C" { -#endif - #ifdef _KERNEL #include -#include -#include -#include typedef struct vdev_disk { ddi_devid_t vd_devid; @@ -48,46 +41,5 @@ extern int vdev_disk_physio(struct block_device *, caddr_t, size_t, uint64_t, int); extern int vdev_disk_read_rootlabel(char *, char *, nvlist_t **); -/* 2.6.24 API change */ -#ifdef HAVE_2ARGS_BIO_END_IO_T -# define BIO_END_IO_PROTO(fn, x, y, z) static void fn(struct bio *x, int z) -# define BIO_END_IO_RETURN(rc) return -#else -# define BIO_END_IO_PROTO(fn, x, y, z) static int fn(struct bio *x, \ - unsigned int y, int z) -# define BIO_END_IO_RETURN(rc) return rc -#endif /* HAVE_2ARGS_BIO_END_IO_T */ - -/* 2.6.28 API change */ -#ifdef HAVE_OPEN_BDEV_EXCLUSIVE -# define vdev_bdev_open(path, md, hld) open_bdev_exclusive(path, md, hld) -# define vdev_bdev_close(bdev, md) close_bdev_exclusive(bdev, md) -#else -# define vdev_bdev_open(path, md, hld) open_bdev_excl(path, md, hld) -# define vdev_bdev_close(bdev, md) close_bdev_excl(bdev) -#endif /* HAVE_OPEN_BDEV_EXCLUSIVE */ - -/* 2.6.22 API change */ -#ifdef HAVE_1ARG_INVALIDATE_BDEV -# define vdev_bdev_invalidate(bdev) invalidate_bdev(bdev) -#else -# define vdev_bdev_invalidate(bdev) invalidate_bdev(bdev, 1) -#endif /* HAVE_1ARG_INVALIDATE_BDEV */ - -/* 2.6.30 API change */ -#ifdef HAVE_BDEV_LOGICAL_BLOCK_SIZE -# define vdev_bdev_block_size(bdev) bdev_logical_block_size(bdev) -#else -# define vdev_bdev_block_size(bdev) bdev_hardsect_size(bdev) -#endif - -/* Default Linux IO Scheduler */ -#define VDEV_SCHEDULER "noop" - #endif /* _KERNEL */ - -#ifdef __cplusplus -} -#endif - -#endif /* _SYS_VDEV_DISK_H */ +#endif /* _SYS_VDEV_DISK_H */ diff --git a/include/sys/zvol.h b/include/sys/zvol.h index c8b9d6507..815b186e0 100644 --- a/include/sys/zvol.h +++ b/include/sys/zvol.h @@ -33,8 +33,6 @@ #ifdef _KERNEL -#include - extern int zvol_check_volsize(uint64_t volsize, uint64_t blocksize); extern int zvol_check_volblocksize(uint64_t volblocksize); extern int zvol_get_stats(objset_t *os, nvlist_t *nv); diff --git a/module/zfs/zvol.c b/module/zfs/zvol.c index 04c885f68..e4487f9a6 100644 --- a/module/zfs/zvol.c +++ b/module/zfs/zvol.c @@ -44,6 +44,7 @@ #include #include #include +#include unsigned int zvol_major = ZVOL_MAJOR; unsigned int zvol_threads = 0; -- cgit v1.2.3