Re: [PATCH v4 00/18] Replace btrfs_workers with kernel workqueue based btrfs_workqueue

2014-01-08 Thread David Sterba
On Wed, Jan 08, 2014 at 02:25:02PM +0800, Qu Wenruo wrote:
 But according to the dmesg, which is expired now though, I made the
 following assumption:
 
 There is a possibility that out of order execution made the work-wq =
 wq sentence executed behind the queue_work() call,
 and the normal_work_helper is executed in another CPU instantly, which
 caused the problem.

This could be the reason, though I still don't see how exactly this
happens.

 --
 static inline void __btrfs_queue_work(struct __btrfs_workqueue *wq,
 struct btrfs_work *work)
 {
 unsigned long flags;
 
 work-wq = wq;
 /* There is no memory barrier ensure the work-wq = wq is executed
 before queue_work */
 thresh_queue_hook(wq);
 if (work-ordered_func) {
 spin_lock_irqsave(wq-list_lock, flags);
 list_add_tail(work-ordered_list, wq-ordered_list);
 spin_unlock_irqrestore(wq-list_lock, flags);
 }
 queue_work(wq-normal_wq, work-normal_work);
 }
 --
 
 The fix is as easy as just adding a smp_wmb() behind the work-wq = wq
 sentence, but since I failed to reproduce the bug,
 I can't confirm whether the fix is good or not.
 
 I know it's impolite but would you please first try the smp_wmb() first to
 confirm the fix?
 If itis convenient for you,would you please give some feedback about the
 smp_wmb() fix ?
 
 Also incase that smp_wmb() doesn't work, it would be very nice of you to
 also try smp_mb() fix.

The smp_wmb barriers have to pair with smp_rmb, which means that
normal_work_helper() has to call smp_rmb at the beginning.

What still puzzles me is why would the barriers are needed at all,
although your example code shows the effects of a delayed store.

Down the call stack, the barrier takes place:

queue_work
  queue_work_on(WORK_CPU_UNBOUND)
__queue_work
  insert_work
smp_mb

There is no barrier before the work is being processed in
workqueue.c::process_one_work(), but there maybe an implied one.


david
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v4 00/18] Replace btrfs_workers with kernel workqueue based btrfs_workqueue

2014-01-08 Thread Qu Wenruo

On Wed, 8 Jan 2014 19:51:59 +0100, David Sterba wrote:

On Wed, Jan 08, 2014 at 02:25:02PM +0800, Qu Wenruo wrote:

But according to the dmesg, which is expired now though, I made the
following assumption:

There is a possibility that out of order execution made the work-wq =
wq sentence executed behind the queue_work() call,
and the normal_work_helper is executed in another CPU instantly, which
caused the problem.

This could be the reason, though I still don't see how exactly this
happens.


--
static inline void __btrfs_queue_work(struct __btrfs_workqueue *wq,
struct btrfs_work *work)
{
unsigned long flags;

work-wq = wq;
/* There is no memory barrier ensure the work-wq = wq is executed
before queue_work */
thresh_queue_hook(wq);
if (work-ordered_func) {
spin_lock_irqsave(wq-list_lock, flags);
list_add_tail(work-ordered_list, wq-ordered_list);
spin_unlock_irqrestore(wq-list_lock, flags);
}
queue_work(wq-normal_wq, work-normal_work);
}
--

The fix is as easy as just adding a smp_wmb() behind the work-wq = wq
sentence, but since I failed to reproduce the bug,
I can't confirm whether the fix is good or not.

I know it's impolite but would you please first try the smp_wmb() first to
confirm the fix?

If itis convenient for you,would you please give some feedback about the
smp_wmb() fix ?

Also incase that smp_wmb() doesn't work, it would be very nice of you to
also try smp_mb() fix.

The smp_wmb barriers have to pair with smp_rmb, which means that
normal_work_helper() has to call smp_rmb at the beginning.

What still puzzles me is why would the barriers are needed at all,
although your example code shows the effects of a delayed store.

Down the call stack, the barrier takes place:

queue_work
   queue_work_on(WORK_CPU_UNBOUND)
 __queue_work
   insert_work
 smp_mb

There is no barrier before the work is being processed in
workqueue.c::process_one_work(), but there maybe an implied one.


david

It is right that before processing the work, there is already an 
smp_mb() in queue_work.

