From patchwork Mon Dec 13 09:47:53 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Zefan X-Patchwork-Id: 405202 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oBD9mDsP017314 for ; Mon, 13 Dec 2010 09:48:13 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751458Ab0LMJry (ORCPT ); Mon, 13 Dec 2010 04:47:54 -0500 Received: from cn.fujitsu.com ([222.73.24.84]:55440 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1751231Ab0LMJrw (ORCPT ); Mon, 13 Dec 2010 04:47:52 -0500 Received: from tang.cn.fujitsu.com (tang.cn.fujitsu.com [10.167.250.3]) by song.cn.fujitsu.com (Postfix) with ESMTP id 7DD9D170982; Mon, 13 Dec 2010 17:47:49 +0800 (CST) Received: from mailserver.fnst.cn.fujitus.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id oBD9h2xG027775; Mon, 13 Dec 2010 17:43:02 +0800 Received: from lizf.localdomain ([10.167.225.51]) by mailserver.fnst.cn.fujitus.com (Lotus Domino Release 8.5.1FP4) with ESMTP id 2010121317475028-220646 ; Mon, 13 Dec 2010 17:47:50 +0800 Message-ID: <4D05EBC9.6020908@cn.fujitsu.com> Date: Mon, 13 Dec 2010 17:47:53 +0800 From: Li Zefan User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1b3pre) Gecko/20090513 Fedora/3.0-2.3.beta2.fc11 Thunderbird/3.0b2 MIME-Version: 1.0 To: "linux-btrfs@vger.kernel.org" CC: "Ian! D. Allen" Subject: [PATCH 1/3] Btrfs: Really return keys within specified range X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.1FP4|July 25, 2010) at 2010-12-13 17:47:50, Serialize by Router on mailserver/fnst(Release 8.5.1FP4|July 25, 2010) at 2010-12-13 17:47:50, Serialize complete at 2010-12-13 17:47:50 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 (demeter1.kernel.org [140.211.167.41]); Mon, 13 Dec 2010 09:48:13 +0000 (UTC) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index f1c9bb4..785f713 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -1028,23 +1028,11 @@ out: static noinline int key_in_sk(struct btrfs_key *key, struct btrfs_ioctl_search_key *sk) { - struct btrfs_key test; - int ret; - - test.objectid = sk->min_objectid; - test.type = sk->min_type; - test.offset = sk->min_offset; - - ret = btrfs_comp_cpu_keys(key, &test); - if (ret < 0) + if (key->type < sk->min_type || key->type > sk->max_type) return 0; - - test.objectid = sk->max_objectid; - test.type = sk->max_type; - test.offset = sk->max_offset; - - ret = btrfs_comp_cpu_keys(key, &test); - if (ret > 0) + if (key->offset < sk->min_offset || key->offset > sk->max_offset) + return 0; + if (key->objectid < sk->min_objectid || key->objectid > sk->max_objectid) return 0; return 1; }