diff options
author | Wu Fengguang <fengguang.wu@intel.com> | 2011-04-23 14:27:27 -0400 |
---|---|---|
committer | Wu Fengguang <fengguang.wu@intel.com> | 2011-06-07 20:25:23 -0400 |
commit | e84d0a4f8e39a73003a6ec9a11b07702745f4c1f (patch) | |
tree | 2319765d78502d13101ac50bafb0ba5577133092 /fs/fs-writeback.c | |
parent | 251d6a471c831e22880b3c146bb4556ddfb1dc82 (diff) |
writeback: trace event writeback_queue_io
Note that it adds a little overheads to account the moved/enqueued
inodes from b_dirty to b_io. The "moved" accounting may be later used to
limit the number of inodes that can be moved in one shot, in order to
keep spinlock hold time under control.
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Diffstat (limited to 'fs/fs-writeback.c')
-rw-r--r-- | fs/fs-writeback.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index 5185fad48b62..6caa98247a5b 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c | |||
@@ -248,15 +248,16 @@ static bool inode_dirtied_after(struct inode *inode, unsigned long t) | |||
248 | /* | 248 | /* |
249 | * Move expired dirty inodes from @delaying_queue to @dispatch_queue. | 249 | * Move expired dirty inodes from @delaying_queue to @dispatch_queue. |
250 | */ | 250 | */ |
251 | static void move_expired_inodes(struct list_head *delaying_queue, | 251 | static int move_expired_inodes(struct list_head *delaying_queue, |
252 | struct list_head *dispatch_queue, | 252 | struct list_head *dispatch_queue, |
253 | unsigned long *older_than_this) | 253 | unsigned long *older_than_this) |
254 | { | 254 | { |
255 | LIST_HEAD(tmp); | 255 | LIST_HEAD(tmp); |
256 | struct list_head *pos, *node; | 256 | struct list_head *pos, *node; |
257 | struct super_block *sb = NULL; | 257 | struct super_block *sb = NULL; |
258 | struct inode *inode; | 258 | struct inode *inode; |
259 | int do_sb_sort = 0; | 259 | int do_sb_sort = 0; |
260 | int moved = 0; | ||
260 | 261 | ||
261 | while (!list_empty(delaying_queue)) { | 262 | while (!list_empty(delaying_queue)) { |
262 | inode = wb_inode(delaying_queue->prev); | 263 | inode = wb_inode(delaying_queue->prev); |
@@ -267,12 +268,13 @@ static void move_expired_inodes(struct list_head *delaying_queue, | |||
267 | do_sb_sort = 1; | 268 | do_sb_sort = 1; |
268 | sb = inode->i_sb; | 269 | sb = inode->i_sb; |
269 | list_move(&inode->i_wb_list, &tmp); | 270 | list_move(&inode->i_wb_list, &tmp); |
271 | moved++; | ||
270 | } | 272 | } |
271 | 273 | ||
272 | /* just one sb in list, splice to dispatch_queue and we're done */ | 274 | /* just one sb in list, splice to dispatch_queue and we're done */ |
273 | if (!do_sb_sort) { | 275 | if (!do_sb_sort) { |
274 | list_splice(&tmp, dispatch_queue); | 276 | list_splice(&tmp, dispatch_queue); |
275 | return; | 277 | goto out; |
276 | } | 278 | } |
277 | 279 | ||
278 | /* Move inodes from one superblock together */ | 280 | /* Move inodes from one superblock together */ |
@@ -284,6 +286,8 @@ static void move_expired_inodes(struct list_head *delaying_queue, | |||
284 | list_move(&inode->i_wb_list, dispatch_queue); | 286 | list_move(&inode->i_wb_list, dispatch_queue); |
285 | } | 287 | } |
286 | } | 288 | } |
289 | out: | ||
290 | return moved; | ||
287 | } | 291 | } |
288 | 292 | ||
289 | /* | 293 | /* |
@@ -299,9 +303,11 @@ static void move_expired_inodes(struct list_head *delaying_queue, | |||
299 | */ | 303 | */ |
300 | static void queue_io(struct bdi_writeback *wb, unsigned long *older_than_this) | 304 | static void queue_io(struct bdi_writeback *wb, unsigned long *older_than_this) |
301 | { | 305 | { |
306 | int moved; | ||
302 | assert_spin_locked(&wb->list_lock); | 307 | assert_spin_locked(&wb->list_lock); |
303 | list_splice_init(&wb->b_more_io, &wb->b_io); | 308 | list_splice_init(&wb->b_more_io, &wb->b_io); |
304 | move_expired_inodes(&wb->b_dirty, &wb->b_io, older_than_this); | 309 | moved = move_expired_inodes(&wb->b_dirty, &wb->b_io, older_than_this); |
310 | trace_writeback_queue_io(wb, older_than_this, moved); | ||
305 | } | 311 | } |
306 | 312 | ||
307 | static int write_inode(struct inode *inode, struct writeback_control *wbc) | 313 | static int write_inode(struct inode *inode, struct writeback_control *wbc) |