From patchwork Thu May 20 07:16:17 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miao Xie X-Patchwork-Id: 101144 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o4K7QAZ7005532 for ; Thu, 20 May 2010 07:26:10 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754143Ab0ETH0I (ORCPT ); Thu, 20 May 2010 03:26:08 -0400 Received: from cn.fujitsu.com ([222.73.24.84]:52130 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1751835Ab0ETH0E (ORCPT ); Thu, 20 May 2010 03:26:04 -0400 Received: from tang.cn.fujitsu.com (tang.cn.fujitsu.com [10.167.250.3]) by song.cn.fujitsu.com (Postfix) with ESMTP id B16AD17012D; Thu, 20 May 2010 15:26:01 +0800 (CST) Received: from fnst.cn.fujitsu.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id o4K7NwrG016209; Thu, 20 May 2010 15:23:59 +0800 Received: from [127.0.0.1] (unknown [10.167.141.211]) by fnst.cn.fujitsu.com (Postfix) with ESMTPA id C044910C00A; Thu, 20 May 2010 15:29:36 +0800 (CST) Message-ID: <4BF4E1C1.5070900@cn.fujitsu.com> Date: Thu, 20 May 2010 15:16:17 +0800 From: Miao Xie Reply-To: miaox@cn.fujitsu.com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.1.9) Gecko/20100317 Thunderbird/3.0.4 MIME-Version: 1.0 To: Chris Mason CC: Linux Btrfs Subject: [PATCH 03/10] btrfs: Remove variable wake for cleanup Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Thu, 20 May 2010 07:26:10 +0000 (UTC) diff --git a/fs/btrfs/async-thread.c b/fs/btrfs/async-thread.c index c0861e7..fec412e 100644 --- a/fs/btrfs/async-thread.c +++ b/fs/btrfs/async-thread.c @@ -620,7 +620,6 @@ int btrfs_requeue_work(struct btrfs_work *work) { struct btrfs_worker_thread *worker = work->worker; unsigned long flags; - int wake = 0; if (test_and_set_bit(WORK_QUEUED_BIT, &work->flags)) goto out; @@ -643,12 +642,10 @@ int btrfs_requeue_work(struct btrfs_work *work) spin_unlock(&worker->workers->lock); } if (!worker->working) { - wake = 1; worker->working = 1; + wake_up_process(worker->task); } - if (wake) - wake_up_process(worker->task); spin_unlock_irqrestore(&worker->lock, flags); out: @@ -667,7 +664,6 @@ int btrfs_queue_worker(struct btrfs_workers *workers, struct btrfs_work *work) { struct btrfs_worker_thread *worker; unsigned long flags; - int wake = 0; /* don't requeue something already on a list */ if (test_and_set_bit(WORK_QUEUED_BIT, &work->flags)) @@ -703,12 +699,11 @@ int btrfs_queue_worker(struct btrfs_workers *workers, struct btrfs_work *work) * avoid calling into wake_up_process if this thread has already * been kicked */ - if (!worker->working) - wake = 1; - worker->working = 1; - - if (wake) + if (!worker->working) { + worker->working = 1; wake_up_process(worker->task); + } + spin_unlock_irqrestore(&worker->lock, flags); out: