missed clustering for small block sizes in cluster_wbuild()
Konstantin Belousov
kostikbel at gmail.com
Tue Jun 11 06:34:51 UTC 2013
On Fri, Jun 07, 2013 at 05:28:11AM +1000, Bruce Evans wrote:
> I think this is best fixed be fixed by removing the check above and
> checking here. Then back out of the changes. I don't know this code
> well enough to write the backing out easily.
Could you test this, please ?
diff --git a/sys/kern/vfs_cluster.c b/sys/kern/vfs_cluster.c
index b280317..9e1528e 100644
--- a/sys/kern/vfs_cluster.c
+++ b/sys/kern/vfs_cluster.c
@@ -766,7 +766,7 @@ cluster_wbuild(struct vnode *vp, long size, daddr_t start_lbn, int len,
{
struct buf *bp, *tbp;
struct bufobj *bo;
- int i, j;
+ int i, j, jj;
int totalwritten = 0;
int dbsize = btodb(size);
@@ -904,14 +904,10 @@ cluster_wbuild(struct vnode *vp, long size, daddr_t start_lbn, int len,
/*
* Check that the combined cluster
- * would make sense with regard to pages
- * and would not be too large
+ * would make sense with regard to pages.
*/
- if ((tbp->b_bcount != size) ||
- ((bp->b_blkno + (dbsize * i)) !=
- tbp->b_blkno) ||
- ((tbp->b_npages + bp->b_npages) >
- (vp->v_mount->mnt_iosize_max / PAGE_SIZE))) {
+ if (tbp->b_bcount != size ||
+ bp->b_blkno + dbsize * i != tbp->b_blkno) {
BUF_UNLOCK(tbp);
break;
}
@@ -964,6 +960,22 @@ cluster_wbuild(struct vnode *vp, long size, daddr_t start_lbn, int len,
bp->b_pages[bp->b_npages] = m;
bp->b_npages++;
}
+ if (bp->b_npages > vp->v_mount->
+ mnt_iosize_max / PAGE_SIZE) {
+ KASSERT(i != 0, ("XXX"));
+ j++;
+ for (jj = 0; jj < j; jj++) {
+ vm_page_io_finish(tbp->
+ b_pages[jj]);
+ }
+ vm_object_pip_subtract(
+ m->object, j);
+ bqrelse(tbp);
+ bp->b_npages -= j;
+ VM_OBJECT_WUNLOCK(tbp->
+ b_bufobj->bo_object);
+ goto finishcluster;
+ }
}
VM_OBJECT_WUNLOCK(tbp->b_bufobj->bo_object);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-fs/attachments/20130611/d8aaa00e/attachment.sig>
More information about the freebsd-fs
mailing list