From patchwork Mon May 17 16:46:04 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nicholas A. Bellinger" X-Patchwork-Id: 100005 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o4H2wpax019244 for ; Mon, 17 May 2010 02:58:51 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752256Ab0EQC6t (ORCPT ); Sun, 16 May 2010 22:58:49 -0400 Received: from smtp125.sbc.mail.sp1.yahoo.com ([69.147.65.184]:26454 "HELO smtp125.sbc.mail.sp1.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1752074Ab0EQC6t (ORCPT ); Sun, 16 May 2010 22:58:49 -0400 Received: (qmail 5954 invoked from network); 17 May 2010 02:58:48 -0000 Received: from adsl-70-231-246-220.dsl.snfc21.sbcglobal.net (nab@70.231.246.220 with login) by smtp125.sbc.mail.sp1.yahoo.com with SMTP; 16 May 2010 19:58:48 -0700 PDT X-Yahoo-SMTP: fzDSGlOswBCWnIOrNw7KwwK1j9PqyNbe5PtLKiS4dDU.UNl_t6bdEZu9tTLW X-YMail-OSG: n43B8uYVM1np3zoZCLU4wwpk3FCOH1EoQOutjDr6gurioIZNLeOGL5tdFWbh6laDm0N0iDyT4UxXAnIyLqGeCEHqp7wqzt5htdh..gnC7lua17n2U_OJIuyjWlLIcTEWF_feTMT.yWFmE3QLAMV4YxY7n7e1eHugRHPjrW3oDD9gM.WdoN0MuM5BF69PMawBznDGxDFy2kC4z7J8VZGadJ_93s2h4uB0ElxN6RR3YhIrd_J5DneLqhgVXJQWwY7CRROog_s9bbTEh9h5Zh3.pdaqREcWT1F8bCVTf3RS0z9U5R3qjQQ22AKg2BimxKmiGKBYcgd.12NhTceMTPwOTY6e0yNb_JSubQUE_VwLnLgpvg-- X-Yahoo-Newman-Property: ymail-3 From: "Nicholas A. Bellinger" To: Kevin Wolf , Christoph Hellwig , Gerd Hoffmann , Hannes Reinecke , kvm-devel , qemu-devel Cc: Nicholas Bellinger Subject: [PATCH 2/2] [block]: Add SG_IO device check in refresh_total_sectors() Date: Mon, 17 May 2010 09:46:04 -0700 Message-Id: <1274114764-27975-1-git-send-email-nab@linux-iscsi.org> X-Mailer: git-send-email 1.5.6.5 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Mon, 17 May 2010 02:58:51 +0000 (UTC) diff --git a/block.c b/block.c index f419ee6..7917712 100644 --- a/block.c +++ b/block.c @@ -364,6 +364,10 @@ static int refresh_total_sectors(BlockDriverState *bs, int64_t hint) { BlockDriver *drv = bs->drv; + /* Do not attempt drv->bdrv_getlength() on scsi-generic devices */ + if (bs->sg) + return 0; + /* query actual device if possible, otherwise just trust the hint */ if (drv->bdrv_getlength) { int64_t length = drv->bdrv_getlength(bs);