linux/fs/xfs/libxfs
Brian Foster 5419040fc0 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>
2015-05-29 09:03:04 +10:00
..
xfs_alloc.c xfs: support min/max agbno args in block allocator 2015-05-29 08:53:00 +10:00
xfs_alloc.h xfs: support min/max agbno args in block allocator 2015-05-29 08:53:00 +10:00
xfs_alloc_btree.c xfs: merge xfs_ag.h into xfs_format.h 2014-11-28 14:25:04 +11:00
xfs_alloc_btree.h
xfs_attr.c xfs: move most of xfs_sb.h to xfs_format.h 2014-11-28 14:27:09 +11:00
xfs_attr_leaf.c xfs: kill unnecessary firstused overflow check on attr3 leaf removal 2015-04-13 11:27:59 +10:00
xfs_attr_leaf.h xfs: pass attr geometry to attr leaf header conversion functions 2015-04-13 11:26:02 +10:00
xfs_attr_remote.c xfs: move most of xfs_sb.h to xfs_format.h 2014-11-28 14:27:09 +11:00
xfs_attr_remote.h
xfs_attr_sf.h
xfs_bit.h
xfs_bmap.c Merge branch 'fallocate-insert-range' into for-next 2015-03-25 15:12:53 +11:00
xfs_bmap.h xfs: Add support FALLOC_FL_INSERT_RANGE for fallocate 2015-03-25 15:08:56 +11:00
xfs_bmap_btree.c xfs: move most of xfs_sb.h to xfs_format.h 2014-11-28 14:27:09 +11:00
xfs_bmap_btree.h
xfs_btree.c xfs: pass mp to XFS_WANT_CORRUPTED_RETURN 2015-02-23 22:39:13 +11:00
xfs_btree.h xfs: require 64-bit sector_t 2014-07-30 09:12:05 +10:00
xfs_cksum.h
xfs_da_btree.c xfs: fix shadow warning in xfs_da3_root_split() 2015-03-25 14:55:25 +11:00
xfs_da_btree.h
xfs_da_format.c xfs: move most of xfs_sb.h to xfs_format.h 2014-11-28 14:27:09 +11:00
xfs_da_format.h xfs: use larger in-core attr firstused field and detect overflow 2015-04-13 11:27:10 +10:00
xfs_dir2.c Merge branch 'xfs-misc-fixes-for-3.19-2' into for-next 2014-12-04 09:46:17 +11:00
xfs_dir2.h xfs: move type conversion functions to xfs_dir.h 2014-12-04 09:43:17 +11:00
xfs_dir2_block.c Merge branch 'xfs-misc-fixes-for-3.19-2' into for-next 2014-12-04 09:46:17 +11:00
xfs_dir2_data.c xfs: pass mp to XFS_WANT_CORRUPTED_RETURN 2015-02-23 22:39:13 +11:00
xfs_dir2_leaf.c Merge branch 'xfs-misc-fixes-for-3.19-2' into for-next 2014-12-04 09:46:17 +11:00
xfs_dir2_node.c Merge branch 'xfs-misc-fixes-for-3.19-2' into for-next 2014-12-04 09:46:17 +11:00
xfs_dir2_priv.h xfs: move type conversion functions to xfs_dir.h 2014-12-04 09:43:17 +11:00
xfs_dir2_sf.c Merge branch 'xfs-misc-fixes-for-3.19-2' into for-next 2014-12-04 09:46:17 +11:00
xfs_dquot_buf.c xfs: move most of xfs_sb.h to xfs_format.h 2014-11-28 14:27:09 +11:00
xfs_format.h xfs: introduce inode record hole mask for sparse inode chunks 2015-05-29 09:03:04 +10:00
xfs_fs.h xfs: add fs geometry bit for sparse inode chunks 2015-05-29 08:58:32 +10:00
xfs_ialloc.c xfs: introduce inode record hole mask for sparse inode chunks 2015-05-29 09:03:04 +10:00
xfs_ialloc.h xfs: merge xfs_ag.h into xfs_format.h 2014-11-28 14:25:04 +11:00
xfs_ialloc_btree.c xfs: introduce inode record hole mask for sparse inode chunks 2015-05-29 09:03:04 +10:00
xfs_ialloc_btree.h
xfs_inode_buf.c xfs: move most of xfs_sb.h to xfs_format.h 2014-11-28 14:27:09 +11:00
xfs_inode_buf.h
xfs_inode_fork.c xfs: merge xfs_inum.h into xfs_format.h 2014-11-28 14:27:10 +11:00
xfs_inode_fork.h
xfs_log_format.h xfs: merge xfs_dinode.h into xfs_format.h 2014-11-28 14:24:06 +11:00
xfs_log_recover.h
xfs_log_rlimit.c xfs: move most of xfs_sb.h to xfs_format.h 2014-11-28 14:27:09 +11:00
xfs_quota_defs.h
xfs_rtbitmap.c xfs: move most of xfs_sb.h to xfs_format.h 2014-11-28 14:27:09 +11:00
xfs_sb.c xfs: sparse inode chunks feature helpers and mount requirements 2015-05-29 08:57:27 +10:00
xfs_sb.h xfs: consolidate superblock logging functions 2015-01-22 09:10:31 +11:00
xfs_shared.h xfs: consolidate superblock logging functions 2015-01-22 09:10:31 +11:00
xfs_symlink_remote.c xfs: set buf types when converting extent formats 2015-01-22 09:30:06 +11:00
xfs_trans_resv.c xfs: consolidate superblock logging functions 2015-01-22 09:10:31 +11:00
xfs_trans_resv.h xfs: consolidate superblock logging functions 2015-01-22 09:10:31 +11:00
xfs_trans_space.h
xfs_types.h xfs: move xfs_types.h to libxfs 2015-01-09 10:46:31 +11:00