All of lore.kernel.org
 help / color / mirror / Atom feed
From: Artem Bityutskiy <dedekind1@gmail.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: Christoph Hellwig <hch@infradead.org>, linux-fsdevel@vger.kernel.org
Subject: [PATCH 3/4] writeback: harmonize writeback threads and tasks - 2
Date: Mon, 12 Jul 2010 10:49:53 +0300	[thread overview]
Message-ID: <1278920994-2402-4-git-send-email-dedekind1@gmail.com> (raw)
In-Reply-To: <1278920994-2402-1-git-send-email-dedekind1@gmail.com>

From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>

The write-back code mixes words "thread" and "task" for the
same things - this is not a problem, but this is still an
inconsistency which makes it a bit difficult to read the code.
It is better to use term "thread" consistently everywhere.

This patch renames the 'task' field in 'struct bdi_writeback'
into 'thread' for consistency reasons.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
---
 fs/fs-writeback.c           |   14 +++++++-------
 include/linux/backing-dev.h |    2 +-
 mm/backing-dev.c            |   20 ++++++++++----------
 3 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index bf10cbf..1df249a 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -84,14 +84,14 @@ static void bdi_queue_work(struct backing_dev_info *bdi,
 	 * If the default thread isn't there, make sure we add it. When
 	 * it gets created and wakes up, we'll run this work.
 	 */
-	if (unlikely(!bdi->wb.task)) {
+	if (unlikely(!bdi->wb.thread)) {
 		trace_writeback_nothread(bdi, work);
-		wake_up_process(default_backing_dev_info.wb.task);
+		wake_up_process(default_backing_dev_info.wb.thread);
 	} else {
 		struct bdi_writeback *wb = &bdi->wb;
 
-		if (wb->task)
-			wake_up_process(wb->task);
+		if (wb->thread)
+			wake_up_process(wb->thread);
 	}
 }
 
@@ -107,9 +107,9 @@ __bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages,
 	 */
 	work = kzalloc(sizeof(*work), GFP_ATOMIC);
 	if (!work) {
-		if (bdi->wb.task) {
+		if (bdi->wb.thread) {
 			trace_writeback_nowork(bdi);
-			wake_up_process(bdi->wb.task);
+			wake_up_process(bdi->wb.thread);
 		}
 		return;
 	}
@@ -862,7 +862,7 @@ int bdi_writeback_thread(void *data)
 		try_to_freeze();
 	}
 
-	wb->task = NULL;
+	wb->thread = NULL;
 
 	/*
 	 * Flush any work that raced with us exiting. No new work
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index e536f3a..14648b9 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -50,7 +50,7 @@ struct bdi_writeback {
 
 	unsigned long last_old_flush;		/* last old data flush */
 
-	struct task_struct	*task;		/* writeback task */
+	struct task_struct	*thread;	/* writeback thread */
 	struct list_head	b_dirty;	/* dirty inodes */
 	struct list_head	b_io;		/* parked for writeback */
 	struct list_head	b_more_io;	/* parked for more writeback */
diff --git a/mm/backing-dev.c b/mm/backing-dev.c
index 431486e..bd36dc4 100644
--- a/mm/backing-dev.c
+++ b/mm/backing-dev.c
@@ -348,7 +348,7 @@ static int bdi_forker_thread(void *ptr)
 		 * a thread registered. If so, set that up.
 		 */
 		list_for_each_entry_safe(bdi, tmp, &bdi_list, bdi_list) {
-			if (bdi->wb.task)
+			if (bdi->wb.thread)
 				continue;
 			if (list_empty(&bdi->work_list) &&
 			    !bdi_has_dirty_io(bdi))
@@ -384,7 +384,7 @@ static int bdi_forker_thread(void *ptr)
 		spin_unlock_bh(&bdi_lock);
 
 		wb = &bdi->wb;
-		wb->task = kthread_run(bdi_writeback_thread, wb, "flush-%s",
+		wb->thread = kthread_run(bdi_writeback_thread, wb, "flush-%s",
 					dev_name(bdi->dev));
 		/*
 		 * If task creation fails, then readd the bdi to
@@ -392,8 +392,8 @@ static int bdi_forker_thread(void *ptr)
 		 * from this forker thread. That will free some memory
 		 * and we can try again.
 		 */
-		if (IS_ERR(wb->task)) {
-			wb->task = NULL;
+		if (IS_ERR(wb->thread)) {
+			wb->thread = NULL;
 
 			/*
 			 * Add this 'bdi' to the back, so we get
@@ -500,10 +500,10 @@ int bdi_register(struct backing_dev_info *bdi, struct device *parent,
 	if (bdi_cap_flush_forker(bdi)) {
 		struct bdi_writeback *wb = &bdi->wb;
 
-		wb->task = kthread_run(bdi_forker_thread, wb, "bdi-%s",
+		wb->thread = kthread_run(bdi_forker_thread, wb, "bdi-%s",
 						dev_name(dev));
-		if (IS_ERR(wb->task)) {
-			wb->task = NULL;
+		if (IS_ERR(wb->thread)) {
+			wb->thread = NULL;
 			ret = -ENOMEM;
 
 			bdi_remove_from_list(bdi);
@@ -550,9 +550,9 @@ static void bdi_wb_shutdown(struct backing_dev_info *bdi)
 	 * unfreeze of the thread before calling kthread_stop(), otherwise
 	 * it would never exet if it is currently stuck in the refrigerator.
 	 */
-	if (bdi->wb.task) {
-		thaw_process(bdi->wb.task);
-		kthread_stop(bdi->wb.task);
+	if (bdi->wb.thread) {
+		thaw_process(bdi->wb.thread);
+		kthread_stop(bdi->wb.thread);
 	}
 }
 
-- 
1.7.1.1


  parent reply	other threads:[~2010-07-12  7:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-12  7:49 [PATCH 0/4] writeback: minor cleanups Artem Bityutskiy
2010-07-12  7:49 ` [PATCH 1/4] writeback: weed out unneeded code Artem Bityutskiy
2010-07-12  7:49 ` [PATCH 2/4] writeback: harmonize writeback threads and tasks - 1 Artem Bityutskiy
2010-07-12  7:49 ` Artem Bityutskiy [this message]
2010-07-12  7:49 ` [PATCH 4/4] writeback: harmonize writeback threads and tasks - 3 Artem Bityutskiy
2010-07-12 15:33   ` Christoph Hellwig
2010-07-13 14:30     ` Artem Bityutskiy
2010-07-12 15:11 ` [PATCH 0/3] writeback: more clean-ups and fixes Artem Bityutskiy

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=1278920994-2402-4-git-send-email-dedekind1@gmail.com \
    --to=dedekind1@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=hch@infradead.org \
    --cc=linux-fsdevel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.