linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] f2fs: check the search bound earlier in dir.c/room_for_filename
@ 2013-07-07  9:10 Wang Sheng-Hui
  2013-07-07  9:18 ` Wang Sheng-Hui
  0 siblings, 1 reply; 3+ messages in thread
From: Wang Sheng-Hui @ 2013-07-07  9:10 UTC (permalink / raw)
  To: jaegeuk.kim, linux-fsdevel

Check the bound earlier than computing the next search start pos.

Signed-off-by: Wang Sheng-Hui <shhuiw@gmail.com>
---
  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 = find_next_bit_le(&dentry_blk->dentry_bitmap,
  						NR_DENTRY_IN_BLOCK,
  						zero_start);
+	if (zero_end >= NR_DENTRY_IN_BLOCK)
+		zero_end = NR_DENTRY_IN_BLOCK;	
+
  	if (zero_end - zero_start >= slots)
  		return zero_start;

+	if (zero_end >= NR_DENTRY_IN_BLOCK)
+		return NR_DENTRY_IN_BLOCK;
+
  	bit_start = zero_end + 1;

-	if (zero_end + 1 >= NR_DENTRY_IN_BLOCK)
-		return NR_DENTRY_IN_BLOCK;
  	goto next;
  }

-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] f2fs: check the search bound earlier in dir.c/room_for_filename
  2013-07-07  9:10 [PATCH] f2fs: check the search bound earlier in dir.c/room_for_filename Wang Sheng-Hui
@ 2013-07-07  9:18 ` Wang Sheng-Hui
  2013-07-15  0:00   ` Jaegeuk Kim
  0 siblings, 1 reply; 3+ messages in thread
From: Wang Sheng-Hui @ 2013-07-07  9:18 UTC (permalink / raw)
  To: jaegeuk.kim, linux-fsdevel

On 2013年07月07日 17:10, Wang Sheng-Hui wrote:
> Check the bound earlier than computing the next search start pos.
>
> Signed-off-by: Wang Sheng-Hui <shhuiw@gmail.com>
> ---
>   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 = find_next_bit_le(&dentry_blk->dentry_bitmap,
>                           NR_DENTRY_IN_BLOCK,
>                           zero_start);
> +    if (zero_end >= NR_DENTRY_IN_BLOCK)
> +        zero_end = NR_DENTRY_IN_BLOCK;
> +
>       if (zero_end - zero_start >= slots)
>           return zero_start;
>
> +    if (zero_end >= NR_DENTRY_IN_BLOCK)
> +        return NR_DENTRY_IN_BLOCK;
> +
>       bit_start = zero_end + 1;
>
> -    if (zero_end + 1 >= 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
From: Wang Sheng-Hui <shhuiw@gmail.com>
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 <shhuiw@gmail.com>
---
  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 = find_next_bit_le(&dentry_blk->dentry_bitmap,
  						NR_DENTRY_IN_BLOCK,
  						zero_start);
+	if (zero_end >= NR_DENTRY_IN_BLOCK)
+		zero_end = NR_DENTRY_IN_BLOCK;
+
  	if (zero_end - zero_start >= slots)
  		return zero_start;

  	bit_start = zero_end + 1;
-
-	if (zero_end + 1 >= NR_DENTRY_IN_BLOCK)
+	if (bit_start >= NR_DENTRY_IN_BLOCK)
  		return NR_DENTRY_IN_BLOCK;
  	goto next;
  }
-- 
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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] f2fs: check the search bound earlier in dir.c/room_for_filename
  2013-07-07  9:18 ` Wang Sheng-Hui
@ 2013-07-15  0:00   ` Jaegeuk Kim
  0 siblings, 0 replies; 3+ messages in thread
From: Jaegeuk Kim @ 2013-07-15  0:00 UTC (permalink / raw)
  To: Wang Sheng-Hui; +Cc: linux-fsdevel

Hi,

2013-07-07 (일), 17:18 +0800, Wang Sheng-Hui:
> On 2013年07月07日 17:10, Wang Sheng-Hui wrote:
> > Check the bound earlier than computing the next search start pos.
> >
> > Signed-off-by: Wang Sheng-Hui <shhuiw@gmail.com>
> > ---
> >   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 = find_next_bit_le(&dentry_blk->dentry_bitmap,
> >                           NR_DENTRY_IN_BLOCK,
> >                           zero_start);
> > +    if (zero_end >= NR_DENTRY_IN_BLOCK)
> > +        zero_end = 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 >= slots)
> >           return zero_start;
> >
> > +    if (zero_end >= NR_DENTRY_IN_BLOCK)
> > +        return NR_DENTRY_IN_BLOCK;
> > +

So we don't need to do like this.
Thanks,

> >       bit_start = zero_end + 1;
> >
> > -    if (zero_end + 1 >= 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
> From: Wang Sheng-Hui <shhuiw@gmail.com>
> 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 <shhuiw@gmail.com>
> ---
>   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 = find_next_bit_le(&dentry_blk->dentry_bitmap,
>   						NR_DENTRY_IN_BLOCK,
>   						zero_start);
> +	if (zero_end >= NR_DENTRY_IN_BLOCK)
> +		zero_end = NR_DENTRY_IN_BLOCK;
> +
>   	if (zero_end - zero_start >= slots)
>   		return zero_start;
> 
>   	bit_start = zero_end + 1;
> -
> -	if (zero_end + 1 >= NR_DENTRY_IN_BLOCK)
> +	if (bit_start >= NR_DENTRY_IN_BLOCK)
>   		return NR_DENTRY_IN_BLOCK;
>   	goto next;
>   }

-- 
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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-07-15  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-07  9:10 [PATCH] f2fs: check the search bound earlier in dir.c/room_for_filename Wang Sheng-Hui
2013-07-07  9:18 ` Wang Sheng-Hui
2013-07-15  0:00   ` Jaegeuk Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).