add patch remove-redundant-assignment-to-node
[ext4-patch-queue.git] / make-ext4-get-inode-loc-plug
blob870dbae5f9fe315e32c11dc68db1d2a0d2136621
1 ext4: make __ext4_get_inode_loc plug
3 From: zhangjs <zachary@baishancloud.com>
5 Add a blk_plug to prevent the inode table readahead from being
6 submitted as small I/O requests.
8 Signed-off-by: zhangjs <zachary@baishancloud.com>
9 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 Reviewed-by: Jan Kara <jack@suse.cz>
11 ---
12  fs/ext4/inode.c | 3 +++
13  1 file changed, 3 insertions(+)
15 diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
16 index ed1d8f9ce5f9..11d7c2e403e9 100644
17 --- a/fs/ext4/inode.c
18 +++ b/fs/ext4/inode.c
19 @@ -4570,6 +4570,7 @@ static int __ext4_get_inode_loc(struct inode *inode,
20         struct buffer_head      *bh;
21         struct super_block      *sb = inode->i_sb;
22         ext4_fsblk_t            block;
23 +       struct blk_plug         plug;
24         int                     inodes_per_block, inode_offset;
26         iloc->bh = NULL;
27 @@ -4658,6 +4659,7 @@ static int __ext4_get_inode_loc(struct inode *inode,
28                  * If we need to do any I/O, try to pre-readahead extra
29                  * blocks from the inode table.
30                  */
31 +               blk_start_plug(&plug);
32                 if (EXT4_SB(sb)->s_inode_readahead_blks) {
33                         ext4_fsblk_t b, end, table;
34                         unsigned num;
35 @@ -4688,6 +4690,7 @@ static int __ext4_get_inode_loc(struct inode *inode,
36                 get_bh(bh);
37                 bh->b_end_io = end_buffer_read_sync;
38                 submit_bh(REQ_OP_READ, REQ_META | REQ_PRIO, bh);
39 +               blk_finish_plug(&plug);
40                 wait_on_buffer(bh);
41                 if (!buffer_uptodate(bh)) {
42                         EXT4_ERROR_INODE_BLOCK(inode, block,