Skip to content

Commit

Permalink
ext4: add block plug for .writepages
Browse files Browse the repository at this point in the history
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 <shaohua.li@intel.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
  • Loading branch information
Shaohua Li authored and Theodore Ts'o committed Oct 18, 2011
1 parent f6f96fd commit 1bce63d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions fs/ext4/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -2160,6 +2160,7 @@ static int ext4_da_writepages(struct address_space *mapping,
struct 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);

Expand Down Expand Up @@ -2238,6 +2239,7 @@ static int ext4_da_writepages(struct address_space *mapping,
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) {

/*
Expand Down Expand Up @@ -2302,6 +2304,7 @@ static int ext4_da_writepages(struct address_space *mapping,
*/
break;
}
blk_finish_plug(&plug);
if (!io_done && !cycled) {
cycled = 1;
index = 0;
Expand Down

0 comments on commit 1bce63d

Please sign in to comment.