Received: from eggs.gnu.org ([2001:4830:134:3::10]:55253) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XXIHf-00081B-Lr for qemu-devel@nongnu.org; Thu, 25 Sep 2014 19:17:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XXIHY-0004K2-NI for qemu-devel@nongnu.org; Thu, 25 Sep 2014 19:17:11 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:54888) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XXIHY-0004H8-B2 for qemu-devel@nongnu.org; Thu, 25 Sep 2014 19:17:04 -0400 From: Tony Breeds Date: Fri, 26 Sep 2014 09:14:12 +1000 Message-Id: <1411686852-26487-2-git-send-email-tony@bakeyournoodle.com> In-Reply-To: <1411686852-26487-1-git-send-email-tony@bakeyournoodle.com> References: <1411622627-22110-1-git-send-email-tony@bakeyournoodle.com> <1411686852-26487-1-git-send-email-tony@bakeyournoodle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH v2 2/2] block/raw-posix: use seek_hole ahead of fiemap List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Markus Armbruster , Tony Breeds , Max Reitz , =?UTF-8?q?P=C3=A1draig=20Brady?= , Stefan Hajnoczi try_fiemap() uses FIEMAP_FLAG_SYNC which has a significant performance impact. Prefer seek_hole() over fiemap() to avoid this impact where possible. seek_hole is more widely used and, arguably, has potential to be optimised in the kernel. Reported-By: Michael Steffens Signed-off-by: Tony Breeds Cc: Kevin Wolf Cc: Markus Armbruster Cc: Stefan Hajnoczi Cc: Max Reitz Cc: P=C3=A1draig Brady Cc: Eric Blake --- Changes since v1: - split in to 2 patches - tried to make the commit messages better block/raw-posix.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/raw-posix.c b/block/raw-posix.c index b8203e9..b438c54 100644 --- a/block/raw-posix.c +++ b/block/raw-posix.c @@ -1561,9 +1561,9 @@ static int64_t coroutine_fn raw_co_get_block_status= (BlockDriverState *bs, =20 start =3D sector_num * BDRV_SECTOR_SIZE; =20 - ret =3D try_fiemap(bs, start, &data, &hole, nb_sectors, pnum); + ret =3D try_seek_hole(bs, start, &data, &hole, pnum); if (ret < 0) { - ret =3D try_seek_hole(bs, start, &data, &hole, pnum); + ret =3D try_fiemap(bs, start, &data, &hole, nb_sectors, pnum); if (ret < 0) { /* Assume everything is allocated. */ data =3D 0; --=20 1.9.3