提交 0e22be89 编写于 作者: Z Zhaolei 提交者: Chris Mason

btrfs: Separate scrub_blocked_if_needed() to scrub_pause_on/off()

It can reduce current duplicated code which is similar to
scrub_blocked_if_needed() but can not call it because little
different.
It also used by my next patch which is in same case.
Signed-off-by: NZhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: NChris Mason <clm@fb.com>
上级 868f401a
...@@ -332,11 +332,14 @@ static void __scrub_blocked_if_needed(struct btrfs_fs_info *fs_info) ...@@ -332,11 +332,14 @@ static void __scrub_blocked_if_needed(struct btrfs_fs_info *fs_info)
} }
} }
static void scrub_blocked_if_needed(struct btrfs_fs_info *fs_info) static void scrub_pause_on(struct btrfs_fs_info *fs_info)
{ {
atomic_inc(&fs_info->scrubs_paused); atomic_inc(&fs_info->scrubs_paused);
wake_up(&fs_info->scrub_pause_wait); wake_up(&fs_info->scrub_pause_wait);
}
static void scrub_pause_off(struct btrfs_fs_info *fs_info)
{
mutex_lock(&fs_info->scrub_lock); mutex_lock(&fs_info->scrub_lock);
__scrub_blocked_if_needed(fs_info); __scrub_blocked_if_needed(fs_info);
atomic_dec(&fs_info->scrubs_paused); atomic_dec(&fs_info->scrubs_paused);
...@@ -345,6 +348,12 @@ static void scrub_blocked_if_needed(struct btrfs_fs_info *fs_info) ...@@ -345,6 +348,12 @@ static void scrub_blocked_if_needed(struct btrfs_fs_info *fs_info)
wake_up(&fs_info->scrub_pause_wait); wake_up(&fs_info->scrub_pause_wait);
} }
static void scrub_blocked_if_needed(struct btrfs_fs_info *fs_info)
{
scrub_pause_on(fs_info);
scrub_pause_off(fs_info);
}
/* /*
* used for workers that require transaction commits (i.e., for the * used for workers that require transaction commits (i.e., for the
* NOCOW case) * NOCOW case)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册