From patchwork Wed Nov 29 23:23:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 10083793 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 790DD60234 for ; Wed, 29 Nov 2017 23:24:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 690C029D4B for ; Wed, 29 Nov 2017 23:24:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5AE5029D4F; Wed, 29 Nov 2017 23:24:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1191C29D48 for ; Wed, 29 Nov 2017 23:24:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752838AbdK2XYR (ORCPT ); Wed, 29 Nov 2017 18:24:17 -0500 Received: from mail.kernel.org ([198.145.29.99]:54240 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753320AbdK2XYP (ORCPT ); Wed, 29 Nov 2017 18:24:15 -0500 Received: from garbanzo.do-not-panic.com (c-73-15-241-2.hsd1.ca.comcast.net [73.15.241.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2C86A2199D; Wed, 29 Nov 2017 23:24:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2C86A2199D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=mcgrof@kernel.org From: "Luis R. Rodriguez" To: viro@zeniv.linux.org.uk, bart.vanassche@wdc.com, ming.lei@redhat.com, tytso@mit.edu, darrick.wong@oracle.com, jikos@kernel.org, rjw@rjwysocki.net, pavel@ucw.cz, len.brown@intel.com, linux-fsdevel@vger.kernel.org Cc: boris.ostrovsky@oracle.com, jgross@suse.com, todd.e.brandt@linux.intel.com, nborisov@suse.com, jack@suse.cz, martin.petersen@oracle.com, ONeukum@suse.com, oleksandr@natalenko.name, oleg.b.antonyan@gmail.com, yu.chen.surf@gmail.com, dan.j.williams@intel.com, linux-pm@vger.kernel.org, linux-block@vger.kernel.org, linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org, "Luis R. Rodriguez" Subject: [PATCH 11/11] jfs: remove not needed freezing calls Date: Wed, 29 Nov 2017 15:23:56 -0800 Message-Id: <20171129232356.28296-12-mcgrof@kernel.org> X-Mailer: git-send-email 2.13.2 In-Reply-To: <20171129232356.28296-1-mcgrof@kernel.org> References: <20171129232356.28296-1-mcgrof@kernel.org> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This removes superflous freezer calls as they are no longer needed as the VFS now performs filesystem freezing/thaw if the filesystem has support for it. The following Coccinelle rule was used as follows: spatch --sp-file fs-freeze-cleanup.cocci --in-place fs/$FS/ @ has_freeze_fs @ identifier super_ops; expression freeze_op; @@ struct super_operations super_ops = { .freeze_fs = freeze_op, }; @ remove_set_freezable depends on has_freeze_fs @ expression time; statement S, S2, S3; expression task; @@ ( - set_freezable(); | - if (try_to_freeze()) - continue; | - try_to_freeze(); | - freezable_schedule(); + schedule(); | - freezable_schedule_timeout(time); + schedule_timeout(time); | - if (freezing(task)) { S } | - if (freezing(task)) { S } - else { S2 } | - freezing(current) ) Generated-by: Coccinelle SmPL Signed-off-by: Luis R. Rodriguez --- fs/jfs/jfs_logmgr.c | 11 +++-------- fs/jfs/jfs_txnmgr.c | 31 +++++++++---------------------- 2 files changed, 12 insertions(+), 30 deletions(-) diff --git a/fs/jfs/jfs_logmgr.c b/fs/jfs/jfs_logmgr.c index 0e5d412c0b01..fa5a95d8fba8 100644 --- a/fs/jfs/jfs_logmgr.c +++ b/fs/jfs/jfs_logmgr.c @@ -2344,14 +2344,9 @@ int jfsIOWait(void *arg) spin_lock_irq(&log_redrive_lock); } - if (freezing(current)) { - spin_unlock_irq(&log_redrive_lock); - try_to_freeze(); - } else { - set_current_state(TASK_INTERRUPTIBLE); - spin_unlock_irq(&log_redrive_lock); - schedule(); - } + set_current_state(TASK_INTERRUPTIBLE); + spin_unlock_irq(&log_redrive_lock); + schedule(); } while (!kthread_should_stop()); jfs_info("jfsIOWait being killed!"); diff --git a/fs/jfs/jfs_txnmgr.c b/fs/jfs/jfs_txnmgr.c index 4d973524c887..a313300c4651 100644 --- a/fs/jfs/jfs_txnmgr.c +++ b/fs/jfs/jfs_txnmgr.c @@ -2747,6 +2747,7 @@ int jfs_lazycommit(void *arg) struct tblock *tblk; unsigned long flags; struct jfs_sb_info *sbi; + DECLARE_WAITQUEUE(wq, current); do { LAZY_LOCK(flags); @@ -2793,19 +2794,11 @@ int jfs_lazycommit(void *arg) } /* In case a wakeup came while all threads were active */ jfs_commit_thread_waking = 0; - - if (freezing(current)) { - LAZY_UNLOCK(flags); - try_to_freeze(); - } else { - DECLARE_WAITQUEUE(wq, current); - - add_wait_queue(&jfs_commit_thread_wait, &wq); - set_current_state(TASK_INTERRUPTIBLE); - LAZY_UNLOCK(flags); - schedule(); - remove_wait_queue(&jfs_commit_thread_wait, &wq); - } + add_wait_queue(&jfs_commit_thread_wait, &wq); + set_current_state(TASK_INTERRUPTIBLE); + LAZY_UNLOCK(flags); + schedule(); + remove_wait_queue(&jfs_commit_thread_wait, &wq); } while (!kthread_should_stop()); if (!list_empty(&TxAnchor.unlock_queue)) @@ -2982,15 +2975,9 @@ int jfs_sync(void *arg) } /* Add anon_list2 back to anon_list */ list_splice_init(&TxAnchor.anon_list2, &TxAnchor.anon_list); - - if (freezing(current)) { - TXN_UNLOCK(); - try_to_freeze(); - } else { - set_current_state(TASK_INTERRUPTIBLE); - TXN_UNLOCK(); - schedule(); - } + set_current_state(TASK_INTERRUPTIBLE); + TXN_UNLOCK(); + schedule(); } while (!kthread_should_stop()); jfs_info("jfs_sync being killed");