linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 8/8] xfs: scrub big block inode btrees correctly
Date: Wed, 7 Nov 2018 09:26:03 +1100	[thread overview]
Message-ID: <20181106222603.GV19305@dastard> (raw)
In-Reply-To: <154147733964.32496.6293258964746388898.stgit@magnolia>

On Mon, Nov 05, 2018 at 08:08:59PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> Teach scrub how to handle the case that there are one or more inobt
> records covering a given inode cluster.  This fixes the operation on big
> block filesystems (e.g. 64k blocks, 512 byte inodes).
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
>  fs/xfs/scrub/ialloc.c |    7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> 
> diff --git a/fs/xfs/scrub/ialloc.c b/fs/xfs/scrub/ialloc.c
> index 10c3aaefc2a3..5a5f8ae31803 100644
> --- a/fs/xfs/scrub/ialloc.c
> +++ b/fs/xfs/scrub/ialloc.c
> @@ -169,6 +169,7 @@ xchk_iallocbt_check_cluster_ifree(
>  	xfs_ino_t			fsino;
>  	xfs_agino_t			agino;
>  	unsigned int			offset;
> +	unsigned int			cluster_ioff;
>  	bool				irec_free;
>  	bool				ino_inuse;
>  	bool				freemask_ok;
> @@ -181,11 +182,13 @@ xchk_iallocbt_check_cluster_ifree(
>  	 * Given an inobt record, an offset of a cluster within the record,
>  	 * and an offset of an inode within a cluster, compute which fs inode
>  	 * we're talking about and the offset of the inode record within the
> -	 * inode buffer.
> +	 * inode buffer, being careful about inobt records that don't align
> +	 * with the start of the inode buffer when block sizes are large.
>  	 */
>  	agino = irec->ir_startino + chunk_ioff + loop_ioff;
>  	fsino = XFS_AGINO_TO_INO(mp, bs->cur->bc_private.a.agno, agino);
> -	offset = loop_ioff * mp->m_sb.sb_inodesize;
> +	cluster_ioff = XFS_INO_TO_OFFSET(mp, irec->ir_startino + chunk_ioff);
> +	offset = (cluster_ioff + loop_ioff) * mp->m_sb.sb_inodesize;

urk.

That's even more confusing because now we have a cluster offset into
the chunk, a chunk offset into the cluster, and an inode offset
into the cluster.

And the cluster inode offset into the chunk is call "chunk offset", the
chunk offset into the cluster is called "cluster offset" and the
inode offset is called "loop offset". And none of them are offsets -
we then calculate and "offset" from all these other "not quite
offsets"....

I'm definitely not going to remember this when I look at the code
again in a week. More help needed, I think.

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

  reply	other threads:[~2018-11-07  7:53 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-06  4:08 [PATCH 0/8] xfs-5.0: inode btree scrub fixes Darrick J. Wong
2018-11-06  4:08 ` [PATCH 1/8] xfs: count inode blocks correctly in inobt scrub Darrick J. Wong
2018-11-06 21:20   ` Dave Chinner
2018-11-06  4:08 ` [PATCH 2/8] xfs: calculate inode cluster geometry once during " Darrick J. Wong
2018-11-06 21:32   ` Dave Chinner
2018-11-07  3:40     ` Darrick J. Wong
2018-11-06  4:08 ` [PATCH 3/8] xfs: check the ir_startino alignment directly Darrick J. Wong
2018-11-06 21:34   ` Dave Chinner
2018-11-07  3:50     ` Darrick J. Wong
2018-11-06  4:08 ` [PATCH 4/8] xfs: check inobt record alignment on big block filesystems Darrick J. Wong
2018-11-06 21:36   ` Dave Chinner
2018-11-06  4:08 ` [PATCH 5/8] xfs: hoist inode cluster checks out of loop Darrick J. Wong
2018-11-06 21:39   ` Dave Chinner
2018-11-06  4:08 ` [PATCH 6/8] xfs: clean up the inode cluster checking in the inobt scrub Darrick J. Wong
2018-11-06 22:11   ` Dave Chinner
2018-11-06  4:08 ` [PATCH 7/8] xfs: rename xchk_iallocbt_check_freemask Darrick J. Wong
2018-11-06 22:13   ` Dave Chinner
2018-11-06  4:08 ` [PATCH 8/8] xfs: scrub big block inode btrees correctly Darrick J. Wong
2018-11-06 22:26   ` Dave Chinner [this message]
2018-11-09 15:07 ` [PATCH 0/8] xfs-5.0: inode btree scrub fixes Christoph Hellwig
2018-11-09 16:39   ` Darrick J. Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181106222603.GV19305@dastard \
    --to=david@fromorbit.com \
    --cc=darrick.wong@oracle.com \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).