mm: add more blk plug
Subsystems (3)
PATCH 1/1 mm: add more blk plug
Some filesystems implement .writepages. We don't have blk plug in such filesystems for .writepages.
mm/page-writeback.c +3 -0
@@ -1253,13 +1253,16 @@ EXPORT_SYMBOL(generic_writepages);int do_writepages (struct address_space *mapping,struct writeback_control *wbc) {int ret; +struct blk_plug plug;if (wbc->nr_to_write <=0 )return 0 ; +blk_start_plug (&plug);if (mapping->a_ops->writepages) ret = mapping->a_ops->writepages (mapping, wbc);else ret =generic_writepages (mapping, wbc); +blk_finish_plug (&plug);return ret; }
Quoted 2 lines · Shaohua Li
Some filesystems implement .writepages. We don't have blk plug in such filesystems for .writepages.
Please add the plugging in the actual ->writepages instances.
Quoted 5 lines · Christoph Hellwig
Quoted 2 lines · Shaohua Li
Some filesystems implement .writepages. We don't have blk plug in such filesystems for .writepages.
Please add the plugging in the actual ->writepages instances.
there are several filesystems have ->writepages. Can you share an hint why we don't add plugging in the do_writepages?
Thanks,
Shaohua
Quoted 8 lines · Shaohua Li
Quoted 5 lines · Christoph Hellwig
Quoted 2 lines · Shaohua Li
Some filesystems implement .writepages. We don't have blk plug in such filesystems for .writepages.
Please add the plugging in the actual ->writepages instances.
there are several filesystems have ->writepages. Can you share an hint why we don't add plugging in the
do_writepages?
Because do_writepages is completely generic code with no knowledge of block I/O. I really don't want to have block plugging be intimately tied into core VM/writeback code all over. We've been there with ->sync_page, and it was a major pain - nevermind the additional (small) overhead for the not block based filesystems.
PATCH 1/1 ext4: add block plug for .writepages
Quoted 7 lines · Christoph Hellwig
Quoted 6 lines · Shaohua Li
Quoted 5 lines · Christoph Hellwig
Quoted 2 lines · Shaohua Li
Some filesystems implement .writepages. We don't have blk plug in such filesystems for .writepages.
Please add the plugging in the actual ->writepages instances.
Quoted 8 lines
Quoted 2 lines
there are several filesystems have ->writepages. Can you share an hint why we don't add plugging in the
do_writepages?Because
do_writepagesis completely generic code with no knowledge of block I/O. I really don't want to have block plugging be intimately tied into core VM/writeback code all over. We've been there with ->sync_page, and it was a major pain - nevermind the additional (small) overhead for the not block based filesystems.
I searched a little bit, looks only ext4 need it. here is the patch.
Add block plug for ext4 .writepages. Though ext4 .writepages already handles request merge very well, block plug is still helpful to reduce block lock contention.
--- fs/ext4/inode.c | 3 +++ 1 file changed, 3 insertions(+)
fs/ext4/inode.c +3 -0
@@ -2046,6 +2046,7 @@ static int ext4_da_writepages(struct addstruct ext4_sb_info *sbi =EXT4_SB (mapping->host->i_sb);pgoff_t done_index =0 ;pgoff_t end; +struct blk_plug plug;trace_ext4_da_writepages (inode, wbc);
@@ -2124,6 +2125,7 @@ retry:if (wbc->sync_mode ==WB_SYNC_ALL || wbc->tagged_writepages)tag_pages_for_writeback (mapping, index, end); +blk_start_plug (&plug);while (!ret && wbc->nr_to_write >0 ) {/*
@@ -2188,6 +2190,7 @@ retry:*/ break ; } +blk_finish_plug (&plug);if (!io_done && !cycled) { cycled =1 ; index =0 ;
Re: [patch]ext4: add block plug for .writepages
Quoted 16 lines · Shaohua Li
Quoted 7 lines · Christoph Hellwig
Quoted 6 lines · Shaohua Li
Quoted 5 lines · Christoph Hellwig
Quoted 2 lines · Shaohua Li
Some filesystems implement .writepages. We don't have blk plug in such filesystems for .writepages.
Please add the plugging in the actual ->writepages instances.
Quoted 8 lines
Quoted 2 lines
there are several filesystems have ->writepages. Can you share an hint why we don't add plugging in the
do_writepages?Because
do_writepagesis completely generic code with no knowledge of block I/O. I really don't want to have block plugging be intimately tied into core VM/writeback code all over. We've been there with ->sync_page, and it was a major pain - nevermind the additional (small) overhead for the not block based filesystems.
Quoted 7 lines
I searched a little bit, looks only ext4 need it. here is the patch.
Add block plug for ext4 .writepages. Though ext4 .writepages already handles request merge very well, block plug is still helpful to reduce block lock contention.
ping
Quoted 35 lines
Signed-off-by Shaohua Li <[email protected]>--- fs/ext4/inode.c | 3 +++ 1 file changed, 3 insertions(+)Index:
linux/fs/ext4/inode.c
===================================================================fs/ext4/inode.c +3
-0@@ -2046,6 +2046,7 @@ static int ext4_da_writepages(struct addstruct ext4_sb_info *sbi =EXT4_SB (mapping->host->i_sb);pgoff_t done_index =0 ;pgoff_t end; +struct blk_plug plug;trace_ext4_da_writepages (inode, wbc);@@ -2124,6 +2125,7 @@ retry:if (wbc->sync_mode ==WB_SYNC_ALL || wbc->tagged_writepages)tag_pages_for_writeback (mapping, index, end); +blk_start_plug (&plug);while (!ret && wbc->nr_to_write >0 ) {/* @@ -2188,6 +2190,7 @@ retry:*/ break ; } +blk_finish_plug (&plug);if (!io_done && !cycled) { cycled =1 ; index =0 ;
Re: [patch]ext4: add block plug for .writepages
In reply to Shaohua LiQuoted 8 lines · Shaohua Li
I searched a little bit, looks only ext4 need it. here is the patch.
Add block plug for ext4 .writepages. Though ext4 .writepages already handles request merge very well, block plug is still helpful to reduce block lock contention.
Signed-off-by Shaohua Li <[email protected]>
Thanks, applied.
- Ted
NamJae Jeon
Reviewed-byRe: [patch]ext4: add block plug for .writepages
2011/10/11 Ted Ts'o <[email protected]>:
Quoted 9 lines · Shaohua Li
Quoted 8 lines
I searched a little bit, looks only ext4 need it. here is the patch.
Add block plug for ext4 .writepages. Though ext4 .writepages already handles request merge very well, block plug is still helpful to reduce block lock contention.
Signed-off-by Shaohua Li <[email protected]>
You found good point.
If there are other filesystem that didn't use generic_writepages, these are needed as this patch.
Quoted 10 lines
Thanks, applied.
- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch]ext4: add block plug for .writepages
In reply to Ted Ts'oQuoted 9 lines · Ted Ts'o
Quoted 8 lines · Shaohua Li
I searched a little bit, looks only ext4 need it. here is the patch.
Add block plug for ext4 .writepages. Though ext4 .writepages already handles request merge very well, block plug is still helpful to reduce block lock contention.
Signed-off-by Shaohua Li <[email protected]>
Does it require to add blk_finish_plug(&plug) when error case?
+ blk_start_plug(&plug);
while (!ret && wbc->nr_to_write > 0) {
...
/* start a new transaction*/
handle = ext4_journal_start(inode, needed_blocks);
if (IS_ERR(handle)) {
ret = PTR_ERR(handle);
ext4_msg(inode->i_sb, KERN_CRIT, "%s: jbd2_start: "
"%ld pages, ino %lu; err %d", __func__,
wbc->nr_to_write, inode->i_ino, ret);
+ blk_finish_plug(&plug);
goto out_writepages;
}Thank you,
Kyungmin Park-
Re: [patch]ext4: add block plug for .writepages
Quoted 5 lines · Kyungmin Park
Quoted 4 lines · Ted Ts'o
Quoted 3 lines · Shaohua Li
I searched a little bit, looks only ext4 need it. here is the patch.
Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
Add block plug for ext4 .writepages. Though ext4 .writepages already handles request merge very well, block plug is still helpful to reduce block lock contention.
Signed-off-by Shaohua Li <[email protected]>Does it require to add
blk_finish_plug(&plug)when error case?
oops, we need.
Subject: ext4: calling blk_finish_plug in error path
Forgot calling blk_finish_plug in error code path. Thanks Kyungmin Park pointed it out.
--- fs/ext4/inode.c | 1 + 1 file changed, 1 insertion(+)
fs/ext4/inode.c +1 -0
@@ -2144,6 +2144,7 @@ retry:ext4_msg (inode->i_sb,KERN_CRIT ,"%s: jbd2_start: " "%ld pages, ino %lu; err %d" , __func__, wbc->nr_to_write, inode->i_ino, ret); +blk_finish_plug (&plug); goto out_writepages; }