Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752659Ab3JVMYK (ORCPT ); Tue, 22 Oct 2013 08:24:10 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:21613 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751446Ab3JVMYH convert rfc822-to-8bit (ORCPT ); Tue, 22 Oct 2013 08:24:07 -0400 X-AuditID: cbfee68f-b7f836d000001b39-4e-52666e650e04 MIME-version: 1.0 Content-type: text/plain; charset=UTF-8 Content-transfer-encoding: 8BIT Message-id: <1382444612.992.67.camel@kjgkr> Subject: Re: [f2fs-dev] [PATCH] f2fs: check all ones or zeros bitmap with integer data type for better mount performance From: Jaegeuk Kim Reply-to: jaegeuk.kim@samsung.com To: Chao Yu Cc: linux-f2fs-devel@lists.sourceforge.net, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, =?UTF-8?Q?=E8=B0=AD=E5=A7=9D?= Date: Tue, 22 Oct 2013 21:23:32 +0900 In-reply-to: <000701cecf09$2b2a2280$817e6780$@samsung.com> References: <000701cecf09$2b2a2280$817e6780$@samsung.com> Organization: Samsung X-Mailer: Evolution 3.2.3-0ubuntu6 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrJIsWRmVeSWpSXmKPExsVy+t8zI93UvLQgg1tLVCz+N31ks7i0yN1i z96TLBaXd81hs2hdeJ7ZgdVj94LPTB59W1YxenzeJBfAHMVlk5Kak1mWWqRvl8CV0f/9IXvB SoGKKZN/MTYw/uDpYuTkkBAwkdj3eTozhC0mceHeerYuRi4OIYFljBLv9z9ngSm6+e8QVGI6 o8T6K0fBErwCghI/Jt8Ds5kF1CUmzVvEDGGLSOy/tZAVwtaWWLbwNVhcSOAVo8St9xkQvdoS 948+ZQSxhQWqJKZ8vQo0h4ODDSi+eb8BRLmixNv9d8HGiAgoSfyav4gV5AZmgYWMEk+WLQPr ZRFQlXjQ/QRsPqeAlcTbhRD3CAlYSl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UCHT2SWEk3OB6acvJJ4 Q2MTMyNLIzMLIxNzc9KElcR5D7RaBwoJpCeWpGanphakFsFsYeLglGpgtLp86JrVgY0ObacZ dA5mnBB+vkfj88naIueAH+yXOx8lsrIrzaiYqPq8iUu4NG5zEENR389fn694MwqxrWNhSp6n GcXnU7PxTXNG7NkzbxM3M5/dUCw4/f7c2RO3+vFyc8QLqzCHTfkkwMT4qs/08smFcddWfp29 u0qU4zqfTHmhw/n1Z5boKLEUZyQaajEXFScCAJ3m4rwvAwAA DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2235 Lines: 70 Hi, 2013-10-22 (화), 17:28 +0800, Chao Yu: > Previously, check_block_count check valid_map with bit data type in common > scenario that sit has all ones or zeros bitmap, it makes low mount > performance. > So let's check the special bitmap with integer data type instead of the bit > one. > > Signed-off-by: Tan Shu > Signed-off-by: Yu Chao > --- > fs/f2fs/segment.h | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > > diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h > index 7f94d78..d43ab9f 100644 > --- a/fs/f2fs/segment.h > +++ b/fs/f2fs/segment.h > @@ -543,6 +543,7 @@ static inline void check_block_count(struct f2fs_sb_info > *sbi, > { > struct f2fs_sm_info *sm_info = SM_I(sbi); > unsigned int end_segno = sm_info->segment_count - 1; > + int *valid_map = (int *)raw_sit->valid_map; > int valid_blocks = 0; > int i; > > @@ -552,6 +553,19 @@ static inline void check_block_count(struct > f2fs_sb_info *sbi, > /* check boundary of a given segment number */ > BUG_ON(segno > end_segno); > > + /* check all ones or zeros valid_map */ > + if (GET_SIT_VBLOCKS(raw_sit) == 0) { > + for (i = 0; i < SIT_VBLOCK_MAP_SIZE / sizeof(int); i++) We cannot guarantee all the time that SIT_VBLOCK_MAP_SIZE is multiple of sizeof(int). How about using memcmp() with __u8? > + if (unlikely(valid_map[i] != 0)) > + BUG(); > + return; > + } else if (GET_SIT_VBLOCKS(raw_sit) == sbi->blocks_per_seg) { > + for (i = 0; i < SIT_VBLOCK_MAP_SIZE / sizeof(int); i++) > + if (unlikely(valid_map[i] != -1)) > + BUG(); > + return; > + } > + > /* check bitmap with valid block count */ > for (i = 0; i < sbi->blocks_per_seg; i++) > if (f2fs_test_bit(i, raw_sit->valid_map)) > --- > > -- > To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- Jaegeuk Kim Samsung -- 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/