Skip to contentSkip to conversation

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

PATCH In review Wang Sheng-Hui 2 participants 3 messages Jul 7, 2013 – Jul 15, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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

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

---
 fs/f2fs/dir.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
fs/f2fs/dir.c +6 -2
index 9d1cd42..83a3549 100644
@@ -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;
 }
 
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 21 lines · Wang Sheng-Hui

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

---
  fs/f2fs/dir.c |    8 ++++++--
  1 file changed, 6 insertions(+), 2 deletions(-)
fs/f2fs/dir.c +3 -0
index 9d1cd42..83a3549 100644
@@ -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;
 

fs/f2fs/dir.c next: · line 422

Quoted 10 lines
fs/f2fs/dir.c +3 -2
+    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 <[email protected]>
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.

---
 fs/f2fs/dir.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
fs/f2fs/dir.c +4 -2
index 9d1cd42..cc405c5 100644
@@ -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;
 }
Signature · 8 lines
1.7.10.4



--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#2 lore raw

Hi,

2013-07-07 (일), 17:18 +0800, Wang Sheng-Hui:

Quoted 8 lines · Wang Sheng-Hui
Quoted 7 lines

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

---
  fs/f2fs/dir.c |    8 ++++++--
  1 file changed, 6 insertions(+), 2 deletions(-)
Quoted 11 lines

fs/f2fs/dir.c next: · line 411

Quoted 11 lines
fs/f2fs/dir.c +3 -0
index 9d1cd42..83a3549 100644
@@ -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.

Quoted 6 lines

fs/f2fs/dir.c next:

Quoted 6 lines
fs/f2fs/dir.c +3 -0
      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,

Quoted 46 lines

fs/f2fs/dir.c next:

Quoted 7 lines
fs/f2fs/dir.c +0 -2
      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 <[email protected]>
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.

---
  fs/f2fs/dir.c |    6 ++++--
  1 file changed, 4 insertions(+), 2 deletions(-)
fs/f2fs/dir.c +4 -2
index 9d1cd42..cc405c5 100644
@@ -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;
  }
Signature · 7 lines
Jaegeuk Kim
Samsung

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