On Thu, 7 Nov 2013 13:51:52 +0800, Qu Wenruo wrote:
> Use kernel workqueue to implement a new btrfs_workqueue_struct, which
> has the ordering execution feature like the btrfs_worker.
>
> The func is executed in a concurrency way, and the
> ordred_func/ordered_free is executed in the sequence them are queued
> after the corresponding func is done.
> The new btrfs_workqueue use 2 workqueues to implement the original
> btrfs_worker, one for the normal work and one for ordered work.
>
> At this patch, high priority work queue or thresholding is not added yet.
> The high priority feature and thresholding will be added in the following patches.
>
> Signed-off-by: Qu Wenruo <quwenruo@xxxxxxxxxxxxxx>
[...]
> diff --git a/fs/btrfs/async-thread.h b/fs/btrfs/async-thread.h
> index 1f26792..eee6709 100644
> --- a/fs/btrfs/async-thread.h
> +++ b/fs/btrfs/async-thread.h
> @@ -1,5 +1,6 @@
> /*
> * Copyright (C) 2007 Oracle. All rights reserved.
> + * Copyright (C) 2013 Fujitsu. All rights reserved.
> *
> * This program is free software; you can redistribute it and/or
> * modify it under the terms of the GNU General Public
> @@ -118,4 +119,47 @@ void btrfs_init_workers(struct btrfs_workers *workers, char *name, int max,
> struct btrfs_workers *async_starter);
> void btrfs_requeue_work(struct btrfs_work *work);
> void btrfs_set_work_high_prio(struct btrfs_work *work);
> +
> +struct btrfs_workqueue_struct {
> + struct workqueue_struct *normal_wq;
> + struct workqueue_struct *ordered_wq;
> +
> + /*
> + * Spinlock to ensure that both ordered and normal work can
> + * be inserted to each workqueue at the same sequance,
> + * which will reduce the ordered_work waiting time and disk head moves.
> + */
> + spinlock_t insert_lock;
> +};
> +
> +struct btrfs_work_struct {
> + void (*func)(struct btrfs_work_struct *arg);
> + void (*ordered_func)(struct btrfs_work_struct *arg);
> + void (*ordered_free)(struct btrfs_work_struct *arg);
> +
> + /* Don't touch things below */
> + struct work_struct normal_work;
> + struct work_struct ordered_work;
> + struct completion normal_completion;
> +};
If you compare the Btrfs sources before applying your patchset and after
applying all 17 patches, one change is this:
-struct btrfs_work {
+struct btrfs_work_struct {
Which causes changes s/struct btrfs_work/struct btrfs_work_struct/ like
in patch 16/17:
- struct btrfs_work work;
+ struct btrfs_work_struct
+ work;
-static void scrub_bio_end_io_worker(struct btrfs_work *work);
+static void scrub_bio_end_io_worker(struct btrfs_work_struct *work);
I just don't see any good reason for renaming 'struct foo' to 'struct
foo_struct'.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html