Fri Oct 11 08:05:19 2019 UTC ()
Regen.


(hannken)
diff -r1.107 -r1.108 src/sys/kern/vnode_if.c

cvs diff -r1.107 -r1.108 src/sys/kern/vnode_if.c (expand / switch to unified diff)

--- src/sys/kern/vnode_if.c 2017/07/12 09:31:59 1.107
+++ src/sys/kern/vnode_if.c 2019/10/11 08:05:19 1.108
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: vnode_if.c,v 1.107 2017/07/12 09:31:59 hannken Exp $ */ 1/* $NetBSD: vnode_if.c,v 1.108 2019/10/11 08:05:19 hannken Exp $ */
2 2
3/* 3/*
4 * Warning: DO NOT EDIT! This file is automatically generated! 4 * Warning: DO NOT EDIT! This file is automatically generated!
5 * (Modifications made here may easily be lost!) 5 * (Modifications made here may easily be lost!)
6 * 6 *
7 * Created from the file: 7 * Created from the file:
8 * NetBSD: vnode_if.src,v 1.77 2017/07/12 09:31:07 hannken Exp 8 * NetBSD: vnode_if.src,v 1.77 2017/07/12 09:31:07 hannken Exp
9 * by the script: 9 * by the script:
10 * NetBSD: vnode_if.sh,v 1.66 2017/06/04 08:03:26 hannken Exp 10 * NetBSD: vnode_if.sh,v 1.66 2017/06/04 08:03:26 hannken Exp
11 */ 11 */
12 12
13/* 13/*
14 * Copyright (c) 1992, 1993, 1994, 1995 14 * Copyright (c) 1992, 1993, 1994, 1995
@@ -30,78 +30,80 @@ @@ -30,78 +30,80 @@
30 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 30 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
31 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 31 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
32 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 32 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
33 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 33 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
34 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 34 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
35 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 35 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
36 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 36 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
37 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 37 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
38 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 38 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
39 * SUCH DAMAGE. 39 * SUCH DAMAGE.
40 */ 40 */
41 41
42#include <sys/cdefs.h> 42#include <sys/cdefs.h>
43__KERNEL_RCSID(0, "$NetBSD: vnode_if.c,v 1.107 2017/07/12 09:31:59 hannken Exp $"); 43__KERNEL_RCSID(0, "$NetBSD: vnode_if.c,v 1.108 2019/10/11 08:05:19 hannken Exp $");
44 44
45#include <sys/param.h> 45#include <sys/param.h>
46#include <sys/mount.h> 46#include <sys/mount.h>
47#include <sys/buf.h> 47#include <sys/buf.h>
48#include <sys/vnode.h> 48#include <sys/vnode.h>
49#include <sys/lock.h> 49#include <sys/lock.h>
50#include <sys/fstrans.h> 50#include <sys/fstrans.h>
51 51
52enum fst_op { FST_NO, FST_YES, FST_TRY }; 52enum fst_op { FST_NO, FST_YES, FST_LAZY, FST_TRY };
53 53
54static inline int 54static inline int
55vop_pre(vnode_t *vp, struct mount **mp, bool *mpsafe, enum fst_op op) 55vop_pre(vnode_t *vp, struct mount **mp, bool *mpsafe, enum fst_op op)
56{ 56{
57 int error; 57 int error;
58 58
59 *mpsafe = (vp->v_vflag & VV_MPSAFE); 59 *mpsafe = (vp->v_vflag & VV_MPSAFE);
60 60
61 if (!*mpsafe) { 61 if (!*mpsafe) {
62 KERNEL_LOCK(1, curlwp); 62 KERNEL_LOCK(1, curlwp);
63 } 63 }
64 64
65 if (op == FST_YES || op == FST_TRY) { 65 if (op == FST_YES || op == FST_LAZY || op == FST_TRY) {
66 for (;;) { 66 for (;;) {
67 *mp = vp->v_mount; 67 *mp = vp->v_mount;
68 if (op == FST_TRY) { 68 if (op == FST_TRY) {
69 error = fstrans_start_nowait(*mp); 69 error = fstrans_start_nowait(*mp);
70 if (error) { 70 if (error) {
71 if (!*mpsafe) { 71 if (!*mpsafe) {
72 KERNEL_UNLOCK_ONE(curlwp); 72 KERNEL_UNLOCK_ONE(curlwp);
73 } 73 }
74 return error; 74 return error;
75 } 75 }
 76 } else if (op == FST_LAZY) {
 77 fstrans_start_lazy(*mp);
76 } else { 78 } else {
77 fstrans_start(*mp); 79 fstrans_start(*mp);
78 } 80 }
79 if (__predict_true(*mp == vp->v_mount)) 81 if (__predict_true(*mp == vp->v_mount))
80 break; 82 break;
81 fstrans_done(*mp); 83 fstrans_done(*mp);
82 } 84 }
83 } else { 85 } else {
84 *mp = vp->v_mount; 86 *mp = vp->v_mount;
85 } 87 }
86 88
87 return 0; 89 return 0;
88} 90}
89 91
90static inline void 92static inline void
91vop_post(vnode_t *vp, struct mount *mp, bool mpsafe, enum fst_op op) 93vop_post(vnode_t *vp, struct mount *mp, bool mpsafe, enum fst_op op)
92{ 94{
93 95
94 if (op == FST_YES) { 96 if (op == FST_YES || op == FST_LAZY) {
95 fstrans_done(mp); 97 fstrans_done(mp);
96 } 98 }
97 99
98 if (!mpsafe) { 100 if (!mpsafe) {
99 KERNEL_UNLOCK_ONE(curlwp); 101 KERNEL_UNLOCK_ONE(curlwp);
100 } 102 }
101} 103}
102 104
103const struct vnodeop_desc vop_default_desc = { 105const struct vnodeop_desc vop_default_desc = {
104 0, 106 0,
105 "default", 107 "default",
106 0, 108 0,
107 NULL, 109 NULL,
@@ -1368,31 +1370,31 @@ const struct vnodeop_desc vop_strategy_d @@ -1368,31 +1370,31 @@ const struct vnodeop_desc vop_strategy_d
1368 VDESC_NO_OFFSET, 1370 VDESC_NO_OFFSET,
1369}; 1371};
1370int 1372int
1371VOP_STRATEGY(struct vnode *vp, 1373VOP_STRATEGY(struct vnode *vp,
1372 struct buf *bp) 1374 struct buf *bp)
1373{ 1375{
1374 int error; 1376 int error;
1375 bool mpsafe; 1377 bool mpsafe;
1376 struct vop_strategy_args a; 1378 struct vop_strategy_args a;
1377 struct mount *mp; 1379 struct mount *mp;
1378 a.a_desc = VDESC(vop_strategy); 1380 a.a_desc = VDESC(vop_strategy);
1379 a.a_vp = vp; 1381 a.a_vp = vp;
1380 a.a_bp = bp; 1382 a.a_bp = bp;
1381 error = vop_pre(vp, &mp, &mpsafe, FST_YES); 1383 error = vop_pre(vp, &mp, &mpsafe, FST_LAZY);
1382 if (error) 1384 if (error)
1383 return error; 1385 return error;
1384 error = (VCALL(vp, VOFFSET(vop_strategy), &a)); 1386 error = (VCALL(vp, VOFFSET(vop_strategy), &a));
1385 vop_post(vp, mp, mpsafe, FST_YES); 1387 vop_post(vp, mp, mpsafe, FST_LAZY);
1386 return error; 1388 return error;
1387} 1389}
1388 1390
1389const int vop_print_vp_offsets[] = { 1391const int vop_print_vp_offsets[] = {
1390 VOPARG_OFFSETOF(struct vop_print_args,a_vp), 1392 VOPARG_OFFSETOF(struct vop_print_args,a_vp),
1391 VDESC_NO_OFFSET 1393 VDESC_NO_OFFSET
1392}; 1394};
1393const struct vnodeop_desc vop_print_desc = { 1395const struct vnodeop_desc vop_print_desc = {
1394 VOP_PRINT_DESCOFFSET, 1396 VOP_PRINT_DESCOFFSET,
1395 "vop_print", 1397 "vop_print",
1396 0, 1398 0,
1397 vop_print_vp_offsets, 1399 vop_print_vp_offsets,
1398 VDESC_NO_OFFSET, 1400 VDESC_NO_OFFSET,