From patchwork Tue Mar 13 16:22:51 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 146442 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id A1E64B6F13 for ; Wed, 14 Mar 2012 03:23:07 +1100 (EST) Received: from localhost ([::1]:40432 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S7UV7-00073g-Ff for incoming@patchwork.ozlabs.org; Tue, 13 Mar 2012 12:23:05 -0400 Received: from eggs.gnu.org ([208.118.235.92]:45565) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S7UUz-00072g-Gv for qemu-devel@nongnu.org; Tue, 13 Mar 2012 12:22:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S7UUx-0008Nc-Ns for qemu-devel@nongnu.org; Tue, 13 Mar 2012 12:22:57 -0400 Received: from isrv.corpit.ru ([86.62.121.231]:34457) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S7UUx-0008NK-GW for qemu-devel@nongnu.org; Tue, 13 Mar 2012 12:22:55 -0400 Received: from gandalf.tls.msk.ru (mjt.vpn.tls.msk.ru [192.168.177.99]) by isrv.corpit.ru (Postfix) with ESMTP id D5B2BA09C2; Tue, 13 Mar 2012 20:22:53 +0400 (MSK) Received: by gandalf.tls.msk.ru (Postfix, from userid 1000) id EBC3A65DB; Tue, 13 Mar 2012 20:22:52 +0400 (MSK) From: Michael Tokarev To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2012 20:22:51 +0400 Message-Id: <1331655771-10868-1-git-send-email-mjt@msgid.tls.msk.ru> X-Mailer: git-send-email 1.7.9.1 In-Reply-To: <1331655521-5986-1-git-send-email-mjt@msgid.tls.msk.ru> References: <1331655521-5986-1-git-send-email-mjt@msgid.tls.msk.ru> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 86.62.121.231 Cc: Stefan Hajnoczi , Michael Tokarev Subject: [Qemu-devel] [PATCH (trivial)] no need to use bdrv_pread() in format guessing code when we can use bdrv_read() directly X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org [Sorry - sent the wrong patch, should have been BDRV_SECTOR_SIZE, not BDRV_BLOCK_SIZE....] block.c:find_image_format() calls bdrv_pread() to read first 2048 bytes from the device to guess its format. This function can use bdrv_read() directly since the the read is done on sector boundary. Signed-off-by: Michael Tokarev --- block.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/block.c b/block.c index b88ee90..b3af1f6 100644 --- a/block.c +++ b/block.c @@ -469,7 +469,7 @@ static int find_image_format(const char *filename, BlockDriver **pdrv) return ret; } - ret = bdrv_pread(bs, 0, buf, sizeof(buf)); + ret = bdrv_read(bs, 0, buf, sizeof(buf) / BDRV_SECTOR_SIZE); bdrv_delete(bs); if (ret < 0) { *pdrv = NULL;