summaryrefslogtreecommitdiff
path: root/sys/ufs/ffs/ffs_alloc.c
diff options
context:
space:
mode:
authorThordur I. Bjornsson <thib@cvs.openbsd.org>2008-08-08 16:17:39 +0000
committerThordur I. Bjornsson <thib@cvs.openbsd.org>2008-08-08 16:17:39 +0000
commite23d642d208f6e954cea39bf798bcc81165a5b9f (patch)
treeb130b281563cd32c4957bd7709c0a322d4203247 /sys/ufs/ffs/ffs_alloc.c
parent54e2a9d4d292f06ea79e4316d0e1a1f8b3b808bb (diff)
use cgbase() instead of doing arthmetic on fs_fpg when calculating
block# too ensure proper casting. From FreeBSD; ok miod@, pedro@, blambert@
Diffstat (limited to 'sys/ufs/ffs/ffs_alloc.c')
-rw-r--r--sys/ufs/ffs/ffs_alloc.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/ufs/ffs/ffs_alloc.c b/sys/ufs/ffs/ffs_alloc.c
index c1b5ef5dcf4..b241b75af6c 100644
--- a/sys/ufs/ffs/ffs_alloc.c
+++ b/sys/ufs/ffs/ffs_alloc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ffs_alloc.c,v 1.85 2008/08/02 08:34:36 otto Exp $ */
+/* $OpenBSD: ffs_alloc.c,v 1.86 2008/08/08 16:17:38 thib Exp $ */
/* $NetBSD: ffs_alloc.c,v 1.11 1996/05/11 18:27:09 mycroft Exp $ */
/*
@@ -1346,7 +1346,7 @@ ffs_alloccg(struct inode *ip, int cg, daddr64_t bpref, int size)
if (frags != allocsiz)
cgp->cg_frsum[allocsiz - frags]++;
- blkno = (daddr64_t)cg * fs->fs_fpg + bno;
+ blkno = cgbase(fs, cg) + bno;
if (DOINGSOFTDEP(ITOV(ip)))
softdep_setup_blkmapdep(bp, fs, blkno);
bdwrite(bp);
@@ -1407,7 +1407,7 @@ gotit:
}
fs->fs_fmod = 1;
- blkno = (daddr64_t)cgp->cg_cgx * fs->fs_fpg + bno;
+ blkno = cgbase(fs, cgp->cg_cgx) + bno;
if (DOINGSOFTDEP(ITOV(ip)))
softdep_setup_blkmapdep(bp, fs, blkno);
@@ -1509,7 +1509,7 @@ ffs_clusteralloc(struct inode *ip, int cg, daddr64_t bpref, int len)
if (!ffs_isblock(fs, cg_blksfree(cgp), got - run + i))
panic("ffs_clusteralloc: map mismatch");
#endif
- bno = cg * fs->fs_fpg + blkstofrags(fs, got - run + 1);
+ bno = cgbase(fs, cg) + blkstofrags(fs, got - run + 1);
#ifdef DIAGNOSTIC
if (dtog(fs, bno) != cg)
panic("ffs_clusteralloc: allocated out of group");