Merge branch 'xfs-sparse-inode' into for-next
This commit is contained in:
@@ -170,7 +170,7 @@ typedef struct xfs_sb {
|
||||
__uint32_t sb_features_log_incompat;
|
||||
|
||||
__uint32_t sb_crc; /* superblock crc */
|
||||
__uint32_t sb_pad;
|
||||
xfs_extlen_t sb_spino_align; /* sparse inode chunk alignment */
|
||||
|
||||
xfs_ino_t sb_pquotino; /* project quota inode */
|
||||
xfs_lsn_t sb_lsn; /* last write sequence */
|
||||
@@ -256,7 +256,7 @@ typedef struct xfs_dsb {
|
||||
__be32 sb_features_log_incompat;
|
||||
|
||||
__le32 sb_crc; /* superblock crc */
|
||||
__be32 sb_pad;
|
||||
__be32 sb_spino_align; /* sparse inode chunk alignment */
|
||||
|
||||
__be64 sb_pquotino; /* project quota inode */
|
||||
__be64 sb_lsn; /* last write sequence */
|
||||
@@ -457,8 +457,10 @@ xfs_sb_has_ro_compat_feature(
|
||||
}
|
||||
|
||||
#define XFS_SB_FEAT_INCOMPAT_FTYPE (1 << 0) /* filetype in dirent */
|
||||
#define XFS_SB_FEAT_INCOMPAT_SPINODES (1 << 1) /* sparse inode chunks */
|
||||
#define XFS_SB_FEAT_INCOMPAT_ALL \
|
||||
(XFS_SB_FEAT_INCOMPAT_FTYPE)
|
||||
(XFS_SB_FEAT_INCOMPAT_FTYPE| \
|
||||
XFS_SB_FEAT_INCOMPAT_SPINODES)
|
||||
|
||||
#define XFS_SB_FEAT_INCOMPAT_UNKNOWN ~XFS_SB_FEAT_INCOMPAT_ALL
|
||||
static inline bool
|
||||
@@ -506,6 +508,12 @@ static inline int xfs_sb_version_hasfinobt(xfs_sb_t *sbp)
|
||||
(sbp->sb_features_ro_compat & XFS_SB_FEAT_RO_COMPAT_FINOBT);
|
||||
}
|
||||
|
||||
static inline bool xfs_sb_version_hassparseinodes(struct xfs_sb *sbp)
|
||||
{
|
||||
return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5 &&
|
||||
xfs_sb_has_incompat_feature(sbp, XFS_SB_FEAT_INCOMPAT_SPINODES);
|
||||
}
|
||||
|
||||
/*
|
||||
* end of superblock version macros
|
||||
*/
|
||||
@@ -1216,26 +1224,54 @@ typedef __uint64_t xfs_inofree_t;
|
||||
#define XFS_INOBT_ALL_FREE ((xfs_inofree_t)-1)
|
||||
#define XFS_INOBT_MASK(i) ((xfs_inofree_t)1 << (i))
|
||||
|
||||
#define XFS_INOBT_HOLEMASK_FULL 0 /* holemask for full chunk */
|
||||
#define XFS_INOBT_HOLEMASK_BITS (NBBY * sizeof(__uint16_t))
|
||||
#define XFS_INODES_PER_HOLEMASK_BIT \
|
||||
(XFS_INODES_PER_CHUNK / (NBBY * sizeof(__uint16_t)))
|
||||
|
||||
static inline xfs_inofree_t xfs_inobt_maskn(int i, int n)
|
||||
{
|
||||
return ((n >= XFS_INODES_PER_CHUNK ? 0 : XFS_INOBT_MASK(n)) - 1) << i;
|
||||
}
|
||||
|
||||
/*
|
||||
* Data record structure
|
||||
* The on-disk inode record structure has two formats. The original "full"
|
||||
* format uses a 4-byte freecount. The "sparse" format uses a 1-byte freecount
|
||||
* and replaces the 3 high-order freecount bytes wth the holemask and inode
|
||||
* count.
|
||||
*
|
||||
* The holemask of the sparse record format allows an inode chunk to have holes
|
||||
* that refer to blocks not owned by the inode record. This facilitates inode
|
||||
* allocation in the event of severe free space fragmentation.
|
||||
*/
|
||||
typedef struct xfs_inobt_rec {
|
||||
__be32 ir_startino; /* starting inode number */
|
||||
__be32 ir_freecount; /* count of free inodes (set bits) */
|
||||
union {
|
||||
struct {
|
||||
__be32 ir_freecount; /* count of free inodes */
|
||||
} f;
|
||||
struct {
|
||||
__be16 ir_holemask;/* hole mask for sparse chunks */
|
||||
__u8 ir_count; /* total inode count */
|
||||
__u8 ir_freecount; /* count of free inodes */
|
||||
} sp;
|
||||
} ir_u;
|
||||
__be64 ir_free; /* free inode mask */
|
||||
} xfs_inobt_rec_t;
|
||||
|
||||
typedef struct xfs_inobt_rec_incore {
|
||||
xfs_agino_t ir_startino; /* starting inode number */
|
||||
__int32_t ir_freecount; /* count of free inodes (set bits) */
|
||||
__uint16_t ir_holemask; /* hole mask for sparse chunks */
|
||||
__uint8_t ir_count; /* total inode count */
|
||||
__uint8_t ir_freecount; /* count of free inodes (set bits) */
|
||||
xfs_inofree_t ir_free; /* free inode mask */
|
||||
} xfs_inobt_rec_incore_t;
|
||||
|
||||
static inline bool xfs_inobt_issparse(uint16_t holemask)
|
||||
{
|
||||
/* non-zero holemask represents a sparse rec. */
|
||||
return holemask;
|
||||
}
|
||||
|
||||
/*
|
||||
* Key structure
|
||||
|
Reference in New Issue
Block a user