]> git.baikalelectronics.ru Git - kernel.git/commit
Btrfs: wrap repeated code into scrub_blocked_if_needed()
authorWang Shilong <wangsl.fnst@cn.fujitsu.com>
Wed, 4 Dec 2013 13:16:53 +0000 (21:16 +0800)
committerChris Mason <clm@fb.com>
Tue, 28 Jan 2014 21:19:53 +0000 (13:19 -0800)
commit0d4bb6a876e7ad47e8b8b1610b23a92337e602fb
tree3557996fdee5e02bfd5f921aa1522fa87f54687c
parent604480f6e38d20628eed6e043713037201f9a4df
Btrfs: wrap repeated code into scrub_blocked_if_needed()

Just wrap same code into one function scrub_blocked_if_needed().

This make a change that we will move waiting (@workers_pending = 0)
before we can wake up commiting transaction(atomic_inc(@scrub_paused)),
we must take carefully to not deadlock here.

Thread 1 Thread 2
|->btrfs_commit_transaction()
|->set trans type(COMMIT_DOING)
|->btrfs_scrub_paused()(blocked)
|->join_transaction(blocked)

Move btrfs_scrub_paused() before setting trans type which means we can
still join a transaction when commiting_transaction is blocked.

Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Suggested-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Chris Mason <clm@fb.com>
fs/btrfs/scrub.c
fs/btrfs/transaction.c