So the problem may not be the memory barrier things.
It looks like I have to dig deeper even I could not reproduce the bug. :(

BTW, since the original dmesg is expired, would josef upload the dmesg 
again?

Also, did david success to reproduce the bug?

Thanks

Qu

--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v4 00/18] Replace btrfs_workers with kernel workqueue based btrfs_workqueue

2014-01-07 Thread Qu Wenruo

On Mon, 23 Dec 2013 10:35:04 +0800
, Qu Wenruo wrote:

On fri, 20 Dec 2013 05:30:48 -0800, Josef Bacik wrote:


On 12/19/2013 07:08 PM, Qu Wenruo wrote:

I'm sorry but I failed to reproduce the problem.
Btrfs/012 in xfstests has been run for serveral hours but nothing 
happened.


Would you please give me some more details about the environment or 
the panic backtrace?




Ok so it wasn't that test, it was just ./check -g auto. It would 
sometimes die at btrfs/012, other times it would make it as far as 
generic/083 before it keeled over. I bisected it down to


btrfs: Replace fs_info-workers with btrfs_workqueue

which of course is just the first patch that you start using the new 
code which isn't helpful. My dmesg from one of my runs is here


http://ur1.ca/g867b

All of the initial panics looked exactly the same. I'm just going to 
kick the series out for now while you track down the problem. Thanks,


Josef
--
To unsubscribe from this list: send the line unsubscribe 
linux-btrfs in

the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html


Thanks for your dmesg a lot.

It's quite sad that I still failed to reproduce the same bug on all my 
test environment during the weekend.


But according to the dmesg, which is expired now though, I made the 
following assumption:


There is a possibility that out of order execution made the work-wq 
= wq sentence executed behind the queue_work() call,
and the normal_work_helper is executed in another CPU instantly, 
which caused the problem.


--
static inline void __btrfs_queue_work(struct __btrfs_workqueue *wq,
struct btrfs_work *work)
{
unsigned long flags;

work-wq = wq;
/* There is no memory barrier ensure the work-wq = wq is executed
before queue_work */
thresh_queue_hook(wq);
if (work-ordered_func) {
spin_lock_irqsave(wq-list_lock, flags);
list_add_tail(work-ordered_list, wq-ordered_list);
spin_unlock_irqrestore(wq-list_lock, flags);
}
queue_work(wq-normal_wq, work-normal_work);
}
--

The memory order problem involves compiler or even CPU hardware (AMD 
CPUS seems to have a weaker memory order than Intel),
so to simulate the bug, I used the following codes tried to reproduce 
the bug, and the result is pretty much the same as your dmesg.

--
static inline void __btrfs_queue_work(struct __btrfs_workqueue *wq,
struct btrfs_work *work)
{
unsigned long flags;
int in_order = get_random_int() % 1000

if (in_order)
work-wq = wq;
thresh_queue_hook(wq);
if (work-ordered_func) {
spin_lock_irqsave(wq-list_lock, flags);
list_add_tail(work-ordered_list, wq-ordered_list);
spin_unlock_irqrestore(wq-list_lock, flags);
}
queue_work(wq-normal_wq, work-normal_work);

/* Try make the codes out of order since the Intel CPU
seems obey the memory order quite well */
if (!in_order)
work-wq = wq;
}
--

The fix is as easy as just adding a smp_wmb() behind the work-wq = 
wq sentence, but since I failed to reproduce the bug,

I can't confirm whether the fix is good or not.

I know it's impolite but would you please first try the smp_wmb() 
first to confirm the fix?


If the fix is good I'll send the formal V5 patchset.

Thanks

Qu

Happy new year!

Very sorry for disturbing but ithas been some time before my last replay
and no feedback since then (mainly because of the new year holiday).

If itis convenient for you,would you please give some feedback about the 
smp_wmb() fix ?


Also incase that smp_wmb() doesn't work, it would be very nice of you to
also try smp_mb() fix.

Thanks
Qu
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v4 00/18] Replace btrfs_workers with kernel workqueue based btrfs_workqueue

2013-12-22 Thread Qu Wenruo

On fri, 20 Dec 2013 05:30:48 -0800, Josef Bacik wrote:


On 12/19/2013 07:08 PM, Qu Wenruo wrote:

I'm sorry but I failed to reproduce the problem.
Btrfs/012 in xfstests has been run for serveral hours but nothing 
happened.


Would you please give me some more details about the environment or 
the panic backtrace?




