Skip to content

Commit 6f904ff

Browse files
Artem BityutskiyJens Axboe
authored andcommitted
writeback: harmonize writeback threads naming
The write-back code mixes words "thread" and "task" for the same things. This is not a big deal, but still an inconsistency. hch: a convention I tend to use and I've seen in various places is to always use _task for the storage of the task_struct pointer, and thread everywhere else. This especially helps with having foo_thread for the actual thread and foo_task for a global variable keeping the task_struct pointer This patch renames: * 'bdi_add_default_flusher_task()' -> 'bdi_add_default_flusher_thread()' * 'bdi_forker_task()' -> 'bdi_forker_thread()' because bdi threads are 'bdi_writeback_thread()', so these names are more consistent. This patch also amends commentaries and makes them refer the forker and bdi threads as "thread", not "task". Also, while on it, make 'bdi_add_default_flusher_thread()' declaration use 'static void' instead of 'void static' and make checkpatch.pl happy. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
1 parent 4aeefdc commit 6f904ff

3 files changed

Lines changed: 15 additions & 15 deletions

File tree

‎fs/fs-writeback.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -840,7 +840,7 @@ int bdi_writeback_thread(void *data)
840840

841841
/*
842842
* Longest period of inactivity that we tolerate. If we
843-
* see dirty data again later, the task will get
843+
* see dirty data again later, the thread will get
844844
* recreated automatically.
845845
*/
846846
max_idle = max(5UL * 60 * HZ, wait_jiffies);

‎include/linux/backing-dev.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ struct bdi_writeback {
5050

5151
unsigned long last_old_flush; /* last old data flush */
5252

53-
struct task_struct *task; /* writeback task */
53+
struct task_struct *task; /* writeback thread */
5454
struct list_head b_dirty; /* dirty inodes */
5555
struct list_head b_io; /* parked for writeback */
5656
struct list_head b_more_io; /* parked for more writeback */

‎mm/backing-dev.c‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ static struct timer_list sync_supers_timer;
5050
static int bdi_sync_supers(void *);
5151
static void sync_supers_timer_fn(unsigned long);
5252

53-
static void bdi_add_default_flusher_task(struct backing_dev_info *bdi);
53+
static void bdi_add_default_flusher_thread(struct backing_dev_info *bdi);
5454

5555
#ifdef CONFIG_DEBUG_FS
5656
#include <linux/debugfs.h>
@@ -279,10 +279,10 @@ static void bdi_flush_io(struct backing_dev_info *bdi)
279279
}
280280

281281
/*
282-
* kupdated() used to do this. We cannot do it from the bdi_forker_task()
282+
* kupdated() used to do this. We cannot do it from the bdi_forker_thread()
283283
* or we risk deadlocking on ->s_umount. The longer term solution would be
284284
* to implement sync_supers_bdi() or similar and simply do it from the
285-
* bdi writeback tasks individually.
285+
* bdi writeback thread individually.
286286
*/
287287
static int bdi_sync_supers(void *unused)
288288
{
@@ -318,7 +318,7 @@ static void sync_supers_timer_fn(unsigned long unused)
318318
bdi_arm_supers_timer();
319319
}
320320

321-
static int bdi_forker_task(void *ptr)
321+
static int bdi_forker_thread(void *ptr)
322322
{
323323
struct bdi_writeback *me = ptr;
324324

@@ -354,7 +354,7 @@ static int bdi_forker_task(void *ptr)
354354
!bdi_has_dirty_io(bdi))
355355
continue;
356356

357-
bdi_add_default_flusher_task(bdi);
357+
bdi_add_default_flusher_thread(bdi);
358358
}
359359

360360
set_current_state(TASK_INTERRUPTIBLE);
@@ -376,7 +376,7 @@ static int bdi_forker_task(void *ptr)
376376

377377
/*
378378
* This is our real job - check for pending entries in
379-
* bdi_pending_list, and create the tasks that got added
379+
* bdi_pending_list, and create the threads that got added
380380
*/
381381
bdi = list_entry(bdi_pending_list.next, struct backing_dev_info,
382382
bdi_list);
@@ -387,7 +387,7 @@ static int bdi_forker_task(void *ptr)
387387
wb->task = kthread_run(bdi_writeback_thread, wb, "flush-%s",
388388
dev_name(bdi->dev));
389389
/*
390-
* If task creation fails, then readd the bdi to
390+
* If thread creation fails, then readd the bdi to
391391
* the pending list and force writeout of the bdi
392392
* from this forker thread. That will free some memory
393393
* and we can try again.
@@ -430,10 +430,10 @@ static void bdi_add_to_pending(struct rcu_head *head)
430430
}
431431

432432
/*
433-
* Add the default flusher task that gets created for any bdi
433+
* Add the default flusher thread that gets created for any bdi
434434
* that has dirty data pending writeout
435435
*/
436-
void static bdi_add_default_flusher_task(struct backing_dev_info *bdi)
436+
static void bdi_add_default_flusher_thread(struct backing_dev_info *bdi)
437437
{
438438
if (!bdi_cap_writeback_dirty(bdi))
439439
return;
@@ -445,10 +445,10 @@ void static bdi_add_default_flusher_task(struct backing_dev_info *bdi)
445445
}
446446

447447
/*
448-
* Check with the helper whether to proceed adding a task. Will only
448+
* Check with the helper whether to proceed adding a thread. Will only
449449
* abort if we two or more simultanous calls to
450-
* bdi_add_default_flusher_task() occured, further additions will block
451-
* waiting for previous additions to finish.
450+
* bdi_add_default_flusher_thread() occured, further additions will
451+
* block waiting for previous additions to finish.
452452
*/
453453
if (!test_and_set_bit(BDI_pending, &bdi->state)) {
454454
list_del_rcu(&bdi->bdi_list);
@@ -506,7 +506,7 @@ int bdi_register(struct backing_dev_info *bdi, struct device *parent,
506506
if (bdi_cap_flush_forker(bdi)) {
507507
struct bdi_writeback *wb = &bdi->wb;
508508

509-
wb->task = kthread_run(bdi_forker_task, wb, "bdi-%s",
509+
wb->task = kthread_run(bdi_forker_thread, wb, "bdi-%s",
510510
dev_name(dev));
511511
if (IS_ERR(wb->task)) {
512512
wb->task = NULL;

0 commit comments

Comments
 (0)