]> git.proxmox.com Git - mirror_zfs.git/blob - include/sys/vdev_disk.h
Use 'noop' IO Scheduler
[mirror_zfs.git] / include / sys / vdev_disk.h
1 /*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright (C) 2008-2010 Lawrence Livermore National Security, LLC.
23 * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
24 * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
25 * LLNL-CODE-403049.
26 */
27
28 #ifndef _SYS_VDEV_DISK_H
29 #define _SYS_VDEV_DISK_H
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34
35 #ifdef _KERNEL
36 #include <sys/vdev.h>
37 #include <sys/ddi.h>
38 #include <sys/sunldi.h>
39 #include <sys/sunddi.h>
40
41 typedef struct vdev_disk {
42 ddi_devid_t vd_devid;
43 char *vd_minor;
44 struct block_device *vd_bdev;
45 } vdev_disk_t;
46
47 extern int vdev_disk_physio(struct block_device *, caddr_t,
48 size_t, uint64_t, int);
49 extern int vdev_disk_read_rootlabel(char *, char *, nvlist_t **);
50
51 /* 2.6.24 API change */
52 #ifdef HAVE_2ARGS_BIO_END_IO_T
53 # define BIO_END_IO_PROTO(fn, x, y, z) static void fn(struct bio *x, int z)
54 # define BIO_END_IO_RETURN(rc) return
55 #else
56 # define BIO_END_IO_PROTO(fn, x, y, z) static int fn(struct bio *x, \
57 unsigned int y, int z)
58 # define BIO_END_IO_RETURN(rc) return rc
59 #endif /* HAVE_2ARGS_BIO_END_IO_T */
60
61 /* 2.6.28 API change */
62 #ifdef HAVE_OPEN_BDEV_EXCLUSIVE
63 # define vdev_bdev_open(path, md, hld) open_bdev_exclusive(path, md, hld)
64 # define vdev_bdev_close(bdev, md) close_bdev_exclusive(bdev, md)
65 #else
66 # define vdev_bdev_open(path, md, hld) open_bdev_excl(path, md, hld)
67 # define vdev_bdev_close(bdev, md) close_bdev_excl(bdev)
68 #endif /* HAVE_OPEN_BDEV_EXCLUSIVE */
69
70 /* 2.6.22 API change */
71 #ifdef HAVE_1ARG_INVALIDATE_BDEV
72 # define vdev_bdev_invalidate(bdev) invalidate_bdev(bdev)
73 #else
74 # define vdev_bdev_invalidate(bdev) invalidate_bdev(bdev, 1)
75 #endif /* HAVE_1ARG_INVALIDATE_BDEV */
76
77 /* 2.6.30 API change */
78 #ifdef HAVE_BDEV_LOGICAL_BLOCK_SIZE
79 # define vdev_bdev_block_size(bdev) bdev_logical_block_size(bdev)
80 #else
81 # define vdev_bdev_block_size(bdev) bdev_hardsect_size(bdev)
82 #endif
83
84 /* Default Linux IO Scheduler */
85 #define VDEV_SCHEDULER "noop"
86
87 #endif /* _KERNEL */
88
89 #ifdef __cplusplus
90 }
91 #endif
92
93 #endif /* _SYS_VDEV_DISK_H */