[PATCH 3/5] repair: phase 6 is trivially parallelisable
Christoph Hellwig
hch at infradead.org
Thu Dec 12 12:43:46 CST 2013
> static void
> add_dotdot_update(
> @@ -64,12 +65,14 @@ add_dotdot_update(
> do_error(_("malloc failed add_dotdot_update (%zu bytes)\n"),
> sizeof(dotdot_update_t));
>
> + pthread_mutex_lock(&dotdot_lock);
> dir->next = dotdot_update_list;
> dir->irec = irec;
> dir->agno = agno;
> dir->ino_offset = ino_offset;
>
> dotdot_update_list = dir;
> + pthread_mutex_unlock(&dotdot_lock);
Would be nice to make this use a list_head if you touch it anyway.
(As a separate patch)
> static void
> traverse_ags(
> - xfs_mount_t *mp)
> + xfs_mount_t *mp)
Not quite sure what actually changed here, but if you touch it anyway
you might as well use the struct version..
> + if (!ag_stride) {
> + work_queue_t queue;
> +
> + queue.mp = mp;
> + pf_args[0] = start_inode_prefetch(0, 1, NULL);
> + for (i = 0; i < glob_agcount; i++) {
> + pf_args[(~i) & 1] = start_inode_prefetch(i + 1, 1,
> + pf_args[i & 1]);
> + traverse_function(&queue, i, pf_args[i & 1]);
> + }
> + return;
> }
> +
> + /*
> + * create one worker thread for each segment of the volume
> + */
> + queues = malloc(thread_count * sizeof(work_queue_t));
> + for (i = 0, agno = 0; i < thread_count; i++) {
> + create_work_queue(&queues[i], mp, 1);
> + pf_args[0] = NULL;
> + for (j = 0; j < ag_stride && agno < glob_agcount; j++, agno++) {
> + pf_args[0] = start_inode_prefetch(agno, 1, pf_args[0]);
> + queue_work(&queues[i], traverse_function, agno,
> + pf_args[0]);
> + }
> + }
> +
> + /*
> + * wait for workers to complete
> + */
> + for (i = 0; i < thread_count; i++)
> + destroy_work_queue(&queues[i]);
> + free(queues);
This is the third copy of this code block, might make sense to
consolidate it.
Btw, does anyone remember why we have the libxfs_bcache_overflowed()
special case in phase4, but not anywhere else?
More information about the xfs
mailing list