From patchwork Wed May 18 08:19:13 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Asias He X-Patchwork-Id: 793132 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p4I8O3wr004358 for ; Wed, 18 May 2011 08:24:07 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755756Ab1ERIXs (ORCPT ); Wed, 18 May 2011 04:23:48 -0400 Received: from mail-pz0-f46.google.com ([209.85.210.46]:37524 "EHLO mail-pz0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755466Ab1ERIXr (ORCPT ); Wed, 18 May 2011 04:23:47 -0400 Received: by mail-pz0-f46.google.com with SMTP id 9so601787pzk.19 for ; Wed, 18 May 2011 01:23:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references; bh=oLi/MTiekrZdGM21Vm3J7DCiZ+Xw+gZW3Zn+uAvyHkA=; b=t5WxKzi0KfIP5ayqku2BI0vNXKmG8y8OPz0KphpHK3d4J/BxVVXhjEoBh2JRaHPzmq ZNp7xyx8sBe4iH1+eUqa4UGFOy4Y9JEREziavEpiMBZta9+mfLy+ZEmslNOij+tLw6BR 911OgfrdAjJB0unrpQnVrkKk1/P2N9gTiSyhc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=ruH+XXijkQ5Qt0CJ55bLE4x5TAml9SngtdmBwNpw0hBDORrZam+7gjl3eEPknDOfmU c+XZHDpyqSCw+jr+9pnFosqTcZ9yfjPr6Msn+me30zpaRFT7J9/xWsH3l5oMX8WnaMb1 Hj3R69x43TOgOVw8zqVGw8f02oQkPAPYBmT5o= Received: by 10.68.41.9 with SMTP id b9mr2617468pbl.436.1305707027234; Wed, 18 May 2011 01:23:47 -0700 (PDT) Received: from localhost.localdomain ([219.224.169.130]) by mx.google.com with ESMTPS id q10sm912018pbk.39.2011.05.18.01.23.41 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 18 May 2011 01:23:46 -0700 (PDT) From: Asias He To: Pekka Enberg Cc: Cyrill Gorcunov , Ingo Molnar , Sasha Levin , Prasad Joshi , kvm@vger.kernel.org, Asias He Subject: [PATCH 12/14] kvm tools: Do not use 'inline' for disk_image__flush Date: Wed, 18 May 2011 16:19:13 +0800 Message-Id: <1305706755-2816-12-git-send-email-asias.hejun@gmail.com> X-Mailer: git-send-email 1.7.5.1 In-Reply-To: <1305706755-2816-1-git-send-email-asias.hejun@gmail.com> References: <1305706755-2816-1-git-send-email-asias.hejun@gmail.com> 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.6 (demeter2.kernel.org [140.211.167.43]); Wed, 18 May 2011 08:24:07 +0000 (UTC) Signed-off-by: Asias He --- tools/kvm/disk/core.c | 8 ++++++++ tools/kvm/include/kvm/disk-image.h | 9 +-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/tools/kvm/disk/core.c b/tools/kvm/disk/core.c index 6894b17..f3dd0bb 100644 --- a/tools/kvm/disk/core.c +++ b/tools/kvm/disk/core.c @@ -59,6 +59,14 @@ struct disk_image *disk_image__open(const char *filename, bool readonly) return NULL; } +int disk_image__flush(struct disk_image *disk) +{ + if (disk->ops->flush) + return disk->ops->flush(disk); + + return fsync(disk->fd); +} + int disk_image__close(struct disk_image *disk) { /* If there was no disk image then there's nothing to do: */ diff --git a/tools/kvm/include/kvm/disk-image.h b/tools/kvm/include/kvm/disk-image.h index 82884fb..ac394e8 100644 --- a/tools/kvm/include/kvm/disk-image.h +++ b/tools/kvm/include/kvm/disk-image.h @@ -53,17 +53,10 @@ struct disk_image { struct disk_image *disk_image__open(const char *filename, bool readonly); struct disk_image *disk_image__new(int fd, u64 size, struct disk_image_operations *ops, int mmap); int disk_image__close(struct disk_image *disk); - +int disk_image__flush(struct disk_image *disk); ssize_t disk_image__read(struct disk_image *disk, u64 sector, const struct iovec *iov, int iovcount); ssize_t disk_image__write(struct disk_image *disk, u64 sector, const struct iovec *iov, int iovcount); -static inline int disk_image__flush(struct disk_image *disk) -{ - if (disk->ops->flush) - return disk->ops->flush(disk); - return fsync(disk->fd); -} - struct disk_image *raw_image__probe(int fd, struct stat *st, bool readonly); struct disk_image *blkdev__probe(const char *filename, struct stat *st);