ffs_alloc.c (100201) | ffs_alloc.c (100344) |
---|---|
1/* 2 * Copyright (c) 2002 Networks Associates Technology, Inc. 3 * All rights reserved. 4 * 5 * This software was developed for the FreeBSD Project by Marshall 6 * Kirk McKusick and Network Associates Laboratories, the Security 7 * Research Division of Network Associates, Inc. under DARPA/SPAWAR 8 * contract N66001-01-C-8035 ("CBOSS"), as part of the DARPA CHATS --- 29 unchanged lines hidden (view full) --- 38 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 39 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 40 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 41 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 42 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 43 * SUCH DAMAGE. 44 * 45 * @(#)ffs_alloc.c 8.18 (Berkeley) 5/26/95 | 1/* 2 * Copyright (c) 2002 Networks Associates Technology, Inc. 3 * All rights reserved. 4 * 5 * This software was developed for the FreeBSD Project by Marshall 6 * Kirk McKusick and Network Associates Laboratories, the Security 7 * Research Division of Network Associates, Inc. under DARPA/SPAWAR 8 * contract N66001-01-C-8035 ("CBOSS"), as part of the DARPA CHATS --- 29 unchanged lines hidden (view full) --- 38 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 39 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 40 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 41 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 42 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 43 * SUCH DAMAGE. 44 * 45 * @(#)ffs_alloc.c 8.18 (Berkeley) 5/26/95 |
46 * $FreeBSD: head/sys/ufs/ffs/ffs_alloc.c 100201 2002-07-16 22:36:00Z mckusick $ | 46 * $FreeBSD: head/sys/ufs/ffs/ffs_alloc.c 100344 2002-07-19 07:29:39Z mckusick $ |
47 */ 48 49#include "opt_quota.h" 50 51#include <sys/param.h> 52#include <sys/systm.h> 53#include <sys/bio.h> 54#include <sys/buf.h> --- 128 unchanged lines hidden (view full) --- 183 * Reallocate a fragment to a bigger size 184 * 185 * The number and size of the old block is given, and a preference 186 * and new size is also specified. The allocator attempts to extend 187 * the original block. Failing that, the regular block allocator is 188 * invoked to get an appropriate block. 189 */ 190int | 47 */ 48 49#include "opt_quota.h" 50 51#include <sys/param.h> 52#include <sys/systm.h> 53#include <sys/bio.h> 54#include <sys/buf.h> --- 128 unchanged lines hidden (view full) --- 183 * Reallocate a fragment to a bigger size 184 * 185 * The number and size of the old block is given, and a preference 186 * and new size is also specified. The allocator attempts to extend 187 * the original block. Failing that, the regular block allocator is 188 * invoked to get an appropriate block. 189 */ 190int |
191ffs_realloccg(ip, lbprev, bpref, osize, nsize, cred, bpp) | 191ffs_realloccg(ip, lbprev, bprev, bpref, osize, nsize, cred, bpp) |
192 struct inode *ip; 193 ufs2_daddr_t lbprev; | 192 struct inode *ip; 193 ufs2_daddr_t lbprev; |
194 ufs2_daddr_t bprev; |
|
194 ufs2_daddr_t bpref; 195 int osize, nsize; 196 struct ucred *cred; 197 struct buf **bpp; 198{ 199 struct vnode *vp; 200 struct fs *fs; 201 struct buf *bp; 202 int cg, request, error, reclaimed; | 195 ufs2_daddr_t bpref; 196 int osize, nsize; 197 struct ucred *cred; 198 struct buf **bpp; 199{ 200 struct vnode *vp; 201 struct fs *fs; 202 struct buf *bp; 203 int cg, request, error, reclaimed; |
203 ufs2_daddr_t bprev, bno; | 204 ufs2_daddr_t bno; |
204 205 *bpp = 0; 206 vp = ITOV(ip); 207 fs = ip->i_fs; 208#ifdef DIAGNOSTIC 209 if (vp->v_mount->mnt_kern_flag & MNTK_SUSPENDED) 210 panic("ffs_realloccg: allocation on suspended filesystem"); 211 if ((u_int)osize > fs->fs_bsize || fragoff(fs, osize) != 0 || --- 7 unchanged lines hidden (view full) --- 219 if (cred == NOCRED) 220 panic("ffs_realloccg: missing credential"); 221#endif /* DIAGNOSTIC */ 222 reclaimed = 0; 223retry: 224 if (suser_cred(cred, PRISON_ROOT) && 225 freespace(fs, fs->fs_minfree) - numfrags(fs, nsize - osize) < 0) 226 goto nospace; | 205 206 *bpp = 0; 207 vp = ITOV(ip); 208 fs = ip->i_fs; 209#ifdef DIAGNOSTIC 210 if (vp->v_mount->mnt_kern_flag & MNTK_SUSPENDED) 211 panic("ffs_realloccg: allocation on suspended filesystem"); 212 if ((u_int)osize > fs->fs_bsize || fragoff(fs, osize) != 0 || --- 7 unchanged lines hidden (view full) --- 220 if (cred == NOCRED) 221 panic("ffs_realloccg: missing credential"); 222#endif /* DIAGNOSTIC */ 223 reclaimed = 0; 224retry: 225 if (suser_cred(cred, PRISON_ROOT) && 226 freespace(fs, fs->fs_minfree) - numfrags(fs, nsize - osize) < 0) 227 goto nospace; |
227 if ((bprev = DIP(ip, i_db[lbprev])) == 0) { | 228 if (bprev == 0) { |
228 printf("dev = %s, bsize = %ld, bprev = %jd, fs = %s\n", 229 devtoname(ip->i_dev), (long)fs->fs_bsize, (intmax_t)bprev, 230 fs->fs_fsmnt); 231 panic("ffs_realloccg: bad bprev"); 232 } 233 /* 234 * Allocate the extra space in the buffer. 235 */ --- 2062 unchanged lines hidden --- | 229 printf("dev = %s, bsize = %ld, bprev = %jd, fs = %s\n", 230 devtoname(ip->i_dev), (long)fs->fs_bsize, (intmax_t)bprev, 231 fs->fs_fsmnt); 232 panic("ffs_realloccg: bad bprev"); 233 } 234 /* 235 * Allocate the extra space in the buffer. 236 */ --- 2062 unchanged lines hidden --- |