xfs
[Top] [All Lists]

Re: [PATCH 3/5] repair: phase 6 is trivially parallelisable

To: Dave Chinner <david@xxxxxxxxxxxxx>
Subject: Re: [PATCH 3/5] repair: phase 6 is trivially parallelisable
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Thu, 12 Dec 2013 10:43:46 -0800
Cc: xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1386832945-19763-4-git-send-email-david@xxxxxxxxxxxxx>
References: <1386832945-19763-1-git-send-email-david@xxxxxxxxxxxxx> <1386832945-19763-4-git-send-email-david@xxxxxxxxxxxxx>
User-agent: Mutt/1.5.21 (2010-09-15)
>  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?

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