Module Name: src Committed By: zafer Date: Sat Jun 9 18:48:31 UTC 2018
Modified Files: src/sys/ufs/lfs: lfs_bio.c lfs_segment.c Log Message: Add missing b_cflags and b_oflags. Ok dholland@ Addresses PR kern/42342 by Yoshihiro Nakajima To generate a diff of this commit: cvs rdiff -u -r1.141 -r1.142 src/sys/ufs/lfs/lfs_bio.c cvs rdiff -u -r1.276 -r1.277 src/sys/ufs/lfs/lfs_segment.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/ufs/lfs/lfs_bio.c diff -u src/sys/ufs/lfs/lfs_bio.c:1.141 src/sys/ufs/lfs/lfs_bio.c:1.142 --- src/sys/ufs/lfs/lfs_bio.c:1.141 Sat Jun 10 05:29:36 2017 +++ src/sys/ufs/lfs/lfs_bio.c Sat Jun 9 18:48:31 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: lfs_bio.c,v 1.141 2017/06/10 05:29:36 maya Exp $ */ +/* $NetBSD: lfs_bio.c,v 1.142 2018/06/09 18:48:31 zafer Exp $ */ /*- * Copyright (c) 1999, 2000, 2001, 2002, 2003, 2008 The NetBSD Foundation, Inc. @@ -60,7 +60,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: lfs_bio.c,v 1.141 2017/06/10 05:29:36 maya Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lfs_bio.c,v 1.142 2018/06/09 18:48:31 zafer Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -420,8 +420,7 @@ lfs_bwrite_ext(struct buf *bp, int flags ASSERT_MAYBE_SEGLOCK(fs); KASSERT(bp->b_cflags & BC_BUSY); KASSERT(flags & BW_CLEAN || !LFS_IS_MALLOC_BUF(bp)); - KASSERT(((bp->b_oflags | bp->b_flags) & (BO_DELWRI|B_LOCKED)) - != BO_DELWRI); + KASSERT((bp->b_flags & B_LOCKED) || !(bp->b_oflags & BO_DELWRI)); /* * Don't write *any* blocks if we're mounted read-only, or Index: src/sys/ufs/lfs/lfs_segment.c diff -u src/sys/ufs/lfs/lfs_segment.c:1.276 src/sys/ufs/lfs/lfs_segment.c:1.277 --- src/sys/ufs/lfs/lfs_segment.c:1.276 Wed Jun 6 01:49:09 2018 +++ src/sys/ufs/lfs/lfs_segment.c Sat Jun 9 18:48:31 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: lfs_segment.c,v 1.276 2018/06/06 01:49:09 maya Exp $ */ +/* $NetBSD: lfs_segment.c,v 1.277 2018/06/09 18:48:31 zafer Exp $ */ /*- * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc. @@ -60,7 +60,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.276 2018/06/06 01:49:09 maya Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.277 2018/06/09 18:48:31 zafer Exp $"); #ifdef DEBUG # define vndebug(vp, str) do { \ @@ -1408,13 +1408,13 @@ loop: continue; } #ifdef DIAGNOSTIC -# ifdef LFS_USE_B_INVAL - if ((bp->b_flags & BC_INVAL) != 0 && bp->b_iodone == NULL) { +# ifdef LFS_USE_BC_INVAL + if ((bp->b_cflags & BC_INVAL) != 0 && bp->b_iodone == NULL) { DLOG((DLOG_SEG, "lfs_gather: lbn %" PRId64 " is BC_INVAL\n", bp->b_lblkno)); VOP_PRINT(bp->b_vp); } -# endif /* LFS_USE_B_INVAL */ +# endif /* LFS_USE_BC_INVAL */ if (!(bp->b_oflags & BO_DELWRI)) panic("lfs_gather: bp not BO_DELWRI"); if (!(bp->b_flags & B_LOCKED)) { @@ -2106,7 +2106,7 @@ lfs_writeseg(struct lfs *fs, struct segm LFS_WRITESEGENTRY(sup, fs, sp->seg_number, bp); /* Ifile */ /* - * Mark blocks B_BUSY, to prevent then from being changed between + * Mark blocks BC_BUSY, to prevent then from being changed between * the checksum computation and the actual write. * * If we are cleaning, check indirect blocks for UNWRITTEN, and if @@ -2217,7 +2217,7 @@ lfs_writeseg(struct lfs *fs, struct segm /* Loop through gop_write cluster blocks */ for (byteoffset = 0; byteoffset < (*bpp)->b_bcount; byteoffset += lfs_sb_getbsize(fs)) { -#ifdef LFS_USE_B_INVAL +#ifdef LFS_USE_BC_INVAL if (((*bpp)->b_cflags & BC_INVAL) != 0 && (*bpp)->b_iodone != NULL) { if (copyin((void *)(*bpp)->b_saveaddr + @@ -2228,7 +2228,7 @@ lfs_writeseg(struct lfs *fs, struct segm (*bpp)->b_lblkno); } } else -#endif /* LFS_USE_B_INVAL */ +#endif /* LFS_USE_BC_INVAL */ { sum = lfs_cksum_part((char *) (*bpp)->b_data + byteoffset, el_size, sum); @@ -2320,9 +2320,9 @@ lfs_writeseg(struct lfs *fs, struct segm bp->b_bcount, bp->b_blkno, sp->seg_number); -#ifdef LFS_USE_B_INVAL +#ifdef LFS_USE_BC_INVAL /* - * Fake buffers from the cleaner are marked as B_INVAL. + * Fake buffers from the cleaner are marked as BC_INVAL. * We need to copy the data from user space rather than * from the buffer indicated. * XXX == what do I do on an error? @@ -2333,7 +2333,7 @@ lfs_writeseg(struct lfs *fs, struct segm panic("lfs_writeseg: " "copyin failed [2]"); } else -#endif /* LFS_USE_B_INVAL */ +#endif /* LFS_USE_BC_INVAL */ if (cl->flags & LFS_CL_MALLOC) { /* copy data into our cluster. */ memcpy(p, bp->b_data, bp->b_bcount); @@ -2590,8 +2590,7 @@ lfs_cluster_aiodone(struct buf *bp) tbp->b_flags |= B_ASYNC; /* for biodone */ } - if (((tbp->b_flags | tbp->b_oflags) & - (B_LOCKED | BO_DELWRI)) == B_LOCKED) + if ((tbp->b_flags & B_LOCKED) && !(tbp->b_oflags & BO_DELWRI)) LFS_UNLOCK_BUF(tbp); if (tbp->b_oflags & BO_DONE) {