From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Mark Fasheh <mfasheh@suse.de>, Josef Bacik <jbacik@fb.com>,
Dave Chinner <david@fromorbit.com>, Theodore Ts'o <tytso@mit.edu>,
Ross Zwisler <ross.zwisler@linux.intel.com>,
Dan Williams <dan.j.williams@intel.com>
Cc: linux-fsdevel <linux-fsdevel@vger.kernel.org>,
linux-api@vger.kernel.org,
linux-ext4 <linux-ext4@vger.kernel.org>,
linux-btrfs <linux-btrfs@vger.kernel.org>, xfs <xfs@oss.sgi.com>
Subject: [PATCH 2/3] xfs: introduce the XFS_IOC_GETFSMAPX ioctl
Date: Thu, 5 May 2016 12:51:49 -0700 [thread overview]
Message-ID: <20160505195149.GB2905@birch.djwong.org> (raw)
In-Reply-To: <20160505194754.GA2785@birch.djwong.org>
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 <darrick.wong@oracle.com>
---
libxfs/xfs_fs.h | 65 +++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 106 insertions(+), 14 deletions(-)
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
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2016-05-05 19:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-05 19:47 [RFC 0/3] getfsmapx ioctl Darrick J. Wong
2016-05-05 19:50 ` [PATCH 1/3] document the XFS_IOC_GETFSMAPX ioctl Darrick J. Wong
2016-05-05 19:51 ` Darrick J. Wong [this message]
2016-05-05 19:52 ` [PATCH 3/3] xfs_io: support the new getfsmap ioctl Darrick J. Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160505195149.GB2905@birch.djwong.org \
--to=darrick.wong@oracle.com \
--cc=dan.j.williams@intel.com \
--cc=david@fromorbit.com \
--cc=jbacik@fb.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=mfasheh@suse.de \
--cc=ross.zwisler@linux.intel.com \
--cc=tytso@mit.edu \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).