ffs_inode.c (173464) | ffs_inode.c (177493) |
---|---|
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 --- 16 unchanged lines hidden (view full) --- 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * @(#)ffs_inode.c 8.13 (Berkeley) 4/21/95 30 */ 31 32#include <sys/cdefs.h> | 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 --- 16 unchanged lines hidden (view full) --- 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * @(#)ffs_inode.c 8.13 (Berkeley) 4/21/95 30 */ 31 32#include <sys/cdefs.h> |
33__FBSDID("$FreeBSD: head/sys/ufs/ffs/ffs_inode.c 173464 2007-11-08 17:21:51Z obrien $"); | 33__FBSDID("$FreeBSD: head/sys/ufs/ffs/ffs_inode.c 177493 2008-03-22 09:15:16Z jeff $"); |
34 35#include "opt_quota.h" 36 37#include <sys/param.h> 38#include <sys/systm.h> 39#include <sys/mount.h> 40#include <sys/proc.h> 41#include <sys/bio.h> --- 100 unchanged lines hidden (view full) --- 142 int flags; 143 struct ucred *cred; 144 struct thread *td; 145{ 146 struct inode *ip; 147 ufs2_daddr_t bn, lbn, lastblock, lastiblock[NIADDR], indir_lbn[NIADDR]; 148 ufs2_daddr_t oldblks[NDADDR + NIADDR], newblks[NDADDR + NIADDR]; 149 ufs2_daddr_t count, blocksreleased = 0, datablocks; | 34 35#include "opt_quota.h" 36 37#include <sys/param.h> 38#include <sys/systm.h> 39#include <sys/mount.h> 40#include <sys/proc.h> 41#include <sys/bio.h> --- 100 unchanged lines hidden (view full) --- 142 int flags; 143 struct ucred *cred; 144 struct thread *td; 145{ 146 struct inode *ip; 147 ufs2_daddr_t bn, lbn, lastblock, lastiblock[NIADDR], indir_lbn[NIADDR]; 148 ufs2_daddr_t oldblks[NDADDR + NIADDR], newblks[NDADDR + NIADDR]; 149 ufs2_daddr_t count, blocksreleased = 0, datablocks; |
150 struct bufobj *bo; |
|
150 struct fs *fs; 151 struct buf *bp; 152 struct ufsmount *ump; 153 int needextclean, softdepslowdown, extblocks; 154 int offset, size, level, nblocks; 155 int i, error, allerror; 156 off_t osize; 157 158 ip = VTOI(vp); 159 fs = ip->i_fs; 160 ump = ip->i_ump; | 151 struct fs *fs; 152 struct buf *bp; 153 struct ufsmount *ump; 154 int needextclean, softdepslowdown, extblocks; 155 int offset, size, level, nblocks; 156 int i, error, allerror; 157 off_t osize; 158 159 ip = VTOI(vp); 160 fs = ip->i_fs; 161 ump = ip->i_ump; |
162 bo = &vp->v_bufobj; |
|
161 162 ASSERT_VOP_LOCKED(vp, "ffs_truncate"); 163 164 if (length < 0) 165 return (EINVAL); 166 /* 167 * Historically clients did not have to specify which data 168 * they were truncating. So, if not specified, we assume --- 312 unchanged lines hidden (view full) --- 481done: 482#ifdef INVARIANTS 483 for (level = SINGLE; level <= TRIPLE; level++) 484 if (newblks[NDADDR + level] != DIP(ip, i_ib[level])) 485 panic("ffs_truncate1"); 486 for (i = 0; i < NDADDR; i++) 487 if (newblks[i] != DIP(ip, i_db[i])) 488 panic("ffs_truncate2"); | 163 164 ASSERT_VOP_LOCKED(vp, "ffs_truncate"); 165 166 if (length < 0) 167 return (EINVAL); 168 /* 169 * Historically clients did not have to specify which data 170 * they were truncating. So, if not specified, we assume --- 312 unchanged lines hidden (view full) --- 483done: 484#ifdef INVARIANTS 485 for (level = SINGLE; level <= TRIPLE; level++) 486 if (newblks[NDADDR + level] != DIP(ip, i_ib[level])) 487 panic("ffs_truncate1"); 488 for (i = 0; i < NDADDR; i++) 489 if (newblks[i] != DIP(ip, i_db[i])) 490 panic("ffs_truncate2"); |
489 VI_LOCK(vp); | 491 BO_LOCK(bo); |
490 if (length == 0 && 491 (fs->fs_magic != FS_UFS2_MAGIC || ip->i_din2->di_extsize == 0) && | 492 if (length == 0 && 493 (fs->fs_magic != FS_UFS2_MAGIC || ip->i_din2->di_extsize == 0) && |
492 (vp->v_bufobj.bo_dirty.bv_cnt > 0 || 493 vp->v_bufobj.bo_clean.bv_cnt > 0)) | 494 (bo->bo_dirty.bv_cnt > 0 || bo->bo_clean.bv_cnt > 0)) |
494 panic("ffs_truncate3"); | 495 panic("ffs_truncate3"); |
495 VI_UNLOCK(vp); | 496 BO_UNLOCK(bo); |
496#endif /* INVARIANTS */ 497 /* 498 * Put back the real size. 499 */ 500 ip->i_size = length; 501 DIP_SET(ip, i_size, length); 502 DIP_SET(ip, i_blocks, DIP(ip, i_blocks) - blocksreleased); 503 --- 144 unchanged lines hidden --- | 497#endif /* INVARIANTS */ 498 /* 499 * Put back the real size. 500 */ 501 ip->i_size = length; 502 DIP_SET(ip, i_size, length); 503 DIP_SET(ip, i_blocks, DIP(ip, i_blocks) - blocksreleased); 504 --- 144 unchanged lines hidden --- |