Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 287885
b: refs/heads/master
c: 2cac13e
h: refs/heads/master
i:
  287883: 530d758
v: v3
  • Loading branch information
Liu Bo authored and David Sterba committed Feb 15, 2012
1 parent 2452e1e commit 0cc3b8f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6af021d8fc3bcce790e7fbb391e39c5920fa3f71
refs/heads/master: 2cac13e41bf5b99ffc426bd28dfd2248df1dfa67
9 changes: 8 additions & 1 deletion trunk/fs/btrfs/extent-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -7886,9 +7886,16 @@ int btrfs_trim_fs(struct btrfs_root *root, struct fstrim_range *range)
u64 start;
u64 end;
u64 trimmed = 0;
u64 total_bytes = btrfs_super_total_bytes(fs_info->super_copy);
int ret = 0;

cache = btrfs_lookup_block_group(fs_info, range->start);
/*
* try to trim all FS space, our block group may start from non-zero.
*/
if (range->len == total_bytes)
cache = btrfs_lookup_first_block_group(fs_info, range->start);
else
cache = btrfs_lookup_block_group(fs_info, range->start);

while (cache) {
if (cache->key.objectid >= (range->start + range->len)) {
Expand Down

0 comments on commit 0cc3b8f

Please sign in to comment.