From patchwork Thu Mar 25 12:30:51 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miao Xie X-Patchwork-Id: 88211 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 o2PCUcYE029609 for ; Thu, 25 Mar 2010 12:30:38 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751546Ab0CYMah (ORCPT ); Thu, 25 Mar 2010 08:30:37 -0400 Received: from cn.fujitsu.com ([222.73.24.84]:60699 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1751106Ab0CYMag (ORCPT ); Thu, 25 Mar 2010 08:30:36 -0400 Received: from tang.cn.fujitsu.com (tang.cn.fujitsu.com [10.167.250.3]) by song.cn.fujitsu.com (Postfix) with ESMTP id 6C99B170080; Thu, 25 Mar 2010 20:30:35 +0800 (CST) Received: from fnst.cn.fujitsu.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id o2PCTGEF005938; Thu, 25 Mar 2010 20:29:16 +0800 Received: from [127.0.0.1] (unknown [10.167.141.211]) by fnst.cn.fujitsu.com (Postfix) with ESMTPA id A1618DC220; Thu, 25 Mar 2010 20:33:01 +0800 (CST) Message-ID: <4BAB577B.3090902@cn.fujitsu.com> Date: Thu, 25 Mar 2010 20:30:51 +0800 From: Miao Xie Reply-To: miaox@cn.fujitsu.com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3 MIME-Version: 1.0 To: Chris Mason CC: Linux Btrfs Subject: [PATCH 06/18] Btrfs: Remove unnecessary variant in __tree_search Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@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]); Thu, 25 Mar 2010 12:30:38 +0000 (UTC) diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c index 5a01f35..9f83eab 100644 --- a/fs/btrfs/extent_map.c +++ b/fs/btrfs/extent_map.c @@ -116,13 +116,11 @@ static struct rb_node *__tree_search(struct rb_root *root, u64 offset, struct rb_node *n = root->rb_node; struct rb_node *prev = NULL; struct rb_node *orig_prev = NULL; - struct extent_map *entry; - struct extent_map *prev_entry = NULL; + struct extent_map *entry = NULL; while (n) { entry = rb_entry(n, struct extent_map, rb_node); prev = n; - prev_entry = entry; WARN_ON(!entry->in_tree); @@ -136,19 +134,19 @@ static struct rb_node *__tree_search(struct rb_root *root, u64 offset, if (prev_ret) { orig_prev = prev; - while (prev && offset >= extent_map_end(prev_entry)) { + while (prev && offset >= extent_map_end(entry)) { prev = rb_next(prev); - prev_entry = rb_entry(prev, struct extent_map, rb_node); + entry = rb_entry(prev, struct extent_map, rb_node); } *prev_ret = prev; prev = orig_prev; } if (next_ret) { - prev_entry = rb_entry(prev, struct extent_map, rb_node); - while (prev && offset < prev_entry->start) { + entry = rb_entry(prev, struct extent_map, rb_node); + while (prev && offset < entry->start) { prev = rb_prev(prev); - prev_entry = rb_entry(prev, struct extent_map, rb_node); + entry = rb_entry(prev, struct extent_map, rb_node); } *next_ret = prev; } diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c index a8ffecd..2d221a4 100644 --- a/fs/btrfs/ordered-data.c +++ b/fs/btrfs/ordered-data.c @@ -70,13 +70,11 @@ static struct rb_node *__tree_search(struct rb_root *root, u64 file_offset, struct rb_node *n = root->rb_node; struct rb_node *prev = NULL; struct rb_node *test; - struct btrfs_ordered_extent *entry; - struct btrfs_ordered_extent *prev_entry = NULL; + struct btrfs_ordered_extent *entry = NULL; while (n) { entry = rb_entry(n, struct btrfs_ordered_extent, rb_node); prev = n; - prev_entry = entry; if (file_offset < entry->file_offset) n = n->rb_left; @@ -88,25 +86,25 @@ static struct rb_node *__tree_search(struct rb_root *root, u64 file_offset, if (!prev_ret) return NULL; - while (prev && file_offset >= entry_end(prev_entry)) { + while (prev && file_offset >= entry_end(entry)) { test = rb_next(prev); if (!test) break; - prev_entry = rb_entry(test, struct btrfs_ordered_extent, + entry = rb_entry(test, struct btrfs_ordered_extent, rb_node); - if (file_offset < entry_end(prev_entry)) + if (file_offset < entry_end(entry)) break; prev = test; } if (prev) - prev_entry = rb_entry(prev, struct btrfs_ordered_extent, + entry = rb_entry(prev, struct btrfs_ordered_extent, rb_node); - while (prev && file_offset < entry_end(prev_entry)) { + while (prev && file_offset < entry_end(entry)) { test = rb_prev(prev); if (!test) break; - prev_entry = rb_entry(test, struct btrfs_ordered_extent, + entry = rb_entry(test, struct btrfs_ordered_extent, rb_node); prev = test; }