| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: xbdback_xenbus.c,v 1.84 2020/04/20 19:20:35 bouyer Exp $ */ | | 1 | /* $NetBSD: xbdback_xenbus.c,v 1.85 2020/04/20 19:29:09 jdolecek Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2006 Manuel Bouyer. | | 4 | * Copyright (c) 2006 Manuel Bouyer. |
5 | * | | 5 | * |
6 | * Redistribution and use in source and binary forms, with or without | | 6 | * Redistribution and use in source and binary forms, with or without |
7 | * modification, are permitted provided that the following conditions | | 7 | * modification, are permitted provided that the following conditions |
8 | * are met: | | 8 | * are met: |
9 | * 1. Redistributions of source code must retain the above copyright | | 9 | * 1. Redistributions of source code must retain the above copyright |
10 | * notice, this list of conditions and the following disclaimer. | | 10 | * notice, this list of conditions and the following disclaimer. |
11 | * 2. Redistributions in binary form must reproduce the above copyright | | 11 | * 2. Redistributions in binary form must reproduce the above copyright |
12 | * notice, this list of conditions and the following disclaimer in the | | 12 | * notice, this list of conditions and the following disclaimer in the |
13 | * documentation and/or other materials provided with the distribution. | | 13 | * documentation and/or other materials provided with the distribution. |
14 | * | | 14 | * |
| @@ -16,27 +16,27 @@ | | | @@ -16,27 +16,27 @@ |
16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | | 16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | | 17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | | 18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | | 19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | | 20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | | 21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | | 22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | | 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | | 24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
25 | * | | 25 | * |
26 | */ | | 26 | */ |
27 | | | 27 | |
28 | #include <sys/cdefs.h> | | 28 | #include <sys/cdefs.h> |
29 | __KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.84 2020/04/20 19:20:35 bouyer Exp $"); | | 29 | __KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.85 2020/04/20 19:29:09 jdolecek Exp $"); |
30 | | | 30 | |
31 | #include <sys/atomic.h> | | 31 | #include <sys/atomic.h> |
32 | #include <sys/buf.h> | | 32 | #include <sys/buf.h> |
33 | #include <sys/condvar.h> | | 33 | #include <sys/condvar.h> |
34 | #include <sys/conf.h> | | 34 | #include <sys/conf.h> |
35 | #include <sys/disk.h> | | 35 | #include <sys/disk.h> |
36 | #include <sys/device.h> | | 36 | #include <sys/device.h> |
37 | #include <sys/fcntl.h> | | 37 | #include <sys/fcntl.h> |
38 | #include <sys/kauth.h> | | 38 | #include <sys/kauth.h> |
39 | #include <sys/kernel.h> | | 39 | #include <sys/kernel.h> |
40 | #include <sys/kmem.h> | | 40 | #include <sys/kmem.h> |
41 | #include <sys/kthread.h> | | 41 | #include <sys/kthread.h> |
42 | #include <sys/mutex.h> | | 42 | #include <sys/mutex.h> |
| @@ -235,29 +235,26 @@ struct xbdback_io { | | | @@ -235,29 +235,26 @@ struct xbdback_io { |
235 | #define xio_gref u.xio_rw.xio_gref | | 235 | #define xio_gref u.xio_rw.xio_gref |
236 | #define xio_gh u.xio_rw.xio_gh | | 236 | #define xio_gh u.xio_rw.xio_gh |
237 | #define xio_nrma u.xio_rw.xio_nrma | | 237 | #define xio_nrma u.xio_rw.xio_nrma |
238 | | | 238 | |
239 | /* | | 239 | /* |
240 | * Pools to manage the chain of block requests and I/Os fragments | | 240 | * Pools to manage the chain of block requests and I/Os fragments |
241 | * submitted by frontend. | | 241 | * submitted by frontend. |
242 | */ | | 242 | */ |
243 | static struct pool_cache xbdback_io_pool; | | 243 | static struct pool_cache xbdback_io_pool; |
244 | | | 244 | |
245 | /* Interval between reports of I/O errors from frontend */ | | 245 | /* Interval between reports of I/O errors from frontend */ |
246 | static const struct timeval xbdback_err_intvl = { 1, 0 }; | | 246 | static const struct timeval xbdback_err_intvl = { 1, 0 }; |
247 | | | 247 | |
248 | #ifdef DEBUG | | | |
249 | static const struct timeval xbdback_fragio_intvl = { 60, 0 }; | | | |
250 | #endif | | | |
251 | void xbdbackattach(int); | | 248 | void xbdbackattach(int); |
252 | static int xbdback_xenbus_create(struct xenbus_device *); | | 249 | static int xbdback_xenbus_create(struct xenbus_device *); |
253 | static int xbdback_xenbus_destroy(void *); | | 250 | static int xbdback_xenbus_destroy(void *); |
254 | static void xbdback_frontend_changed(void *, XenbusState); | | 251 | static void xbdback_frontend_changed(void *, XenbusState); |
255 | static void xbdback_backend_changed(struct xenbus_watch *, | | 252 | static void xbdback_backend_changed(struct xenbus_watch *, |
256 | const char **, unsigned int); | | 253 | const char **, unsigned int); |
257 | static int xbdback_evthandler(void *); | | 254 | static int xbdback_evthandler(void *); |
258 | | | 255 | |
259 | static int xbdback_connect(struct xbdback_instance *); | | 256 | static int xbdback_connect(struct xbdback_instance *); |
260 | static void xbdback_disconnect(struct xbdback_instance *); | | 257 | static void xbdback_disconnect(struct xbdback_instance *); |
261 | static void xbdback_finish_disconnect(struct xbdback_instance *); | | 258 | static void xbdback_finish_disconnect(struct xbdback_instance *); |
262 | | | 259 | |
263 | static bool xbdif_lookup(domid_t, uint32_t); | | 260 | static bool xbdif_lookup(domid_t, uint32_t); |