From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jaegeuk Kim Subject: Re: [PATCH] f2fs: check the search bound earlier in dir.c/room_for_filename Date: Mon, 15 Jul 2013 09:00:13 +0900 Message-ID: <1373846413.26443.9.camel@kjgkr> References: <51D93068.3080606@gmail.com> <51D9324A.3010305@gmail.com> Reply-To: jaegeuk.kim@samsung.com Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: linux-fsdevel@vger.kernel.org To: Wang Sheng-Hui Return-path: Received: from mailout1.samsung.com ([203.254.224.24]:57650 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753458Ab3GOAAW (ORCPT ); Sun, 14 Jul 2013 20:00:22 -0400 Received: from epcpsbgr3.samsung.com (u143.gpu120.samsung.co.kr [203.254.230.143]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MPY00GZ5ANP2W30@mailout1.samsung.com> for linux-fsdevel@vger.kernel.org; Mon, 15 Jul 2013 09:00:21 +0900 (KST) In-reply-to: <51D9324A.3010305@gmail.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Hi, 2013-07-07 (=EC=9D=BC), 17:18 +0800, Wang Sheng-Hui: > On 2013=E5=B9=B407=E6=9C=8807=E6=97=A5 17:10, Wang Sheng-Hui wrote: > > Check the bound earlier than computing the next search start pos. > > > > Signed-off-by: Wang Sheng-Hui > > --- > > fs/f2fs/dir.c | 8 ++++++-- > > 1 file changed, 6 insertions(+), 2 deletions(-) > > > > diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c > > index 9d1cd42..83a3549 100644 > > --- a/fs/f2fs/dir.c > > +++ b/fs/f2fs/dir.c > > @@ -406,13 +406,17 @@ next: > > zero_end =3D find_next_bit_le(&dentry_blk->dentry_bitmap, > > NR_DENTRY_IN_BLOCK, > > zero_start); > > + if (zero_end >=3D NR_DENTRY_IN_BLOCK) > > + zero_end =3D NR_DENTRY_IN_BLOCK; > > + This assignment is needless, since find_next_bit_le returns less or equal than NR_DENTRY_IN_BLOCK all the time. > > if (zero_end - zero_start >=3D slots) > > return zero_start; > > > > + if (zero_end >=3D NR_DENTRY_IN_BLOCK) > > + return NR_DENTRY_IN_BLOCK; > > + So we don't need to do like this. Thanks, > > bit_start =3D zero_end + 1; > > > > - if (zero_end + 1 >=3D NR_DENTRY_IN_BLOCK) > > - return NR_DENTRY_IN_BLOCK; > > goto next; > > } > > >=20 > Sorry, paste the wrong one. Please check the following patch. >=20 > Thanks, >=20 >=20 > From cda0fe2ebdd2d5afe2324c567444fc6329f98d6d Mon Sep 17 00:00:00 20= 01 > From: Wang Sheng-Hui > Date: Sun, 7 Jul 2013 17:15:54 +0800 > Subject: [PATCH] f2fs: check the search bound earlier in dir.c/room_f= or_filename >=20 > Check the bound earlier than computing the next search start pos. >=20 > Signed-off-by: Wang Sheng-Hui > --- > fs/f2fs/dir.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) >=20 > diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c > index 9d1cd42..cc405c5 100644 > --- a/fs/f2fs/dir.c > +++ b/fs/f2fs/dir.c > @@ -406,12 +406,14 @@ next: > zero_end =3D find_next_bit_le(&dentry_blk->dentry_bitmap, > NR_DENTRY_IN_BLOCK, > zero_start); > + if (zero_end >=3D NR_DENTRY_IN_BLOCK) > + zero_end =3D NR_DENTRY_IN_BLOCK; > + > if (zero_end - zero_start >=3D slots) > return zero_start; >=20 > bit_start =3D zero_end + 1; > - > - if (zero_end + 1 >=3D NR_DENTRY_IN_BLOCK) > + if (bit_start >=3D NR_DENTRY_IN_BLOCK) > return NR_DENTRY_IN_BLOCK; > goto next; > } --=20 Jaegeuk Kim Samsung -- 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