Skip to content

Commit ad4e38d

Browse files
Curt WohlgemuthWu Fengguang
authored andcommitted
writeback: send work item to queue_io, move_expired_inodes
Instead of sending ->older_than_this to queue_io() and move_expired_inodes(), send the entire wb_writeback_work structure. There are other fields of a work item that are useful in these routines and in tracepoints. Acked-by: Jan Kara <[email protected]> Signed-off-by: Curt Wohlgemuth <[email protected]> Signed-off-by: Wu Fengguang <[email protected]>
1 parent ece13ac commit ad4e38d

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

fs/fs-writeback.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ static bool inode_dirtied_after(struct inode *inode, unsigned long t)
251251
*/
252252
static int move_expired_inodes(struct list_head *delaying_queue,
253253
struct list_head *dispatch_queue,
254-
unsigned long *older_than_this)
254+
struct wb_writeback_work *work)
255255
{
256256
LIST_HEAD(tmp);
257257
struct list_head *pos, *node;
@@ -262,8 +262,8 @@ static int move_expired_inodes(struct list_head *delaying_queue,
262262

263263
while (!list_empty(delaying_queue)) {
264264
inode = wb_inode(delaying_queue->prev);
265-
if (older_than_this &&
266-
inode_dirtied_after(inode, *older_than_this))
265+
if (work->older_than_this &&
266+
inode_dirtied_after(inode, *work->older_than_this))
267267
break;
268268
if (sb && sb != inode->i_sb)
269269
do_sb_sort = 1;
@@ -302,13 +302,13 @@ static int move_expired_inodes(struct list_head *delaying_queue,
302302
* |
303303
* +--> dequeue for IO
304304
*/
305-
static void queue_io(struct bdi_writeback *wb, unsigned long *older_than_this)
305+
static void queue_io(struct bdi_writeback *wb, struct wb_writeback_work *work)
306306
{
307307
int moved;
308308
assert_spin_locked(&wb->list_lock);
309309
list_splice_init(&wb->b_more_io, &wb->b_io);
310-
moved = move_expired_inodes(&wb->b_dirty, &wb->b_io, older_than_this);
311-
trace_writeback_queue_io(wb, older_than_this, moved);
310+
moved = move_expired_inodes(&wb->b_dirty, &wb->b_io, work);
311+
trace_writeback_queue_io(wb, work, moved);
312312
}
313313

314314
static int write_inode(struct inode *inode, struct writeback_control *wbc)
@@ -651,7 +651,7 @@ long writeback_inodes_wb(struct bdi_writeback *wb, long nr_pages)
651651

652652
spin_lock(&wb->list_lock);
653653
if (list_empty(&wb->b_io))
654-
queue_io(wb, NULL);
654+
queue_io(wb, &work);
655655
__writeback_inodes_wb(wb, &work);
656656
spin_unlock(&wb->list_lock);
657657

@@ -745,7 +745,7 @@ static long wb_writeback(struct bdi_writeback *wb,
745745

746746
trace_writeback_start(wb->bdi, work);
747747
if (list_empty(&wb->b_io))
748-
queue_io(wb, work->older_than_this);
748+
queue_io(wb, work);
749749
if (work->sb)
750750
progress = writeback_sb_inodes(work->sb, wb, work);
751751
else

include/trace/events/writeback.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,16 +157,17 @@ DEFINE_WBC_EVENT(wbc_writepage);
157157

158158
TRACE_EVENT(writeback_queue_io,
159159
TP_PROTO(struct bdi_writeback *wb,
160-
unsigned long *older_than_this,
160+
struct wb_writeback_work *work,
161161
int moved),
162-
TP_ARGS(wb, older_than_this, moved),
162+
TP_ARGS(wb, work, moved),
163163
TP_STRUCT__entry(
164164
__array(char, name, 32)
165165
__field(unsigned long, older)
166166
__field(long, age)
167167
__field(int, moved)
168168
),
169169
TP_fast_assign(
170+
unsigned long *older_than_this = work->older_than_this;
170171
strncpy(__entry->name, dev_name(wb->bdi->dev), 32);
171172
__entry->older = older_than_this ? *older_than_this : 0;
172173
__entry->age = older_than_this ?

0 commit comments

Comments
 (0)