Ok so it wasn't that test, it was just ./check -g auto. It would 
sometimes die at btrfs/012, other times it would make it as far as 
generic/083 before it keeled over. I bisected it down to


btrfs: Replace fs_info-workers with btrfs_workqueue

which of course is just the first patch that you start using the new 
code which isn't helpful. My dmesg from one of my runs is here


http://ur1.ca/g867b

All of the initial panics looked exactly the same. I'm just going to 
kick the series out for now while you track down the problem. Thanks,


Josef
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html


Thanks for your dmesg a lot.

It's quite sad that I still failed to reproduce the same bug on all my 
test environment during the weekend.


But according to the dmesg, which is expired now though, I made the 
following assumption:


There is a possibility that out of order execution made the work-wq = 
wq sentence executed behind the queue_work() call,
and the normal_work_helper is executed in another CPU instantly, which 
caused the problem.


--
static inline void __btrfs_queue_work(struct __btrfs_workqueue *wq,
struct btrfs_work *work)
{
unsigned long flags;

work-wq = wq;
/* There is no memory barrier ensure the work-wq = wq is executed
before queue_work */
thresh_queue_hook(wq);
if (work-ordered_func) {
spin_lock_irqsave(wq-list_lock, flags);
list_add_tail(work-ordered_list, wq-ordered_list);
spin_unlock_irqrestore(wq-list_lock, flags);
}
queue_work(wq-normal_wq, work-normal_work);
}
--

The memory order problem involves compiler or even CPU hardware (AMD 
CPUS seems to have a weaker memory order than Intel),
so to simulate the bug, I used the following codes tried to reproduce 
the bug, and the result is pretty much the same as your dmesg.

--
static inline void __btrfs_queue_work(struct __btrfs_workqueue *wq,
struct btrfs_work *work)
{
unsigned long flags;
int in_order = get_random_int() % 1000

if (in_order)
work-wq = wq;
thresh_queue_hook(wq);
if (work-ordered_func) {
spin_lock_irqsave(wq-list_lock, flags);
list_add_tail(work-ordered_list, wq-ordered_list);
spin_unlock_irqrestore(wq-list_lock, flags);
}
queue_work(wq-normal_wq, work-normal_work);

/* Try make the codes out of order since the Intel CPU
seems obey the memory order quite well */
if (!in_order)
work-wq = wq;
}
--

The fix is as easy as just adding a smp_wmb() behind the work-wq = wq 
sentence, but since I failed to reproduce the bug,

I can't confirm whether the fix is good or not.

I know it's impolite but would you please first try the smp_wmb() first 
to confirm the fix?


If the fix is good I'll send the formal V5 patchset.

Thanks

Qu
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v4 00/18] Replace btrfs_workers with kernel workqueue based btrfs_workqueue

2013-12-20 Thread Josef Bacik


On 12/19/2013 07:08 PM, Qu Wenruo wrote:

I'm sorry but I failed to reproduce the problem.
Btrfs/012 in xfstests has been run for serveral hours but nothing 
happened.


Would you please give me some more details about the environment or 
the panic backtrace?




Ok so it wasn't that test, it was just ./check -g auto.  It would 
sometimes die at btrfs/012, other times it would make it as far as 
generic/083 before it keeled over.  I bisected it down to


btrfs: Replace fs_info-workers with btrfs_workqueue

which of course is just the first patch that you start using the new 
code which isn't helpful.  My dmesg from one of my runs is here


http://ur1.ca/g867b

All of the initial panics looked exactly the same.  I'm just going to 
kick the series out for now while you track down the problem. Thanks,


Josef
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v4 00/18] Replace btrfs_workers with kernel workqueue based btrfs_workqueue

2013-12-19 Thread Josef Bacik
I got a panic with btrfs/012 in the worker stuff.  I'm bisecting it down 
to figure out which patch introduced it but I'm afraid it may just be 
one of the replace blah with btrfs_workqueue patches and not be super 
helpful.  You may want to run it in a loop or something and see if you 
can trigger it in the meantime and I'll respond whenever my bisect 
finishes.  Thanks,


Josef

On 12/17/2013 04:31 AM, Qu Wenruo wrote:

Add a new btrfs_workqueue_struct which use kernel workqueue to implement
most of the original btrfs_workers, to replace btrfs_workers.

With this patchset, redundant workqueue codes are replaced with kernel
workqueue infrastructure, which not only reduces the code size but also the
effort to maintain it.

