[PATCH 3/4] writeback: harmonize writeback threads and tasks - 2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Artem Bityutskiy <Artem.Bityutskiy@xxxxxxxxx>

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@xxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux