From patchwork Fri Jun 5 15:01:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Mladek X-Patchwork-Id: 481373 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id D5CEA1401DA for ; Sat, 6 Jun 2015 01:07:40 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Z0tB6-0003O9-40; Fri, 05 Jun 2015 15:05:00 +0000 Received: from merlin.infradead.org ([205.233.59.134]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Z0tAs-0003Hh-Mg for linux-mtd@bombadil.infradead.org; Fri, 05 Jun 2015 15:04:46 +0000 Received: from cantor2.suse.de ([195.135.220.15] helo=mx2.suse.de) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Z0t8n-0006CZ-4s for linux-mtd@lists.infradead.org; Fri, 05 Jun 2015 15:02:38 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 0D23AADDB; Fri, 5 Jun 2015 15:02:01 +0000 (UTC) From: Petr Mladek To: Andrew Morton , Oleg Nesterov , Tejun Heo , Ingo Molnar , Peter Zijlstra Subject: [RFC PATCH 10/18] jffs2: Remove forward definition of jffs2_garbage_collect_thread() Date: Fri, 5 Jun 2015 17:01:09 +0200 Message-Id: <1433516477-5153-11-git-send-email-pmladek@suse.cz> X-Mailer: git-send-email 1.8.5.6 In-Reply-To: <1433516477-5153-1-git-send-email-pmladek@suse.cz> References: <1433516477-5153-1-git-send-email-pmladek@suse.cz> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150605_110237_395116_5E95F7D0 X-CRM114-Status: GOOD ( 17.07 ) X-Spam-Score: -6.9 (------) X-Spam-Report: SpamAssassin version 3.4.0 on merlin.infradead.org summary: Content analysis details: (-6.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [195.135.220.15 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: linux-nfs@vger.kernel.org, Borislav Petkov , Jiri Kosina , Richard Weinberger , Trond Myklebust , linux-kernel@vger.kernel.org, Steven Rostedt , Michal Hocko , Chris Mason , Petr Mladek , linux-mtd@lists.infradead.org, linux-api@vger.kernel.org, Linus Torvalds , live-patching@vger.kernel.org, Thomas Gleixner , "Paul E. McKenney" , David Woodhouse , Anna Schumaker X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org This commit just moves the function definition and fixes few coding style problems reported by checkpatch.pl. There are no changes in the functionality. The change will be useful when switching to the new iterant kthread API. Signed-off-by: Petr Mladek --- fs/jffs2/background.c | 101 +++++++++++++++++++++++++------------------------- 1 file changed, 50 insertions(+), 51 deletions(-) diff --git a/fs/jffs2/background.c b/fs/jffs2/background.c index bb9cebc9ca8a..6af076b8f60f 100644 --- a/fs/jffs2/background.c +++ b/fs/jffs2/background.c @@ -21,57 +21,6 @@ #include #include "nodelist.h" - -static int jffs2_garbage_collect_thread(void *); - -void jffs2_garbage_collect_trigger(struct jffs2_sb_info *c) -{ - assert_spin_locked(&c->erase_completion_lock); - if (c->gc_task && jffs2_thread_should_wake(c)) - send_sig(SIGHUP, c->gc_task, 1); -} - -/* This must only ever be called when no GC thread is currently running */ -int jffs2_start_garbage_collect_thread(struct jffs2_sb_info *c) -{ - struct task_struct *tsk; - int ret = 0; - - BUG_ON(c->gc_task); - - init_completion(&c->gc_thread_start); - init_completion(&c->gc_thread_exit); - - tsk = kthread_run(jffs2_garbage_collect_thread, c, "jffs2_gcd_mtd%d", c->mtd->index); - if (IS_ERR(tsk)) { - pr_warn("fork failed for JFFS2 garbage collect thread: %ld\n", - -PTR_ERR(tsk)); - complete(&c->gc_thread_exit); - ret = PTR_ERR(tsk); - } else { - /* Wait for it... */ - jffs2_dbg(1, "Garbage collect thread is pid %d\n", tsk->pid); - wait_for_completion(&c->gc_thread_start); - ret = tsk->pid; - } - - return ret; -} - -void jffs2_stop_garbage_collect_thread(struct jffs2_sb_info *c) -{ - int wait = 0; - spin_lock(&c->erase_completion_lock); - if (c->gc_task) { - jffs2_dbg(1, "Killing GC task %d\n", c->gc_task->pid); - send_sig(SIGKILL, c->gc_task, 1); - wait = 1; - } - spin_unlock(&c->erase_completion_lock); - if (wait) - wait_for_completion(&c->gc_thread_exit); -} - static int jffs2_garbage_collect_thread(void *_c) { struct jffs2_sb_info *c = _c; @@ -166,3 +115,53 @@ static int jffs2_garbage_collect_thread(void *_c) spin_unlock(&c->erase_completion_lock); complete_and_exit(&c->gc_thread_exit, 0); } + +void jffs2_garbage_collect_trigger(struct jffs2_sb_info *c) +{ + assert_spin_locked(&c->erase_completion_lock); + if (c->gc_task && jffs2_thread_should_wake(c)) + send_sig(SIGHUP, c->gc_task, 1); +} + +/* This must only ever be called when no GC thread is currently running */ +int jffs2_start_garbage_collect_thread(struct jffs2_sb_info *c) +{ + struct task_struct *tsk; + int ret = 0; + + BUG_ON(c->gc_task); + + init_completion(&c->gc_thread_start); + init_completion(&c->gc_thread_exit); + + tsk = kthread_run(jffs2_garbage_collect_thread, c, + "jffs2_gcd_mtd%d", c->mtd->index); + if (IS_ERR(tsk)) { + pr_warn("fork failed for JFFS2 garbage collect thread: %ld\n", + -PTR_ERR(tsk)); + complete(&c->gc_thread_exit); + ret = PTR_ERR(tsk); + } else { + /* Wait for it... */ + jffs2_dbg(1, "Garbage collect thread is pid %d\n", tsk->pid); + wait_for_completion(&c->gc_thread_start); + ret = tsk->pid; + } + + return ret; +} + +void jffs2_stop_garbage_collect_thread(struct jffs2_sb_info *c) +{ + int wait = 0; + + spin_lock(&c->erase_completion_lock); + if (c->gc_task) { + jffs2_dbg(1, "Killing GC task %d\n", c->gc_task->pid); + send_sig(SIGKILL, c->gc_task, 1); + wait = 1; + } + spin_unlock(&c->erase_completion_lock); + if (wait) + wait_for_completion(&c->gc_thread_exit); +}