xfs: disable sparse inode chunk alignment check when there is no alignment
PATCH 1/1 xfs: disable sparse inode chunk alignment check when there is no alignment
From: Darrick J. Wong <[email protected]>
While testing a 64k-blocksize filesystem, I noticed that xfs/709 fails to rebuild the inode btree with a bunch of "Corruption remains" messages. It turns out that when the inode chunk size is smaller than a single filesystem block, no block alignments constraints are necessary for inode chunk allocations, and sb_spino_align is zero. Hence we can skip the check.
--- fs/xfs/scrub/ialloc_repair.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/scrub/ialloc_repair.c +1 -1
@@ -369,7 +369,7 @@ xrep_ibt_check_inode_ext(* On a sparse inode fs, this cluster could be part of a sparse chunk. * Sparse clusters must be aligned to sparse chunk alignment. */ -if (xfs_has_sparseinodes (mp) && +if (xfs_has_sparseinodes (mp) && mp->m_sb.sb_spino_align && (!IS_ALIGNED (agbno, mp->m_sb.sb_spino_align) || !IS_ALIGNED (agbno + len, mp->m_sb.sb_spino_align)))return -EFSCORRUPTED ;
Quoted 8 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
While testing a 64k-blocksize filesystem, I noticed that xfs/709 fails to rebuild the inode btree with a bunch of "Corruption remains" messages. It turns out that when the inode chunk size is smaller than a single filesystem block, no block alignments constraints are necessary for inode chunk allocations, and
sb_spino_alignis zero. Hence we can skip the check.
Should sparse inodes even be enabled by mkfs in this case?
Regardless, if sb_spino_align = 0 then xfs_ialloc_setup_geometry() does:
igeo->ialloc_min_blks = igeo->ialloc_blks;
And this turns off sparse inode allocation for this situation....
Quoted 11 lines
Fixes dbfbf3bdf639 ("xfs: repair inode btrees")Signed-off-by Darrick J. Wong <[email protected]>--- fs/xfs/scrub/ialloc_repair.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/xfs/scrub/ialloc_repair.c +0
-0
fs/xfs/scrub/ialloc_repair.c xrep_ibt_check_inode_ext( · line 375
Quoted 8 lines
fs/xfs/scrub/ialloc_repair.c +1
-1@@ -369,7 +369,7 @@ xrep_ibt_check_inode_ext(* On a sparse inode fs, this cluster could be part of a sparse chunk. * Sparse clusters must be aligned to sparse chunk alignment. */ -if (xfs_has_sparseinodes (mp) && +if (xfs_has_sparseinodes (mp) && mp->m_sb.sb_spino_align && (!IS_ALIGNED (agbno, mp->m_sb.sb_spino_align) || !IS_ALIGNED (agbno + len, mp->m_sb.sb_spino_align)))return -EFSCORRUPTED ;
... which makes this additional check reasonable.
Signature · 2 lines
Dave Chinner [email protected]
Quoted 11 lines · Dave Chinner
Quoted 8 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
While testing a 64k-blocksize filesystem, I noticed that xfs/709 fails to rebuild the inode btree with a bunch of "Corruption remains" messages. It turns out that when the inode chunk size is smaller than a single filesystem block, no block alignments constraints are necessary for inode chunk allocations, and
sb_spino_alignis zero. Hence we can skip the check.Should sparse inodes even be enabled by mkfs in this case?
Probably not, it's totally useless for inopblock <= 64.
Quoted 29 lines
Regardless, if
sb_spino_align= 0 thenxfs_ialloc_setup_geometry()does:igeo->ialloc_min_blks = igeo->ialloc_blks;And this turns off sparse inode allocation for this situation....
Quoted 11 lines
Fixes dbfbf3bdf639 ("xfs: repair inode btrees")Signed-off-by Darrick J. Wong <[email protected]>--- fs/xfs/scrub/ialloc_repair.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/xfs/scrub/ialloc_repair.c +0
-0fs/xfs/scrub/ialloc_repair.c xrep_ibt_check_inode_ext( · line 375
Quoted 8 lines
fs/xfs/scrub/ialloc_repair.c +1
-1@@ -369,7 +369,7 @@ xrep_ibt_check_inode_ext(* On a sparse inode fs, this cluster could be part of a sparse chunk. * Sparse clusters must be aligned to sparse chunk alignment. */ -if (xfs_has_sparseinodes (mp) && +if (xfs_has_sparseinodes (mp) && mp->m_sb.sb_spino_align && (!IS_ALIGNED (agbno, mp->m_sb.sb_spino_align) || !IS_ALIGNED (agbno + len, mp->m_sb.sb_spino_align)))return -EFSCORRUPTED ;... which makes this additional check reasonable.
Quoted 1 line
Reviewed-by Dave Chinner <[email protected]>
Thanks!
--D
Quoted 5 lines
Signature · 3 lines
-- Dave Chinner [email protected]
Looks good:
(and we really need large blocksize support to be able to test 64k block sizes on x86 :))