Sun Apr 12 22:41:28 2015 UTC ()
Don't putpages in ufs buffercached writes: kassert there are none.


(riastradh)
diff -r1.118 -r1.119 src/sys/ufs/ufs/ufs_readwrite.c

cvs diff -r1.118 -r1.119 src/sys/ufs/ufs/ufs_readwrite.c (expand / switch to unified diff)

--- src/sys/ufs/ufs/ufs_readwrite.c 2015/03/31 11:43:05 1.118
+++ src/sys/ufs/ufs/ufs_readwrite.c 2015/04/12 22:41:28 1.119
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ufs_readwrite.c,v 1.118 2015/03/31 11:43:05 riastradh Exp $ */ 1/* $NetBSD: ufs_readwrite.c,v 1.119 2015/04/12 22:41:28 riastradh Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1993 4 * Copyright (c) 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -22,27 +22,27 @@ @@ -22,27 +22,27 @@
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 22 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE. 29 * SUCH DAMAGE.
30 * 30 *
31 * @(#)ufs_readwrite.c 8.11 (Berkeley) 5/8/95 31 * @(#)ufs_readwrite.c 8.11 (Berkeley) 5/8/95
32 */ 32 */
33 33
34#include <sys/cdefs.h> 34#include <sys/cdefs.h>
35__KERNEL_RCSID(1, "$NetBSD: ufs_readwrite.c,v 1.118 2015/03/31 11:43:05 riastradh Exp $"); 35__KERNEL_RCSID(1, "$NetBSD: ufs_readwrite.c,v 1.119 2015/04/12 22:41:28 riastradh Exp $");
36 36
37#ifdef LFS_READWRITE 37#ifdef LFS_READWRITE
38#define FS struct lfs 38#define FS struct lfs
39#define I_FS i_lfs 39#define I_FS i_lfs
40#define READ lfs_read 40#define READ lfs_read
41#define READ_S "lfs_read" 41#define READ_S "lfs_read"
42#define WRITE lfs_write 42#define WRITE lfs_write
43#define WRITE_S "lfs_write" 43#define WRITE_S "lfs_write"
44#define BUFRD lfs_bufrd 44#define BUFRD lfs_bufrd
45#define BUFWR lfs_bufwr 45#define BUFWR lfs_bufwr
46#define fs_bsize lfs_bsize 46#define fs_bsize lfs_bsize
47#define fs_bmask lfs_bmask 47#define fs_bmask lfs_bmask
48#define UFS_WAPBL_BEGIN(mp) 0 48#define UFS_WAPBL_BEGIN(mp) 0
@@ -557,29 +557,27 @@ BUFWR(struct vnode *vp, struct uio *uio, @@ -557,29 +557,27 @@ BUFWR(struct vnode *vp, struct uio *uio,
557 origoff = uio->uio_offset; 557 origoff = uio->uio_offset;
558 resid = uio->uio_resid; 558 resid = uio->uio_resid;
559 osize = ip->i_size; 559 osize = ip->i_size;
560 error = 0; 560 error = 0;
561 561
562 KASSERT(vp->v_type != VREG); 562 KASSERT(vp->v_type != VREG);
563 563
564#ifdef LFS_READWRITE 564#ifdef LFS_READWRITE
565 lfs_availwait(fs, btofsb(fs, uio->uio_resid)); 565 lfs_availwait(fs, btofsb(fs, uio->uio_resid));
566 lfs_check(vp, LFS_UNUSED_LBN, 0); 566 lfs_check(vp, LFS_UNUSED_LBN, 0);
567#endif /* !LFS_READWRITE */ 567#endif /* !LFS_READWRITE */
568 568
569 /* XXX Should never have pages cached here. */ 569 /* XXX Should never have pages cached here. */
570 mutex_enter(vp->v_interlock); 570 KASSERT(vp->v_uobj.uo_npages == 0);
571 VOP_PUTPAGES(vp, trunc_page(origoff), round_page(origoff + resid), 
572 PGO_CLEANIT | PGO_FREE | PGO_SYNCIO | PGO_JOURNALLOCKED); 
573 while (uio->uio_resid > 0) { 571 while (uio->uio_resid > 0) {
574 lbn = ufs_lblkno(fs, uio->uio_offset); 572 lbn = ufs_lblkno(fs, uio->uio_offset);
575 blkoffset = ufs_blkoff(fs, uio->uio_offset); 573 blkoffset = ufs_blkoff(fs, uio->uio_offset);
576 xfersize = MIN(fs->fs_bsize - blkoffset, uio->uio_resid); 574 xfersize = MIN(fs->fs_bsize - blkoffset, uio->uio_resid);
577 if (fs->fs_bsize > xfersize) 575 if (fs->fs_bsize > xfersize)
578 flags |= B_CLRBUF; 576 flags |= B_CLRBUF;
579 else 577 else
580 flags &= ~B_CLRBUF; 578 flags &= ~B_CLRBUF;
581 579
582#ifdef LFS_READWRITE 580#ifdef LFS_READWRITE
583 error = lfs_reserve(fs, vp, NULL, 581 error = lfs_reserve(fs, vp, NULL,
584 btofsb(fs, (UFS_NIADDR + 1) << fs->lfs_bshift)); 582 btofsb(fs, (UFS_NIADDR + 1) << fs->lfs_bshift));
585 if (error) 583 if (error)