]> www.infradead.org Git - users/hch/xfsprogs.git/commit
xfs: introduce inode record hole mask for sparse inode chunks
authorBrian Foster <bfoster@redhat.com>
Thu, 28 May 2015 23:03:04 +0000 (09:03 +1000)
committerDave Chinner <david@fromorbit.com>
Thu, 30 Jul 2015 23:07:07 +0000 (09:07 +1000)
commit11640e307851a047c402b1799a7564d560ba3a6a
tree4b1efa5cebf973da9fe881ad79c264a9b2b7a140
parent5f90a19287b0e3a2e176f78113bb71f4b0d3fe9a
xfs: introduce inode record hole mask for sparse inode chunks

The inode btrees track 64 inodes per record regardless of inode size.
Thus, inode chunks on disk vary in size depending on the size of the
inodes. This creates a contiguous allocation requirement for new inode
chunks that can be difficult to satisfy on an aged and fragmented (free
space) filesystems.

The inode record freecount currently uses 4 bytes on disk to track the
free inode count. With a maximum freecount value of 64, only one byte is
required. Convert the freecount field to a single byte and use two of
the remaining 3 higher order bytes left for the hole mask field. Use the
final leftover byte for the total count field.

The hole mask field tracks holes in the chunks of physical space that
the inode record refers to. This facilitates the sparse allocation of
inode chunks when contiguous chunks are not available and allows the
inode btrees to identify what portions of the chunk contain valid
inodes. The total count field contains the total number of valid inodes
referred to by the record. This can also be deduced from the hole mask.
The count field provides clarity and redundancy for internal record
verification.

Note that neither of the new fields can be written to disk on fs'
without sparse inode support. Doing so writes to the high-order bytes of
freecount and causes corruption from the perspective of older kernels.
The on-disk inobt record data structure is updated with a union to
distinguish between the original, "full" format and the new, "sparse"
format. The conversion routines to get, insert and update records are
updated to translate to and from the on-disk record accordingly such
that freecount remains a 4-byte value on non-supported fs, yet the new
fields of the in-core record are always valid with respect to the
record. This means that higher level code can refer to the current
in-core record format unconditionally and lower level code ensures that
records are translated to/from disk according to the capabilities of the
fs.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
db/btblock.c
db/check.c
libxfs/xfs_format.h
libxfs/xfs_ialloc.c
libxfs/xfs_ialloc_btree.c
repair/phase5.c
repair/scan.c