Re: [PATCH 11/12] xfs_repair: use precomputed inode geometry values

Dave Chinner
2019-08-30T06:17:40Z

On Tue, Aug 20, 2019 at 01:32:23PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
>
> Use the precomputed inode geometry values instead of open-coding them.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
> repair/dino_chunks.c | 22 +++++++++++-----------
> repair/dinode.c | 13 ++++---------
> repair/globals.c | 1 -
> repair/globals.h | 1 -
> repair/prefetch.c | 21 ++++++++-------------
> repair/xfs_repair.c | 2 --
> 6 files changed, 23 insertions(+), 37 deletions(-)

two minor nits:

> diff --git a/repair/prefetch.c b/repair/prefetch.c
> index 2fecfd68..5a725a51 100644
> --- a/repair/prefetch.c
> +++ b/repair/prefetch.c
> @@ -710,17 +710,12 @@ pf_queuing_worker(
> int num_inos;
> ino_tree_node_t *irec;
> ino_tree_node_t *cur_irec;
> - int blks_per_cluster;
> xfs_agblock_t bno;
> int i;
> int err;
> uint64_t sparse;
> struct xfs_ino_geometry *igeo = M_IGEO(mp);
>
> - blks_per_cluster = igeo->inode_cluster_size >> mp->m_sb.sb_blocklog;
> - if (blks_per_cluster == 0)
> - blks_per_cluster = 1;
> -
> for (i = 0; i < PF_THREAD_COUNT; i++) {
> err = pthread_create(&args->io_threads[i], NULL,
> pf_io_worker, args);
> @@ -786,21 +781,22 @@ pf_queuing_worker(
> struct xfs_buf_map map;
>
> map.bm_bn = XFS_AGB_TO_DADDR(mp, args->agno, bno);
> - map.bm_len = XFS_FSB_TO_BB(mp, blks_per_cluster);
> + map.bm_len = XFS_FSB_TO_BB(mp,
> + M_IGEO(mp)->blocks_per_cluster);

igeo->blocks_per_cluster

>
> /*
> * Queue I/O for each non-sparse cluster. We can check
> * sparse state in cluster sized chunks as cluster size
> * is the min. granularity of sparse irec regions.
> */
> - if ((sparse & ((1ULL << inodes_per_cluster) - 1)) == 0)
> + if ((sparse & ((1ULL << M_IGEO(mp)->inodes_per_cluster) - 1)) == 0)

igeo->inodes_per_cluster and 80 columns....

Otherwise,

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

Cheers,

Dave.
--
Dave Chinner
david@fromorbit.com