aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/btrfs/extent-tree.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index fa57965f60a3..94bed61b799f 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -270,9 +270,27 @@ static int exclude_super_stripes(struct btrfs_root *root,
270 return ret; 270 return ret;
271 271
272 while (nr--) { 272 while (nr--) {
273 cache->bytes_super += stripe_len; 273 u64 start, len;
274 ret = add_excluded_extent(root, logical[nr], 274
275 stripe_len); 275 if (logical[nr] > cache->key.objectid +
276 cache->key.offset)
277 continue;
278
279 if (logical[nr] + stripe_len <= cache->key.objectid)
280 continue;
281
282 start = logical[nr];
283 if (start < cache->key.objectid) {
284 start = cache->key.objectid;
285 len = (logical[nr] + stripe_len) - start;
286 } else {
287 len = min_t(u64, stripe_len,
288 cache->key.objectid +
289 cache->key.offset - start);
290 }
291
292 cache->bytes_super += len;
293 ret = add_excluded_extent(root, start, len);
276 if (ret) { 294 if (ret) {
277 kfree(logical); 295 kfree(logical);
278 return ret; 296 return ret;