Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1234669 > unrolled thread

[RFC] fs: change lookup_bh_lru() to use memmove()

Started byyalin wang <yalin.wang2010@gmail.com>
First post2015-09-29 05:20 +0200
Last post2015-09-29 05:20 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [RFC] fs: change lookup_bh_lru() to use memmove() yalin wang <yalin.wang2010@gmail.com> - 2015-09-29 05:20 +0200

#1234669 — [RFC] fs: change lookup_bh_lru() to use memmove()

Fromyalin wang <yalin.wang2010@gmail.com>
Date2015-09-29 05:20 +0200
Subject[RFC] fs: change lookup_bh_lru() to use memmove()
Message-ID<qdTCp-2zg-3@gated-at.bofh.it>
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web