From: Wang Sheng-Hui <shhuiw@gmail.com>
To: jaegeuk.kim@samsung.com, linux-fsdevel@vger.kernel.org
Subject: [PATCH] f2fs: check the search bound earlier in dir.c/room_for_filename
Date: Sun, 07 Jul 2013 17:10:00 +0800 [thread overview]
Message-ID: <51D93068.3080606@gmail.com> (raw)
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
next reply other threads:[~2013-07-07 9:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-07 9:10 Wang Sheng-Hui [this message]
2013-07-07 9:18 ` [PATCH] f2fs: check the search bound earlier in dir.c/room_for_filename Wang Sheng-Hui
2013-07-15 0:00 ` Jaegeuk Kim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51D93068.3080606@gmail.com \
--to=shhuiw@gmail.com \
--cc=jaegeuk.kim@samsung.com \
--cc=linux-fsdevel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.