diff options
author | Darrick J. Wong <darrick.wong@oracle.com> | 2016-10-03 09:11:18 -0700 |
---|---|---|
committer | Darrick J. Wong <darrick.wong@oracle.com> | 2016-10-03 09:11:18 -0700 |
commit | 1946b91cee4fc8ae25450673e4d4f35e9b462e9e (patch) | |
tree | e9cc737943e4e7b76c01cab92f88a6c49b49dc43 /fs/xfs/libxfs/xfs_format.h | |
parent | af30dfa14411e9df0e69c6e46e8c6c467b88229d (diff) | |
download | lwn-1946b91cee4fc8ae25450673e4d4f35e9b462e9e.tar.gz lwn-1946b91cee4fc8ae25450673e4d4f35e9b462e9e.zip |
xfs: define the on-disk refcount btree format
Start constructing the refcount btree implementation by establishing
the on-disk format and everything needed to read, write, and
manipulate the refcount btree blocks.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/xfs/libxfs/xfs_format.h')
-rw-r--r-- | fs/xfs/libxfs/xfs_format.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/fs/xfs/libxfs/xfs_format.h b/fs/xfs/libxfs/xfs_format.h index 622055bb283b..97c74f4a22b5 100644 --- a/fs/xfs/libxfs/xfs_format.h +++ b/fs/xfs/libxfs/xfs_format.h @@ -1457,6 +1457,42 @@ typedef __be32 xfs_rmap_ptr_t; unsigned int xfs_refc_block(struct xfs_mount *mp); +/* + * Data record/key structure + * + * Each record associates a range of physical blocks (starting at + * rc_startblock and ending rc_blockcount blocks later) with a reference + * count (rc_refcount). Extents that are being used to stage a copy on + * write (CoW) operation are recorded in the refcount btree with a + * refcount of 1. All other records must have a refcount > 1 and must + * track an extent mapped only by file data forks. + * + * Extents with a single owner (attributes, metadata, non-shared file + * data) are not tracked here. Free space is also not tracked here. + * This is consistent with pre-reflink XFS. + */ +struct xfs_refcount_rec { + __be32 rc_startblock; /* starting block number */ + __be32 rc_blockcount; /* count of blocks */ + __be32 rc_refcount; /* number of inodes linked here */ +}; + +struct xfs_refcount_key { + __be32 rc_startblock; /* starting block number */ +}; + +struct xfs_refcount_irec { + xfs_agblock_t rc_startblock; /* starting block number */ + xfs_extlen_t rc_blockcount; /* count of free blocks */ + xfs_nlink_t rc_refcount; /* number of inodes linked here */ +}; + +#define MAXREFCOUNT ((xfs_nlink_t)~0U) +#define MAXREFCEXTLEN ((xfs_extlen_t)~0U) + +/* btree pointer type */ +typedef __be32 xfs_refcount_ptr_t; + /* * BMAP Btree format definitions |