From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58060) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XgD84-0004CV-53 for qemu-devel@nongnu.org; Mon, 20 Oct 2014 09:36:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XgD7z-0007C6-Lc for qemu-devel@nongnu.org; Mon, 20 Oct 2014 09:36:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38689) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XgD7z-0007C0-DP for qemu-devel@nongnu.org; Mon, 20 Oct 2014 09:36:03 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s9KDa1jJ019552 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Mon, 20 Oct 2014 09:36:02 -0400 From: Kevin Wolf Date: Mon, 20 Oct 2014 15:35:29 +0200 Message-Id: <1413812154-11153-4-git-send-email-kwolf@redhat.com> In-Reply-To: <1413812154-11153-1-git-send-email-kwolf@redhat.com> References: <1413812154-11153-1-git-send-email-kwolf@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL 03/28] 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: kwolf@redhat.com From: Tony Breeds 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 Reviewed-by: Eric Blake Reviewed-by: Max Reitz Signed-off-by: Kevin Wolf --- 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 d672c73..eb76f0e 100644 --- a/block/raw-posix.c +++ b/block/raw-posix.c @@ -1571,9 +1571,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.8.3.1