Commit cf137307cd9827495b65e7d74ea2b610daa9898b

Authored by Jens Axboe
1 parent 5c03449d34

writeback: don't resort for a single super_block in move_expired_inodes()

If we only moved inodes from a single super_block to the temporary
list, there's no point in doing a resort for multiple super_blocks.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>

Showing 1 changed file with 11 additions and 1 deletions Side-by-side Diff

... ... @@ -336,15 +336,25 @@
336 336 {
337 337 LIST_HEAD(tmp);
338 338 struct list_head *pos, *node;
339   - struct super_block *sb;
  339 + struct super_block *sb = NULL;
340 340 struct inode *inode;
  341 + int do_sb_sort = 0;
341 342  
342 343 while (!list_empty(delaying_queue)) {
343 344 inode = list_entry(delaying_queue->prev, struct inode, i_list);
344 345 if (older_than_this &&
345 346 inode_dirtied_after(inode, *older_than_this))
346 347 break;
  348 + if (sb && sb != inode->i_sb)
  349 + do_sb_sort = 1;
  350 + sb = inode->i_sb;
347 351 list_move(&inode->i_list, &tmp);
  352 + }
  353 +
  354 + /* just one sb in list, splice to dispatch_queue and we're done */
  355 + if (!do_sb_sort) {
  356 + list_splice(&tmp, dispatch_queue);
  357 + return;
348 358 }
349 359  
350 360 /* Move inodes from one superblock together */