linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: jinshui zhang <leozhangjs@gmail.com>
To: tytso@mit.edu, adilger.kernel@dilger.ca
Cc: linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org,
	zhangjs <zachary@baishancloud.com>
Subject: [PATCH] ext4: make __ext4_get_inode_loc plug
Date: Mon, 17 Jun 2019 23:57:12 +0800	[thread overview]
Message-ID: <20190617155712.51339-1-leozhangjs@gmail.com> (raw)

From: zhangjs <zachary@baishancloud.com>

If the task is unplugged when called, the inode_readahead_blks may not be merged, 
these will cause small pieces of io, It should be plugged.

Signed-off-by: zhangjs <zachary@baishancloud.com>
---
 fs/ext4/inode.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index c7f77c6..8fe046b 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -4570,6 +4570,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;
@@ -4654,6 +4655,8 @@ static int __ext4_get_inode_loc(struct inode *inode,
 		}
 
 make_io:
+		blk_start_plug(&plug);
+
 		/*
 		 * If we need to do any I/O, try to pre-readahead extra
 		 * blocks from the inode table.
@@ -4688,6 +4691,9 @@ static int __ext4_get_inode_loc(struct inode *inode,
 		get_bh(bh);
 		bh->b_end_io = end_buffer_read_sync;
 		submit_bh(REQ_OP_READ, REQ_META | REQ_PRIO, bh);
+
+		blk_finish_plug(&plug);
+
 		wait_on_buffer(bh);
 		if (!buffer_uptodate(bh)) {
 			EXT4_ERROR_INODE_BLOCK(inode, block,
-- 
1.8.3.1


             reply	other threads:[~2019-06-17 15:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-17 15:57 jinshui zhang [this message]
2019-06-19 11:08 ` [PATCH] ext4: make __ext4_get_inode_loc plug Jan Kara
     [not found]   ` <8BF438AD-0EA2-4F15-B565-A171E3AB13FA@gmail.com>
2019-06-19 12:24     ` Jan Kara
2019-06-19 12:29   ` Zhangjs Jinshui
2019-06-20  3:42 ` Theodore Ts'o
     [not found] <CAEKGrW601HBKVA+FsoeCPMXFZnzv8r0_96FaLDnVKCp=KmcvtA@mail.gmail.com>
2019-06-17 14:09 ` Theodore Ts'o

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190617155712.51339-1-leozhangjs@gmail.com \
    --to=leozhangjs@gmail.com \
    --cc=adilger.kernel@dilger.ca \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tytso@mit.edu \
    --cc=zachary@baishancloud.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).