diff options
author | Chris Mason <chris.mason@fusionio.com> | 2013-02-20 14:05:45 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@fusionio.com> | 2013-02-20 14:05:45 -0500 |
commit | b2c6b3e0611c58fbeb6b9c0892b6249f7bdfaf6b (patch) | |
tree | de7cf0825605aa6acf33a8d107003efd7aedbe72 /fs/btrfs/free-space-cache.c | |
parent | 19f949f52599ba7c3f67a5897ac6be14bfcb1200 (diff) | |
parent | 272d26d0ad8c0e326689f2fa3cdc6a5fcc8e74e0 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/josef/btrfs-next into for-linus-3.9
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Conflicts:
fs/btrfs/disk-io.c
Diffstat (limited to 'fs/btrfs/free-space-cache.c')
-rw-r--r-- | fs/btrfs/free-space-cache.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c index 0be7a8742a43..c8090f18c217 100644 --- a/fs/btrfs/free-space-cache.c +++ b/fs/btrfs/free-space-cache.c | |||
@@ -1356,6 +1356,8 @@ static void recalculate_thresholds(struct btrfs_free_space_ctl *ctl) | |||
1356 | u64 bytes_per_bg = BITS_PER_BITMAP * ctl->unit; | 1356 | u64 bytes_per_bg = BITS_PER_BITMAP * ctl->unit; |
1357 | int max_bitmaps = div64_u64(size + bytes_per_bg - 1, bytes_per_bg); | 1357 | int max_bitmaps = div64_u64(size + bytes_per_bg - 1, bytes_per_bg); |
1358 | 1358 | ||
1359 | max_bitmaps = max(max_bitmaps, 1); | ||
1360 | |||
1359 | BUG_ON(ctl->total_bitmaps > max_bitmaps); | 1361 | BUG_ON(ctl->total_bitmaps > max_bitmaps); |
1360 | 1362 | ||
1361 | /* | 1363 | /* |
@@ -1636,10 +1638,14 @@ static bool use_bitmap(struct btrfs_free_space_ctl *ctl, | |||
1636 | } | 1638 | } |
1637 | 1639 | ||
1638 | /* | 1640 | /* |
1639 | * some block groups are so tiny they can't be enveloped by a bitmap, so | 1641 | * The original block groups from mkfs can be really small, like 8 |
1640 | * don't even bother to create a bitmap for this | 1642 | * megabytes, so don't bother with a bitmap for those entries. However |
1643 | * some block groups can be smaller than what a bitmap would cover but | ||
1644 | * are still large enough that they could overflow the 32k memory limit, | ||
1645 | * so allow those block groups to still be allowed to have a bitmap | ||
1646 | * entry. | ||
1641 | */ | 1647 | */ |
1642 | if (BITS_PER_BITMAP * ctl->unit > block_group->key.offset) | 1648 | if (((BITS_PER_BITMAP * ctl->unit) >> 1) > block_group->key.offset) |
1643 | return false; | 1649 | return false; |
1644 | 1650 | ||
1645 | return true; | 1651 | return true; |