summaryrefslogtreecommitdiffstats
path: root/sys/ufs/ffs/ffs_balloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/ufs/ffs/ffs_balloc.c')
-rw-r--r--sys/ufs/ffs/ffs_balloc.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/sys/ufs/ffs/ffs_balloc.c b/sys/ufs/ffs/ffs_balloc.c
index d20df77..771f8eb 100644
--- a/sys/ufs/ffs/ffs_balloc.c
+++ b/sys/ufs/ffs/ffs_balloc.c
@@ -246,7 +246,8 @@ ffs_balloc_ufs1(struct vnode *vp, off_t startoffset, int size,
lbns_remfree = lbns;
if (nb == 0) {
UFS_LOCK(ump);
- pref = ffs_blkpref_ufs1(ip, lbn, 0, (ufs1_daddr_t *)0);
+ pref = ffs_blkpref_ufs1(ip, lbn, -indirs[0].in_off - 1,
+ (ufs1_daddr_t *)0);
if ((error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize,
flags, cred, &newb)) != 0) {
curthread_pflags_restore(saved_inbdflush);
@@ -299,7 +300,8 @@ retry:
}
UFS_LOCK(ump);
if (pref == 0)
- pref = ffs_blkpref_ufs1(ip, lbn, 0, (ufs1_daddr_t *)0);
+ pref = ffs_blkpref_ufs1(ip, lbn, i - num - 1,
+ (ufs1_daddr_t *)0);
if ((error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize,
flags | IO_BUFLOCKED, cred, &newb)) != 0) {
brelse(bp);
@@ -794,7 +796,8 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size,
lbns_remfree = lbns;
if (nb == 0) {
UFS_LOCK(ump);
- pref = ffs_blkpref_ufs2(ip, lbn, 0, (ufs2_daddr_t *)0);
+ pref = ffs_blkpref_ufs2(ip, lbn, -indirs[0].in_off - 1,
+ (ufs2_daddr_t *)0);
if ((error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize,
flags, cred, &newb)) != 0) {
curthread_pflags_restore(saved_inbdflush);
@@ -848,7 +851,8 @@ retry:
}
UFS_LOCK(ump);
if (pref == 0)
- pref = ffs_blkpref_ufs2(ip, lbn, 0, (ufs2_daddr_t *)0);
+ pref = ffs_blkpref_ufs2(ip, lbn, i - num - 1,
+ (ufs2_daddr_t *)0);
if ((error = ffs_alloc(ip, lbn, pref, (int)fs->fs_bsize,
flags | IO_BUFLOCKED, cred, &newb)) != 0) {
brelse(bp);
OpenPOWER on IntegriCloud