From: Darrick J. Wong Date: Wed, 28 Aug 2019 16:08:09 +0000 (-0400) Subject: xfs: allow single bulkstat of special inodes X-Git-Tag: v5.3.0-rc1~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bfcd754e0b9eb3c985d2e898e6630cadab660031;p=thirdparty%2Fxfsprogs-dev.git xfs: allow single bulkstat of special inodes Source kernel commit: bf3cb394479210a9ebcf8fef7a7f8fcabc7b9928 Create a new bulk ireq flag that enables userspace to ask us for a special inode number instead of interpreting @ino as a literal inode number. This enables us to query the root inode easily. The reason for adding the ability to query specifically the root directory inode is that certain programs (xfsdump and xfsrestore) want to confirm when they've been pointed to the root directory. The userspace code assumes the root directory is always the first result from calling bulkstat with lastino == 0, but this isn't true if the (initial btree roots + initial AGFL + inode alignment padding) is itself long enough to be allocated to new inodes if all of those blocks should happen to be free at the same time. Rather than make userspace guess at internal filesystem state, we provide a direct query. Signed-off-by: Darrick J. Wong Reviewed-by: Allison Collins Reviewed-by: Brian Foster Signed-off-by: Eric Sandeen --- diff --git a/libxfs/xfs_fs.h b/libxfs/xfs_fs.h index c9f7166cf..67fceffc7 100644 --- a/libxfs/xfs_fs.h +++ b/libxfs/xfs_fs.h @@ -493,7 +493,18 @@ struct xfs_bulk_ireq { */ #define XFS_BULK_IREQ_AGNO (1 << 0) -#define XFS_BULK_IREQ_FLAGS_ALL (XFS_BULK_IREQ_AGNO) +/* + * Return bulkstat information for a single inode, where @ino value is a + * special value, not a literal inode number. See the XFS_BULK_IREQ_SPECIAL_* + * values below. Not compatible with XFS_BULK_IREQ_AGNO. + */ +#define XFS_BULK_IREQ_SPECIAL (1 << 1) + +#define XFS_BULK_IREQ_FLAGS_ALL (XFS_BULK_IREQ_AGNO | \ + XFS_BULK_IREQ_SPECIAL) + +/* Operate on the root directory inode. */ +#define XFS_BULK_IREQ_SPECIAL_ROOT (1) /* * ioctl structures for v5 bulkstat and inumbers requests