From 6bf8d16009cff0a5e945bb9055f1297ebfff7e85 Mon Sep 17 00:00:00 2001 From: Allan Jude Date: Sat, 30 Jul 2016 17:45:56 +0000 Subject: [PATCH] bcache should support reads shorter than sector size dosfs (fat file systems) can perform reads of partial sectors bcache should support such reads. Submitted by: Toomas Soome Reviewed by: cem Differential Revision: https://reviews.freebsd.org/D6475 --- sys/boot/common/bcache.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/boot/common/bcache.c b/sys/boot/common/bcache.c index 4bb9082bea2..c935c90f938 100644 --- a/sys/boot/common/bcache.c +++ b/sys/boot/common/bcache.c @@ -303,7 +303,9 @@ read_strategy(void *devdata, int rw, daddr_t blk, size_t offset, break; } - size = i * bcache_blksize; + if (size > i * bcache_blksize) + size = i * bcache_blksize; + if (size != 0) { bcopy(bc->bcache_data + (bcache_blksize * BHASH(bc, blk)) + offset, buf, size);