aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2013-07-09 10:36:45 -0400
committerFengguang Wu <fengguang.wu@intel.com>2013-07-09 10:36:45 -0400
commita8855990e382fc81c04187c5fdb48743307baf32 (patch)
treee15bfdcd0a629be344d09113991dd2e613b747b7
parent8bb495e3f02401ee6f76d1b1d77f3ac9f079e376 (diff)
writeback: Do not sort b_io list only because of block device inode
It is very likely that block device inode will be part of BDI dirty list as well. However it doesn't make sence to sort inodes on the b_io list just because of this inode (as it contains buffers all over the device anyway). So save some CPU cycles which is valuable since we hold relatively contented wb->list_lock. Signed-off-by: Jan Kara <jack@suse.cz>
-rw-r--r--fs/block_dev.c2
-rw-r--r--fs/fs-writeback.c8
-rw-r--r--include/linux/fs.h6
3 files changed, 12 insertions, 4 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 2091db8cdd78..256233098206 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -606,7 +606,7 @@ static struct block_device *bd_acquire(struct inode *inode)
606 return bdev; 606 return bdev;
607} 607}
608 608
609static inline int sb_is_blkdev_sb(struct super_block *sb) 609int sb_is_blkdev_sb(struct super_block *sb)
610{ 610{
611 return sb == blockdev_superblock; 611 return sb == blockdev_superblock;
612} 612}
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index 3be57189efd5..cabdece4cb39 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -68,7 +68,7 @@ static inline struct backing_dev_info *inode_to_bdi(struct inode *inode)
68{ 68{
69 struct super_block *sb = inode->i_sb; 69 struct super_block *sb = inode->i_sb;
70 70
71 if (strcmp(sb->s_type->name, "bdev") == 0) 71 if (sb_is_blkdev_sb(sb))
72 return inode->i_mapping->backing_dev_info; 72 return inode->i_mapping->backing_dev_info;
73 73
74 return sb->s_bdi; 74 return sb->s_bdi;
@@ -250,11 +250,13 @@ static int move_expired_inodes(struct list_head *delaying_queue,
250 if (work->older_than_this && 250 if (work->older_than_this &&
251 inode_dirtied_after(inode, *work->older_than_this)) 251 inode_dirtied_after(inode, *work->older_than_this))
252 break; 252 break;
253 list_move(&inode->i_wb_list, &tmp);
254 moved++;
255 if (sb_is_blkdev_sb(inode->i_sb))
256 continue;
253 if (sb && sb != inode->i_sb) 257 if (sb && sb != inode->i_sb)
254 do_sb_sort = 1; 258 do_sb_sort = 1;
255 sb = inode->i_sb; 259 sb = inode->i_sb;
256 list_move(&inode->i_wb_list, &tmp);
257 moved++;
258 } 260 }
259 261
260 /* just one sb in list, splice to dispatch_queue and we're done */ 262 /* just one sb in list, splice to dispatch_queue and we're done */
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 65c2be22b601..61da2f1c8056 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2058,6 +2058,7 @@ extern struct super_block *freeze_bdev(struct block_device *);
2058extern void emergency_thaw_all(void); 2058extern void emergency_thaw_all(void);
2059extern int thaw_bdev(struct block_device *bdev, struct super_block *sb); 2059extern int thaw_bdev(struct block_device *bdev, struct super_block *sb);
2060extern int fsync_bdev(struct block_device *); 2060extern int fsync_bdev(struct block_device *);
2061extern int sb_is_blkdev_sb(struct super_block *sb);
2061#else 2062#else
2062static inline void bd_forget(struct inode *inode) {} 2063static inline void bd_forget(struct inode *inode) {}
2063static inline int sync_blockdev(struct block_device *bdev) { return 0; } 2064static inline int sync_blockdev(struct block_device *bdev) { return 0; }
@@ -2077,6 +2078,11 @@ static inline int thaw_bdev(struct block_device *bdev, struct super_block *sb)
2077static inline void iterate_bdevs(void (*f)(struct block_device *, void *), void *arg) 2078static inline void iterate_bdevs(void (*f)(struct block_device *, void *), void *arg)
2078{ 2079{
2079} 2080}
2081
2082static inline int sb_is_blkdev_sb(struct super_block *sb)
2083{
2084 return 0;
2085}
2080#endif 2086#endif
2081extern int sync_filesystem(struct super_block *); 2087extern int sync_filesystem(struct super_block *);
2082extern const struct file_operations def_blk_fops; 2088extern const struct file_operations def_blk_fops;