From: yalin wang <yalin.wang2010@gmail.com>
To: viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: yalin wang <yalin.wang2010@gmail.com>
Subject: [RFC] fs: change lookup_bh_lru() to use memmove()
Date: Tue, 29 Sep 2015 11:16:14 +0800 [thread overview]
Message-ID: <1443496574-12623-1-git-send-email-yalin.wang2010@gmail.com> (raw)
This patch make a little change to lookup_bh_lru() function
to use memmove() to set new buffer_head,
better performance for some platforms.
Signed-off-by: yalin wang <yalin.wang2010@gmail.com>
---
fs/buffer.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/fs/buffer.c b/fs/buffer.c
index d6769f1..af14d69 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -1331,11 +1331,9 @@ lookup_bh_lru(struct block_device *bdev, sector_t block, unsigned size)
if (bh && bh->b_blocknr == block && bh->b_bdev == bdev &&
bh->b_size == size) {
if (i) {
- while (i) {
- __this_cpu_write(bh_lrus.bhs[i],
- __this_cpu_read(bh_lrus.bhs[i - 1]));
- i--;
- }
+ memmove(&this_cpu_ptr(&bh_lrus)->bhs[1],
+ &this_cpu_ptr(&bh_lrus)->bhs[0],
+ sizeof(bh)*i);
__this_cpu_write(bh_lrus.bhs[0], bh);
}
get_bh(bh);
--
1.9.1
reply other threads:[~2015-09-29 3:16 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1443496574-12623-1-git-send-email-yalin.wang2010@gmail.com \
--to=yalin.wang2010@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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).