From patchwork Mon Sep 16 07:41:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Bo X-Patchwork-Id: 275131 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id B0C1B2C00EF for ; Mon, 16 Sep 2013 17:41:45 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751388Ab3IPHlk (ORCPT ); Mon, 16 Sep 2013 03:41:40 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:41802 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751300Ab3IPHlk (ORCPT ); Mon, 16 Sep 2013 03:41:40 -0400 Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by aserp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r8G7fZ9N019970 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 16 Sep 2013 07:41:36 GMT Received: from aserz7022.oracle.com (aserz7022.oracle.com [141.146.126.231]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r8G7fZRN020747 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 16 Sep 2013 07:41:35 GMT Received: from abhmt108.oracle.com (abhmt108.oracle.com [141.146.116.60]) by aserz7022.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r8G7fZiD020741; Mon, 16 Sep 2013 07:41:35 GMT Received: from localhost.jp.oracle.com (/10.191.9.31) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 16 Sep 2013 00:41:34 -0700 From: Liu Bo To: linux-ext4@vger.kernel.org Cc: linux-btrfs@vger.kernel.org, dsterba@suse.cz, jeff.liu@oracle.com Subject: [PATCH] E2fsprogs: introduce FIEMAP_EXTENT_SHARED support Date: Mon, 16 Sep 2013 15:41:24 +0800 Message-Id: <1379317284-20311-1-git-send-email-bo.li.liu@oracle.com> X-Mailer: git-send-email 1.8.1.4 X-Source-IP: acsinet22.oracle.com [141.146.126.238] Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Filesystems, such as ocfs2 and btrfs, support shared space that is shared among different files, so the upstream introduces flag FIEMAP_EXTENT_SHARED for that. With this, e2fsprogs's filefrag also support the flag. Signed-off-by: Liu Bo --- lib/ext2fs/fiemap.h | 2 ++ misc/filefrag.c | 2 ++ 2 files changed, 4 insertions(+), 0 deletions(-) diff --git a/lib/ext2fs/fiemap.h b/lib/ext2fs/fiemap.h index 30bf555..895cd0b 100644 --- a/lib/ext2fs/fiemap.h +++ b/lib/ext2fs/fiemap.h @@ -64,5 +64,7 @@ struct fiemap { #define FIEMAP_EXTENT_MERGED 0x00001000 /* File does not natively * support extents. Result * merged for efficiency. */ +#define FIEMAP_EXTENT_SHARED 0x00002000 /* Space shared with other + * files. */ #endif /* _LINUX_FIEMAP_H */ diff --git a/misc/filefrag.c b/misc/filefrag.c index 35b3544..31dfb64 100644 --- a/misc/filefrag.c +++ b/misc/filefrag.c @@ -165,6 +165,8 @@ static void print_extent_info(struct fiemap_extent *fm_extent, int cur_ex, strcat(flags, "unwritten,"); if (fm_extent->fe_flags & FIEMAP_EXTENT_MERGED) strcat(flags, "merged,"); + if (fm_extent->fe_flags & FIEMAP_EXTENT_SHARED) + strcat(flags, "shared,"); if (fm_extent->fe_logical + fm_extent->fe_length >= (__u64) st->st_size) strcat(flags, "eof,");