Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 332535
b: refs/heads/master
c: 7014cdb
h: refs/heads/master
i:
  332533: c49d9ec
  332531: b54ec47
  332527: e63a77b
v: v3
  • Loading branch information
Josef Bacik authored and Chris Mason committed Oct 1, 2012
1 parent 011c8b4 commit 577fe5d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 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: ac14aed66558d686b1f95dac1f07ecfe11d8c30e
refs/heads/master: 7014cdb49305eda0767d2ae6136f8c191ea8fd81
4 changes: 2 additions & 2 deletions trunk/fs/btrfs/ctree.h
Original file line number Diff line number Diff line change
Expand Up @@ -3316,8 +3316,8 @@ int btrfs_add_inode_defrag(struct btrfs_trans_handle *trans,
struct inode *inode);
int btrfs_run_defrag_inodes(struct btrfs_fs_info *fs_info);
int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync);
int btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end,
int skip_pinned);
void btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end,
int skip_pinned);
int btrfs_replace_extent_cache(struct inode *inode, struct extent_map *replace,
u64 start, u64 end, int skip_pinned,
int modified);
Expand Down
13 changes: 9 additions & 4 deletions trunk/fs/btrfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -459,8 +459,8 @@ int btrfs_dirty_pages(struct btrfs_root *root, struct inode *inode,
* this drops all the extents in the cache that intersect the range
* [start, end]. Existing extents are split as required.
*/
int btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end,
int skip_pinned)
void btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end,
int skip_pinned)
{
struct extent_map *em;
struct extent_map *split = NULL;
Expand All @@ -479,11 +479,14 @@ int btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end,
testend = 0;
}
while (1) {
int no_splits = 0;

if (!split)
split = alloc_extent_map();
if (!split2)
split2 = alloc_extent_map();
BUG_ON(!split || !split2); /* -ENOMEM */
if (!split || !split2)
no_splits = 1;

write_lock(&em_tree->lock);
em = lookup_extent_mapping(em_tree, start, len);
Expand All @@ -509,6 +512,8 @@ int btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end,
compressed = test_bit(EXTENT_FLAG_COMPRESSED, &em->flags);
clear_bit(EXTENT_FLAG_PINNED, &em->flags);
remove_extent_mapping(em_tree, em);
if (no_splits)
goto next;

if (em->block_start < EXTENT_MAP_LAST_BYTE &&
em->start < start) {
Expand Down Expand Up @@ -559,6 +564,7 @@ int btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end,
free_extent_map(split);
split = NULL;
}
next:
write_unlock(&em_tree->lock);

/* once for us */
Expand All @@ -570,7 +576,6 @@ int btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end,
free_extent_map(split);
if (split2)
free_extent_map(split2);
return 0;
}

/*
Expand Down

0 comments on commit 577fe5d

Please sign in to comment.