The result from sysbench shows minor improvement on the following server:
CPU: two-way Xeon X5660
RAM: 4G
HDD: SAS HDD, 150G total, 100G partition for btrfs test

Test result on default mount option:
https://docs.google.com/spreadsheet/ccc?key=0AhpkL3ehzX3pdENjajJTWFg5d1BWbExnYWFpMTJxeUEusp=sharing

Test result on -o compress mount option:
https://docs.google.com/spreadsheet/ccc?key=0AhpkL3ehzX3pdHdTTEJ6OW96SXJFaDR5enB1SzMzc0Eusp=sharing

Changelog:
v1-v2:
   - Fix some workqueue flags.
v2-v3:
   - Add the thresholding mechanism to simulate the old behavior
   - Convert all the btrfs_workers to btrfs_workrqueue_struct.
   - Fix some potential deadlock when executed in IRQ handler.
v3-v4:
   - Change the ordered workqueue implement to fix the performance drop in 32K
 multi thread random write.
   - Change the high priority workqueue implement to get an independent high
 workqueue without starving problem.
   - Simplify the btrfs_alloc_workqueue parameters.
   - Coding style cleanup.
   - Remove the redundant _struct suffix.

Qu Wenruo (18):
   btrfs: Cleanup the unused struct async_sched.
   btrfs: Added btrfs_workqueue_struct implemented ordered execution
 based on kernel workqueue
   btrfs: Add high priority workqueue support for btrfs_workqueue_struct
   btrfs: Add threshold workqueue based on kernel workqueue
   btrfs: Replace fs_info-workers with btrfs_workqueue.
   btrfs: Replace fs_info-delalloc_workers with btrfs_workqueue
   btrfs: Replace fs_info-submit_workers with btrfs_workqueue.
   btrfs: Replace fs_info-flush_workers with btrfs_workqueue.
   btrfs: Replace fs_info-endio_* workqueue with btrfs_workqueue.
   btrfs: Replace fs_info-rmw_workers workqueue with btrfs_workqueue.
   btrfs: Replace fs_info-cache_workers workqueue with btrfs_workqueue.
   btrfs: Replace fs_info-readahead_workers workqueue with
 btrfs_workqueue.
   btrfs: Replace fs_info-fixup_workers workqueue with btrfs_workqueue.
   btrfs: Replace fs_info-delayed_workers workqueue with
 btrfs_workqueue.
   btrfs: Replace fs_info-qgroup_rescan_worker workqueue with
 btrfs_workqueue.
   btrfs: Replace fs_info-scrub_* workqueue with btrfs_workqueue.
   btrfs: Cleanup the old btrfs_worker.
   btrfs: Cleanup the _struct suffix in btrfs_workequeue

  fs/btrfs/async-thread.c  | 821 ---
  fs/btrfs/async-thread.h  | 117 ++-
  fs/btrfs/ctree.h |  39 ++-
  fs/btrfs/delayed-inode.c |   6 +-
  fs/btrfs/disk-io.c   | 212 +---
  fs/btrfs/extent-tree.c   |   4 +-
  fs/btrfs/inode.c |  38 +--
  fs/btrfs/ordered-data.c  |  11 +-
  fs/btrfs/qgroup.c|  15 +-
  fs/btrfs/raid56.c|  21 +-
  fs/btrfs/reada.c |   4 +-
  fs/btrfs/scrub.c |  70 ++--
  fs/btrfs/super.c |  36 +--
  fs/btrfs/volumes.c   |  16 +-
  14 files changed, 430 insertions(+), 980 deletions(-)



--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v4 00/18] Replace btrfs_workers with kernel workqueue based btrfs_workqueue

2013-12-19 Thread Qu Wenruo

Thanks for reporting.

That's interesting, I'll look into it to figure out what's happening.

Qu


On Thu, 19 Dec 2013 10:27:22 -0500, Josef Bacik wrote:
I got a panic with btrfs/012 in the worker stuff.  I'm bisecting it 
down to figure out which patch introduced it but I'm afraid it may 
just be one of the replace blah with btrfs_workqueue patches and not 
be super helpful.  You may want to run it in a loop or something and 
see if you can trigger it in the meantime and I'll respond whenever my 
bisect finishes.  Thanks,


Josef

On 12/17/2013 04:31 AM, Qu Wenruo wrote:

Add a new btrfs_workqueue_struct which use kernel workqueue to implement
most of the original btrfs_workers, to replace btrfs_workers.

