From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932430AbbI2DQ2 (ORCPT ); Mon, 28 Sep 2015 23:16:28 -0400 Received: from mail-pa0-f52.google.com ([209.85.220.52]:34653 "EHLO mail-pa0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932154AbbI2DQ1 (ORCPT ); Mon, 28 Sep 2015 23:16:27 -0400 From: yalin wang To: viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: yalin wang Subject: [RFC] fs: change lookup_bh_lru() to use memmove() Date: Tue, 29 Sep 2015 11:16:14 +0800 Message-Id: <1443496574-12623-1-git-send-email-yalin.wang2010@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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