summaryrefslogtreecommitdiff
path: root/sys/ufs/ffs/ffs_balloc.c
diff options
context:
space:
mode:
authorPedro Martelletto <pedro@cvs.openbsd.org>2007-05-26 20:26:52 +0000
committerPedro Martelletto <pedro@cvs.openbsd.org>2007-05-26 20:26:52 +0000
commit196f5066228d908cbac060396a1aba557efe1ef3 (patch)
tree5c48aa4f82af6d902afe35afb642c3d4225a1a07 /sys/ufs/ffs/ffs_balloc.c
parent6e18a0b85a66c596fb041fbf27229487f6661bbf (diff)
Dynamic buffer cache. Initial diff from mickey@, okay art@ beck@ toby@
deraadt@ dlg@.
Diffstat (limited to 'sys/ufs/ffs/ffs_balloc.c')
-rw-r--r--sys/ufs/ffs/ffs_balloc.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/sys/ufs/ffs/ffs_balloc.c b/sys/ufs/ffs/ffs_balloc.c
index 2bba9412313..c4d0e1af4f0 100644
--- a/sys/ufs/ffs/ffs_balloc.c
+++ b/sys/ufs/ffs/ffs_balloc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ffs_balloc.c,v 1.31 2007/01/17 20:47:13 sturm Exp $ */
+/* $OpenBSD: ffs_balloc.c,v 1.32 2007/05/26 20:26:51 pedro Exp $ */
/* $NetBSD: ffs_balloc.c,v 1.3 1996/02/09 22:22:21 christos Exp $ */
/*
@@ -164,12 +164,13 @@ ffs1_balloc(struct inode *ip, off_t startoffset, int size, struct ucred *cred,
* Just read the block (if requested).
*/
if (bpp != NULL) {
- error = bread(vp, lbn, osize, NOCRED,
- bpp);
+ error = bread(vp, lbn, fs->fs_bsize,
+ NOCRED, bpp);
if (error) {
brelse(*bpp);
return (error);
}
+ (*bpp)->b_bcount = osize;
}
return (0);
} else {
@@ -204,7 +205,9 @@ ffs1_balloc(struct inode *ip, off_t startoffset, int size, struct ucred *cred,
if (error)
return (error);
if (bpp != NULL) {
- *bpp = getblk(vp, lbn, nsize, 0, 0);
+ *bpp = getblk(vp, lbn, fs->fs_bsize, 0, 0);
+ if (nsize < fs->fs_bsize)
+ (*bpp)->b_bcount = nsize;
(*bpp)->b_blkno = fsbtodb(fs, newb);
if (flags & B_CLRBUF)
clrbuf(*bpp);
@@ -534,12 +537,13 @@ ffs2_balloc(struct inode *ip, off_t off, int size, struct ucred *cred,
* big as we want. Just read it, if requested.
*/
if (bpp != NULL) {
- error = bread(vp, lbn, osize, NOCRED,
- bpp);
+ error = bread(vp, lbn, fs->fs_bsize,
+ NOCRED, bpp);
if (error) {
brelse(*bpp);
return (error);
}
+ (*bpp)->b_bcount = osize;
}
return (0);
@@ -576,7 +580,9 @@ ffs2_balloc(struct inode *ip, off_t off, int size, struct ucred *cred,
return (error);
if (bpp != NULL) {
- bp = getblk(vp, lbn, nsize, 0, 0);
+ bp = getblk(vp, lbn, fs->fs_bsize, 0, 0);
+ if (nsize < fs->fs_bsize)
+ bp->b_bcount = nsize;
bp->b_blkno = fsbtodb(fs, newb);
if (flags & B_CLRBUF)
clrbuf(bp);