From: Wang Shilong Date: Wed, 4 Dec 2013 13:16:53 +0000 (+0800) Subject: Btrfs: wrap repeated code into scrub_blocked_if_needed() X-Git-Tag: v3.14-rc1~29^2~97 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cb7ab02156e4;p=pandora-kernel.git 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 Suggested-by: Miao Xie Signed-off-by: Josef Bacik Signed-off-by: Chris Mason --- Reading git-diff-tree failed