Index: lib/libstand/read.c =================================================================== --- lib/libstand/read.c (revision 288668) +++ lib/libstand/read.c (working copy) @@ -78,8 +78,11 @@ } if (f->f_flags & F_RAW) { twiddle(4); - errno = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, - btodb(f->f_offset), bcount, dest, &resid); + int flag = F_READ; + if (bcount >1024) + flag |= F_NOBUF; /* avoid bcache trashing */ + errno = (f->f_dev->dv_strategy)(f->f_devdata, flag, btodb(f->f_offset), + bcount, dest, &resid); if (errno) return (-1); f->f_offset += resid; Index: lib/libstand/stand.h =================================================================== --- lib/libstand/stand.h (revision 288668) +++ lib/libstand/stand.h (working copy) @@ -174,7 +174,10 @@ #define F_READ 0x0001 /* file opened for reading */ #define F_WRITE 0x0002 /* file opened for writing */ #define F_RAW 0x0004 /* raw device open - no file system */ -#define F_NODEV 0x0008 /* network open - no device */ +#define F_NODEV 0x0008 /* network open - no device */ +#define F_GZIP 0x0010 /* file is compressed by gzip */ +#define F_BZIP 0x0020 /* file is compressed by bzip */ +#define F_NOBUF 0x0040 /* skip bcache */ #define isascii(c) (((c) & ~0x7F) == 0) Index: lib/libstand/ufs.c =================================================================== --- lib/libstand/ufs.c (revision 288668) +++ lib/libstand/ufs.c (working copy) @@ -407,8 +407,9 @@ fp->f_buf_size = block_size; } else { twiddle(4); - rc = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, - fsbtodb(fs, disk_block), + /* disable double buffering for speed */ + rc = (f->f_dev->dv_strategy)(f->f_devdata, + F_READ|F_NOBUF, fsbtodb(fs, disk_block), block_size, fp->f_buf, &fp->f_buf_size); if (rc) return (rc); Index: sys/boot/common/bcache.c =================================================================== --- sys/boot/common/bcache.c (revision 288668) +++ sys/boot/common/bcache.c (working copy) @@ -238,8 +238,10 @@ } /* bypass large requests, or when the cache is inactive */ - if ((bcache_data == NULL) || ((size * 2 / bcache_blksize) > bcache_nblks)) { + if ((bcache_data == NULL) || (rw & F_NOBUF) || + ((size * 2 / bcache_blksize) > bcache_nblks)) { DEBUG("bypass %d from %d", size / bcache_blksize, blk); + rw &= ~F_NOBUF; bcache_bypasses++; return(dd->dv_strategy(dd->dv_devdata, rw, blk, size, buf, rsize)); }