Re: [PATCH 07/10] repair: prefetch runs too far ahead

Christoph Hellwig
2014-02-26T01:52:52Z

On Mon, Feb 24, 2014 at 05:29:26PM +1100, Dave Chinner wrote:
> @@ -842,7 +842,7 @@ start_inode_prefetch(
> * and not any other associated metadata like directories
> */
>
> - max_queue = libxfs_bcache->c_maxcount / thread_count / 8;
> + max_queue = libxfs_bcache->c_maxcount / thread_count / 32;

I can't correlate this to anything mentioned in the changelog.
Also if you're touching it anyway it might be a good idea to document
the magic number here.

> +void
> +prefetch_ag_range(
> + struct work_queue *work,
> + xfs_agnumber_t start_ag,
> + xfs_agnumber_t end_ag,
> + bool dirs_only,
> + void (*func)(struct work_queue *,
> + xfs_agnumber_t, void *))
> +{
> + int i;
> + struct prefetch_args *pf_args[2];
> +
> + pf_args[start_ag & 1] = start_inode_prefetch(start_ag, dirs_only, NULL);
> + for (i = start_ag; i < end_ag; i++) {
> + /* Don't prefetch end_ag */
> + if (i + 1 < end_ag)
> + pf_args[(~i) & 1] = start_inode_prefetch(i + 1,
> + dirs_only, pf_args[i & 1]);
> + func(work, i, pf_args[i & 1]);
> + }
> +}

This seems to largely duplicate the common code added in patch 5.
Having _range variants of those that the non-range ones wrap with 0 and
mp->m_sb.sb_agcount as default parameters would avoid that duplication.