public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs: disable sparse inode chunk alignment check when there is no alignment
@ 2024-01-31 19:47 Darrick J. Wong
  2024-01-31 20:54 ` Dave Chinner
  2024-02-01  4:17 ` Christoph Hellwig
  0 siblings, 2 replies; 4+ messages in thread
From: Darrick J. Wong @ 2024-01-31 19:47 UTC (permalink / raw)
  To: Christoph Hellwig, Chandan Babu R; +Cc: xfs

From: Darrick J. Wong <djwong@kernel.org>

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.

Fixes: dbfbf3bdf639 ("xfs: repair inode btrees")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 fs/xfs/scrub/ialloc_repair.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/xfs/scrub/ialloc_repair.c b/fs/xfs/scrub/ialloc_repair.c
index b3f7182dd2f5d..e94f108000825 100644
--- a/fs/xfs/scrub/ialloc_repair.c
+++ b/fs/xfs/scrub/ialloc_repair.c
@@ -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;

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] xfs: disable sparse inode chunk alignment check when there is no alignment
  2024-01-31 19:47 [PATCH] xfs: disable sparse inode chunk alignment check when there is no alignment Darrick J. Wong
@ 2024-01-31 20:54 ` Dave Chinner
  2024-01-31 22:11   ` Darrick J. Wong
  2024-02-01  4:17 ` Christoph Hellwig
  1 sibling, 1 reply; 4+ messages in thread
From: Dave Chinner @ 2024-01-31 20:54 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: Christoph Hellwig, Chandan Babu R, xfs

On Wed, Jan 31, 2024 at 11:47:14AM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> 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.

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....

> Fixes: dbfbf3bdf639 ("xfs: repair inode btrees")
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---
>  fs/xfs/scrub/ialloc_repair.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/xfs/scrub/ialloc_repair.c b/fs/xfs/scrub/ialloc_repair.c
> index b3f7182dd2f5d..e94f108000825 100644
> --- a/fs/xfs/scrub/ialloc_repair.c
> +++ b/fs/xfs/scrub/ialloc_repair.c
> @@ -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.

Reviewed-by: Dave Chinner <dchinner@redhat.com>

-- 
Dave Chinner
david@fromorbit.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] xfs: disable sparse inode chunk alignment check when there is no alignment
  2024-01-31 20:54 ` Dave Chinner
@ 2024-01-31 22:11   ` Darrick J. Wong
  0 siblings, 0 replies; 4+ messages in thread
From: Darrick J. Wong @ 2024-01-31 22:11 UTC (permalink / raw)
  To: Dave Chinner; +Cc: Christoph Hellwig, Chandan Babu R, xfs

On Thu, Feb 01, 2024 at 07:54:49AM +1100, Dave Chinner wrote:
> On Wed, Jan 31, 2024 at 11:47:14AM -0800, Darrick J. Wong wrote:
> > From: Darrick J. Wong <djwong@kernel.org>
> > 
> > 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.
> 
> Should sparse inodes even be enabled by mkfs in this case?

Probably not, it's totally useless for inopblock <= 64.

> 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....
> 
> > Fixes: dbfbf3bdf639 ("xfs: repair inode btrees")
> > Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> > ---
> >  fs/xfs/scrub/ialloc_repair.c |    2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/fs/xfs/scrub/ialloc_repair.c b/fs/xfs/scrub/ialloc_repair.c
> > index b3f7182dd2f5d..e94f108000825 100644
> > --- a/fs/xfs/scrub/ialloc_repair.c
> > +++ b/fs/xfs/scrub/ialloc_repair.c
> > @@ -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.
> 
> Reviewed-by: Dave Chinner <dchinner@redhat.com>

Thanks!

--D

> 
> -- 
> Dave Chinner
> david@fromorbit.com
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] xfs: disable sparse inode chunk alignment check when there is no alignment
  2024-01-31 19:47 [PATCH] xfs: disable sparse inode chunk alignment check when there is no alignment Darrick J. Wong
  2024-01-31 20:54 ` Dave Chinner
@ 2024-02-01  4:17 ` Christoph Hellwig
  1 sibling, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2024-02-01  4:17 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: Christoph Hellwig, Chandan Babu R, xfs

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>

(and we really need large blocksize support to be able to test
64k block sizes on x86 :))


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-02-01  4:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-31 19:47 [PATCH] xfs: disable sparse inode chunk alignment check when there is no alignment Darrick J. Wong
2024-01-31 20:54 ` Dave Chinner
2024-01-31 22:11   ` Darrick J. Wong
2024-02-01  4:17 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox