linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: jeffm@suse.com
To: btrfs list <linux-btrfs@vger.kernel.org>
Cc: Chris Mason <chris.mason@oracle.com>
Subject: [patch v3 14/23] btrfs: async-thread.c: Make functions with no error conditions return void
Date: Thu, 08 Sep 2011 20:22:54 -0400	[thread overview]
Message-ID: <20110909002732.404871770@suse.com> (raw)
In-Reply-To: 20110909002240.141223014@suse.com

 run_ordered_completions, btrfs_stop_workers, btrfs_requeue_work, and
 btrfs_queue_worker don't have any error conditions and should return
 void.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
 fs/btrfs/async-thread.c |   31 ++++++++++---------------------
 fs/btrfs/async-thread.h |    7 ++++---
 2 files changed, 14 insertions(+), 24 deletions(-)

--- a/fs/btrfs/async-thread.c
+++ b/fs/btrfs/async-thread.c
@@ -95,7 +95,6 @@ static void start_new_worker_func(struct
 static int start_new_worker(struct btrfs_workers *queue)
 {
 	struct worker_start *start;
-	int ret;
 
 	start = kzalloc(sizeof(*start), GFP_NOFS);
 	if (!start)
@@ -103,10 +102,8 @@ static int start_new_worker(struct btrfs
 
 	start->work.func = start_new_worker_func;
 	start->queue = queue;
-	ret = btrfs_queue_worker(queue->atomic_worker_start, &start->work);
-	if (ret)
-		kfree(start);
-	return ret;
+	btrfs_queue_worker(queue->atomic_worker_start, &start->work);
+	return 0;
 }
 
 /*
@@ -177,11 +174,11 @@ out:
 	spin_unlock_irqrestore(&workers->lock, flags);
 }
 
-static noinline int run_ordered_completions(struct btrfs_workers *workers,
-					    struct btrfs_work *work)
+static noinline void run_ordered_completions(struct btrfs_workers *workers,
+					     struct btrfs_work *work)
 {
 	if (!workers->ordered)
-		return 0;
+		return;
 
 	set_bit(WORK_DONE_BIT, &work->flags);
 
@@ -219,7 +216,6 @@ static noinline int run_ordered_completi
 	}
 
 	spin_unlock(&workers->order_lock);
-	return 0;
 }
 
 static void put_worker(struct btrfs_worker_thread *worker)
@@ -405,7 +401,7 @@ again:
 /*
  * this will wait for all the worker threads to shutdown
  */
-int btrfs_stop_workers(struct btrfs_workers *workers)
+void btrfs_stop_workers(struct btrfs_workers *workers)
 {
 	struct list_head *cur;
 	struct btrfs_worker_thread *worker;
@@ -433,7 +429,6 @@ int btrfs_stop_workers(struct btrfs_work
 		put_worker(worker);
 	}
 	spin_unlock_irq(&workers->lock);
-	return 0;
 }
 
 /*
@@ -618,14 +613,14 @@ found:
  * it was taken from.  It is intended for use with long running work functions
  * that make some progress and want to give the cpu up for others.
  */
-int btrfs_requeue_work(struct btrfs_work *work)
+void 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;
+		return;
 
 	spin_lock_irqsave(&worker->lock, flags);
 	if (test_bit(WORK_HIGH_PRIO_BIT, &work->flags))
@@ -652,9 +647,6 @@ int btrfs_requeue_work(struct btrfs_work
 	if (wake)
 		wake_up_process(worker->task);
 	spin_unlock_irqrestore(&worker->lock, flags);
-out:
-
-	return 0;
 }
 
 void btrfs_set_work_high_prio(struct btrfs_work *work)
@@ -665,7 +657,7 @@ void btrfs_set_work_high_prio(struct btr
 /*
  * places a struct btrfs_work into the pending queue of one of the kthreads
  */
-int btrfs_queue_worker(struct btrfs_workers *workers, struct btrfs_work *work)
+void btrfs_queue_worker(struct btrfs_workers *workers, struct btrfs_work *work)
 {
 	struct btrfs_worker_thread *worker;
 	unsigned long flags;
@@ -673,7 +665,7 @@ int btrfs_queue_worker(struct btrfs_work
 
 	/* don't requeue something already on a list */
 	if (test_and_set_bit(WORK_QUEUED_BIT, &work->flags))
-		goto out;
+		return;
 
 	worker = find_worker(workers);
 	if (workers->ordered) {
@@ -712,7 +704,4 @@ int btrfs_queue_worker(struct btrfs_work
 	if (wake)
 		wake_up_process(worker->task);
 	spin_unlock_irqrestore(&worker->lock, flags);
-
-out:
-	return 0;
 }
--- a/fs/btrfs/async-thread.h
+++ b/fs/btrfs/async-thread.h
@@ -109,11 +109,12 @@ struct btrfs_workers {
 	char *name;
 };
 
-int btrfs_queue_worker(struct btrfs_workers *workers, struct btrfs_work *work);
+void btrfs_queue_worker(struct btrfs_workers *workers,
+			struct btrfs_work *work);
 int btrfs_start_workers(struct btrfs_workers *workers, int num_workers);
-int btrfs_stop_workers(struct btrfs_workers *workers);
+void btrfs_stop_workers(struct btrfs_workers *workers);
 void btrfs_init_workers(struct btrfs_workers *workers, char *name, int max,
 			struct btrfs_workers *async_starter);
-int btrfs_requeue_work(struct btrfs_work *work);
+void btrfs_requeue_work(struct btrfs_work *work);
 void btrfs_set_work_high_prio(struct btrfs_work *work);
 #endif



  parent reply	other threads:[~2011-09-09  0:22 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-09  0:22 [patch v3 00/23] More error handling fixes jeffm
2011-09-09  0:22 ` [patch v3 01/23] btrfs: Add btrfs_panic() jeffm
2011-09-09  0:22 ` [patch v3 02/23] btrfs: Catch locking failures in {set,clear}_extent_bit jeffm
2011-09-09  0:22 ` [patch v3 03/23] btrfs: Push up set_extent_bit errors to callers jeffm
2011-09-09  0:22 ` [patch v3 04/23] btrfs: Push up lock_extent " jeffm
2011-09-09  0:22 ` [patch v3 05/23] btrfs: Push up clear_extent_bit " jeffm
2011-09-09  0:22 ` [patch v3 06/23] btrfs: Push up unlock_extent " jeffm
2011-09-09  0:22 ` [patch v3 07/23] btrfs: Make pin_down_extent return void jeffm
2011-09-09  0:22 ` [patch v3 08/23] btrfs: Push up btrfs_pin_extent failures jeffm
2011-09-09  0:22 ` [patch v3 09/23] btrfs: btrfs_drop_snapshot should return int jeffm
2011-09-09  0:22 ` [patch v3 10/23] btrfs: Push up non-looped btrfs_start_transaction failures jeffm
2011-09-09  0:22 ` [patch v3 11/23] btrfs: Make set_range_writeback return void jeffm
2011-09-09  0:22 ` [patch v3 12/23] btrfs: extent_io.c: Make functions with no error conditions " jeffm
2011-09-09  0:22 ` [patch v3 13/23] btrfs: volumes.c: " jeffm
2011-09-09  0:22 ` jeffm [this message]
2011-09-09  0:22 ` [patch v3 15/23] btrfs: tree-log.c: " jeffm
2011-09-09  0:22 ` [patch v3 16/23] btrfs: Make btrfs_init_compress " jeffm
2011-09-09  0:22 ` [patch v3 17/23] btrfs: Make btrfs_invalidate_inodes " jeffm
2011-09-09  0:22 ` [patch v3 18/23] btrfs: disk-io.c: Make functions with no error conditions " jeffm
2011-09-09  0:22 ` [patch v3 19/23] btrfs: extent-tree.c: " jeffm
2011-09-09  0:23 ` [patch v3 20/23] btrfs: file.c: " jeffm
2011-09-09  0:23 ` [patch v3 21/23] btrfs: simplify btrfs_submit_bio_hook jeffm
2011-09-09  0:23 ` [patch v3 22/23] btrfs: Factor out tree->ops->merge_bio_hook call jeffm
2011-09-09  0:23 ` [patch v3 23/23] btrfs: Push up ->submit_bio_hook failures jeffm
2011-09-09  0:35 ` [patch v3 00/23] More error handling fixes Jeff Mahoney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110909002732.404871770@suse.com \
    --to=jeffm@suse.com \
    --cc=chris.mason@oracle.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).