From patchwork Wed Jan 23 08:12:47 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 2022761 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 557FAE00AF for ; Wed, 23 Jan 2013 08:08:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753948Ab3AWIH6 (ORCPT ); Wed, 23 Jan 2013 03:07:58 -0500 Received: from aserp1040.oracle.com ([141.146.126.69]:49248 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753965Ab3AWIHA (ORCPT ); Wed, 23 Jan 2013 03:07:00 -0500 Received: from ucsinet22.oracle.com (ucsinet22.oracle.com [156.151.31.94]) by aserp1040.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id r0N86HFA024642 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 23 Jan 2013 08:06:18 GMT Received: from acsmt357.oracle.com (acsmt357.oracle.com [141.146.40.157]) by ucsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r0N86GCr003385 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 23 Jan 2013 08:06:17 GMT Received: from abhmt120.oracle.com (abhmt120.oracle.com [141.146.116.72]) by acsmt357.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id r0N86Gk5010801; Wed, 23 Jan 2013 02:06:16 -0600 Received: from wish.sg.oracle.com (/10.186.101.18) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 23 Jan 2013 00:06:15 -0800 From: Anand Jain To: linux-btrfs@vger.kernel.org, dsterba@suse.cz, gene@czarc.net Cc: Anand Jain Subject: [PATCH 06/10] Btrfs-progs: add method to filter snapshots by parent uuid Date: Wed, 23 Jan 2013 16:12:47 +0800 Message-Id: <1358928771-31960-7-git-send-email-anand.jain@oracle.com> X-Mailer: git-send-email 1.8.1.164.g2d0029e In-Reply-To: <1358928771-31960-1-git-send-email-anand.jain@oracle.com> References: <1358928771-31960-1-git-send-email-anand.jain@oracle.com> X-Source-IP: ucsinet22.oracle.com [156.151.31.94] Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org Signed-off-by: Anand Jain --- btrfs-list.c | 6 ++++++ btrfs-list.h | 1 + 2 files changed, 7 insertions(+) diff --git a/btrfs-list.c b/btrfs-list.c index ec64a36..f5958cf 100644 --- a/btrfs-list.c +++ b/btrfs-list.c @@ -1144,6 +1144,11 @@ static int filter_topid_equal(struct root_info *ri, u64 data) return ri->top_id == data; } +static int filter_by_parent(struct root_info *ri, u64 data) +{ + return !uuid_compare(ri->puuid, (u8 *)data); +} + static btrfs_list_filter_func all_filter_funcs[] = { [BTRFS_LIST_FILTER_ROOTID] = filter_by_rootid, [BTRFS_LIST_FILTER_SNAPSHOT_ONLY] = filter_snapshot, @@ -1155,6 +1160,7 @@ static btrfs_list_filter_func all_filter_funcs[] = { [BTRFS_LIST_FILTER_CGEN_LESS] = filter_cgen_less, [BTRFS_LIST_FILTER_CGEN_EQUAL] = filter_cgen_equal, [BTRFS_LIST_FILTER_TOPID_EQUAL] = filter_topid_equal, + [BTRFS_LIST_FILTER_BY_PARENT] = filter_by_parent, }; struct btrfs_list_filter_set *btrfs_list_alloc_filter_set(void) diff --git a/btrfs-list.h b/btrfs-list.h index 580d4d1..cde7a3f 100644 --- a/btrfs-list.h +++ b/btrfs-list.h @@ -117,6 +117,7 @@ enum btrfs_list_filter_enum { BTRFS_LIST_FILTER_CGEN_LESS, BTRFS_LIST_FILTER_CGEN_MORE, BTRFS_LIST_FILTER_TOPID_EQUAL, + BTRFS_LIST_FILTER_BY_PARENT, BTRFS_LIST_FILTER_MAX, };