[PATCH] f2fs: check the search bound earlier in dir.c/room_for_filename

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Signed-off-by: Wang Sheng-Hui <shhuiw@xxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux