ffs_alloc.c (7170) | ffs_alloc.c (7399) |
---|---|
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_alloc.c 8.8 (Berkeley) 2/21/94 | 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_alloc.c 8.8 (Berkeley) 2/21/94 |
34 * $Id: ffs_alloc.c,v 1.10 1995/03/10 22:11:50 davidg Exp $ | 34 * $Id: ffs_alloc.c,v 1.11 1995/03/19 14:29:11 davidg Exp $ |
35 */ 36 37#include <sys/param.h> 38#include <sys/systm.h> 39#include <sys/buf.h> 40#include <sys/proc.h> 41#include <sys/vnode.h> 42#include <sys/mount.h> --- 174 unchanged lines hidden (view full) --- 217 */ 218 cg = dtog(fs, bprev); 219 bno = ffs_fragextend(ip, cg, (long)bprev, osize, nsize); 220 if (bno) { 221 if (bp->b_blkno != fsbtodb(fs, bno)) 222 panic("bad blockno"); 223 ip->i_blocks += btodb(nsize - osize); 224 ip->i_flag |= IN_CHANGE | IN_UPDATE; | 35 */ 36 37#include <sys/param.h> 38#include <sys/systm.h> 39#include <sys/buf.h> 40#include <sys/proc.h> 41#include <sys/vnode.h> 42#include <sys/mount.h> --- 174 unchanged lines hidden (view full) --- 217 */ 218 cg = dtog(fs, bprev); 219 bno = ffs_fragextend(ip, cg, (long)bprev, osize, nsize); 220 if (bno) { 221 if (bp->b_blkno != fsbtodb(fs, bno)) 222 panic("bad blockno"); 223 ip->i_blocks += btodb(nsize - osize); 224 ip->i_flag |= IN_CHANGE | IN_UPDATE; |
225 allocbuf(bp, nsize, 0); | 225 allocbuf(bp, nsize); |
226 bp->b_flags |= B_DONE; 227 bzero((char *)bp->b_data + osize, (u_int)nsize - osize); 228 *bpp = bp; 229 return (0); 230 } 231 /* 232 * Allocate a new disk location. 233 */ --- 47 unchanged lines hidden (view full) --- 281 if (bno > 0) { 282 bp->b_blkno = fsbtodb(fs, bno); 283 ffs_blkfree(ip, bprev, (long)osize); 284 if (nsize < request) 285 ffs_blkfree(ip, bno + numfrags(fs, nsize), 286 (long)(request - nsize)); 287 ip->i_blocks += btodb(nsize - osize); 288 ip->i_flag |= IN_CHANGE | IN_UPDATE; | 226 bp->b_flags |= B_DONE; 227 bzero((char *)bp->b_data + osize, (u_int)nsize - osize); 228 *bpp = bp; 229 return (0); 230 } 231 /* 232 * Allocate a new disk location. 233 */ --- 47 unchanged lines hidden (view full) --- 281 if (bno > 0) { 282 bp->b_blkno = fsbtodb(fs, bno); 283 ffs_blkfree(ip, bprev, (long)osize); 284 if (nsize < request) 285 ffs_blkfree(ip, bno + numfrags(fs, nsize), 286 (long)(request - nsize)); 287 ip->i_blocks += btodb(nsize - osize); 288 ip->i_flag |= IN_CHANGE | IN_UPDATE; |
289 allocbuf(bp, nsize, 0); | 289 allocbuf(bp, nsize); |
290 bp->b_flags |= B_DONE; 291 bzero((char *)bp->b_data + osize, (u_int)nsize - osize); 292 *bpp = bp; 293 return (0); 294 } 295#ifdef QUOTA 296 /* 297 * Restore user's disk quota because allocation failed. --- 1202 unchanged lines hidden --- | 290 bp->b_flags |= B_DONE; 291 bzero((char *)bp->b_data + osize, (u_int)nsize - osize); 292 *bpp = bp; 293 return (0); 294 } 295#ifdef QUOTA 296 /* 297 * Restore user's disk quota because allocation failed. --- 1202 unchanged lines hidden --- |