From patchwork Tue Dec 15 06:54:15 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miao Xie X-Patchwork-Id: 67535 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nBF6no4M002937 for ; Tue, 15 Dec 2009 06:49:50 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753983AbZLOGtt (ORCPT ); Tue, 15 Dec 2009 01:49:49 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753771AbZLOGts (ORCPT ); Tue, 15 Dec 2009 01:49:48 -0500 Received: from cn.fujitsu.com ([222.73.24.84]:56851 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1753462AbZLOGtr (ORCPT ); Tue, 15 Dec 2009 01:49:47 -0500 Received: from tang.cn.fujitsu.com (tang.cn.fujitsu.com [10.167.250.3]) by song.cn.fujitsu.com (Postfix) with ESMTP id BF8DD170117; Tue, 15 Dec 2009 14:49:46 +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 nBF6mOm2018547; Tue, 15 Dec 2009 14:48:24 +0800 Received: from [127.0.0.1] (unknown [10.167.141.211]) by fnst.cn.fujitsu.com (Postfix) with ESMTPA id B345CD430D; Tue, 15 Dec 2009 14:50:05 +0800 (CST) Message-ID: <4B273297.6040809@cn.fujitsu.com> Date: Tue, 15 Dec 2009 14:54:15 +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.5) Gecko/20091204 Thunderbird/3.0 MIME-Version: 1.0 To: Chris Mason CC: Linux Btrfs Subject: [PATCH 3/4] btrfs: cleanup the unnecessary code in __tree_search() in ordered-data.c Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c index 5799bc4..74128f6 100644 --- a/fs/btrfs/ordered-data.c +++ b/fs/btrfs/ordered-data.c @@ -69,7 +69,6 @@ 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; @@ -88,28 +87,9 @@ 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)) { - test = rb_next(prev); - if (!test) - break; - prev_entry = rb_entry(test, struct btrfs_ordered_extent, - rb_node); - if (file_offset < entry_end(prev_entry)) - break; + if (prev && file_offset < prev_entry->file_offset) + prev = rb_prev(prev); - prev = test; - } - if (prev) - prev_entry = rb_entry(prev, struct btrfs_ordered_extent, - rb_node); - while (prev && file_offset < entry_end(prev_entry)) { - test = rb_prev(prev); - if (!test) - break; - prev_entry = rb_entry(test, struct btrfs_ordered_extent, - rb_node); - prev = test; - } *prev_ret = prev; return NULL; }