Re: [PATCH 18/28] repair: scan and track sparse inode chunks correctly

Dave Chinner
2015-06-05T00:56:50Z

On Tue, Jun 02, 2015 at 02:41:51PM -0400, Brian Foster wrote:
> Phase 2 of xfs_repair scans the on-disk inobt and creates in-core
> records for all inodes in the fs. This also involves marking
> free/allocated state of all inodes, internal record verification and
> block state management for the inode chunks tracked by inode records.
> Various parts of the inobt scan mechanism assume fully allocated inode
> records and thus lead to spurious errors when sparse inode records are
> encountered.
>
> Update the inobt scan to detect and handle sparse inode records
> correctly. Do not set the allocation state of blocks in sparse inode
> regions as these blocks do not belong to the record. Do not account
> sparse inodes against the ir_freecount as these inodes do not exist and
> are not available for allocation by the fs. Finally, track the sparse
> status of each individual inode in the in-core inode records for future
> reference.
>
> Signed-off-by: Brian Foster <bfoster@redhat.com>
> ---
> include/libxfs.h | 16 ++++++++++++++++
> repair/incore.h | 14 ++++++++++++++
> repair/incore_ino.c | 1 +
> repair/scan.c | 48 +++++++++++++++++++++++++++++++++++++++++-------
> 4 files changed, 72 insertions(+), 7 deletions(-)
>
> diff --git a/include/libxfs.h b/include/libxfs.h
> index 6a59cc0..3321c50 100644
> --- a/include/libxfs.h
> +++ b/include/libxfs.h
> @@ -183,6 +183,22 @@ extern unsigned long libxfs_physmem(void); /* in kilobytes */
> #define XFS_INOBT_IS_FREE_DISK(rp,i) \
> ((be64_to_cpu((rp)->ir_free) & XFS_INOBT_MASK(i)) != 0)
>
> +static inline bool
> +XFS_INOBT_IS_SPARSE_DISK(

Shouty! ;)

I changed this lower case, otherwise ok.

Cheers,

Dave.
--
Dave Chinner
david@fromorbit.com