ffs_vnops.c (47995) | ffs_vnops.c (48225) |
---|---|
1/* 2 * Copyright (c) 1982, 1986, 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * @(#)ffs_vnops.c 8.15 (Berkeley) 5/14/95 | 1/* 2 * Copyright (c) 1982, 1986, 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * @(#)ffs_vnops.c 8.15 (Berkeley) 5/14/95 |
34 * $Id: ffs_vnops.c,v 1.56 1999/05/14 01:26:05 mckusick Exp $ | 34 * $Id: ffs_vnops.c,v 1.57 1999/06/18 05:49:46 mckusick Exp $ |
35 */ 36 37#include <sys/param.h> 38#include <sys/systm.h> 39#include <sys/resourcevar.h> 40#include <sys/signalvar.h> 41#include <sys/kernel.h> 42#include <sys/stat.h> --- 111 unchanged lines hidden (view full) --- 154 bp->b_flags &= ~B_SCANNED; 155 for (bp = TAILQ_FIRST(&vp->v_dirtyblkhd); bp; bp = nbp) { 156 nbp = TAILQ_NEXT(bp, b_vnbufs); 157 /* 158 * First time through on a synchronous call, 159 * or if it's already scheduled, skip to the next 160 * buffer 161 */ | 35 */ 36 37#include <sys/param.h> 38#include <sys/systm.h> 39#include <sys/resourcevar.h> 40#include <sys/signalvar.h> 41#include <sys/kernel.h> 42#include <sys/stat.h> --- 111 unchanged lines hidden (view full) --- 154 bp->b_flags &= ~B_SCANNED; 155 for (bp = TAILQ_FIRST(&vp->v_dirtyblkhd); bp; bp = nbp) { 156 nbp = TAILQ_NEXT(bp, b_vnbufs); 157 /* 158 * First time through on a synchronous call, 159 * or if it's already scheduled, skip to the next 160 * buffer 161 */ |
162 if ((bp->b_flags & (B_BUSY | B_SCANNED)) || 163 ((skipmeta == 1) && (bp->b_lblkno < 0))) | 162 if ((bp->b_flags & B_SCANNED) || 163 ((skipmeta == 1) && (bp->b_lblkno < 0)) || 164 BUF_LOCK(bp, LK_EXCLUSIVE | LK_NOWAIT)) |
164 continue; 165 if ((bp->b_flags & B_DELWRI) == 0) 166 panic("ffs_fsync: not dirty"); 167 /* 168 * If data is outstanding to another vnode, or we were 169 * asked to wait for everything, or it's not a file or BDEV, 170 * start the IO on this buffer immediatly. 171 */ --- 4 unchanged lines hidden (view full) --- 176 /* 177 * On our final pass through, do all I/O synchronously 178 * so that we can find out if our flush is failing 179 * because of write errors. 180 */ 181 if (passes > 0 || (ap->a_waitfor != MNT_WAIT)) { 182 if ((bp->b_flags & B_CLUSTEROK) && 183 ap->a_waitfor != MNT_WAIT) { | 165 continue; 166 if ((bp->b_flags & B_DELWRI) == 0) 167 panic("ffs_fsync: not dirty"); 168 /* 169 * If data is outstanding to another vnode, or we were 170 * asked to wait for everything, or it's not a file or BDEV, 171 * start the IO on this buffer immediatly. 172 */ --- 4 unchanged lines hidden (view full) --- 177 /* 178 * On our final pass through, do all I/O synchronously 179 * so that we can find out if our flush is failing 180 * because of write errors. 181 */ 182 if (passes > 0 || (ap->a_waitfor != MNT_WAIT)) { 183 if ((bp->b_flags & B_CLUSTEROK) && 184 ap->a_waitfor != MNT_WAIT) { |
185 BUF_UNLOCK(bp); |
|
184 (void) vfs_bio_awrite(bp); 185 } else { 186 bremfree(bp); | 186 (void) vfs_bio_awrite(bp); 187 } else { 188 bremfree(bp); |
187 bp->b_flags |= B_BUSY; | |
188 splx(s); 189 (void) bawrite(bp); 190 s = splbio(); 191 } 192 } else { 193 bremfree(bp); | 189 splx(s); 190 (void) bawrite(bp); 191 s = splbio(); 192 } 193 } else { 194 bremfree(bp); |
194 bp->b_flags |= B_BUSY; | |
195 splx(s); 196 if ((error = bwrite(bp)) != 0) 197 return (error); 198 s = splbio(); 199 } 200 } else if ((vp->v_type == VREG) && (bp->b_lblkno >= lbn)) { 201 /* 202 * If the buffer is for data that has been truncated 203 * off the file, then throw it away. 204 */ 205 bremfree(bp); | 195 splx(s); 196 if ((error = bwrite(bp)) != 0) 197 return (error); 198 s = splbio(); 199 } 200 } else if ((vp->v_type == VREG) && (bp->b_lblkno >= lbn)) { 201 /* 202 * If the buffer is for data that has been truncated 203 * off the file, then throw it away. 204 */ 205 bremfree(bp); |
206 bp->b_flags |= B_BUSY | B_INVAL | B_NOCACHE; | 206 bp->b_flags |= B_INVAL | B_NOCACHE; |
207 splx(s); 208 brelse(bp); 209 s = splbio(); 210 } else { | 207 splx(s); 208 brelse(bp); 209 s = splbio(); 210 } else { |
211 BUF_UNLOCK(bp); |
|
211 vfs_bio_awrite(bp); 212 } 213 /* 214 * Since we may have slept during the I/O, we need 215 * to start from a known point. 216 */ 217 nbp = TAILQ_FIRST(&vp->v_dirtyblkhd); 218 } --- 47 unchanged lines hidden --- | 212 vfs_bio_awrite(bp); 213 } 214 /* 215 * Since we may have slept during the I/O, we need 216 * to start from a known point. 217 */ 218 nbp = TAILQ_FIRST(&vp->v_dirtyblkhd); 219 } --- 47 unchanged lines hidden --- |