ext4: add block plug for .writepages
authorShaohua Li <shaohua.li@intel.com>
Tue, 18 Oct 2011 14:55:51 +0000 (10:55 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 18 Oct 2011 14:55:51 +0000 (10:55 -0400)
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>
fs/ext4/inode.c

index 4863238c3754dc50a4b1d3c1f1f1cd9279b648b1..081bb25a9ad3ceb442b10e0f7ec10c5fd36eec16 100644 (file)
@@ -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);
 
@@ -2238,6 +2239,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) {
 
                /*
@@ -2302,6 +2304,7 @@ retry:
                         */
                        break;
        }
+       blk_finish_plug(&plug);
        if (!io_done && !cycled) {
                cycled = 1;
                index = 0;