From patchwork Sat Jul 9 13:02:34 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pekka Enberg X-Patchwork-Id: 959512 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p69D3J0D004277 for ; Sat, 9 Jul 2011 13:03:21 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753509Ab1GINDE (ORCPT ); Sat, 9 Jul 2011 09:03:04 -0400 Received: from filtteri1.pp.htv.fi ([213.243.153.184]:46669 "EHLO filtteri1.pp.htv.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752982Ab1GINDB (ORCPT ); Sat, 9 Jul 2011 09:03:01 -0400 Received: from localhost (localhost [127.0.0.1]) by filtteri1.pp.htv.fi (Postfix) with ESMTP id 075D41FB021; Sat, 9 Jul 2011 16:03:00 +0300 (EEST) X-Virus-Scanned: Debian amavisd-new at pp.htv.fi Received: from smtp6.welho.com ([213.243.153.40]) by localhost (filtteri1.pp.htv.fi [213.243.153.184]) (amavisd-new, port 10024) with ESMTP id kgV+wGdz7jV2; Sat, 9 Jul 2011 16:02:59 +0300 (EEST) Received: from localhost.localdomain (cs181136138.pp.htv.fi [82.181.136.138]) by smtp6.welho.com (Postfix) with ESMTP id 902525BC005; Sat, 9 Jul 2011 16:02:59 +0300 (EEST) From: Pekka Enberg To: kvm@vger.kernel.org Cc: Pekka Enberg , Asias He , Cyrill Gorcunov , Ingo Molnar , Prasad Joshi , Sasha Levin Subject: [PATCH 1/9] kvm tools, qcow: Rename struct qcow_l2_cache to struct qcow_l2_table Date: Sat, 9 Jul 2011 16:02:34 +0300 Message-Id: <1310216563-17503-2-git-send-email-penberg@kernel.org> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1310216563-17503-1-git-send-email-penberg@kernel.org> References: <1310216563-17503-1-git-send-email-penberg@kernel.org> 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 (demeter1.kernel.org [140.211.167.41]); Sat, 09 Jul 2011 13:03:22 +0000 (UTC) This patch renames 'struct qcow_l2_cache' to 'struct qcow_l2_table' in preparation for replacing the untyped L2 table arrays with the struct. Cc: Asias He Cc: Cyrill Gorcunov Cc: Ingo Molnar Cc: Prasad Joshi Cc: Sasha Levin Signed-off-by: Pekka Enberg --- tools/kvm/disk/qcow.c | 32 ++++++++++++++++---------------- tools/kvm/include/kvm/qcow.h | 2 +- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/tools/kvm/disk/qcow.c b/tools/kvm/disk/qcow.c index 3f8c52d..a346c3d 100644 --- a/tools/kvm/disk/qcow.c +++ b/tools/kvm/disk/qcow.c @@ -16,16 +16,16 @@ #include #include -static int insert(struct rb_root *root, struct qcow_l2_cache *new) +static int insert(struct rb_root *root, struct qcow_l2_table *new) { struct rb_node **link = &(root->rb_node), *parent = NULL; u64 offset = new->offset; /* search the tree */ while (*link) { - struct qcow_l2_cache *t; + struct qcow_l2_table *t; - t = rb_entry(*link, struct qcow_l2_cache, node); + t = rb_entry(*link, struct qcow_l2_table, node); if (!t) goto error; @@ -48,14 +48,14 @@ error: return -1; } -static struct qcow_l2_cache *search(struct rb_root *root, u64 offset) +static struct qcow_l2_table *search(struct rb_root *root, u64 offset) { struct rb_node *link = root->rb_node; while (link) { - struct qcow_l2_cache *t; + struct qcow_l2_table *t; - t = rb_entry(link, struct qcow_l2_cache, node); + t = rb_entry(link, struct qcow_l2_table, node); if (!t) goto out; @@ -73,13 +73,13 @@ out: static void free_cache(struct qcow *q) { struct list_head *pos, *n; - struct qcow_l2_cache *t; + struct qcow_l2_table *t; struct rb_root *r = &q->root; list_for_each_safe(pos, n, &q->lru_list) { /* Remove cache table from the list and RB tree */ list_del(pos); - t = list_entry(pos, struct qcow_l2_cache, list); + t = list_entry(pos, struct qcow_l2_table, list); rb_erase(&t->node, r); /* Free the cached node */ @@ -87,17 +87,17 @@ static void free_cache(struct qcow *q) } } -static int cache_table(struct qcow *q, struct qcow_l2_cache *c) +static int cache_table(struct qcow *q, struct qcow_l2_table *c) { struct rb_root *r = &q->root; - struct qcow_l2_cache *lru; + struct qcow_l2_table *lru; if (q->nr_cached == MAX_CACHE_NODES) { /* * The node at the head of the list is least recently used * node. Remove it from the list and replaced with a new node. */ - lru = list_first_entry(&q->lru_list, struct qcow_l2_cache, list); + lru = list_first_entry(&q->lru_list, struct qcow_l2_table, list); /* Remove the node from the cache */ rb_erase(&lru->node, r); @@ -123,7 +123,7 @@ error: static int search_table(struct qcow *q, u64 **table, u64 offset) { - struct qcow_l2_cache *c; + struct qcow_l2_table *c; *table = NULL; @@ -139,10 +139,10 @@ static int search_table(struct qcow *q, u64 **table, u64 offset) } /* Allocates a new node for caching L2 table */ -static struct qcow_l2_cache *new_cache_table(struct qcow *q, u64 offset) +static struct qcow_l2_table *new_cache_table(struct qcow *q, u64 offset) { struct qcow_header *header = q->header; - struct qcow_l2_cache *c; + struct qcow_l2_table *c; u64 l2t_sz; u64 size; @@ -183,7 +183,7 @@ static inline u64 get_cluster_offset(struct qcow *q, u64 offset) static int qcow_read_l2_table(struct qcow *q, u64 **table, u64 offset) { struct qcow_header *header = q->header; - struct qcow_l2_cache *c; + struct qcow_l2_table *c; u64 size; u64 i; u64 *t; @@ -367,7 +367,7 @@ static ssize_t qcow_write_cluster(struct qcow *q, u64 offset, void *buf, u32 src { struct qcow_header *header = q->header; struct qcow_table *table = &q->table; - struct qcow_l2_cache *c; + struct qcow_l2_table *c; bool update_meta; u64 clust_start; u64 clust_off; diff --git a/tools/kvm/include/kvm/qcow.h b/tools/kvm/include/kvm/qcow.h index 973d9f3..12247e0 100644 --- a/tools/kvm/include/kvm/qcow.h +++ b/tools/kvm/include/kvm/qcow.h @@ -21,7 +21,7 @@ #define MAX_CACHE_NODES 32 -struct qcow_l2_cache { +struct qcow_l2_table { u64 offset; struct rb_node node; struct list_head list;