diff options
author | Josef Bacik <josef@redhat.com> | 2011-02-02 21:39:52 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2011-02-06 07:13:12 -0500 |
commit | 13dbc08987f25d9dba488a34b44b43e3844b027c (patch) | |
tree | f1ccabbf2c8bc676be0dacacc3da86c62cf1b19f /fs | |
parent | 98d5dc13e7e74b77ca3b4c3cbded9f48d2dbbbb7 (diff) |
Btrfs: make sure search_bitmap finds something in remove_from_bitmap
When we're cleaning up the tree log we need to be able to remove free space from
the block group. The problem is if that free space spans bitmaps we would not
find the space since we're looking for too many bytes. So make sure the amount
of bytes we search for is limited to either the number of bytes we want, or the
number of bytes left in the bitmap. This was tested by a user who was hitting
the BUG() after search_bitmap. With this patch he can now mount his fs.
Thanks,
Signed-off-by: Josef Bacik <josef@redhat.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/free-space-cache.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c index a5501edc3c9f..a0390657451b 100644 --- a/fs/btrfs/free-space-cache.c +++ b/fs/btrfs/free-space-cache.c | |||
@@ -1216,6 +1216,7 @@ again: | |||
1216 | */ | 1216 | */ |
1217 | search_start = *offset; | 1217 | search_start = *offset; |
1218 | search_bytes = *bytes; | 1218 | search_bytes = *bytes; |
1219 | search_bytes = min(search_bytes, end - search_start + 1); | ||
1219 | ret = search_bitmap(block_group, bitmap_info, &search_start, | 1220 | ret = search_bitmap(block_group, bitmap_info, &search_start, |
1220 | &search_bytes); | 1221 | &search_bytes); |
1221 | BUG_ON(ret < 0 || search_start != *offset); | 1222 | BUG_ON(ret < 0 || search_start != *offset); |