[Btrfs-devel][PATCH]Off by one fix for btrfs_drop_extents

Yan Zheng yanzheng at 21cn.com
Fri Dec 14 05:20:15 PST 2007


Hello,

One of my old patches introduces a new bug to
btrfs_drop_extents(changeset 275). Inline extents are not truncated
properly when "extent_end == end", it can trigger the BUG_ON at
file.c:600.  I hope I don't introduce new bug this time.

Regards
YZ
---
diff -r 3734c71a6b6d file.c
--- a/file.c	Thu Dec 13 11:13:32 2007 -0500
+++ b/file.c	Fri Dec 14 21:02:40 2007 +0800
@@ -481,8 +481,9 @@ next_slot:
 			search_start = (extent_end + mask) & ~mask;
 		} else
 			search_start = extent_end;
-		if (end < extent_end && start > key.offset && found_inline) {
+		if (end <= extent_end && start >= key.offset && found_inline) {
 			*hint_byte = EXTENT_MAP_INLINE;
+			continue;
 		}
 		if (end < extent_end && end >= key.offset) {
 			if (found_extent) {



More information about the Btrfs-devel mailing list