* [PATCH] writeback: Do not sort b_io list only because of block device inode
@ 2013-06-24 8:07 Jan Kara
2013-07-08 16:06 ` Jan Kara
0 siblings, 1 reply; 3+ messages in thread
From: Jan Kara @ 2013-06-24 8:07 UTC (permalink / raw)
To: Wu Fengguang; +Cc: linux-fsdevel, LKML, Jan Kara
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>
---
fs/block_dev.c | 2 +-
fs/fs-writeback.c | 8 +++++---
include/linux/fs.h | 6 ++++++
3 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 2091db8..2562330 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -606,7 +606,7 @@ static struct block_device *bd_acquire(struct inode *inode)
return bdev;
}
-static inline int sb_is_blkdev_sb(struct super_block *sb)
+int sb_is_blkdev_sb(struct super_block *sb)
{
return sb == blockdev_superblock;
}
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index 3be5718..cabdece 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)
{
struct super_block *sb = inode->i_sb;
- if (strcmp(sb->s_type->name, "bdev") == 0)
+ if (sb_is_blkdev_sb(sb))
return inode->i_mapping->backing_dev_info;
return sb->s_bdi;
@@ -250,11 +250,13 @@ static int move_expired_inodes(struct list_head *delaying_queue,
if (work->older_than_this &&
inode_dirtied_after(inode, *work->older_than_this))
break;
+ list_move(&inode->i_wb_list, &tmp);
+ moved++;
+ if (sb_is_blkdev_sb(inode->i_sb))
+ continue;
if (sb && sb != inode->i_sb)
do_sb_sort = 1;
sb = inode->i_sb;
- list_move(&inode->i_wb_list, &tmp);
- moved++;
}
/* 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 43db02e..8f897d0 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2058,6 +2058,7 @@ extern struct super_block *freeze_bdev(struct block_device *);
extern void emergency_thaw_all(void);
extern int thaw_bdev(struct block_device *bdev, struct super_block *sb);
extern int fsync_bdev(struct block_device *);
+extern int sb_is_blkdev_sb(struct super_block *sb);
#else
static inline void bd_forget(struct inode *inode) {}
static 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)
static inline void iterate_bdevs(void (*f)(struct block_device *, void *), void *arg)
{
}
+
+static inline int sb_is_blkdev_sb(struct super_block *sb)
+{
+ return 0;
+}
#endif
extern int sync_filesystem(struct super_block *);
extern const struct file_operations def_blk_fops;
--
1.8.1.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] writeback: Do not sort b_io list only because of block device inode
2013-06-24 8:07 [PATCH] writeback: Do not sort b_io list only because of block device inode Jan Kara
@ 2013-07-08 16:06 ` Jan Kara
2013-07-09 14:32 ` Fengguang Wu
0 siblings, 1 reply; 3+ messages in thread
From: Jan Kara @ 2013-07-08 16:06 UTC (permalink / raw)
To: Wu Fengguang; +Cc: linux-fsdevel, LKML, Jan Kara
On Mon 24-06-13 10:07:49, Jan Kara wrote:
> 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.
Ping? Fengguang, can you merge the patch please?
Honza
>
> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
> fs/block_dev.c | 2 +-
> fs/fs-writeback.c | 8 +++++---
> include/linux/fs.h | 6 ++++++
> 3 files changed, 12 insertions(+), 4 deletions(-)
>
> diff --git a/fs/block_dev.c b/fs/block_dev.c
> index 2091db8..2562330 100644
> --- a/fs/block_dev.c
> +++ b/fs/block_dev.c
> @@ -606,7 +606,7 @@ static struct block_device *bd_acquire(struct inode *inode)
> return bdev;
> }
>
> -static inline int sb_is_blkdev_sb(struct super_block *sb)
> +int sb_is_blkdev_sb(struct super_block *sb)
> {
> return sb == blockdev_superblock;
> }
> diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
> index 3be5718..cabdece 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)
> {
> struct super_block *sb = inode->i_sb;
>
> - if (strcmp(sb->s_type->name, "bdev") == 0)
> + if (sb_is_blkdev_sb(sb))
> return inode->i_mapping->backing_dev_info;
>
> return sb->s_bdi;
> @@ -250,11 +250,13 @@ static int move_expired_inodes(struct list_head *delaying_queue,
> if (work->older_than_this &&
> inode_dirtied_after(inode, *work->older_than_this))
> break;
> + list_move(&inode->i_wb_list, &tmp);
> + moved++;
> + if (sb_is_blkdev_sb(inode->i_sb))
> + continue;
> if (sb && sb != inode->i_sb)
> do_sb_sort = 1;
> sb = inode->i_sb;
> - list_move(&inode->i_wb_list, &tmp);
> - moved++;
> }
>
> /* 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 43db02e..8f897d0 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -2058,6 +2058,7 @@ extern struct super_block *freeze_bdev(struct block_device *);
> extern void emergency_thaw_all(void);
> extern int thaw_bdev(struct block_device *bdev, struct super_block *sb);
> extern int fsync_bdev(struct block_device *);
> +extern int sb_is_blkdev_sb(struct super_block *sb);
> #else
> static inline void bd_forget(struct inode *inode) {}
> static 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)
> static inline void iterate_bdevs(void (*f)(struct block_device *, void *), void *arg)
> {
> }
> +
> +static inline int sb_is_blkdev_sb(struct super_block *sb)
> +{
> + return 0;
> +}
> #endif
> extern int sync_filesystem(struct super_block *);
> extern const struct file_operations def_blk_fops;
> --
> 1.8.1.4
>
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] writeback: Do not sort b_io list only because of block device inode
2013-07-08 16:06 ` Jan Kara
@ 2013-07-09 14:32 ` Fengguang Wu
0 siblings, 0 replies; 3+ messages in thread
From: Fengguang Wu @ 2013-07-09 14:32 UTC (permalink / raw)
To: Jan Kara; +Cc: linux-fsdevel, LKML
On Mon, Jul 08, 2013 at 06:06:02PM +0200, Jan Kara wrote:
> On Mon 24-06-13 10:07:49, Jan Kara wrote:
> > 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.
> Ping? Fengguang, can you merge the patch please?
OK! It's a good optimization to have.
Thanks,
Fengguang
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-07-09 14:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-24 8:07 [PATCH] writeback: Do not sort b_io list only because of block device inode Jan Kara
2013-07-08 16:06 ` Jan Kara
2013-07-09 14:32 ` Fengguang Wu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).