From patchwork Thu May 5 19:51:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 9027051 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id AB3EF9F1C1 for ; Thu, 5 May 2016 19:52:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C3F8E202EC for ; Thu, 5 May 2016 19:52:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C3FE0202E9 for ; Thu, 5 May 2016 19:52:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757568AbcEETwO (ORCPT ); Thu, 5 May 2016 15:52:14 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:48766 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757359AbcEETwL (ORCPT ); Thu, 5 May 2016 15:52:11 -0400 Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u45JpsoS029913 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 5 May 2016 19:51:55 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0022.oracle.com (8.13.8/8.13.8) with ESMTP id u45Jpsoc021562 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 5 May 2016 19:51:54 GMT Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by aserv0122.oracle.com (8.13.8/8.13.8) with ESMTP id u45Jpps6003955; Thu, 5 May 2016 19:51:53 GMT Received: from localhost (/24.21.211.40) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 05 May 2016 12:51:51 -0700 Date: Thu, 5 May 2016 12:51:49 -0700 From: "Darrick J. Wong" To: Mark Fasheh , Josef Bacik , Dave Chinner , "Theodore Ts'o" , Ross Zwisler , Dan Williams Cc: linux-fsdevel , linux-api@vger.kernel.org, xfs , linux-btrfs , linux-ext4 Subject: [PATCH 2/3] xfs: introduce the XFS_IOC_GETFSMAPX ioctl Message-ID: <20160505195149.GB2905@birch.djwong.org> References: <20160505194754.GA2785@birch.djwong.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20160505194754.GA2785@birch.djwong.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-Source-IP: aserv0022.oracle.com [141.146.126.234] Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-9.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Introduce a new ioctl that uses the reverse mapping btree to return information about the physical layout of the filesystem. This is the xfsprogs side of things for userspace support. Signed-off-by: Darrick J. Wong --- libxfs/xfs_fs.h | 65 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 106 insertions(+), 14 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/libxfs/xfs_fs.h b/libxfs/xfs_fs.h index d5ed090..6573fcc 100644 --- a/libxfs/xfs_fs.h +++ b/libxfs/xfs_fs.h @@ -117,6 +117,70 @@ struct getbmapx { #define BMV_OF_SHARED 0x8 /* segment shared with another file */ /* + * Structure for XFS_IOC_GETFSMAPX. + * + * Similar to XFS_IOC_GETBMAPX, the first two elements in the array are + * used to constrain the output. The first element in the array should + * represent the lowest disk address that the user wants to learn about. + * The second element in the array should represent the highest disk + * address to query. Subsequent array elements will be filled out by the + * command. + * + * The fmv_iflags field is only used in the first structure. The + * fmv_oflags field is filled in for each returned structure after the + * second structure. The fmv_unused1 fields in the first two array + * elements must be zero. + * + * The fmv_count, fmv_entries, and fmv_iflags fields in the second array + * element must be zero. + * + * fmv_block, fmv_offset, and fmv_length are expressed in units of 512 + * byte sectors. + */ +#ifndef HAVE_GETFSMAPX +struct getfsmapx { + __s64 fmv_device; /* device id */ + __s64 fmv_block; /* starting block */ + __s64 fmv_owner; /* owner id */ + __s64 fmv_offset; /* file offset of segment */ + __s64 fmv_length; /* length of segment, blocks */ + __s32 fmv_oflags; /* mapping flags */ + __s32 fmv_iflags; /* control flags (1st structure) */ + __s32 fmv_count; /* # of entries in array incl. input */ + __s32 fmv_entries; /* # of entries filled in (output). */ + __s64 fmv_unused1; /* future use, must be zero */ +}; +#endif + +/* fmv_device values - set by XFS_IOC_GETFSMAPX caller. */ +/* use this value if the filesystem doesn't support multiple devices. */ +#define FMV_DEV_DEFAULT 0 + +/* fmv_flags values - set by XFS_IOC_GETFSMAPX caller. */ +/* no flags defined yet */ +#define FMV_IF_VALID 0 + +/* fmv_flags values - returned for each non-header segment */ +#define FMV_OF_PREALLOC 0x1 /* segment = unwritten pre-allocation */ +#define FMV_OF_ATTR_FORK 0x2 /* segment = attribute fork */ +#define FMV_OF_EXTENT_MAP 0x4 /* segment = extent map */ +#define FMV_OF_SHARED 0x8 /* segment = shared with another file */ +#define FMV_OF_SPECIAL_OWNER 0x10 /* owner is a special value */ +#define FMV_OF_LAST 0x20 /* segment is the last in the FS */ + +/* fmv_owner special values */ +#define FMV_OWN_FREE (-1ULL) /* free space */ +#define FMV_OWN_UNKNOWN (-2ULL) /* unknown owner */ +#define FMV_OWN_FS (-3ULL) /* static fs metadata */ +#define FMV_OWN_LOG (-4ULL) /* journalling log */ +#define FMV_OWN_AG (-5ULL) /* per-AG metadata */ +#define FMV_OWN_INOBT (-6ULL) /* inode btree blocks */ +#define FMV_OWN_INODES (-7ULL) /* inodes */ +#define FMV_OWN_REFC (-8ULL) /* refcount tree */ +#define FMV_OWN_COW (-9ULL) /* cow allocations */ +#define FMV_OWN_DEFECTIVE (-10ULL) /* bad blocks */ + +/* * Structure for XFS_IOC_FSSETDM. * For use by backup and restore programs to set the XFS on-disk inode * fields di_dmevmask and di_dmstate. These must be set to exactly and @@ -523,6 +587,7 @@ typedef struct xfs_swapext #define XFS_IOC_GETBMAPX _IOWR('X', 56, struct getbmap) #define XFS_IOC_ZERO_RANGE _IOW ('X', 57, struct xfs_flock64) #define XFS_IOC_FREE_EOFBLOCKS _IOR ('X', 58, struct xfs_fs_eofblocks) +#define XFS_IOC_GETFSMAPX _IOWR('X', 59, struct getfsmapx) /* * ioctl commands that replace IRIX syssgi()'s