diff options
author | dillon <dillon@FreeBSD.org> | 2001-10-25 22:49:48 +0000 |
---|---|---|
committer | dillon <dillon@FreeBSD.org> | 2001-10-25 22:49:48 +0000 |
commit | c428dfdefb9b7fbf3edbaf5efad4918801a356cd (patch) | |
tree | cd988e95d101c4bdf78edd58c8b8e51655541a76 /sys | |
parent | a22b73a2d7884460d1f21cc881cfe3d8411065ac (diff) | |
download | FreeBSD-src-c428dfdefb9b7fbf3edbaf5efad4918801a356cd.zip FreeBSD-src-c428dfdefb9b7fbf3edbaf5efad4918801a356cd.tar.gz |
In cluster_rbuild(), 'size' had better match buf->b_bcount and buf->b_bufsize
or the cluster will not be properly merged. Dup the code from
cluster_wbuild() and add some printf()s to see if bad cases are present.
MFC after: 2 weeks
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/vfs_cluster.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/sys/kern/vfs_cluster.c b/sys/kern/vfs_cluster.c index a2b97a7..0af9fed 100644 --- a/sys/kern/vfs_cluster.c +++ b/sys/kern/vfs_cluster.c @@ -477,8 +477,20 @@ cluster_rbuild(vp, filesize, lbn, blkno, size, run, fbp) if ((m->valid & VM_PAGE_BITS_ALL) == VM_PAGE_BITS_ALL) tbp->b_pages[j] = bogus_page; } - bp->b_bcount += tbp->b_bcount; - bp->b_bufsize += tbp->b_bufsize; + /* + * XXX shouldn't this be += size for both, like in + * cluster_wbuild()? + * + * Don't inherit tbp->b_bufsize as it may be larger due to + * a non-page-aligned size. Instead just aggregate using + * 'size'. + */ + if (tbp->b_bcount != size) + printf("warning: tbp->b_bcount wrong %ld vs %ld\n", tbp->b_bcount, size); + if (tbp->b_bufsize != size) + printf("warning: tbp->b_bufsize wrong %ld vs %ld\n", tbp->b_bufsize, size); + bp->b_bcount += size; + bp->b_bufsize += size; } /* |