Sat Jul 25 10:40:35 2015 UTC ()
Use accessors in DEBUG and DIAGNOSTIC code as well


(martin)
diff -r1.130 -r1.131 src/sys/ufs/lfs/lfs_bio.c
diff -r1.43 -r1.44 src/sys/ufs/lfs/lfs_debug.c
diff -r1.3 -r1.4 src/sys/ufs/lfs/lfs_pages.c
diff -r1.243 -r1.244 src/sys/ufs/lfs/lfs_segment.c
diff -r1.275 -r1.276 src/sys/ufs/lfs/lfs_vnops.c

cvs diff -r1.130 -r1.131 src/sys/ufs/lfs/lfs_bio.c (expand / switch to unified diff)

--- src/sys/ufs/lfs/lfs_bio.c 2015/07/24 06:59:32 1.130
+++ src/sys/ufs/lfs/lfs_bio.c 2015/07/25 10:40:35 1.131
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: lfs_bio.c,v 1.130 2015/07/24 06:59:32 dholland Exp $ */ 1/* $NetBSD: lfs_bio.c,v 1.131 2015/07/25 10:40:35 martin Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1999, 2000, 2001, 2002, 2003, 2008 The NetBSD Foundation, Inc. 4 * Copyright (c) 1999, 2000, 2001, 2002, 2003, 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 Konrad E. Schroder <perseant@hhhh.org>. 8 * by Konrad E. Schroder <perseant@hhhh.org>.
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.
@@ -50,27 +50,27 @@ @@ -50,27 +50,27 @@
50 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 50 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
51 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 51 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
52 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 52 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
53 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 53 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
54 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 54 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
55 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 55 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
56 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 56 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
57 * SUCH DAMAGE. 57 * SUCH DAMAGE.
58 * 58 *
59 * @(#)lfs_bio.c 8.10 (Berkeley) 6/10/95 59 * @(#)lfs_bio.c 8.10 (Berkeley) 6/10/95
60 */ 60 */
61 61
62#include <sys/cdefs.h> 62#include <sys/cdefs.h>
63__KERNEL_RCSID(0, "$NetBSD: lfs_bio.c,v 1.130 2015/07/24 06:59:32 dholland Exp $"); 63__KERNEL_RCSID(0, "$NetBSD: lfs_bio.c,v 1.131 2015/07/25 10:40:35 martin Exp $");
64 64
65#include <sys/param.h> 65#include <sys/param.h>
66#include <sys/systm.h> 66#include <sys/systm.h>
67#include <sys/proc.h> 67#include <sys/proc.h>
68#include <sys/buf.h> 68#include <sys/buf.h>
69#include <sys/vnode.h> 69#include <sys/vnode.h>
70#include <sys/resourcevar.h> 70#include <sys/resourcevar.h>
71#include <sys/mount.h> 71#include <sys/mount.h>
72#include <sys/kernel.h> 72#include <sys/kernel.h>
73#include <sys/kauth.h> 73#include <sys/kauth.h>
74 74
75#include <ufs/lfs/ulfs_inode.h> 75#include <ufs/lfs/ulfs_inode.h>
76#include <ufs/lfs/ulfsmount.h> 76#include <ufs/lfs/ulfsmount.h>
@@ -221,27 +221,27 @@ lfs_reserveavail(struct lfs *fs, struct  @@ -221,27 +221,27 @@ lfs_reserveavail(struct lfs *fs, struct
221 221
222 ASSERT_MAYBE_SEGLOCK(fs); 222 ASSERT_MAYBE_SEGLOCK(fs);
223 slept = 0; 223 slept = 0;
224 mutex_enter(&lfs_lock); 224 mutex_enter(&lfs_lock);
225 cantwait = (VTOI(vp)->i_flag & IN_ADIROP) || fs->lfs_unlockvp == vp; 225 cantwait = (VTOI(vp)->i_flag & IN_ADIROP) || fs->lfs_unlockvp == vp;
226 while (!cantwait && fsb > 0 && 226 while (!cantwait && fsb > 0 &&
227 !lfs_fits(fs, fsb + fs->lfs_ravail + fs->lfs_favail)) { 227 !lfs_fits(fs, fsb + fs->lfs_ravail + fs->lfs_favail)) {
228 mutex_exit(&lfs_lock); 228 mutex_exit(&lfs_lock);
229 229
230 if (!slept) { 230 if (!slept) {
231 DLOG((DLOG_AVAIL, "lfs_reserve: waiting for %ld (bfree = %d," 231 DLOG((DLOG_AVAIL, "lfs_reserve: waiting for %ld (bfree = %d,"
232 " est_bfree = %d)\n", 232 " est_bfree = %d)\n",
233 fsb + fs->lfs_ravail + fs->lfs_favail, 233 fsb + fs->lfs_ravail + fs->lfs_favail,
234 fs->lfs_bfree, LFS_EST_BFREE(fs))); 234 lfs_sb_getbfree(fs), LFS_EST_BFREE(fs)));
235 } 235 }
236 ++slept; 236 ++slept;
237 237
238 /* Wake up the cleaner */ 238 /* Wake up the cleaner */
239 LFS_CLEANERINFO(cip, fs, bp); 239 LFS_CLEANERINFO(cip, fs, bp);
240 LFS_SYNC_CLEANERINFO(cip, fs, bp, 0); 240 LFS_SYNC_CLEANERINFO(cip, fs, bp, 0);
241 lfs_wakeup_cleaner(fs); 241 lfs_wakeup_cleaner(fs);
242 242
243 mutex_enter(&lfs_lock); 243 mutex_enter(&lfs_lock);
244 /* Cleaner might have run while we were reading, check again */ 244 /* Cleaner might have run while we were reading, check again */
245 if (lfs_fits(fs, fsb + fs->lfs_ravail + fs->lfs_favail)) 245 if (lfs_fits(fs, fsb + fs->lfs_ravail + fs->lfs_favail))
246 break; 246 break;
247 247
@@ -357,27 +357,27 @@ lfs_fits(struct lfs *fs, int fsb) @@ -357,27 +357,27 @@ lfs_fits(struct lfs *fs, int fsb)
357{ 357{
358 int64_t needed; 358 int64_t needed;
359 359
360 ASSERT_NO_SEGLOCK(fs); 360 ASSERT_NO_SEGLOCK(fs);
361 needed = fsb + lfs_btofsb(fs, lfs_sb_getsumsize(fs)) + 361 needed = fsb + lfs_btofsb(fs, lfs_sb_getsumsize(fs)) +
362 ((howmany(lfs_sb_getuinodes(fs) + 1, LFS_INOPB(fs)) + 362 ((howmany(lfs_sb_getuinodes(fs) + 1, LFS_INOPB(fs)) +
363 lfs_sb_getsegtabsz(fs) + 363 lfs_sb_getsegtabsz(fs) +
364 1) << (lfs_sb_getbshift(fs) - lfs_sb_getffshift(fs))); 364 1) << (lfs_sb_getbshift(fs) - lfs_sb_getffshift(fs)));
365 365
366 if (needed >= lfs_sb_getavail(fs)) { 366 if (needed >= lfs_sb_getavail(fs)) {
367#ifdef DEBUG 367#ifdef DEBUG
368 DLOG((DLOG_AVAIL, "lfs_fits: no fit: fsb = %ld, uinodes = %ld, " 368 DLOG((DLOG_AVAIL, "lfs_fits: no fit: fsb = %ld, uinodes = %ld, "
369 "needed = %jd, avail = %jd\n", 369 "needed = %jd, avail = %jd\n",
370 (long)fsb, (long)fs->lfs_uinodes, (intmax_t)needed, 370 (long)fsb, (long)lfs_sb_getuinodes(fs), (intmax_t)needed,
371 (intmax_t)lfs_sb_getavail(fs))); 371 (intmax_t)lfs_sb_getavail(fs)));
372#endif 372#endif
373 return 0; 373 return 0;
374 } 374 }
375 return 1; 375 return 1;
376} 376}
377 377
378int 378int
379lfs_availwait(struct lfs *fs, int fsb) 379lfs_availwait(struct lfs *fs, int fsb)
380{ 380{
381 int error; 381 int error;
382 CLEANERINFO *cip; 382 CLEANERINFO *cip;
383 struct buf *cbp; 383 struct buf *cbp;

cvs diff -r1.43 -r1.44 src/sys/ufs/lfs/lfs_debug.c (expand / switch to unified diff)

--- src/sys/ufs/lfs/lfs_debug.c 2013/06/18 18:18:58 1.43
+++ src/sys/ufs/lfs/lfs_debug.c 2015/07/25 10:40:35 1.44
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: lfs_debug.c,v 1.43 2013/06/18 18:18:58 christos Exp $ */ 1/* $NetBSD: lfs_debug.c,v 1.44 2015/07/25 10:40:35 martin Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc. 4 * Copyright (c) 1999, 2000, 2001, 2002, 2003 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 Konrad E. Schroder <perseant@hhhh.org>. 8 * by Konrad E. Schroder <perseant@hhhh.org>.
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.
@@ -50,27 +50,27 @@ @@ -50,27 +50,27 @@
50 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 50 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
51 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 51 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
52 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 52 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
53 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 53 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
54 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 54 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
55 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 55 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
56 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 56 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
57 * SUCH DAMAGE. 57 * SUCH DAMAGE.
58 * 58 *
59 * @(#)lfs_debug.c 8.1 (Berkeley) 6/11/93 59 * @(#)lfs_debug.c 8.1 (Berkeley) 6/11/93
60 */ 60 */
61 61
62#include <sys/cdefs.h> 62#include <sys/cdefs.h>
63__KERNEL_RCSID(0, "$NetBSD: lfs_debug.c,v 1.43 2013/06/18 18:18:58 christos Exp $"); 63__KERNEL_RCSID(0, "$NetBSD: lfs_debug.c,v 1.44 2015/07/25 10:40:35 martin Exp $");
64 64
65#ifdef DEBUG 65#ifdef DEBUG
66 66
67#include <sys/param.h> 67#include <sys/param.h>
68#include <sys/systm.h> 68#include <sys/systm.h>
69#include <sys/namei.h> 69#include <sys/namei.h>
70#include <sys/vnode.h> 70#include <sys/vnode.h>
71#include <sys/mount.h> 71#include <sys/mount.h>
72#include <sys/buf.h> 72#include <sys/buf.h>
73#include <sys/syslog.h> 73#include <sys/syslog.h>
74#include <sys/proc.h> 74#include <sys/proc.h>
75 75
76#include <ufs/lfs/ulfs_inode.h> 76#include <ufs/lfs/ulfs_inode.h>
@@ -119,82 +119,82 @@ lfs_dumplog(void) @@ -119,82 +119,82 @@ lfs_dumplog(void)
119 lfs_log[i].line, 119 lfs_log[i].line,
120 cp); 120 cp);
121 } 121 }
122} 122}
123 123
124void 124void
125lfs_dump_super(struct lfs *lfsp) 125lfs_dump_super(struct lfs *lfsp)
126{ 126{
127 int i; 127 int i;
128 128
129 printf("%s%x\t%s%x\t%s%d\t%s%d\n", 129 printf("%s%x\t%s%x\t%s%d\t%s%d\n",
130 "magic ", lfsp->lfs_magic, 130 "magic ", lfsp->lfs_magic,
131 "version ", lfsp->lfs_version, 131 "version ", lfsp->lfs_version,
132 "size ", lfsp->lfs_size, 132 "size ", lfs_sb_getsize(lfsp),
133 "ssize ", lfsp->lfs_ssize); 133 "ssize ", lfs_sb_getssize(lfsp));
134 printf("%s%d\t%s%d\t%s%d\t%s%d\n", 134 printf("%s%d\t%s%d\t%s%d\t%s%d\n",
135 "dsize ", lfsp->lfs_dsize, 135 "dsize ", lfs_sb_getdsize(lfsp),
136 "bsize ", lfsp->lfs_bsize, 136 "bsize ", lfs_sb_getbsize(lfsp),
137 "fsize ", lfsp->lfs_fsize, 137 "fsize ", lfs_sb_getfsize(lfsp),
138 "frag ", lfsp->lfs_frag); 138 "frag ", lfs_sb_getfrag(lfsp));
139 139
140 printf("%s%d\t%s%d\t%s%d\t%s%d\n", 140 printf("%s%d\t%s%d\t%s%d\t%s%d\n",
141 "minfree ", lfsp->lfs_minfree, 141 "minfree ", lfs_sb_getminfree(lfsp),
142 "inopb ", lfsp->lfs_inopb, 142 "inopb ", lfs_sb_getinopb(lfsp),
143 "ifpb ", lfsp->lfs_ifpb, 143 "ifpb ", lfs_sb_getifpb(lfsp),
144 "nindir ", lfsp->lfs_nindir); 144 "nindir ", lfs_sb_getnindir(lfsp));
145 145
146 printf("%s%d\t%s%d\t%s%d\t%s%d\n", 146 printf("%s%d\t%s%d\t%s%d\t%s%d\n",
147 "nseg ", lfsp->lfs_nseg, 147 "nseg ", lfs_sb_getnseg(lfsp),
148 "nspf ", lfsp->lfs_nspf, 148 "nspf ", lfs_sb_getnspf(lfsp),
149 "cleansz ", lfsp->lfs_cleansz, 149 "cleansz ", lfs_sb_getcleansz(lfsp),
150 "segtabsz ", lfsp->lfs_segtabsz); 150 "segtabsz ", lfs_sb_getsegtabsz(lfsp));
151 151
152 printf("%s%x\t%s%d\t%s%lx\t%s%d\n", 152 printf("%s%x\t%s%d\t%s%lx\t%s%d\n",
153 "segmask ", lfsp->lfs_segmask, 153 "segmask ", lfs_sb_getsegmask(lfsp),
154 "segshift ", lfsp->lfs_segshift, 154 "segshift ", lfs_sb_getsegshift(lfsp),
155 "bmask ", (unsigned long)lfsp->lfs_bmask, 155 "bmask ", (unsigned long)lfs_sb_getbmask(lfsp),
156 "bshift ", lfsp->lfs_bshift); 156 "bshift ", lfs_sb_getbshift(lfsp));
157 157
158 printf("%s%lu\t%s%d\t%s%lx\t%s%u\n", 158 printf("%s%lu\t%s%d\t%s%lx\t%s%u\n",
159 "ffmask ", (unsigned long)lfsp->lfs_ffmask, 159 "ffmask ", (unsigned long)lfs_sb_getffmask(lfsp),
160 "ffshift ", lfsp->lfs_ffshift, 160 "ffshift ", lfs_sb_getffshift(lfsp),
161 "fbmask ", (unsigned long)lfsp->lfs_fbmask, 161 "fbmask ", (unsigned long)lfs_sb_getfbmask(lfsp),
162 "fbshift ", lfsp->lfs_fbshift); 162 "fbshift ", lfs_sb_getfbshift(lfsp));
163 163
164 printf("%s%d\t%s%d\t%s%x\t%s%qx\n", 164 printf("%s%d\t%s%d\t%s%x\t%s%qx\n",
165 "sushift ", lfsp->lfs_sushift, 165 "sushift ", lfs_sb_getsushift(lfsp),
166 "fsbtodb ", lfsp->lfs_fsbtodb, 166 "fsbtodb ", lfs_sb_getfsbtodb(lfsp),
167 "cksum ", lfsp->lfs_cksum, 167 "cksum ", lfs_sb_getcksum(lfsp),
168 "maxfilesize ", (long long)lfsp->lfs_maxfilesize); 168 "maxfilesize ", (long long)lfs_sb_getmaxfilesize(lfsp));
169 169
170 printf("Superblock disk addresses:"); 170 printf("Superblock disk addresses:");
171 for (i = 0; i < LFS_MAXNUMSB; i++) 171 for (i = 0; i < LFS_MAXNUMSB; i++)
172 printf(" %x", lfsp->lfs_sboffs[i]); 172 printf(" %x", lfs_sb_getsboff(lfsp, i));
173 printf("\n"); 173 printf("\n");
174 174
175 printf("Checkpoint Info\n"); 175 printf("Checkpoint Info\n");
176 printf("%s%d\t%s%x\t%s%d\n", 176 printf("%s%d\t%s%x\t%s%d\n",
177 "freehd ", lfsp->lfs_freehd, 177 "freehd ", lfs_sb_getfreehd(lfsp),
178 "idaddr ", lfsp->lfs_idaddr, 178 "idaddr ", lfs_sb_getidaddr(lfsp),
179 "ifile ", lfsp->lfs_ifile); 179 "ifile ", lfs_sb_getifile(lfsp));
180 printf("%s%x\t%s%d\t%s%x\t%s%x\t%s%x\t%s%x\n", 180 printf("%s%x\t%s%d\t%s%x\t%s%x\t%s%x\t%s%x\n",
181 "bfree ", lfsp->lfs_bfree, 181 "bfree ", lfs_sb_getbfree(lfsp),
182 "nfiles ", lfsp->lfs_nfiles, 182 "nfiles ", lfs_sb_getnfiles(lfsp),
183 "lastseg ", lfsp->lfs_lastseg, 183 "lastseg ", lfs_sb_getlastseg(lfsp),
184 "nextseg ", lfsp->lfs_nextseg, 184 "nextseg ", lfs_sb_getnextseg(lfsp),
185 "curseg ", lfsp->lfs_curseg, 185 "curseg ", lfs_sb_getcurseg(lfsp),
186 "offset ", lfsp->lfs_offset); 186 "offset ", lfs_sb_getoffset(lfsp));
187 printf("tstamp %llx\n", (long long)lfsp->lfs_tstamp); 187 printf("tstamp %llx\n", (long long)lfs_sb_gettstamp(lfsp));
188} 188}
189 189
190void 190void
191lfs_dump_dinode(struct ulfs1_dinode *dip) 191lfs_dump_dinode(struct ulfs1_dinode *dip)
192{ 192{
193 int i; 193 int i;
194 194
195 printf("%s%u\t%s%d\t%s%u\t%s%u\t%s%qu\t%s%d\n", 195 printf("%s%u\t%s%d\t%s%u\t%s%u\t%s%qu\t%s%d\n",
196 "mode ", dip->di_mode, 196 "mode ", dip->di_mode,
197 "nlink ", dip->di_nlink, 197 "nlink ", dip->di_nlink,
198 "uid ", dip->di_uid, 198 "uid ", dip->di_uid,
199 "gid ", dip->di_gid, 199 "gid ", dip->di_gid,
200 "size ", (long long)dip->di_size, 200 "size ", (long long)dip->di_size,
@@ -222,58 +222,58 @@ lfs_check_segsum(struct lfs *fs, struct  @@ -222,58 +222,58 @@ lfs_check_segsum(struct lfs *fs, struct
222 if ((actual = 1) == 1) 222 if ((actual = 1) == 1)
223 return; /* XXXX not checking this anymore, really */ 223 return; /* XXXX not checking this anymore, really */
224 224
225 if (sp->sum_bytes_left >= FINFOSIZE 225 if (sp->sum_bytes_left >= FINFOSIZE
226 && sp->fip->fi_nblocks > 512) { 226 && sp->fip->fi_nblocks > 512) {
227 printf("%s:%d: fi_nblocks = %d\n",file,line,sp->fip->fi_nblocks); 227 printf("%s:%d: fi_nblocks = %d\n",file,line,sp->fip->fi_nblocks);
228#ifdef DDB 228#ifdef DDB
229 Debugger(); 229 Debugger();
230#endif 230#endif
231 } 231 }
232 232
233 if (sp->sum_bytes_left > 484) { 233 if (sp->sum_bytes_left > 484) {
234 printf("%s:%d: bad value (%d = -%d) for sum_bytes_left\n", 234 printf("%s:%d: bad value (%d = -%d) for sum_bytes_left\n",
235 file, line, sp->sum_bytes_left, fs->lfs_sumsize-sp->sum_bytes_left); 235 file, line, sp->sum_bytes_left, lfs_sb_getsumsize(fs)-sp->sum_bytes_left);
236 panic("too many bytes"); 236 panic("too many bytes");
237 } 237 }
238 238
239 actual = fs->lfs_sumsize 239 actual = lfs_sb_getsumsize(fs)
240 /* amount taken up by FINFOs */ 240 /* amount taken up by FINFOs */
241 - ((char *)&(sp->fip->fi_blocks[sp->fip->fi_nblocks]) - (char *)(sp->segsum)) 241 - ((char *)&(sp->fip->fi_blocks[sp->fip->fi_nblocks]) - (char *)(sp->segsum))
242 /* amount taken up by inode blocks */ 242 /* amount taken up by inode blocks */
243 - sizeof(int32_t)*((sp->ninodes+LFS_INOPB(fs)-1) / LFS_INOPB(fs)); 243 - sizeof(int32_t)*((sp->ninodes+LFS_INOPB(fs)-1) / LFS_INOPB(fs));
244#if 0 244#if 0
245 if (actual - sp->sum_bytes_left < offset) 245 if (actual - sp->sum_bytes_left < offset)
246 { 246 {
247 printf("%s:%d: offset changed %d -> %d\n", file, line, 247 printf("%s:%d: offset changed %d -> %d\n", file, line,
248 offset, actual-sp->sum_bytes_left); 248 offset, actual-sp->sum_bytes_left);
249 offset = actual - sp->sum_bytes_left; 249 offset = actual - sp->sum_bytes_left;
250 /* panic("byte mismatch"); */ 250 /* panic("byte mismatch"); */
251 } 251 }
252#endif 252#endif
253#if 0 253#if 0
254 if (actual != sp->sum_bytes_left) 254 if (actual != sp->sum_bytes_left)
255 printf("%s:%d: warning: segsum miscalc at %d (-%d => %d)\n", 255 printf("%s:%d: warning: segsum miscalc at %d (-%d => %d)\n",
256 file, line, sp->sum_bytes_left, 256 file, line, sp->sum_bytes_left,
257 fs->lfs_sumsize-sp->sum_bytes_left, 257 fs->lfs_sumsize-sp->sum_bytes_left,
258 actual); 258 actual);
259#endif 259#endif
260 if (sp->sum_bytes_left > 0 260 if (sp->sum_bytes_left > 0
261 && ((char *)(sp->segsum))[fs->lfs_sumsize 261 && ((char *)(sp->segsum))[lfs_sb_getsumsize(fs)
262 - sizeof(int32_t) * ((sp->ninodes+LFS_INOPB(fs)-1) / LFS_INOPB(fs)) 262 - sizeof(int32_t) * ((sp->ninodes+LFS_INOPB(fs)-1) / LFS_INOPB(fs))
263 - sp->sum_bytes_left] != '\0') { 263 - sp->sum_bytes_left] != '\0') {
264 printf("%s:%d: warning: segsum overwrite at %d (-%d => %d)\n", 264 printf("%s:%d: warning: segsum overwrite at %d (-%d => %d)\n",
265 file, line, sp->sum_bytes_left, 265 file, line, sp->sum_bytes_left,
266 fs->lfs_sumsize-sp->sum_bytes_left, 266 lfs_sb_getsumsize(fs)-sp->sum_bytes_left,
267 actual); 267 actual);
268#ifdef DDB 268#ifdef DDB
269 Debugger(); 269 Debugger();
270#endif 270#endif
271 } 271 }
272} 272}
273 273
274void 274void
275lfs_check_bpp(struct lfs *fs, struct segment *sp, char *file, int line) 275lfs_check_bpp(struct lfs *fs, struct segment *sp, char *file, int line)
276{ 276{
277 daddr_t blkno; 277 daddr_t blkno;
278 struct buf **bpp; 278 struct buf **bpp;
279 struct vnode *devvp; 279 struct vnode *devvp;

cvs diff -r1.3 -r1.4 src/sys/ufs/lfs/lfs_pages.c (expand / switch to unified diff)

--- src/sys/ufs/lfs/lfs_pages.c 2015/07/24 06:59:32 1.3
+++ src/sys/ufs/lfs/lfs_pages.c 2015/07/25 10:40:35 1.4
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: lfs_pages.c,v 1.3 2015/07/24 06:59:32 dholland Exp $ */ 1/* $NetBSD: lfs_pages.c,v 1.4 2015/07/25 10:40:35 martin Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc. 4 * Copyright (c) 1999, 2000, 2001, 2002, 2003 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 Konrad E. Schroder <perseant@hhhh.org>. 8 * by Konrad E. Schroder <perseant@hhhh.org>.
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.
@@ -50,27 +50,27 @@ @@ -50,27 +50,27 @@
50 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 50 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
51 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 51 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
52 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 52 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
53 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 53 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
54 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 54 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
55 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 55 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
56 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 56 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
57 * SUCH DAMAGE. 57 * SUCH DAMAGE.
58 * 58 *
59 * @(#)lfs_vnops.c 8.13 (Berkeley) 6/10/95 59 * @(#)lfs_vnops.c 8.13 (Berkeley) 6/10/95
60 */ 60 */
61 61
62#include <sys/cdefs.h> 62#include <sys/cdefs.h>
63__KERNEL_RCSID(0, "$NetBSD: lfs_pages.c,v 1.3 2015/07/24 06:59:32 dholland Exp $"); 63__KERNEL_RCSID(0, "$NetBSD: lfs_pages.c,v 1.4 2015/07/25 10:40:35 martin Exp $");
64 64
65#ifdef _KERNEL_OPT 65#ifdef _KERNEL_OPT
66#include "opt_compat_netbsd.h" 66#include "opt_compat_netbsd.h"
67#include "opt_uvm_page_trkown.h" 67#include "opt_uvm_page_trkown.h"
68#endif 68#endif
69 69
70#include <sys/param.h> 70#include <sys/param.h>
71#include <sys/systm.h> 71#include <sys/systm.h>
72#include <sys/namei.h> 72#include <sys/namei.h>
73#include <sys/resourcevar.h> 73#include <sys/resourcevar.h>
74#include <sys/kernel.h> 74#include <sys/kernel.h>
75#include <sys/file.h> 75#include <sys/file.h>
76#include <sys/stat.h> 76#include <sys/stat.h>
@@ -774,43 +774,43 @@ lfs_putpages(void *v) @@ -774,43 +774,43 @@ lfs_putpages(void *v)
774 } 774 }
775  775
776 busypg = NULL; 776 busypg = NULL;
777 KASSERT(!mutex_owned(&uvm_pageqlock)); 777 KASSERT(!mutex_owned(&uvm_pageqlock));
778 oreclaim = (ap->a_flags & PGO_RECLAIM); 778 oreclaim = (ap->a_flags & PGO_RECLAIM);
779 ap->a_flags &= ~PGO_RECLAIM; 779 ap->a_flags &= ~PGO_RECLAIM;
780 error = genfs_do_putpages(vp, startoffset, endoffset, 780 error = genfs_do_putpages(vp, startoffset, endoffset,
781 ap->a_flags, &busypg); 781 ap->a_flags, &busypg);
782 ap->a_flags |= oreclaim; 782 ap->a_flags |= oreclaim;
783  783
784 if (error == EDEADLK || error == EAGAIN) { 784 if (error == EDEADLK || error == EAGAIN) {
785 DLOG((DLOG_PAGE, "lfs_putpages: genfs_putpages returned" 785 DLOG((DLOG_PAGE, "lfs_putpages: genfs_putpages returned"
786 " %d ino %d off %x (seg %d)\n", error, 786 " %d ino %d off %x (seg %d)\n", error,
787 ip->i_number, fs->lfs_offset, 787 ip->i_number, lfs_sb_getoffset(fs),
788 lfs_dtosn(fs, fs->lfs_offset))); 788 lfs_dtosn(fs, lfs_sb_getoffset(fs))));
789 789
790 if (oreclaim) { 790 if (oreclaim) {
791 mutex_enter(vp->v_interlock); 791 mutex_enter(vp->v_interlock);
792 write_and_wait(fs, vp, busypg, seglocked, "again"); 792 write_and_wait(fs, vp, busypg, seglocked, "again");
793 mutex_exit(vp->v_interlock); 793 mutex_exit(vp->v_interlock);
794 } else { 794 } else {
795 if ((sp->seg_flags & SEGM_SINGLE) && 795 if ((sp->seg_flags & SEGM_SINGLE) &&
796 lfs_sb_getcurseg(fs) != fs->lfs_startseg) 796 lfs_sb_getcurseg(fs) != fs->lfs_startseg)
797 donewriting = 1; 797 donewriting = 1;
798 } 798 }
799 } else if (error) { 799 } else if (error) {
800 DLOG((DLOG_PAGE, "lfs_putpages: genfs_putpages returned" 800 DLOG((DLOG_PAGE, "lfs_putpages: genfs_putpages returned"
801 " %d ino %d off %x (seg %d)\n", error, 801 " %d ino %d off %x (seg %d)\n", error,
802 (int)ip->i_number, fs->lfs_offset, 802 (int)ip->i_number, lfs_sb_getoffset(fs),
803 lfs_dtosn(fs, fs->lfs_offset))); 803 lfs_dtosn(fs, lfs_sb_getoffset(fs))));
804 } 804 }
805 /* genfs_do_putpages loses the interlock */ 805 /* genfs_do_putpages loses the interlock */
806#ifdef DEBUG 806#ifdef DEBUG
807 ++debug_n_again; 807 ++debug_n_again;
808#endif 808#endif
809 if (oreclaim && error == EAGAIN) { 809 if (oreclaim && error == EAGAIN) {
810 DLOG((DLOG_PAGE, "vp %p ino %d vi_flags %x a_flags %x avoiding vclean panic\n", 810 DLOG((DLOG_PAGE, "vp %p ino %d vi_flags %x a_flags %x avoiding vclean panic\n",
811 vp, (int)ip->i_number, vp->v_iflag, ap->a_flags)); 811 vp, (int)ip->i_number, vp->v_iflag, ap->a_flags));
812 mutex_enter(vp->v_interlock); 812 mutex_enter(vp->v_interlock);
813 } 813 }
814 if (error == EDEADLK) 814 if (error == EDEADLK)
815 mutex_enter(vp->v_interlock); 815 mutex_enter(vp->v_interlock);
816 } while (error == EDEADLK || (oreclaim && error == EAGAIN)); 816 } while (error == EDEADLK || (oreclaim && error == EAGAIN));

cvs diff -r1.243 -r1.244 src/sys/ufs/lfs/lfs_segment.c (expand / switch to unified diff)

--- src/sys/ufs/lfs/lfs_segment.c 2015/07/24 06:59:32 1.243
+++ src/sys/ufs/lfs/lfs_segment.c 2015/07/25 10:40:35 1.244
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: lfs_segment.c,v 1.243 2015/07/24 06:59:32 dholland Exp $ */ 1/* $NetBSD: lfs_segment.c,v 1.244 2015/07/25 10:40:35 martin Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc. 4 * Copyright (c) 1999, 2000, 2001, 2002, 2003 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 Konrad E. Schroder <perseant@hhhh.org>. 8 * by Konrad E. Schroder <perseant@hhhh.org>.
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.
@@ -50,27 +50,27 @@ @@ -50,27 +50,27 @@
50 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 50 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
51 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 51 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
52 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 52 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
53 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 53 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
54 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 54 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
55 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 55 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
56 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 56 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
57 * SUCH DAMAGE. 57 * SUCH DAMAGE.
58 * 58 *
59 * @(#)lfs_segment.c 8.10 (Berkeley) 6/10/95 59 * @(#)lfs_segment.c 8.10 (Berkeley) 6/10/95
60 */ 60 */
61 61
62#include <sys/cdefs.h> 62#include <sys/cdefs.h>
63__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.243 2015/07/24 06:59:32 dholland Exp $"); 63__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.244 2015/07/25 10:40:35 martin Exp $");
64 64
65#define _VFS_VNODE_PRIVATE /* XXX: check for VI_MARKER, this has to go */ 65#define _VFS_VNODE_PRIVATE /* XXX: check for VI_MARKER, this has to go */
66 66
67#ifdef DEBUG 67#ifdef DEBUG
68# define vndebug(vp, str) do { \ 68# define vndebug(vp, str) do { \
69 if (VTOI(vp)->i_flag & IN_CLEANING) \ 69 if (VTOI(vp)->i_flag & IN_CLEANING) \
70 DLOG((DLOG_WVNODE, "not writing ino %d because %s (op %d)\n", \ 70 DLOG((DLOG_WVNODE, "not writing ino %d because %s (op %d)\n", \
71 VTOI(vp)->i_number, (str), op)); \ 71 VTOI(vp)->i_number, (str), op)); \
72} while(0) 72} while(0)
73#else 73#else
74# define vndebug(vp, str) 74# define vndebug(vp, str)
75#endif 75#endif
76#define ivndebug(vp, str) \ 76#define ivndebug(vp, str) \
@@ -2237,27 +2237,27 @@ lfs_writeseg(struct lfs *fs, struct segm @@ -2237,27 +2237,27 @@ lfs_writeseg(struct lfs *fs, struct segm
2237 for (bpp = sp->bpp, i = nblocks; i;) { 2237 for (bpp = sp->bpp, i = nblocks; i;) {
2238 cbp = lfs_newclusterbuf(fs, devvp, (*bpp)->b_blkno, i); 2238 cbp = lfs_newclusterbuf(fs, devvp, (*bpp)->b_blkno, i);
2239 cl = cbp->b_private; 2239 cl = cbp->b_private;
2240 2240
2241 cbp->b_flags |= B_ASYNC; 2241 cbp->b_flags |= B_ASYNC;
2242 cbp->b_cflags |= BC_BUSY; 2242 cbp->b_cflags |= BC_BUSY;
2243 cbp->b_bcount = 0; 2243 cbp->b_bcount = 0;
2244 2244
2245#if defined(DEBUG) && defined(DIAGNOSTIC) 2245#if defined(DEBUG) && defined(DIAGNOSTIC)
2246 if (bpp - sp->bpp > (lfs_sb_getsumsize(fs) - SEGSUM_SIZE(fs)) 2246 if (bpp - sp->bpp > (lfs_sb_getsumsize(fs) - SEGSUM_SIZE(fs))
2247 / sizeof(int32_t)) { 2247 / sizeof(int32_t)) {
2248 panic("lfs_writeseg: real bpp overwrite"); 2248 panic("lfs_writeseg: real bpp overwrite");
2249 } 2249 }
2250 if (bpp - sp->bpp > lfs_segsize(fs) / fs->lfs_fsize) { 2250 if (bpp - sp->bpp > lfs_segsize(fs) / lfs_sb_getfsize(fs)) {
2251 panic("lfs_writeseg: theoretical bpp overwrite"); 2251 panic("lfs_writeseg: theoretical bpp overwrite");
2252 } 2252 }
2253#endif 2253#endif
2254 2254
2255 /* 2255 /*
2256 * Construct the cluster. 2256 * Construct the cluster.
2257 */ 2257 */
2258 mutex_enter(&lfs_lock); 2258 mutex_enter(&lfs_lock);
2259 ++fs->lfs_iocount; 2259 ++fs->lfs_iocount;
2260 mutex_exit(&lfs_lock); 2260 mutex_exit(&lfs_lock);
2261 while (i && cbp->b_bcount < CHUNKSIZE) { 2261 while (i && cbp->b_bcount < CHUNKSIZE) {
2262 bp = *bpp; 2262 bp = *bpp;
2263 2263

cvs diff -r1.275 -r1.276 src/sys/ufs/lfs/lfs_vnops.c (expand / switch to unified diff)

--- src/sys/ufs/lfs/lfs_vnops.c 2015/07/24 06:59:32 1.275
+++ src/sys/ufs/lfs/lfs_vnops.c 2015/07/25 10:40:35 1.276
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: lfs_vnops.c,v 1.275 2015/07/24 06:59:32 dholland Exp $ */ 1/* $NetBSD: lfs_vnops.c,v 1.276 2015/07/25 10:40:35 martin Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc. 4 * Copyright (c) 1999, 2000, 2001, 2002, 2003 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 Konrad E. Schroder <perseant@hhhh.org>. 8 * by Konrad E. Schroder <perseant@hhhh.org>.
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.
@@ -115,27 +115,27 @@ @@ -115,27 +115,27 @@
115 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 115 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
116 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 116 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
117 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 117 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
118 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 118 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
119 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 119 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
120 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 120 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
121 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 121 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
122 * SUCH DAMAGE. 122 * SUCH DAMAGE.
123 * 123 *
124 * @(#)ufs_vnops.c 8.28 (Berkeley) 7/31/95 124 * @(#)ufs_vnops.c 8.28 (Berkeley) 7/31/95
125 */ 125 */
126 126
127#include <sys/cdefs.h> 127#include <sys/cdefs.h>
128__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.275 2015/07/24 06:59:32 dholland Exp $"); 128__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.276 2015/07/25 10:40:35 martin Exp $");
129 129
130#ifdef _KERNEL_OPT 130#ifdef _KERNEL_OPT
131#include "opt_compat_netbsd.h" 131#include "opt_compat_netbsd.h"
132#include "opt_uvm_page_trkown.h" 132#include "opt_uvm_page_trkown.h"
133#endif 133#endif
134 134
135#include <sys/param.h> 135#include <sys/param.h>
136#include <sys/systm.h> 136#include <sys/systm.h>
137#include <sys/namei.h> 137#include <sys/namei.h>
138#include <sys/resourcevar.h> 138#include <sys/resourcevar.h>
139#include <sys/kernel.h> 139#include <sys/kernel.h>
140#include <sys/file.h> 140#include <sys/file.h>
141#include <sys/stat.h> 141#include <sys/stat.h>
@@ -1860,27 +1860,27 @@ segwait_common: @@ -1860,27 +1860,27 @@ segwait_common:
1860 lfs_flush_dirops(fs); 1860 lfs_flush_dirops(fs);
1861 LFS_CLEANERINFO(cip, fs, bp); 1861 LFS_CLEANERINFO(cip, fs, bp);
1862 oclean = cip->clean; 1862 oclean = cip->clean;
1863 LFS_SYNC_CLEANERINFO(cip, fs, bp, 1); 1863 LFS_SYNC_CLEANERINFO(cip, fs, bp, 1);
1864 lfs_segwrite(ap->a_vp->v_mount, SEGM_FORCE_CKP); 1864 lfs_segwrite(ap->a_vp->v_mount, SEGM_FORCE_CKP);
1865 fs->lfs_sp->seg_flags |= SEGM_PROT; 1865 fs->lfs_sp->seg_flags |= SEGM_PROT;
1866 lfs_segunlock(fs); 1866 lfs_segunlock(fs);
1867 lfs_writer_leave(fs); 1867 lfs_writer_leave(fs);
1868 1868
1869#ifdef DEBUG 1869#ifdef DEBUG
1870 LFS_CLEANERINFO(cip, fs, bp); 1870 LFS_CLEANERINFO(cip, fs, bp);
1871 DLOG((DLOG_CLEAN, "lfs_fcntl: reclaim wrote %" PRId64 1871 DLOG((DLOG_CLEAN, "lfs_fcntl: reclaim wrote %" PRId64
1872 " blocks, cleaned %" PRId32 " segments (activesb %d)\n", 1872 " blocks, cleaned %" PRId32 " segments (activesb %d)\n",
1873 fs->lfs_offset - off, cip->clean - oclean, 1873 lfs_sb_getoffset(fs) - off, cip->clean - oclean,
1874 fs->lfs_activesb)); 1874 fs->lfs_activesb));
1875 LFS_SYNC_CLEANERINFO(cip, fs, bp, 0); 1875 LFS_SYNC_CLEANERINFO(cip, fs, bp, 0);
1876#else 1876#else
1877 __USE(oclean); 1877 __USE(oclean);
1878 __USE(off); 1878 __USE(off);
1879#endif 1879#endif
1880 1880
1881 return 0; 1881 return 0;
1882 1882
1883 case LFCNIFILEFH_COMPAT: 1883 case LFCNIFILEFH_COMPAT:
1884 /* Return the filehandle of the Ifile */ 1884 /* Return the filehandle of the Ifile */
1885 if ((error = kauth_authorize_system(l->l_cred, 1885 if ((error = kauth_authorize_system(l->l_cred,
1886 KAUTH_SYSTEM_FILEHANDLE, 0, NULL, NULL, NULL)) != 0) 1886 KAUTH_SYSTEM_FILEHANDLE, 0, NULL, NULL, NULL)) != 0)