Index: sys/kern/vfs_bio.c =================================================================== --- sys/kern/vfs_bio.c +++ sys/kern/vfs_bio.c @@ -4175,19 +4175,6 @@ static void vfs_nonvmio_truncate(struct buf *bp, int newbsize) { - - if (bp->b_flags & B_MALLOC) { - /* - * malloced buffers are not shrunk - */ - if (newbsize == 0) { - bufmallocadjust(bp, 0); - free(bp->b_data, M_BIOBUF); - bp->b_data = bp->b_kvabase; - bp->b_flags &= ~B_MALLOC; - } - return; - } vm_hold_free_pages(bp, newbsize); bufspace_adjust(bp, newbsize); } @@ -4198,48 +4185,8 @@ static void vfs_nonvmio_extend(struct buf *bp, int newbsize) { - caddr_t origbuf; - int origbufsize; - - /* - * We only use malloced memory on the first allocation. - * and revert to page-allocated memory when the buffer - * grows. - * - * There is a potential smp race here that could lead - * to bufmallocspace slightly passing the max. It - * is probably extremely rare and not worth worrying - * over. - */ - if (bp->b_bufsize == 0 && newbsize <= PAGE_SIZE/2 && - bufmallocspace < maxbufmallocspace) { - bp->b_data = malloc(newbsize, M_BIOBUF, M_WAITOK); - bp->b_flags |= B_MALLOC; - bufmallocadjust(bp, newbsize); - return; - } - - /* - * If the buffer is growing on its other-than-first - * allocation then we revert to the page-allocation - * scheme. - */ - origbuf = NULL; - origbufsize = 0; - if (bp->b_flags & B_MALLOC) { - origbuf = bp->b_data; - origbufsize = bp->b_bufsize; - bp->b_data = bp->b_kvabase; - bufmallocadjust(bp, 0); - bp->b_flags &= ~B_MALLOC; - newbsize = round_page(newbsize); - } vm_hold_load_pages(bp, (vm_offset_t) bp->b_data + bp->b_bufsize, (vm_offset_t) bp->b_data + newbsize); - if (origbuf != NULL) { - bcopy(origbuf, bp->b_data, origbufsize); - free(origbuf, M_BIOBUF); - } bufspace_adjust(bp, newbsize); }