Advertisement
Guest User

[PATCH] writeback: Do not sort b_io list only because of blo

a guest
Sep 2nd, 2013
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.98 KB | None | 0 0
  1. It is very likely that block device inode will be part of BDI dirty list
  2. as well. However it doesn't make sence to sort inodes on the b_io list
  3. just because of this inode (as it contains buffers all over the device
  4. anyway). So save some CPU cycles which is valuable since we hold relatively
  5. contented wb->list_lock.
  6.  
  7. Signed-off-by: Jan Kara <jack@suse.cz>
  8. ---
  9. fs/block_dev.c | 2 +-
  10. fs/fs-writeback.c | 8 +++++---
  11. include/linux/fs.h | 6 ++++++
  12. 3 files changed, 12 insertions(+), 4 deletions(-)
  13.  
  14. diff --git a/fs/block_dev.c b/fs/block_dev.c
  15. index 2091db8..2562330 100644
  16. --- a/fs/block_dev.c
  17. +++ b/fs/block_dev.c
  18. @@ -606,7 +606,7 @@ static struct block_device *bd_acquire(struct inode *inode)
  19. return bdev;
  20. }
  21.  
  22. -static inline int sb_is_blkdev_sb(struct super_block *sb)
  23. +int sb_is_blkdev_sb(struct super_block *sb)
  24. {
  25. return sb == blockdev_superblock;
  26. }
  27. diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
  28. index 3be5718..cabdece 100644
  29. --- a/fs/fs-writeback.c
  30. +++ b/fs/fs-writeback.c
  31. @@ -68,7 +68,7 @@ static inline struct backing_dev_info *inode_to_bdi(struct inode *inode)
  32. {
  33. struct super_block *sb = inode->i_sb;
  34.  
  35. - if (strcmp(sb->s_type->name, "bdev") == 0)
  36. + if (sb_is_blkdev_sb(sb))
  37. return inode->i_mapping->backing_dev_info;
  38.  
  39. return sb->s_bdi;
  40. @@ -250,11 +250,13 @@ static int move_expired_inodes(struct list_head *delaying_queue,
  41. if (work->older_than_this &&
  42. inode_dirtied_after(inode, *work->older_than_this))
  43. break;
  44. + list_move(&inode->i_wb_list, &tmp);
  45. + moved++;
  46. + if (sb_is_blkdev_sb(inode->i_sb))
  47. + continue;
  48. if (sb && sb != inode->i_sb)
  49. do_sb_sort = 1;
  50. sb = inode->i_sb;
  51. - list_move(&inode->i_wb_list, &tmp);
  52. - moved++;
  53. }
  54.  
  55. /* just one sb in list, splice to dispatch_queue and we're done */
  56. diff --git a/include/linux/fs.h b/include/linux/fs.h
  57. index 43db02e..8f897d0 100644
  58. --- a/include/linux/fs.h
  59. +++ b/include/linux/fs.h
  60. @@ -2058,6 +2058,7 @@ extern struct super_block *freeze_bdev(struct block_device *);
  61. extern void emergency_thaw_all(void);
  62. extern int thaw_bdev(struct block_device *bdev, struct super_block *sb);
  63. extern int fsync_bdev(struct block_device *);
  64. +extern int sb_is_blkdev_sb(struct super_block *sb);
  65. #else
  66. static inline void bd_forget(struct inode *inode) {}
  67. static inline int sync_blockdev(struct block_device *bdev) { return 0; }
  68. @@ -2077,6 +2078,11 @@ static inline int thaw_bdev(struct block_device *bdev, struct super_block *sb)
  69. static inline void iterate_bdevs(void (*f)(struct block_device *, void *), void *arg)
  70. {
  71. }
  72. +
  73. +static inline int sb_is_blkdev_sb(struct super_block *sb)
  74. +{
  75. + return 0;
  76. +}
  77. #endif
  78. extern int sync_filesystem(struct super_block *);
  79. extern const struct file_operations def_blk_fops;
  80. --
  81. 1.8.1.4
  82.  
  83. --
  84. To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
  85. the body of a message to majordomo@vger.kernel.org
  86. More majordomo info at http://vger.kernel.org/majordomo-info.html
  87. Please read the FAQ at http://www.tux.org/lkml/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement