From 9c8f0619db3a8863d952c422ae3791f4a29a35b7 Mon Sep 17 00:00:00 2001 From: Doug Ambrisko Date: Fri, 27 May 2016 19:23:15 +0000 Subject: [PATCH] If the I/O offset and length is multiple of the media size then directly pass the request otherwise use a buffer that is a multiple of the media size. This speeds up I/O quite a bit when using large transfer sizes on 4Kn disks etc. MFC after: 1 week --- sys/boot/efi/libefi/efipart.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/boot/efi/libefi/efipart.c b/sys/boot/efi/libefi/efipart.c index 11b7a1a3c604..7e5364321884 100644 --- a/sys/boot/efi/libefi/efipart.c +++ b/sys/boot/efi/libefi/efipart.c @@ -325,11 +325,14 @@ efipart_realstrategy(void *devdata, int rw, daddr_t blk, size_t offset, if (rsize != NULL) *rsize = size; - if (blkio->Media->BlockSize == 512) - return (efipart_readwrite(blkio, rw, blk, size / 512, buf)); + if ((size % blkio->Media->BlockSize == 0) && + ((blk * 512) % blkio->Media->BlockSize == 0)) + return (efipart_readwrite(blkio, rw, + blk * 512 / blkio->Media->BlockSize, + size / blkio->Media->BlockSize, buf)); /* - * The block size of the media is not 512B per sector. + * The block size of the media is not a multiple of I/O. */ blkbuf = malloc(blkio->Media->BlockSize); if (blkbuf == NULL)