xfs
[Top] [All Lists]

Re: [PATCH 19/28] repair: scan sparse finobt records correctly

To: Brian Foster <bfoster@xxxxxxxxxx>
Subject: Re: [PATCH 19/28] repair: scan sparse finobt records correctly
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Fri, 5 Jun 2015 11:03:02 +1000
Cc: xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1433270521-62026-20-git-send-email-bfoster@xxxxxxxxxx>
References: <1433270521-62026-1-git-send-email-bfoster@xxxxxxxxxx> <1433270521-62026-20-git-send-email-bfoster@xxxxxxxxxx>
User-agent: Mutt/1.5.21 (2010-09-15)
On Tue, Jun 02, 2015 at 02:41:52PM -0400, Brian Foster wrote:
> The finobt scan performs similar checks as to the inobt scan, including
> internal record consistency checks, consistency with inobt records,
> inode block state, etc. Various parts of this mechanism also assume
> fully allocated inode records and thus lead to false errors with sparse
> records.
> 
> Update the finobt scan to detect and handle sparse inode records
> correctly. As for the inobt, do not assume that blocks associated with
> sparse regions are allocated for inodes and do not account sparse inodes
> against the freecount. Additionally, verify that sparse state is
> consistent with the in-core record and set up any new in-core records
> that might have been missing from the inobt correctly.
> 
> Signed-off-by: Brian Foster <bfoster@xxxxxxxxxx>
....
>  
> +     /*
> +      * Mark sparse inodes as such in the in-core tree. Verify that sparse
> +      * inodes are free and that freecount is consistent with the free mask.
> +      */
> +     nfree = 0;
> +     for (j = 0; j < XFS_INODES_PER_CHUNK; j++) {
> +             if (ino_issparse(rp, j)) {
> +                     if (!suspect && !XFS_INOBT_IS_FREE_DISK(rp, j)) {
> +                             do_warn(
> +_("finobt ir_holemask/ir_free mismatch, inode chunk %d/%u, holemask 0x%x 
> free 0x%llx\n"),
> +                                     agno, ino,
> +                                     be16_to_cpu(rp->ir_u.sp.ir_holemask),
> +                                     be64_to_cpu(rp->ir_free));
> +                             suspect++;
> +                     }
> +                     if (!suspect && ino_rec)
> +                             set_inode_sparse(ino_rec, j);
> +             } else if (XFS_INOBT_IS_FREE_DISK(rp, j)) {
> +                     /* freecount only tracks non-sparse inos */
> +                     nfree++;
> +             }
> +     }
> +

This is the same checking code as used for the inobt. Can you factor
these into a helper? I'll apply as is, so delta patch again. ;)

Cheers,

Dave.
-- 
Dave Chinner
david@xxxxxxxxxxxxx

<Prev in Thread] Current Thread [Next in Thread>