With this patchset, redundant workqueue codes are replaced with kernel
workqueue infrastructure, which not only reduces the code size but 
also the

effort to maintain it.

The result from sysbench shows minor improvement on the following 
server:

CPU: two-way Xeon X5660
RAM: 4G
HDD: SAS HDD, 150G total, 100G partition for btrfs test

Test result on default mount option:
https://docs.google.com/spreadsheet/ccc?key=0AhpkL3ehzX3pdENjajJTWFg5d1BWbExnYWFpMTJxeUEusp=sharing 



Test result on -o compress mount option:
https://docs.google.com/spreadsheet/ccc?key=0AhpkL3ehzX3pdHdTTEJ6OW96SXJFaDR5enB1SzMzc0Eusp=sharing 



Changelog:
v1-v2:
   - Fix some workqueue flags.
v2-v3:
   - Add the thresholding mechanism to simulate the old behavior
   - Convert all the btrfs_workers to btrfs_workrqueue_struct.
   - Fix some potential deadlock when executed in IRQ handler.
v3-v4:
   - Change the ordered workqueue implement to fix the performance 
drop in 32K

 multi thread random write.
   - Change the high priority workqueue implement to get an 
independent high

 workqueue without starving problem.
   - Simplify the btrfs_alloc_workqueue parameters.
   - Coding style cleanup.
   - Remove the redundant _struct suffix.

Qu Wenruo (18):
   btrfs: Cleanup the unused struct async_sched.
   btrfs: Added btrfs_workqueue_struct implemented ordered execution
 based on kernel workqueue
   btrfs: Add high priority workqueue support for btrfs_workqueue_struct
   btrfs: Add threshold workqueue based on kernel workqueue
   btrfs: Replace fs_info-workers with btrfs_workqueue.
   btrfs: Replace fs_info-delalloc_workers with btrfs_workqueue
   btrfs: Replace fs_info-submit_workers with btrfs_workqueue.
   btrfs: Replace fs_info-flush_workers with btrfs_workqueue.
   btrfs: Replace fs_info-endio_* workqueue with btrfs_workqueue.
   btrfs: Replace fs_info-rmw_workers workqueue with btrfs_workqueue.
   btrfs: Replace fs_info-cache_workers workqueue with btrfs_workqueue.
   btrfs: Replace fs_info-readahead_workers workqueue with
 btrfs_workqueue.
   btrfs: Replace fs_info-fixup_workers workqueue with btrfs_workqueue.
   btrfs: Replace fs_info-delayed_workers workqueue with
 btrfs_workqueue.
   btrfs: Replace fs_info-qgroup_rescan_worker workqueue with
 btrfs_workqueue.
   btrfs: Replace fs_info-scrub_* workqueue with btrfs_workqueue.
   btrfs: Cleanup the old btrfs_worker.
   btrfs: Cleanup the _struct suffix in btrfs_workequeue

  fs/btrfs/async-thread.c  | 821 
---

  fs/btrfs/async-thread.h  | 117 ++-
  fs/btrfs/ctree.h |  39 ++-
  fs/btrfs/delayed-inode.c |   6 +-
  fs/btrfs/disk-io.c   | 212 +---
  fs/btrfs/extent-tree.c   |   4 +-
  fs/btrfs/inode.c |  38 +--
  fs/btrfs/ordered-data.c  |  11 +-
  fs/btrfs/qgroup.c|  15 +-
  fs/btrfs/raid56.c|  21 +-
  fs/btrfs/reada.c |   4 +-
  fs/btrfs/scrub.c |  70 ++--
  fs/btrfs/super.c |  36 +--
  fs/btrfs/volumes.c   |  16 +-
  14 files changed, 430 insertions(+), 980 deletions(-)







--
-
Qu Wenruo
Development Dept.I
Nanjing Fujitsu Nanda Software Tech. Co., Ltd.(FNST)
No. 6 Wenzhu Road, Nanjing, 210012, China
TEL: +86+25-86630566-8526
COINS: 7998-8526
FAX: +86+25-83317685
MAIL: quwen...@cn.fujitsu.com
-

--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v4 00/18] Replace btrfs_workers with kernel workqueue based btrfs_workqueue

2013-12-19 Thread Qu Wenruo

I'm sorry but I failed to reproduce the problem.
Btrfs/012 in xfstests has been run for serveral hours but nothing happened.

