From patchwork Tue Jul 31 05:49:34 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: liubo X-Patchwork-Id: 1257981 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id E475A3FC1A for ; Tue, 31 Jul 2012 05:50:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755062Ab2GaFuU (ORCPT ); Tue, 31 Jul 2012 01:50:20 -0400 Received: from cn.fujitsu.com ([222.73.24.84]:65058 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1751710Ab2GaFuT (ORCPT ); Tue, 31 Jul 2012 01:50:19 -0400 X-IronPort-AV: E=Sophos;i="4.77,682,1336320000"; d="scan'208";a="5515610" Received: from unknown (HELO tang.cn.fujitsu.com) ([10.167.250.3]) by song.cn.fujitsu.com with ESMTP; 31 Jul 2012 13:48:51 +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 q6V5nmiS001622 for ; Tue, 31 Jul 2012 13:49:48 +0800 Received: from localhost.localdomain ([10.167.225.27]) by fnstmail02.fnst.cn.fujitsu.com (Lotus Domino Release 8.5.3) with ESMTP id 2012073113502246-29381 ; Tue, 31 Jul 2012 13:50:22 +0800 From: Liu Bo To: Subject: [PATCH 1/3 RESEND] Btrfs-progs: search subvolumes with proper objectid Date: Tue, 31 Jul 2012 13:49:34 +0800 Message-Id: <1343713776-14232-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/31 13:50:22, Serialize by Router on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2012/07/31 13:50:23, Serialize complete at 2012/07/31 13:50:23 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;