Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 360502
b: refs/heads/master
c: 124fe66
h: refs/heads/master
v: v3
  • Loading branch information
Josef Bacik committed Mar 1, 2013
1 parent 6fded55 commit dd771f9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 83c8266acc1d19debbf353a16aabbd892ef99462
refs/heads/master: 124fe663f93162d17b7e391705cac122101e93d8
18 changes: 18 additions & 0 deletions trunk/fs/btrfs/tree-log.c
Original file line number Diff line number Diff line change
Expand Up @@ -3300,6 +3300,7 @@ static int log_one_extent(struct btrfs_trans_handle *trans,
int index = log->log_transid % 2;
bool skip_csum = BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM;

insert:
INIT_LIST_HEAD(&ordered_sums);
btrfs_init_map_token(&token);
key.objectid = btrfs_ino(inode);
Expand All @@ -3315,6 +3316,23 @@ static int log_one_extent(struct btrfs_trans_handle *trans,
leaf = path->nodes[0];
fi = btrfs_item_ptr(leaf, path->slots[0],
struct btrfs_file_extent_item);

/*
* If we are overwriting an inline extent with a real one then we need
* to just delete the inline extent as it may not be large enough to
* have the entire file_extent_item.
*/
if (ret && btrfs_token_file_extent_type(leaf, fi, &token) ==
BTRFS_FILE_EXTENT_INLINE) {
ret = btrfs_del_item(trans, log, path);
btrfs_release_path(path);
if (ret) {
path->really_keep_locks = 0;
return ret;
}
goto insert;
}

btrfs_set_token_file_extent_generation(leaf, fi, em->generation,
&token);
if (test_bit(EXTENT_FLAG_PREALLOC, &em->flags)) {
Expand Down

0 comments on commit dd771f9

Please sign in to comment.