xfs: implement the GETFSMAP ioctl
Introduce a new ioctl that uses the reverse mapping btree to return information about the physical layout of the filesystem. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Brian Foster <bfoster@redhat.com>
This commit is contained in:
@@ -2305,3 +2305,31 @@ xfs_rmap_free_extent(
|
||||
return __xfs_rmap_add(mp, dfops, XFS_RMAP_FREE, owner,
|
||||
XFS_DATA_FORK, &bmap);
|
||||
}
|
||||
|
||||
/* Compare rmap records. Returns -1 if a < b, 1 if a > b, and 0 if equal. */
|
||||
int
|
||||
xfs_rmap_compare(
|
||||
const struct xfs_rmap_irec *a,
|
||||
const struct xfs_rmap_irec *b)
|
||||
{
|
||||
__u64 oa;
|
||||
__u64 ob;
|
||||
|
||||
oa = xfs_rmap_irec_offset_pack(a);
|
||||
ob = xfs_rmap_irec_offset_pack(b);
|
||||
|
||||
if (a->rm_startblock < b->rm_startblock)
|
||||
return -1;
|
||||
else if (a->rm_startblock > b->rm_startblock)
|
||||
return 1;
|
||||
else if (a->rm_owner < b->rm_owner)
|
||||
return -1;
|
||||
else if (a->rm_owner > b->rm_owner)
|
||||
return 1;
|
||||
else if (oa < ob)
|
||||
return -1;
|
||||
else if (oa > ob)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user