Switch to vn_bdev_open* functions.diff -r1.180 -r1.181 src/sys/dev/ccd.c
(mlelstv)
--- src/sys/dev/ccd.c 2019/08/07 00:38:01 1.180
+++ src/sys/dev/ccd.c 2019/12/08 12:14:40 1.181
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: ccd.c,v 1.180 2019/08/07 00:38:01 pgoyette Exp $ */ | 1 | /* $NetBSD: ccd.c,v 1.181 2019/12/08 12:14:40 mlelstv Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 1996, 1997, 1998, 1999, 2007, 2009 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 1996, 1997, 1998, 1999, 2007, 2009 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Jason R. Thorpe, and by Andrew Doran. | 8 | * by Jason R. Thorpe, and by Andrew Doran. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -78,27 +78,27 @@ | @@ -78,27 +78,27 @@ | |||
78 | * sc_stop, sc_bufq and b_resid from master buffers. | 78 | * sc_stop, sc_bufq and b_resid from master buffers. | |
79 | * | 79 | * | |
80 | * => a combination of CCDF_INITED, sc_inflight, and sc_iolock is used to | 80 | * => a combination of CCDF_INITED, sc_inflight, and sc_iolock is used to | |
81 | * serialize I/O and configuration changes. | 81 | * serialize I/O and configuration changes. | |
82 | * | 82 | * | |
83 | * => the in-core disk label does not change while the device is open. | 83 | * => the in-core disk label does not change while the device is open. | |
84 | * | 84 | * | |
85 | * On memory consumption: ccd fans out I/O requests and so needs to | 85 | * On memory consumption: ccd fans out I/O requests and so needs to | |
86 | * allocate memory. If the system is desperately low on memory, we | 86 | * allocate memory. If the system is desperately low on memory, we | |
87 | * single thread I/O. | 87 | * single thread I/O. | |
88 | */ | 88 | */ | |
89 | 89 | |||
90 | #include <sys/cdefs.h> | 90 | #include <sys/cdefs.h> | |
91 | __KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.180 2019/08/07 00:38:01 pgoyette Exp $"); | 91 | __KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.181 2019/12/08 12:14:40 mlelstv Exp $"); | |
92 | 92 | |||
93 | #include <sys/param.h> | 93 | #include <sys/param.h> | |
94 | #include <sys/systm.h> | 94 | #include <sys/systm.h> | |
95 | #include <sys/kernel.h> | 95 | #include <sys/kernel.h> | |
96 | #include <sys/proc.h> | 96 | #include <sys/proc.h> | |
97 | #include <sys/errno.h> | 97 | #include <sys/errno.h> | |
98 | #include <sys/buf.h> | 98 | #include <sys/buf.h> | |
99 | #include <sys/kmem.h> | 99 | #include <sys/kmem.h> | |
100 | #include <sys/pool.h> | 100 | #include <sys/pool.h> | |
101 | #include <sys/module.h> | 101 | #include <sys/module.h> | |
102 | #include <sys/namei.h> | 102 | #include <sys/namei.h> | |
103 | #include <sys/stat.h> | 103 | #include <sys/stat.h> | |
104 | #include <sys/ioctl.h> | 104 | #include <sys/ioctl.h> | |
@@ -1212,27 +1212,27 @@ ccdioctl(dev_t dev, u_long cmd, void *da | @@ -1212,27 +1212,27 @@ ccdioctl(dev_t dev, u_long cmd, void *da | |||
1212 | if (ccddebug & CCDB_INIT) | 1212 | if (ccddebug & CCDB_INIT) | |
1213 | for (i = 0; i < ccio->ccio_ndisks; ++i) | 1213 | for (i = 0; i < ccio->ccio_ndisks; ++i) | |
1214 | printf("ccdioctl: component %d: %p\n", | 1214 | printf("ccdioctl: component %d: %p\n", | |
1215 | i, cpp[i]); | 1215 | i, cpp[i]); | |
1216 | #endif | 1216 | #endif | |
1217 | 1217 | |||
1218 | for (i = 0; i < ccio->ccio_ndisks; ++i) { | 1218 | for (i = 0; i < ccio->ccio_ndisks; ++i) { | |
1219 | #ifdef DEBUG | 1219 | #ifdef DEBUG | |
1220 | if (ccddebug & CCDB_INIT) | 1220 | if (ccddebug & CCDB_INIT) | |
1221 | printf("ccdioctl: lookedup = %d\n", lookedup); | 1221 | printf("ccdioctl: lookedup = %d\n", lookedup); | |
1222 | #endif | 1222 | #endif | |
1223 | error = pathbuf_copyin(cpp[i], &pb); | 1223 | error = pathbuf_copyin(cpp[i], &pb); | |
1224 | if (error == 0) { | 1224 | if (error == 0) { | |
1225 | error = dk_lookup(pb, l, &vpp[i]); | 1225 | error = vn_bdev_openpath(pb, &vpp[i], l); | |
1226 | } | 1226 | } | |
1227 | pathbuf_destroy(pb); | 1227 | pathbuf_destroy(pb); | |
1228 | if (error != 0) { | 1228 | if (error != 0) { | |
1229 | for (j = 0; j < lookedup; ++j) | 1229 | for (j = 0; j < lookedup; ++j) | |
1230 | (void)vn_close(vpp[j], FREAD|FWRITE, | 1230 | (void)vn_close(vpp[j], FREAD|FWRITE, | |
1231 | uc); | 1231 | uc); | |
1232 | kmem_free(vpp, ccio->ccio_ndisks * | 1232 | kmem_free(vpp, ccio->ccio_ndisks * | |
1233 | sizeof(*vpp)); | 1233 | sizeof(*vpp)); | |
1234 | kmem_free(cpp, ccio->ccio_ndisks * | 1234 | kmem_free(cpp, ccio->ccio_ndisks * | |
1235 | sizeof(*cpp)); | 1235 | sizeof(*cpp)); | |
1236 | goto out; | 1236 | goto out; | |
1237 | } | 1237 | } | |
1238 | ++lookedup; | 1238 | ++lookedup; |
--- src/sys/dev/cgd.c 2018/01/23 22:42:29 1.116
+++ src/sys/dev/cgd.c 2019/12/08 12:14:40 1.117
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: cgd.c,v 1.116 2018/01/23 22:42:29 pgoyette Exp $ */ | 1 | /* $NetBSD: cgd.c,v 1.117 2019/12/08 12:14:40 mlelstv Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2002 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2002 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Roland C. Dowdeswell. | 8 | * by Roland C. Dowdeswell. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -20,27 +20,27 @@ | @@ -20,27 +20,27 @@ | |||
20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
29 | * POSSIBILITY OF SUCH DAMAGE. | 29 | * POSSIBILITY OF SUCH DAMAGE. | |
30 | */ | 30 | */ | |
31 | 31 | |||
32 | #include <sys/cdefs.h> | 32 | #include <sys/cdefs.h> | |
33 | __KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.116 2018/01/23 22:42:29 pgoyette Exp $"); | 33 | __KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.117 2019/12/08 12:14:40 mlelstv Exp $"); | |
34 | 34 | |||
35 | #include <sys/types.h> | 35 | #include <sys/types.h> | |
36 | #include <sys/param.h> | 36 | #include <sys/param.h> | |
37 | #include <sys/systm.h> | 37 | #include <sys/systm.h> | |
38 | #include <sys/proc.h> | 38 | #include <sys/proc.h> | |
39 | #include <sys/errno.h> | 39 | #include <sys/errno.h> | |
40 | #include <sys/buf.h> | 40 | #include <sys/buf.h> | |
41 | #include <sys/bufq.h> | 41 | #include <sys/bufq.h> | |
42 | #include <sys/malloc.h> | 42 | #include <sys/malloc.h> | |
43 | #include <sys/module.h> | 43 | #include <sys/module.h> | |
44 | #include <sys/pool.h> | 44 | #include <sys/pool.h> | |
45 | #include <sys/ioctl.h> | 45 | #include <sys/ioctl.h> | |
46 | #include <sys/device.h> | 46 | #include <sys/device.h> | |
@@ -772,27 +772,27 @@ cgd_ioctl_set(struct cgd_softc *cs, void | @@ -772,27 +772,27 @@ cgd_ioctl_set(struct cgd_softc *cs, void | |||
772 | size_t i; | 772 | size_t i; | |
773 | size_t keybytes; /* key length in bytes */ | 773 | size_t keybytes; /* key length in bytes */ | |
774 | const char *cp; | 774 | const char *cp; | |
775 | struct pathbuf *pb; | 775 | struct pathbuf *pb; | |
776 | char *inbuf; | 776 | char *inbuf; | |
777 | struct dk_softc *dksc = &cs->sc_dksc; | 777 | struct dk_softc *dksc = &cs->sc_dksc; | |
778 | 778 | |||
779 | cp = ci->ci_disk; | 779 | cp = ci->ci_disk; | |
780 | 780 | |||
781 | ret = pathbuf_copyin(ci->ci_disk, &pb); | 781 | ret = pathbuf_copyin(ci->ci_disk, &pb); | |
782 | if (ret != 0) { | 782 | if (ret != 0) { | |
783 | return ret; | 783 | return ret; | |
784 | } | 784 | } | |
785 | ret = dk_lookup(pb, l, &vp); | 785 | ret = vn_bdev_openpath(pb, &vp, l); | |
786 | pathbuf_destroy(pb); | 786 | pathbuf_destroy(pb); | |
787 | if (ret != 0) { | 787 | if (ret != 0) { | |
788 | return ret; | 788 | return ret; | |
789 | } | 789 | } | |
790 | 790 | |||
791 | inbuf = malloc(MAX_KEYSIZE, M_TEMP, M_WAITOK); | 791 | inbuf = malloc(MAX_KEYSIZE, M_TEMP, M_WAITOK); | |
792 | 792 | |||
793 | if ((ret = cgdinit(cs, cp, vp, l)) != 0) | 793 | if ((ret = cgdinit(cs, cp, vp, l)) != 0) | |
794 | goto bail; | 794 | goto bail; | |
795 | 795 | |||
796 | (void)memset(inbuf, 0, MAX_KEYSIZE); | 796 | (void)memset(inbuf, 0, MAX_KEYSIZE); | |
797 | ret = copyinstr(ci->ci_alg, inbuf, 256, NULL); | 797 | ret = copyinstr(ci->ci_alg, inbuf, 256, NULL); | |
798 | if (ret) | 798 | if (ret) |
--- src/sys/dev/dm/dm_pdev.c 2019/12/07 15:28:39 1.18
+++ src/sys/dev/dm/dm_pdev.c 2019/12/08 12:14:40 1.19
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: dm_pdev.c,v 1.18 2019/12/07 15:28:39 tkusumi Exp $ */ | 1 | /* $NetBSD: dm_pdev.c,v 1.19 2019/12/08 12:14:40 mlelstv Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2008 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2008 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Adam Hamsik. | 8 | * by Adam Hamsik. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -19,27 +19,27 @@ | @@ -19,27 +19,27 @@ | |||
19 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | 19 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | |
20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
29 | * POSSIBILITY OF SUCH DAMAGE. | 29 | * POSSIBILITY OF SUCH DAMAGE. | |
30 | */ | 30 | */ | |
31 | #include <sys/cdefs.h> | 31 | #include <sys/cdefs.h> | |
32 | __KERNEL_RCSID(0, "$NetBSD: dm_pdev.c,v 1.18 2019/12/07 15:28:39 tkusumi Exp $"); | 32 | __KERNEL_RCSID(0, "$NetBSD: dm_pdev.c,v 1.19 2019/12/08 12:14:40 mlelstv Exp $"); | |
33 | 33 | |||
34 | #include <sys/types.h> | 34 | #include <sys/types.h> | |
35 | #include <sys/param.h> | 35 | #include <sys/param.h> | |
36 | 36 | |||
37 | #include <sys/disk.h> | 37 | #include <sys/disk.h> | |
38 | #include <sys/fcntl.h> | 38 | #include <sys/fcntl.h> | |
39 | #include <sys/kmem.h> | 39 | #include <sys/kmem.h> | |
40 | #include <sys/namei.h> | 40 | #include <sys/namei.h> | |
41 | 41 | |||
42 | #include <dev/dkvar.h> | 42 | #include <dev/dkvar.h> | |
43 | 43 | |||
44 | #include "dm.h" | 44 | #include "dm.h" | |
45 | 45 | |||
@@ -106,30 +106,30 @@ dm_pdev_insert(const char *dev_name) | @@ -106,30 +106,30 @@ dm_pdev_insert(const char *dev_name) | |||
106 | if ((dmp = dm_pdev_alloc(dev_name)) == NULL) { | 106 | if ((dmp = dm_pdev_alloc(dev_name)) == NULL) { | |
107 | mutex_exit(&dm_pdev_mutex); | 107 | mutex_exit(&dm_pdev_mutex); | |
108 | return NULL; | 108 | return NULL; | |
109 | } | 109 | } | |
110 | 110 | |||
111 | dev_pb = pathbuf_create(dev_name); | 111 | dev_pb = pathbuf_create(dev_name); | |
112 | if (dev_pb == NULL) { | 112 | if (dev_pb == NULL) { | |
113 | aprint_debug("%s: pathbuf_create on device: %s failed!\n", | 113 | aprint_debug("%s: pathbuf_create on device: %s failed!\n", | |
114 | __func__, dev_name); | 114 | __func__, dev_name); | |
115 | mutex_exit(&dm_pdev_mutex); | 115 | mutex_exit(&dm_pdev_mutex); | |
116 | kmem_free(dmp, sizeof(dm_pdev_t)); | 116 | kmem_free(dmp, sizeof(dm_pdev_t)); | |
117 | return NULL; | 117 | return NULL; | |
118 | } | 118 | } | |
119 | error = dk_lookup(dev_pb, curlwp, &dmp->pdev_vnode); | 119 | error = vn_bdev_openpath(dev_pb, &dmp->pdev_vnode, curlwp); | |
120 | pathbuf_destroy(dev_pb); | 120 | pathbuf_destroy(dev_pb); | |
121 | if (error) { | 121 | if (error) { | |
122 | aprint_debug("%s: dk_lookup on device: %s (error %d)\n", | 122 | aprint_debug("%s: lookup on device: %s (error %d)\n", | |
123 | __func__, dev_name, error); | 123 | __func__, dev_name, error); | |
124 | mutex_exit(&dm_pdev_mutex); | 124 | mutex_exit(&dm_pdev_mutex); | |
125 | kmem_free(dmp, sizeof(dm_pdev_t)); | 125 | kmem_free(dmp, sizeof(dm_pdev_t)); | |
126 | return NULL; | 126 | return NULL; | |
127 | } | 127 | } | |
128 | getdisksize(dmp->pdev_vnode, &dmp->pdev_numsec, &dmp->pdev_secsize); | 128 | getdisksize(dmp->pdev_vnode, &dmp->pdev_numsec, &dmp->pdev_secsize); | |
129 | dmp->ref_cnt = 1; | 129 | dmp->ref_cnt = 1; | |
130 | 130 | |||
131 | SLIST_INSERT_HEAD(&dm_pdev_list, dmp, next_pdev); | 131 | SLIST_INSERT_HEAD(&dm_pdev_list, dmp, next_pdev); | |
132 | mutex_exit(&dm_pdev_mutex); | 132 | mutex_exit(&dm_pdev_mutex); | |
133 | 133 | |||
134 | return dmp; | 134 | return dmp; | |
135 | } | 135 | } |
--- src/sys/dev/raidframe/rf_copyback.c 2019/10/10 03:43:59 1.52
+++ src/sys/dev/raidframe/rf_copyback.c 2019/12/08 12:14:40 1.53
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: rf_copyback.c,v 1.52 2019/10/10 03:43:59 christos Exp $ */ | 1 | /* $NetBSD: rf_copyback.c,v 1.53 2019/12/08 12:14:40 mlelstv Exp $ */ | |
2 | /* | 2 | /* | |
3 | * Copyright (c) 1995 Carnegie-Mellon University. | 3 | * Copyright (c) 1995 Carnegie-Mellon University. | |
4 | * All rights reserved. | 4 | * All rights reserved. | |
5 | * | 5 | * | |
6 | * Author: Mark Holland | 6 | * Author: Mark Holland | |
7 | * | 7 | * | |
8 | * Permission to use, copy, modify and distribute this software and | 8 | * Permission to use, copy, modify and distribute this software and | |
9 | * its documentation is hereby granted, provided that both the copyright | 9 | * its documentation is hereby granted, provided that both the copyright | |
10 | * notice and this permission notice appear in all copies of the | 10 | * notice and this permission notice appear in all copies of the | |
11 | * software, derivative works or modified versions, and any portions | 11 | * software, derivative works or modified versions, and any portions | |
12 | * thereof, and that both notices appear in supporting documentation. | 12 | * thereof, and that both notices appear in supporting documentation. | |
13 | * | 13 | * | |
14 | * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" | 14 | * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" | |
@@ -28,27 +28,27 @@ | @@ -28,27 +28,27 @@ | |||
28 | 28 | |||
29 | /***************************************************************************** | 29 | /***************************************************************************** | |
30 | * | 30 | * | |
31 | * copyback.c -- code to copy reconstructed data back from spare space to | 31 | * copyback.c -- code to copy reconstructed data back from spare space to | |
32 | * the replaced disk. | 32 | * the replaced disk. | |
33 | * | 33 | * | |
34 | * the code operates using callbacks on the I/Os to continue with the | 34 | * the code operates using callbacks on the I/Os to continue with the | |
35 | * next unit to be copied back. We do this because a simple loop | 35 | * next unit to be copied back. We do this because a simple loop | |
36 | * containing blocking I/Os will not work in the simulator. | 36 | * containing blocking I/Os will not work in the simulator. | |
37 | * | 37 | * | |
38 | ****************************************************************************/ | 38 | ****************************************************************************/ | |
39 | 39 | |||
40 | #include <sys/cdefs.h> | 40 | #include <sys/cdefs.h> | |
41 | __KERNEL_RCSID(0, "$NetBSD: rf_copyback.c,v 1.52 2019/10/10 03:43:59 christos Exp $"); | 41 | __KERNEL_RCSID(0, "$NetBSD: rf_copyback.c,v 1.53 2019/12/08 12:14:40 mlelstv Exp $"); | |
42 | 42 | |||
43 | #include <dev/raidframe/raidframevar.h> | 43 | #include <dev/raidframe/raidframevar.h> | |
44 | 44 | |||
45 | #include <sys/time.h> | 45 | #include <sys/time.h> | |
46 | #include <sys/buf.h> | 46 | #include <sys/buf.h> | |
47 | #include "rf_raid.h" | 47 | #include "rf_raid.h" | |
48 | #include "rf_mcpair.h" | 48 | #include "rf_mcpair.h" | |
49 | #include "rf_acctrace.h" | 49 | #include "rf_acctrace.h" | |
50 | #include "rf_etimer.h" | 50 | #include "rf_etimer.h" | |
51 | #include "rf_general.h" | 51 | #include "rf_general.h" | |
52 | #include "rf_utils.h" | 52 | #include "rf_utils.h" | |
53 | #include "rf_copyback.h" | 53 | #include "rf_copyback.h" | |
54 | #include "rf_decluster.h" | 54 | #include "rf_decluster.h" | |
@@ -134,31 +134,31 @@ rf_CopybackReconstructedData(RF_Raid_t * | @@ -134,31 +134,31 @@ rf_CopybackReconstructedData(RF_Raid_t * | |||
134 | raidPtr->Disks[fcol].auto_configured = 0; | 134 | raidPtr->Disks[fcol].auto_configured = 0; | |
135 | 135 | |||
136 | printf("About to (re-)open the device: %s\n", | 136 | printf("About to (re-)open the device: %s\n", | |
137 | raidPtr->Disks[fcol].devname); | 137 | raidPtr->Disks[fcol].devname); | |
138 | 138 | |||
139 | dev_pb = pathbuf_create(raidPtr->Disks[fcol].devname); | 139 | dev_pb = pathbuf_create(raidPtr->Disks[fcol].devname); | |
140 | if (dev_pb == NULL) { | 140 | if (dev_pb == NULL) { | |
141 | /* shouldn't happen unless maybe the system is OOMing */ | 141 | /* shouldn't happen unless maybe the system is OOMing */ | |
142 | printf("raid%d: copyback: pathbuf_create on device: %s failed: %d!\n", | 142 | printf("raid%d: copyback: pathbuf_create on device: %s failed: %d!\n", | |
143 | raidPtr->raidid, raidPtr->Disks[fcol].devname, | 143 | raidPtr->raidid, raidPtr->Disks[fcol].devname, | |
144 | ENOMEM); | 144 | ENOMEM); | |
145 | return; | 145 | return; | |
146 | } | 146 | } | |
147 | retcode = dk_lookup(dev_pb, curlwp, &vp); | 147 | retcode = vn_bdev_openpath(dev_pb, &vp, curlwp); | |
148 | pathbuf_destroy(dev_pb); | 148 | pathbuf_destroy(dev_pb); | |
149 | 149 | |||
150 | if (retcode) { | 150 | if (retcode) { | |
151 | printf("raid%d: copyback: dk_lookup on device: %s failed: %d!\n", | 151 | printf("raid%d: copyback: open device: %s failed: %d!\n", | |
152 | raidPtr->raidid, raidPtr->Disks[fcol].devname, | 152 | raidPtr->raidid, raidPtr->Disks[fcol].devname, | |
153 | retcode); | 153 | retcode); | |
154 | 154 | |||
155 | /* XXX the component isn't responding properly... must be | 155 | /* XXX the component isn't responding properly... must be | |
156 | * still dead :-( */ | 156 | * still dead :-( */ | |
157 | return; | 157 | return; | |
158 | 158 | |||
159 | } else { | 159 | } else { | |
160 | 160 | |||
161 | /* Ok, so we can at least do a lookup... How about actually | 161 | /* Ok, so we can at least do a lookup... How about actually | |
162 | * getting a vp for it? */ | 162 | * getting a vp for it? */ | |
163 | 163 | |||
164 | retcode = rf_getdisksize(vp, &raidPtr->Disks[fcol]); | 164 | retcode = rf_getdisksize(vp, &raidPtr->Disks[fcol]); |
--- src/sys/dev/raidframe/rf_disks.c 2019/02/09 03:34:00 1.91
+++ src/sys/dev/raidframe/rf_disks.c 2019/12/08 12:14:40 1.92
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: rf_disks.c,v 1.91 2019/02/09 03:34:00 christos Exp $ */ | 1 | /* $NetBSD: rf_disks.c,v 1.92 2019/12/08 12:14:40 mlelstv Exp $ */ | |
2 | /*- | 2 | /*- | |
3 | * Copyright (c) 1999 The NetBSD Foundation, Inc. | 3 | * Copyright (c) 1999 The NetBSD Foundation, Inc. | |
4 | * All rights reserved. | 4 | * All rights reserved. | |
5 | * | 5 | * | |
6 | * This code is derived from software contributed to The NetBSD Foundation | 6 | * This code is derived from software contributed to The NetBSD Foundation | |
7 | * by Greg Oster | 7 | * by Greg Oster | |
8 | * | 8 | * | |
9 | * Redistribution and use in source and binary forms, with or without | 9 | * Redistribution and use in source and binary forms, with or without | |
10 | * modification, are permitted provided that the following conditions | 10 | * modification, are permitted provided that the following conditions | |
11 | * are met: | 11 | * are met: | |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright | |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. | |
14 | * 2. Redistributions in binary form must reproduce the above copyright | 14 | * 2. Redistributions in binary form must reproduce the above copyright | |
@@ -50,27 +50,27 @@ | @@ -50,27 +50,27 @@ | |||
50 | * School of Computer Science | 50 | * School of Computer Science | |
51 | * Carnegie Mellon University | 51 | * Carnegie Mellon University | |
52 | * Pittsburgh PA 15213-3890 | 52 | * Pittsburgh PA 15213-3890 | |
53 | * | 53 | * | |
54 | * any improvements or extensions that they make and grant Carnegie the | 54 | * any improvements or extensions that they make and grant Carnegie the | |
55 | * rights to redistribute these changes. | 55 | * rights to redistribute these changes. | |
56 | */ | 56 | */ | |
57 | 57 | |||
58 | /*************************************************************** | 58 | /*************************************************************** | |
59 | * rf_disks.c -- code to perform operations on the actual disks | 59 | * rf_disks.c -- code to perform operations on the actual disks | |
60 | ***************************************************************/ | 60 | ***************************************************************/ | |
61 | 61 | |||
62 | #include <sys/cdefs.h> | 62 | #include <sys/cdefs.h> | |
63 | __KERNEL_RCSID(0, "$NetBSD: rf_disks.c,v 1.91 2019/02/09 03:34:00 christos Exp $"); | 63 | __KERNEL_RCSID(0, "$NetBSD: rf_disks.c,v 1.92 2019/12/08 12:14:40 mlelstv Exp $"); | |
64 | 64 | |||
65 | #include <dev/raidframe/raidframevar.h> | 65 | #include <dev/raidframe/raidframevar.h> | |
66 | 66 | |||
67 | #include "rf_raid.h" | 67 | #include "rf_raid.h" | |
68 | #include "rf_alloclist.h" | 68 | #include "rf_alloclist.h" | |
69 | #include "rf_utils.h" | 69 | #include "rf_utils.h" | |
70 | #include "rf_general.h" | 70 | #include "rf_general.h" | |
71 | #include "rf_options.h" | 71 | #include "rf_options.h" | |
72 | #include "rf_kintf.h" | 72 | #include "rf_kintf.h" | |
73 | #include "rf_netbsd.h" | 73 | #include "rf_netbsd.h" | |
74 | 74 | |||
75 | #include <sys/param.h> | 75 | #include <sys/param.h> | |
76 | #include <sys/systm.h> | 76 | #include <sys/systm.h> | |
@@ -594,30 +594,30 @@ rf_ConfigureDisk(RF_Raid_t *raidPtr, cha | @@ -594,30 +594,30 @@ rf_ConfigureDisk(RF_Raid_t *raidPtr, cha | |||
594 | printf("Ignoring missing component at column %d\n", col); | 594 | printf("Ignoring missing component at column %d\n", col); | |
595 | snprintf(diskPtr->devname, sizeof(diskPtr->devname), | 595 | snprintf(diskPtr->devname, sizeof(diskPtr->devname), | |
596 | "component%d", col); | 596 | "component%d", col); | |
597 | diskPtr->status = rf_ds_failed; | 597 | diskPtr->status = rf_ds_failed; | |
598 | return (0); | 598 | return (0); | |
599 | } | 599 | } | |
600 | 600 | |||
601 | pb = pathbuf_create(diskPtr->devname); | 601 | pb = pathbuf_create(diskPtr->devname); | |
602 | if (pb == NULL) { | 602 | if (pb == NULL) { | |
603 | printf("pathbuf_create for device: %s failed!\n", | 603 | printf("pathbuf_create for device: %s failed!\n", | |
604 | diskPtr->devname); | 604 | diskPtr->devname); | |
605 | return ENOMEM; | 605 | return ENOMEM; | |
606 | } | 606 | } | |
607 | error = dk_lookup(pb, curlwp, &vp); | 607 | error = vn_bdev_openpath(pb, &vp, curlwp); | |
608 | pathbuf_destroy(pb); | 608 | pathbuf_destroy(pb); | |
609 | if (error) { | 609 | if (error) { | |
610 | printf("dk_lookup on device: %s failed!\n", diskPtr->devname); | 610 | printf("open device: %s failed!\n", diskPtr->devname); | |
611 | if (error == ENXIO) { | 611 | if (error == ENXIO) { | |
612 | /* the component isn't there... must be dead :-( */ | 612 | /* the component isn't there... must be dead :-( */ | |
613 | diskPtr->status = rf_ds_failed; | 613 | diskPtr->status = rf_ds_failed; | |
614 | return 0; | 614 | return 0; | |
615 | } else { | 615 | } else { | |
616 | return (error); | 616 | return (error); | |
617 | } | 617 | } | |
618 | } | 618 | } | |
619 | 619 | |||
620 | if ((error = rf_getdisksize(vp, diskPtr)) != 0) | 620 | if ((error = rf_getdisksize(vp, diskPtr)) != 0) | |
621 | return (error); | 621 | return (error); | |
622 | 622 | |||
623 | /* | 623 | /* |
--- src/sys/dev/raidframe/rf_reconstruct.c 2019/10/10 03:43:59 1.123
+++ src/sys/dev/raidframe/rf_reconstruct.c 2019/12/08 12:14:40 1.124
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: rf_reconstruct.c,v 1.123 2019/10/10 03:43:59 christos Exp $ */ | 1 | /* $NetBSD: rf_reconstruct.c,v 1.124 2019/12/08 12:14:40 mlelstv Exp $ */ | |
2 | /* | 2 | /* | |
3 | * Copyright (c) 1995 Carnegie-Mellon University. | 3 | * Copyright (c) 1995 Carnegie-Mellon University. | |
4 | * All rights reserved. | 4 | * All rights reserved. | |
5 | * | 5 | * | |
6 | * Author: Mark Holland | 6 | * Author: Mark Holland | |
7 | * | 7 | * | |
8 | * Permission to use, copy, modify and distribute this software and | 8 | * Permission to use, copy, modify and distribute this software and | |
9 | * its documentation is hereby granted, provided that both the copyright | 9 | * its documentation is hereby granted, provided that both the copyright | |
10 | * notice and this permission notice appear in all copies of the | 10 | * notice and this permission notice appear in all copies of the | |
11 | * software, derivative works or modified versions, and any portions | 11 | * software, derivative works or modified versions, and any portions | |
12 | * thereof, and that both notices appear in supporting documentation. | 12 | * thereof, and that both notices appear in supporting documentation. | |
13 | * | 13 | * | |
14 | * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" | 14 | * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" | |
@@ -23,27 +23,27 @@ | @@ -23,27 +23,27 @@ | |||
23 | * Pittsburgh PA 15213-3890 | 23 | * Pittsburgh PA 15213-3890 | |
24 | * | 24 | * | |
25 | * any improvements or extensions that they make and grant Carnegie the | 25 | * any improvements or extensions that they make and grant Carnegie the | |
26 | * rights to redistribute these changes. | 26 | * rights to redistribute these changes. | |
27 | */ | 27 | */ | |
28 | 28 | |||
29 | /************************************************************ | 29 | /************************************************************ | |
30 | * | 30 | * | |
31 | * rf_reconstruct.c -- code to perform on-line reconstruction | 31 | * rf_reconstruct.c -- code to perform on-line reconstruction | |
32 | * | 32 | * | |
33 | ************************************************************/ | 33 | ************************************************************/ | |
34 | 34 | |||
35 | #include <sys/cdefs.h> | 35 | #include <sys/cdefs.h> | |
36 | __KERNEL_RCSID(0, "$NetBSD: rf_reconstruct.c,v 1.123 2019/10/10 03:43:59 christos Exp $"); | 36 | __KERNEL_RCSID(0, "$NetBSD: rf_reconstruct.c,v 1.124 2019/12/08 12:14:40 mlelstv Exp $"); | |
37 | 37 | |||
38 | #include <sys/param.h> | 38 | #include <sys/param.h> | |
39 | #include <sys/time.h> | 39 | #include <sys/time.h> | |
40 | #include <sys/buf.h> | 40 | #include <sys/buf.h> | |
41 | #include <sys/errno.h> | 41 | #include <sys/errno.h> | |
42 | #include <sys/systm.h> | 42 | #include <sys/systm.h> | |
43 | #include <sys/proc.h> | 43 | #include <sys/proc.h> | |
44 | #include <sys/ioctl.h> | 44 | #include <sys/ioctl.h> | |
45 | #include <sys/fcntl.h> | 45 | #include <sys/fcntl.h> | |
46 | #include <sys/vnode.h> | 46 | #include <sys/vnode.h> | |
47 | #include <sys/namei.h> /* for pathbuf */ | 47 | #include <sys/namei.h> /* for pathbuf */ | |
48 | #include <dev/raidframe/raidframevar.h> | 48 | #include <dev/raidframe/raidframevar.h> | |
49 | 49 | |||
@@ -433,32 +433,32 @@ rf_ReconstructInPlace(RF_Raid_t *raidPtr | @@ -433,32 +433,32 @@ rf_ReconstructInPlace(RF_Raid_t *raidPtr | |||
433 | } | 433 | } | |
434 | /* note that this disk was *not* auto_configured (any longer)*/ | 434 | /* note that this disk was *not* auto_configured (any longer)*/ | |
435 | raidPtr->Disks[col].auto_configured = 0; | 435 | raidPtr->Disks[col].auto_configured = 0; | |
436 | 436 | |||
437 | #if 0 | 437 | #if 0 | |
438 | printf("About to (re-)open the device for rebuilding: %s\n", | 438 | printf("About to (re-)open the device for rebuilding: %s\n", | |
439 | raidPtr->Disks[col].devname); | 439 | raidPtr->Disks[col].devname); | |
440 | #endif | 440 | #endif | |
441 | rf_unlock_mutex2(raidPtr->mutex); | 441 | rf_unlock_mutex2(raidPtr->mutex); | |
442 | pb = pathbuf_create(raidPtr->Disks[col].devname); | 442 | pb = pathbuf_create(raidPtr->Disks[col].devname); | |
443 | if (pb == NULL) { | 443 | if (pb == NULL) { | |
444 | retcode = ENOMEM; | 444 | retcode = ENOMEM; | |
445 | } else { | 445 | } else { | |
446 | retcode = dk_lookup(pb, curlwp, &vp); | 446 | retcode = vn_bdev_openpath(pb, &vp, curlwp); | |
447 | pathbuf_destroy(pb); | 447 | pathbuf_destroy(pb); | |
448 | } | 448 | } | |
449 | 449 | |||
450 | if (retcode) { | 450 | if (retcode) { | |
451 | printf("raid%d: rebuilding: dk_lookup on device: %s failed: %d!\n",raidPtr->raidid, | 451 | printf("raid%d: rebuilding: open device: %s failed: %d!\n",raidPtr->raidid, | |
452 | raidPtr->Disks[col].devname, retcode); | 452 | raidPtr->Disks[col].devname, retcode); | |
453 | 453 | |||
454 | /* the component isn't responding properly... | 454 | /* the component isn't responding properly... | |
455 | must be still dead :-( */ | 455 | must be still dead :-( */ | |
456 | rf_lock_mutex2(raidPtr->mutex); | 456 | rf_lock_mutex2(raidPtr->mutex); | |
457 | raidPtr->reconInProgress--; | 457 | raidPtr->reconInProgress--; | |
458 | rf_signal_cond2(raidPtr->waitForReconCond); | 458 | rf_signal_cond2(raidPtr->waitForReconCond); | |
459 | rf_unlock_mutex2(raidPtr->mutex); | 459 | rf_unlock_mutex2(raidPtr->mutex); | |
460 | return(retcode); | 460 | return(retcode); | |
461 | } | 461 | } | |
462 | 462 | |||
463 | /* Ok, so we can at least do a lookup... | 463 | /* Ok, so we can at least do a lookup... | |
464 | How about actually getting a vp for it? */ | 464 | How about actually getting a vp for it? */ |