]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
Btrfs: Fix test_range_bit for whole file extents
authorChris Mason <chris.mason@oracle.com>
Thu, 24 Sep 2009 00:23:16 +0000 (20:23 -0400)
committerChris Mason <chris.mason@oracle.com>
Thu, 24 Sep 2009 00:30:52 +0000 (20:30 -0400)
If test_range_bit finds an extent that goes all the way to (u64)-1, it
can incorrectly wrap the u64 instead of treaing it like the end of
the address space.

This just adds a check for the highest possible offset so we don't wrap.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/extent_io.c

index b9506548853b20a11df852c543b1e57b7e2ae878..dcce98d0ec4f85e901e7c5de18d907b702eee1b9 100644 (file)
@@ -1564,6 +1564,10 @@ int test_range_bit(struct extent_io_tree *tree, u64 start, u64 end,
                        bitset = 0;
                        break;
                }
+
+               if (state->end == (u64)-1)
+                       break;
+
                start = state->end + 1;
                if (start > end)
                        break;