From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wang Sheng-Hui Subject: Re: [PATCH] f2fs: check the search bound earlier in dir.c/room_for_filename Date: Sun, 07 Jul 2013 17:18:02 +0800 Message-ID: <51D9324A.3010305@gmail.com> References: <51D93068.3080606@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE To: jaegeuk.kim@samsung.com, linux-fsdevel@vger.kernel.org Return-path: Received: from mail-pb0-f49.google.com ([209.85.160.49]:35324 "EHLO mail-pb0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751683Ab3GGJSH (ORCPT ); Sun, 7 Jul 2013 05:18:07 -0400 Received: by mail-pb0-f49.google.com with SMTP id jt11so3315449pbb.8 for ; Sun, 07 Jul 2013 02:18:07 -0700 (PDT) In-Reply-To: <51D93068.3080606@gmail.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: 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; > + > if (zero_end - zero_start >=3D slots) > return zero_start; > > + if (zero_end >=3D NR_DENTRY_IN_BLOCK) > + return NR_DENTRY_IN_BLOCK; > + > bit_start =3D zero_end + 1; > > - if (zero_end + 1 >=3D NR_DENTRY_IN_BLOCK) > - return NR_DENTRY_IN_BLOCK; > goto next; > } > Sorry, paste the wrong one. Please check the following patch. Thanks, From cda0fe2ebdd2d5afe2324c567444fc6329f98d6d Mon Sep 17 00:00:00 2001 =46rom: Wang Sheng-Hui Date: Sun, 7 Jul 2013 17:15:54 +0800 Subject: [PATCH] f2fs: check the search bound earlier in dir.c/room_for= _filename Check the bound earlier than computing the next search start pos. Signed-off-by: Wang Sheng-Hui --- fs/f2fs/dir.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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; 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 1.7.10.4 -- 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