Would you please give me some more details about the environment or the 
panic backtrace?


Thanks.

Qu

On Thu, 19 Dec 2013 10:27:22 -0500, Josef Bacik wrote:
I got a panic with btrfs/012 in the worker stuff.  I'm bisecting it 
down to figure out which patch introduced it but I'm afraid it may 
just be one of the replace blah with btrfs_workqueue patches and not 
be super helpful.  You may want to run it in a loop or something and 
see if you can trigger it in the meantime and I'll respond whenever my 
bisect finishes.  Thanks,


Josef

On 12/17/2013 04:31 AM, Qu Wenruo wrote:

Add a new btrfs_workqueue_struct which use kernel workqueue to implement
most of the original btrfs_workers, to replace btrfs_workers.

With this patchset, redundant workqueue codes are replaced with kernel
workqueue infrastructure, which not only reduces the code size but 
also the

effort to maintain it.

The result from sysbench shows minor improvement on the following 
server:

CPU: two-way Xeon X5660
RAM: 4G
HDD: SAS HDD, 150G total, 100G partition for btrfs test

Test result on default mount option:
https://docs.google.com/spreadsheet/ccc?key=0AhpkL3ehzX3pdENjajJTWFg5d1BWbExnYWFpMTJxeUEusp=sharing 



Test result on -o compress mount option:
https://docs.google.com/spreadsheet/ccc?key=0AhpkL3ehzX3pdHdTTEJ6OW96SXJFaDR5enB1SzMzc0Eusp=sharing 



Changelog:
v1-v2:
   - Fix some workqueue flags.
v2-v3:
   - Add the thresholding mechanism to simulate the old behavior
   - Convert all the btrfs_workers to btrfs_workrqueue_struct.
   - Fix some potential deadlock when executed in IRQ handler.
v3-v4:
   - Change the ordered workqueue implement to fix the performance 
drop in 32K

 multi thread random write.
   - Change the high priority workqueue implement to get an 
independent high

 workqueue without starving problem.
   - Simplify the btrfs_alloc_workqueue parameters.
   - Coding style cleanup.
   - Remove the redundant _struct suffix.

Qu Wenruo (18):
   btrfs: Cleanup the unused struct async_sched.
   btrfs: Added btrfs_workqueue_struct implemented ordered execution
 based on kernel workqueue
   btrfs: Add high priority workqueue support for btrfs_workqueue_struct
   btrfs: Add threshold workqueue based on kernel workqueue
   btrfs: Replace fs_info-workers with btrfs_workqueue.
   btrfs: Replace fs_info-delalloc_workers with btrfs_workqueue
   btrfs: Replace fs_info-submit_workers with btrfs_workqueue.
   btrfs: Replace fs_info-flush_workers with btrfs_workqueue.
   btrfs: Replace fs_info-endio_* workqueue with btrfs_workqueue.
   btrfs: Replace fs_info-rmw_workers workqueue with btrfs_workqueue.
   btrfs: Replace fs_info-cache_workers workqueue with btrfs_workqueue.
   btrfs: Replace fs_info-readahead_workers workqueue with
 btrfs_workqueue.
   btrfs: Replace fs_info-fixup_workers workqueue with btrfs_workqueue.
   btrfs: Replace fs_info-delayed_workers workqueue with
 btrfs_workqueue.
   btrfs: Replace fs_info-qgroup_rescan_worker workqueue with
 btrfs_workqueue.
   btrfs: Replace fs_info-scrub_* workqueue with btrfs_workqueue.
   btrfs: Cleanup the old btrfs_worker.
   btrfs: Cleanup the _struct suffix in btrfs_workequeue

  fs/btrfs/async-thread.c  | 821 
---

  fs/btrfs/async-thread.h  | 117 ++-
  fs/btrfs/ctree.h |  39 ++-
  fs/btrfs/delayed-inode.c |   6 +-
  fs/btrfs/disk-io.c   | 212 +---
  fs/btrfs/extent-tree.c   |   4 +-
  fs/btrfs/inode.c |  38 +--
  fs/btrfs/ordered-data.c  |  11 +-
  fs/btrfs/qgroup.c|  15 +-
  fs/btrfs/raid56.c|  21 +-
  fs/btrfs/reada.c |   4 +-
  fs/btrfs/scrub.c |  70 ++--
  fs/btrfs/super.c |  36 +--
  fs/btrfs/volumes.c   |  16 +-
  14 files changed, 430 insertions(+), 980 deletions(-)







