From patchwork Tue Jul 24 10:39:23 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: liubo X-Patchwork-Id: 1231011 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 140ABDF25A for ; Tue, 24 Jul 2012 10:40:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752815Ab2GXKkO (ORCPT ); Tue, 24 Jul 2012 06:40:14 -0400 Received: from cn.fujitsu.com ([222.73.24.84]:53512 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1751995Ab2GXKkN (ORCPT ); Tue, 24 Jul 2012 06:40:13 -0400 X-IronPort-AV: E=Sophos;i="4.77,645,1336320000"; d="scan'208";a="5470467" Received: from unknown (HELO tang.cn.fujitsu.com) ([10.167.250.3]) by song.cn.fujitsu.com with ESMTP; 24 Jul 2012 18:39:16 +0800 Received: from fnstmail02.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 q6OAeAES006620 for ; Tue, 24 Jul 2012 18:40:11 +0800 Received: from localhost.localdomain ([10.167.225.27]) by fnstmail02.fnst.cn.fujitsu.com (Lotus Domino Release 8.5.3) with ESMTP id 2012072418404532-842287 ; Tue, 24 Jul 2012 18:40:45 +0800 From: Liu Bo To: Subject: [PATCH 1/2] Btrfs-progs: search subvolumes with proper objectid Date: Tue, 24 Jul 2012 18:39:23 +0800 Message-Id: <1343126364-27919-1-git-send-email-liubo2009@cn.fujitsu.com> X-Mailer: git-send-email 1.6.5.2 X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2012/07/24 18:40:45, Serialize by Router on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2012/07/24 18:40:46, Serialize complete at 2012/07/24 18:40:46 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org Btrfs's subvolume/snapshot is limited to [BTRFS_FIRST_FREE_OBJECTID, BTRFS_LAST_FREE_OBJECTID], so just apply the range. Signed-off-by: Liu Bo --- btrfs-list.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/btrfs-list.c b/btrfs-list.c index c53d016..ac6507a 100644 --- a/btrfs-list.c +++ b/btrfs-list.c @@ -634,11 +634,13 @@ static int __list_subvol_search(int fd, struct root_lookup *root_lookup) sk->max_type = BTRFS_ROOT_BACKREF_KEY; sk->min_type = BTRFS_ROOT_BACKREF_KEY; + sk->min_objectid = BTRFS_FIRST_FREE_OBJECTID; + /* * set all the other params to the max, we'll take any objectid * and any trans */ - sk->max_objectid = (u64)-1; + sk->max_objectid = BTRFS_LAST_FREE_OBJECTID; sk->max_offset = (u64)-1; sk->max_transid = (u64)-1; @@ -690,7 +692,7 @@ static int __list_subvol_search(int fd, struct root_lookup *root_lookup) if (sk->min_type < BTRFS_ROOT_BACKREF_KEY) { sk->min_type = BTRFS_ROOT_BACKREF_KEY; sk->min_offset = 0; - } else if (sk->min_objectid < (u64)-1) { + } else if (sk->min_objectid < BTRFS_LAST_FREE_OBJECTID) { sk->min_objectid++; sk->min_type = BTRFS_ROOT_BACKREF_KEY; sk->min_offset = 0;