diff options
author | ambrisko <ambrisko@FreeBSD.org> | 2016-05-27 19:23:15 +0000 |
---|---|---|
committer | ambrisko <ambrisko@FreeBSD.org> | 2016-05-27 19:23:15 +0000 |
commit | 761de60035ded8db43c3a1524937596cfd93c15c (patch) | |
tree | 3d3b42b3b36f7b9b0703f2ec1de911b5ffd1249c | |
parent | 2ee4c45354a70796c27caff9e46e153706269ccf (diff) | |
download | FreeBSD-src-761de60035ded8db43c3a1524937596cfd93c15c.zip FreeBSD-src-761de60035ded8db43c3a1524937596cfd93c15c.tar.gz |
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
-rw-r--r-- | sys/boot/efi/libefi/efipart.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/boot/efi/libefi/efipart.c b/sys/boot/efi/libefi/efipart.c index 11b7a1a..7e53643 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) |