2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2025-01-18 10:34:24 +08:00

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 <jack@suse.cz>
Signed-off-by: Curt Wohlgemuth <curtw@google.com>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
This commit is contained in:
Curt Wohlgemuth 2011-10-07 21:51:56 -06:00 committed by Wu Fengguang
parent ece13ac31b
commit ad4e38dd6a
2 changed files with 11 additions and 10 deletions

View File

@ -251,7 +251,7 @@ static bool inode_dirtied_after(struct inode *inode, unsigned long t)
*/ */
static int move_expired_inodes(struct list_head *delaying_queue, static int move_expired_inodes(struct list_head *delaying_queue,
struct list_head *dispatch_queue, struct list_head *dispatch_queue,
unsigned long *older_than_this) struct wb_writeback_work *work)
{ {
LIST_HEAD(tmp); LIST_HEAD(tmp);
struct list_head *pos, *node; struct list_head *pos, *node;
@ -262,8 +262,8 @@ static int move_expired_inodes(struct list_head *delaying_queue,
while (!list_empty(delaying_queue)) { while (!list_empty(delaying_queue)) {
inode = wb_inode(delaying_queue->prev); inode = wb_inode(delaying_queue->prev);
if (older_than_this && if (work->older_than_this &&
inode_dirtied_after(inode, *older_than_this)) inode_dirtied_after(inode, *work->older_than_this))
break; break;
if (sb && sb != inode->i_sb) if (sb && sb != inode->i_sb)
do_sb_sort = 1; do_sb_sort = 1;
@ -302,13 +302,13 @@ out:
* | * |
* +--> dequeue for IO * +--> dequeue for IO
*/ */
static void queue_io(struct bdi_writeback *wb, unsigned long *older_than_this) static void queue_io(struct bdi_writeback *wb, struct wb_writeback_work *work)
{ {
int moved; int moved;
assert_spin_locked(&wb->list_lock); assert_spin_locked(&wb->list_lock);
list_splice_init(&wb->b_more_io, &wb->b_io); list_splice_init(&wb->b_more_io, &wb->b_io);
moved = move_expired_inodes(&wb->b_dirty, &wb->b_io, older_than_this); moved = move_expired_inodes(&wb->b_dirty, &wb->b_io, work);
trace_writeback_queue_io(wb, older_than_this, moved); trace_writeback_queue_io(wb, work, moved);
} }
static int write_inode(struct inode *inode, struct writeback_control *wbc) 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)
spin_lock(&wb->list_lock); spin_lock(&wb->list_lock);
if (list_empty(&wb->b_io)) if (list_empty(&wb->b_io))
queue_io(wb, NULL); queue_io(wb, &work);
__writeback_inodes_wb(wb, &work); __writeback_inodes_wb(wb, &work);
spin_unlock(&wb->list_lock); spin_unlock(&wb->list_lock);
@ -745,7 +745,7 @@ static long wb_writeback(struct bdi_writeback *wb,
trace_writeback_start(wb->bdi, work); trace_writeback_start(wb->bdi, work);
if (list_empty(&wb->b_io)) if (list_empty(&wb->b_io))
queue_io(wb, work->older_than_this); queue_io(wb, work);
if (work->sb) if (work->sb)
progress = writeback_sb_inodes(work->sb, wb, work); progress = writeback_sb_inodes(work->sb, wb, work);
else else

View File

@ -157,9 +157,9 @@ DEFINE_WBC_EVENT(wbc_writepage);
TRACE_EVENT(writeback_queue_io, TRACE_EVENT(writeback_queue_io,
TP_PROTO(struct bdi_writeback *wb, TP_PROTO(struct bdi_writeback *wb,
unsigned long *older_than_this, struct wb_writeback_work *work,
int moved), int moved),
TP_ARGS(wb, older_than_this, moved), TP_ARGS(wb, work, moved),
TP_STRUCT__entry( TP_STRUCT__entry(
__array(char, name, 32) __array(char, name, 32)
__field(unsigned long, older) __field(unsigned long, older)
@ -167,6 +167,7 @@ TRACE_EVENT(writeback_queue_io,
__field(int, moved) __field(int, moved)
), ),
TP_fast_assign( TP_fast_assign(
unsigned long *older_than_this = work->older_than_this;
strncpy(__entry->name, dev_name(wb->bdi->dev), 32); strncpy(__entry->name, dev_name(wb->bdi->dev), 32);
__entry->older = older_than_this ? *older_than_this : 0; __entry->older = older_than_this ? *older_than_this : 0;
__entry->age = older_than_this ? __entry->age = older_than_this ?