[2/2,SRU,E] Revert "Revert "ext4: make __ext4_get_inode_loc plug""
diff mbox series

Message ID 20191003131004.6805-3-colin.king@canonical.com
State New
Headers show
  • improve ext4 performance with revert of a reverted ext4 fix
Related show

Commit Message

Colin King Oct. 3, 2019, 1:10 p.m. UTC
From: Linus Torvalds <torvalds@linux-foundation.org>

BugLink: https://bugs.launchpad.net/bugs/1846486

This reverts commit 72dbcf72156641fde4d8ea401e977341bfd35a05.

Instead of waiting forever for entropy that may just not happen, we now
try to actively generate entropy when required, and are thus hopefully
avoiding the problem that caused the nice ext4 IO pattern fix to be

So revert the revert.

Cc: Ahmed S. Darwish <darwish.07@gmail.com>
Cc: Ted Ts'o <tytso@mit.edu>
Cc: Willy Tarreau <w@1wt.eu>
Cc: Alexander E. Patrakov <patrakov@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit 02f03c4206c1b2a7451d3b3546f86c9c783eac13)
Signed-off-by: Colin Ian King <colin.king@canonical.com>
 fs/ext4/inode.c | 3 +++
 1 file changed, 3 insertions(+)

diff mbox series

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index f2b2524..552a5fc 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -4586,6 +4586,7 @@  static int __ext4_get_inode_loc(struct inode *inode,
 	struct buffer_head	*bh;
 	struct super_block	*sb = inode->i_sb;
 	ext4_fsblk_t		block;
+	struct blk_plug		plug;
 	int			inodes_per_block, inode_offset;
 	iloc->bh = NULL;
@@ -4674,6 +4675,7 @@  static int __ext4_get_inode_loc(struct inode *inode,
 		 * If we need to do any I/O, try to pre-readahead extra
 		 * blocks from the inode table.
+		blk_start_plug(&plug);
 		if (EXT4_SB(sb)->s_inode_readahead_blks) {
 			ext4_fsblk_t b, end, table;
 			unsigned num;
@@ -4704,6 +4706,7 @@  static int __ext4_get_inode_loc(struct inode *inode,
 		bh->b_end_io = end_buffer_read_sync;
 		submit_bh(REQ_OP_READ, REQ_META | REQ_PRIO, bh);
+		blk_finish_plug(&plug);
 		if (!buffer_uptodate(bh)) {
 			EXT4_ERROR_INODE_BLOCK(inode, block,