| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: lfs_segment.c,v 1.270 2017/06/10 05:29:36 maya Exp $ */ | | 1 | /* $NetBSD: lfs_segment.c,v 1.271 2017/06/12 15:02:32 maya 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.270 2017/06/10 05:29:36 maya Exp $"); | | 63 | __KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.271 2017/06/12 15:02:32 maya Exp $"); |
64 | | | 64 | |
65 | #ifdef DEBUG | | 65 | #ifdef DEBUG |
66 | # define vndebug(vp, str) do { \ | | 66 | # define vndebug(vp, str) do { \ |
67 | if (VTOI(vp)->i_state & IN_CLEANING) \ | | 67 | if (VTOI(vp)->i_state & IN_CLEANING) \ |
68 | DLOG((DLOG_WVNODE, "not writing ino %d because %s (op %d)\n", \ | | 68 | DLOG((DLOG_WVNODE, "not writing ino %d because %s (op %d)\n", \ |
69 | VTOI(vp)->i_number, (str), op)); \ | | 69 | VTOI(vp)->i_number, (str), op)); \ |
70 | } while(0) | | 70 | } while(0) |
71 | #else | | 71 | #else |
72 | # define vndebug(vp, str) | | 72 | # define vndebug(vp, str) |
73 | #endif | | 73 | #endif |
74 | #define ivndebug(vp, str) \ | | 74 | #define ivndebug(vp, str) \ |
75 | DLOG((DLOG_WVNODE, "ino %d: %s\n", VTOI(vp)->i_number, (str))) | | 75 | DLOG((DLOG_WVNODE, "ino %d: %s\n", VTOI(vp)->i_number, (str))) |
76 | | | 76 | |
| @@ -1371,27 +1371,28 @@ lfs_gather(struct lfs *fs, struct segmen | | | @@ -1371,27 +1371,28 @@ lfs_gather(struct lfs *fs, struct segmen |
1371 | /* This is a hack to see if ordering the blocks in LFS makes a difference. */ | | 1371 | /* This is a hack to see if ordering the blocks in LFS makes a difference. */ |
1372 | # define BUF_OFFSET \ | | 1372 | # define BUF_OFFSET \ |
1373 | (((char *)&LIST_NEXT(bp, b_vnbufs)) - (char *)bp) | | 1373 | (((char *)&LIST_NEXT(bp, b_vnbufs)) - (char *)bp) |
1374 | # define BACK_BUF(BP) \ | | 1374 | # define BACK_BUF(BP) \ |
1375 | ((struct buf *)(((char *)(BP)->b_vnbufs.le_prev) - BUF_OFFSET)) | | 1375 | ((struct buf *)(((char *)(BP)->b_vnbufs.le_prev) - BUF_OFFSET)) |
1376 | # define BEG_OF_LIST \ | | 1376 | # define BEG_OF_LIST \ |
1377 | ((struct buf *)(((char *)&LIST_FIRST(&vp->v_dirtyblkhd)) - BUF_OFFSET)) | | 1377 | ((struct buf *)(((char *)&LIST_FIRST(&vp->v_dirtyblkhd)) - BUF_OFFSET)) |
1378 | | | 1378 | |
1379 | loop: | | 1379 | loop: |
1380 | /* Find last buffer. */ | | 1380 | /* Find last buffer. */ |
1381 | for (bp = LIST_FIRST(&vp->v_dirtyblkhd); | | 1381 | for (bp = LIST_FIRST(&vp->v_dirtyblkhd); |
1382 | bp && LIST_NEXT(bp, b_vnbufs) != NULL; | | 1382 | bp && LIST_NEXT(bp, b_vnbufs) != NULL; |
1383 | bp = LIST_NEXT(bp, b_vnbufs)) | | 1383 | bp = LIST_NEXT(bp, b_vnbufs)) |
1384 | /* nothing */; | | 1384 | continue; |
| | | 1385 | |
1385 | for (; bp && bp != BEG_OF_LIST; bp = nbp) { | | 1386 | for (; bp && bp != BEG_OF_LIST; bp = nbp) { |
1386 | nbp = BACK_BUF(bp); | | 1387 | nbp = BACK_BUF(bp); |
1387 | #else /* LFS_NO_BACKBUF_HACK */ | | 1388 | #else /* LFS_NO_BACKBUF_HACK */ |
1388 | loop: | | 1389 | loop: |
1389 | for (bp = LIST_FIRST(&vp->v_dirtyblkhd); bp; bp = nbp) { | | 1390 | for (bp = LIST_FIRST(&vp->v_dirtyblkhd); bp; bp = nbp) { |
1390 | nbp = LIST_NEXT(bp, b_vnbufs); | | 1391 | nbp = LIST_NEXT(bp, b_vnbufs); |
1391 | #endif /* LFS_NO_BACKBUF_HACK */ | | 1392 | #endif /* LFS_NO_BACKBUF_HACK */ |
1392 | if ((bp->b_cflags & BC_BUSY) != 0 || | | 1393 | if ((bp->b_cflags & BC_BUSY) != 0 || |
1393 | (bp->b_flags & B_GATHERED) != 0 || !match(fs, bp)) { | | 1394 | (bp->b_flags & B_GATHERED) != 0 || !match(fs, bp)) { |
1394 | #ifdef DEBUG | | 1395 | #ifdef DEBUG |
1395 | if (vp == fs->lfs_ivnode && | | 1396 | if (vp == fs->lfs_ivnode && |
1396 | (bp->b_cflags & BC_BUSY) != 0 && | | 1397 | (bp->b_cflags & BC_BUSY) != 0 && |
1397 | (bp->b_flags & B_GATHERED) == 0) | | 1398 | (bp->b_flags & B_GATHERED) == 0) |