--
-
Qu Wenruo
Development Dept.I
Nanjing Fujitsu Nanda Software Tech. Co., Ltd.(FNST)
No. 6 Wenzhu Road, Nanjing, 210012, China
TEL: +86+25-86630566-8526
COINS: 7998-8526
FAX: +86+25-83317685
MAIL: quwen...@cn.fujitsu.com
-

--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 00/18] Replace btrfs_workers with kernel workqueue based btrfs_workqueue

2013-12-17 Thread Qu Wenruo
Add a new btrfs_workqueue_struct which use kernel workqueue to implement
most of the original btrfs_workers, to replace btrfs_workers.

With this patchset, redundant workqueue codes are replaced with kernel
workqueue infrastructure, which not only reduces the code size but also the
effort to maintain it.

The result from sysbench shows minor improvement on the following server:
CPU: two-way Xeon X5660
RAM: 4G 
HDD: SAS HDD, 150G total, 100G partition for btrfs test

Test result on default mount option:
https://docs.google.com/spreadsheet/ccc?key=0AhpkL3ehzX3pdENjajJTWFg5d1BWbExnYWFpMTJxeUEusp=sharing

Test result on -o compress mount option:
https://docs.google.com/spreadsheet/ccc?key=0AhpkL3ehzX3pdHdTTEJ6OW96SXJFaDR5enB1SzMzc0Eusp=sharing

Changelog:
v1-v2:
  - Fix some workqueue flags.
v2-v3:
  - Add the thresholding mechanism to simulate the old behavior
  - Convert all the btrfs_workers to btrfs_workrqueue_struct.
  - Fix some potential deadlock when executed in IRQ handler.
v3-v4:
  - Change the ordered workqueue implement to fix the performance drop in 32K
multi thread random write.
  - Change the high priority workqueue implement to get an independent high
workqueue without starving problem.
  - Simplify the btrfs_alloc_workqueue parameters.
  - Coding style cleanup.
  - Remove the redundant _struct suffix.

Qu Wenruo (18):
  btrfs: Cleanup the unused struct async_sched.
  btrfs: Added btrfs_workqueue_struct implemented ordered execution
based on kernel workqueue
  btrfs: Add high priority workqueue support for btrfs_workqueue_struct
  btrfs: Add threshold workqueue based on kernel workqueue
  btrfs: Replace fs_info-workers with btrfs_workqueue.
  btrfs: Replace fs_info-delalloc_workers with btrfs_workqueue
  btrfs: Replace fs_info-submit_workers with btrfs_workqueue.
  btrfs: Replace fs_info-flush_workers with btrfs_workqueue.
  btrfs: Replace fs_info-endio_* workqueue with btrfs_workqueue.
  btrfs: Replace fs_info-rmw_workers workqueue with btrfs_workqueue.
  btrfs: Replace fs_info-cache_workers workqueue with btrfs_workqueue.
  btrfs: Replace fs_info-readahead_workers workqueue with
btrfs_workqueue.
  btrfs: Replace fs_info-fixup_workers workqueue with btrfs_workqueue.
  btrfs: Replace fs_info-delayed_workers workqueue with
btrfs_workqueue.
  btrfs: Replace fs_info-qgroup_rescan_worker workqueue with
btrfs_workqueue.
  btrfs: Replace fs_info-scrub_* workqueue with btrfs_workqueue.
  btrfs: Cleanup the old btrfs_worker.
  btrfs: Cleanup the _struct suffix in btrfs_workequeue

 fs/btrfs/async-thread.c  | 821 ---
 fs/btrfs/async-thread.h  | 117 ++-
 fs/btrfs/ctree.h |  39 ++-
 fs/btrfs/delayed-inode.c |   6 +-
 fs/btrfs/disk-io.c   | 212 +---
 fs/btrfs/extent-tree.c   |   4 +-
 fs/btrfs/inode.c |  38 +--
 fs/btrfs/ordered-data.c  |  11 +-
 fs/btrfs/qgroup.c|  15 +-
 fs/btrfs/raid56.c|  21 +-
 fs/btrfs/reada.c |   4 +-
 fs/btrfs/scrub.c |  70 ++--
 fs/btrfs/super.c |  36 +--
 fs/btrfs/volumes.c   |  16 +-
 14 files changed, 430 insertions(+), 980 deletions(-)

-- 
1.8.5.1

--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html