Here's another pass of sparse inode chunk support. There are still some
outstanding things to resolve, but I think this hits on some of the
larger comments of v1 and serves as a decent checkpoint.
My biggest open question at this point is how to handle backwards
compatibility in relation to the behavior of the new ir_count field
introduced in v2. The current behavior is to use ir_count whenever
sparse inode chunk support is enabled (from a feature bit perspective,
see xfs_inobt_insert()). The side effect of this is that backwards
compatibility is no longer solely tied to the existence of sparse inode
chunks. In other words, we cannot simply toggle off a feature bit for
fs' without sparse inode allocations, as the existing allocations have
an ir_count == 64 value in the upper bytes of the old ir_free field.
We can follow a couple alternate directions that I can think of:
- Only use ir_count for actual sparse chunks. E.g., ir_count == 0 for
chunks with XFS_INODES_PER_CHUNK inodes.
- Always use ir_count when feature bit enabled, consider inverting
ir_holemask to ir_allocmask or some such to simplify.
The further I progress on this work, the more I think the backwards
compatibility has limited utility, poor cost-benefit and I lean towards
the second approach.
That said, I don't necessarily see a problem with retaining the
backwards compatible nature of the on-disk structures with the
understanding that the ability for such conversions probably will not be
provided in the near term. E.g., backwards compat. simply becomes a
design characteristic to leave the window open for future work. But I'm
also not a huge fan of letting some unknown conversion mechanism from
the future put too many constraints on simplification of an existing
design. E.g., what's the point if the end result ends up being some kind
of userspace conversion via xfs_repair (for example) that can track
sparse chunks and fix up the records appropriately?
- Use a manually set feature bit instead of dynamic based on the
existence of sparse inode chunks.
- Add sb/mp fields for sparse alloc. granularity (use instead of cluster
- Undo xfs_inobt_insert() loop removal to avoid breakage of larger page
- Rename sparse record overlap helper and do XFS_LOOKUP_LE search.
- Use byte of pad space in inobt record for inode count field.
- Convert bitmap mgmt to use generic bitmap code.
- Rename XFS_INODES_PER_SPCHUNK to XFS_INODES_PER_HOLEMASK_BIT.
- Add fs geometry bit for sparse inodes.
- Rebase to latest for-next (bulkstat refactor).
Brian Foster (17):
xfs: add sparse inode chunk alignment superblock field
xfs: use sparse chunk alignment for min. inode allocation requirement
xfs: define sparse inode chunks v5 sb feature bit and helper function
xfs: introduce inode record hole mask for sparse inode chunks
xfs: create macros/helpers for dealing with sparse inode chunks
xfs: pass inode count through ordered icreate log item
xfs: handle sparse inode chunks in icreate log recovery
xfs: create helper to manage record overlap for sparse inode chunks
xfs: allocate sparse inode chunks on full chunk allocation failure
xfs: helpers to convert holemask to/from generic bitmap
xfs: filter out sparse regions from individual inode allocation
xfs: update free inode record logic to support sparse inode records
xfs: only free allocated regions of inode chunks
xfs: skip unallocated regions of inode chunks in xfs_ifree_cluster()
xfs: use actual inode count for sparse records in bulkstat/inumbers
xfs: add fs geometry bit for sparse inode chunks
xfs: enable sparse inode chunks for v5 superblocks
fs/xfs/libxfs/xfs_format.h | 17 +-
fs/xfs/libxfs/xfs_ialloc.c | 456 ++++++++++++++++++++++++++++++++++++---
fs/xfs/libxfs/xfs_ialloc.h | 17 +-
fs/xfs/libxfs/xfs_ialloc_btree.c | 4 +-
fs/xfs/libxfs/xfs_sb.c | 9 +-
fs/xfs/libxfs/xfs_sb.h | 16 +-
fs/xfs/xfs_fs.h | 1 +
fs/xfs/xfs_fsops.c | 4 +-
fs/xfs/xfs_inode.c | 28 ++-
fs/xfs/xfs_itable.c | 16 +-
fs/xfs/xfs_log_recover.c | 23 +-
fs/xfs/xfs_mount.h | 2 +
12 files changed, 525 insertions(+), 68 deletions(-)