Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 332530
b: refs/heads/master
c: 2671485
h: refs/heads/master
v: v3
  • Loading branch information
Josef Bacik authored and Chris Mason committed Oct 1, 2012
1 parent 08958f5 commit 86773d2
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 31 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: d2794405113cd04f13a58e32e4d541dc87ec86e4
refs/heads/master: 2671485d395c07fca104c972785898d7c52fc942
4 changes: 2 additions & 2 deletions trunk/fs/btrfs/ctree.h
Original file line number Diff line number Diff line change
Expand Up @@ -3323,10 +3323,10 @@ extern const struct file_operations btrfs_file_operations;
int __btrfs_drop_extents(struct btrfs_trans_handle *trans,
struct btrfs_root *root, struct inode *inode,
struct btrfs_path *path, u64 start, u64 end,
u64 *hint_byte, int drop_cache);
int drop_cache);
int btrfs_drop_extents(struct btrfs_trans_handle *trans,
struct btrfs_root *root, struct inode *inode, u64 start,
u64 end, u64 *hint_byte, int drop_cache);
u64 end, int drop_cache);
int btrfs_mark_extent_written(struct btrfs_trans_handle *trans,
struct inode *inode, u64 start, u64 end);
int btrfs_release_file(struct inode *inode, struct file *file);
Expand Down
16 changes: 5 additions & 11 deletions trunk/fs/btrfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ int btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end,
int __btrfs_drop_extents(struct btrfs_trans_handle *trans,
struct btrfs_root *root, struct inode *inode,
struct btrfs_path *path, u64 start, u64 end,
u64 *hint_byte, int drop_cache)
int drop_cache)
{
struct extent_buffer *leaf;
struct btrfs_file_extent_item *fi;
Expand Down Expand Up @@ -716,7 +716,6 @@ int __btrfs_drop_extents(struct btrfs_trans_handle *trans,
new_key.objectid,
start - extent_offset, 0);
BUG_ON(ret); /* -ENOMEM */
*hint_byte = disk_bytenr;
}
key.offset = start;
}
Expand All @@ -736,10 +735,8 @@ int __btrfs_drop_extents(struct btrfs_trans_handle *trans,
btrfs_set_file_extent_num_bytes(leaf, fi,
extent_end - end);
btrfs_mark_buffer_dirty(leaf);
if (update_refs && disk_bytenr > 0) {
if (update_refs && disk_bytenr > 0)
inode_sub_bytes(inode, end - key.offset);
*hint_byte = disk_bytenr;
}
break;
}

Expand All @@ -755,10 +752,8 @@ int __btrfs_drop_extents(struct btrfs_trans_handle *trans,
btrfs_set_file_extent_num_bytes(leaf, fi,
start - key.offset);
btrfs_mark_buffer_dirty(leaf);
if (update_refs && disk_bytenr > 0) {
if (update_refs && disk_bytenr > 0)
inode_sub_bytes(inode, extent_end - start);
*hint_byte = disk_bytenr;
}
if (end == extent_end)
break;

Expand Down Expand Up @@ -794,7 +789,6 @@ int __btrfs_drop_extents(struct btrfs_trans_handle *trans,
BUG_ON(ret); /* -ENOMEM */
inode_sub_bytes(inode,
extent_end - key.offset);
*hint_byte = disk_bytenr;
}

if (end == extent_end)
Expand Down Expand Up @@ -834,7 +828,7 @@ int __btrfs_drop_extents(struct btrfs_trans_handle *trans,

int btrfs_drop_extents(struct btrfs_trans_handle *trans,
struct btrfs_root *root, struct inode *inode, u64 start,
u64 end, u64 *hint_byte, int drop_cache)
u64 end, int drop_cache)
{
struct btrfs_path *path;
int ret;
Expand All @@ -843,7 +837,7 @@ int btrfs_drop_extents(struct btrfs_trans_handle *trans,
if (!path)
return -ENOMEM;
ret = __btrfs_drop_extents(trans, root, inode, path, start, end,
hint_byte, drop_cache);
drop_cache);
btrfs_free_path(path);
return ret;
}
Expand Down
12 changes: 3 additions & 9 deletions trunk/fs/btrfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ static noinline int cow_file_range_inline(struct btrfs_trans_handle *trans,
u64 inline_len = actual_end - start;
u64 aligned_end = (end + root->sectorsize - 1) &
~((u64)root->sectorsize - 1);
u64 hint_byte;
u64 data_len = inline_len;
int ret;

Expand All @@ -247,8 +246,7 @@ static noinline int cow_file_range_inline(struct btrfs_trans_handle *trans,
return 1;
}

ret = btrfs_drop_extents(trans, root, inode, start, aligned_end,
&hint_byte, 1);
ret = btrfs_drop_extents(trans, root, inode, start, aligned_end, 1);
if (ret)
return ret;

Expand Down Expand Up @@ -1786,7 +1784,6 @@ static int insert_reserved_file_extent(struct btrfs_trans_handle *trans,
struct btrfs_path *path;
struct extent_buffer *leaf;
struct btrfs_key ins;
u64 hint;
int ret;

path = btrfs_alloc_path();
Expand All @@ -1805,8 +1802,7 @@ static int insert_reserved_file_extent(struct btrfs_trans_handle *trans,
* with the others.
*/
ret = btrfs_drop_extents(trans, root, inode, file_pos,
file_pos + num_bytes,
&hint, 0);
file_pos + num_bytes, 0);
if (ret)
goto out;

Expand Down Expand Up @@ -3629,7 +3625,6 @@ int btrfs_cont_expand(struct inode *inode, loff_t oldsize, loff_t size)
last_byte = (last_byte + mask) & ~mask;
if (!test_bit(EXTENT_FLAG_PREALLOC, &em->flags)) {
struct extent_map *hole_em;
u64 hint_byte = 0;
hole_size = last_byte - cur_offset;

trans = btrfs_start_transaction(root, 3);
Expand All @@ -3640,8 +3635,7 @@ int btrfs_cont_expand(struct inode *inode, loff_t oldsize, loff_t size)

err = btrfs_drop_extents(trans, root, inode,
cur_offset,
cur_offset + hole_size,
&hint_byte, 1);
cur_offset + hole_size, 1);
if (err) {
btrfs_abort_transaction(trans, root, err);
btrfs_end_transaction(trans, root);
Expand Down
5 changes: 2 additions & 3 deletions trunk/fs/btrfs/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -2353,7 +2353,6 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
int ret;
u64 len = olen;
u64 bs = root->fs_info->sb->s_blocksize;
u64 hint_byte;

/*
* TODO:
Expand Down Expand Up @@ -2579,7 +2578,7 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
ret = btrfs_drop_extents(trans, root, inode,
new_key.offset,
new_key.offset + datal,
&hint_byte, 1);
1);
if (ret) {
btrfs_abort_transaction(trans, root,
ret);
Expand Down Expand Up @@ -2653,7 +2652,7 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
ret = btrfs_drop_extents(trans, root, inode,
new_key.offset,
new_key.offset + datal,
&hint_byte, 1);
1);
if (ret) {
btrfs_abort_transaction(trans, root,
ret);
Expand Down
7 changes: 2 additions & 5 deletions trunk/fs/btrfs/tree-log.c
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,6 @@ static noinline int replay_one_extent(struct btrfs_trans_handle *trans,
int found_type;
u64 mask = root->sectorsize - 1;
u64 extent_end;
u64 alloc_hint;
u64 start = key->offset;
u64 saved_nbytes;
struct btrfs_file_extent_item *item;
Expand Down Expand Up @@ -551,8 +550,7 @@ static noinline int replay_one_extent(struct btrfs_trans_handle *trans,

saved_nbytes = inode_get_bytes(inode);
/* drop any overlapping extents */
ret = btrfs_drop_extents(trans, root, inode, start, extent_end,
&alloc_hint, 1);
ret = btrfs_drop_extents(trans, root, inode, start, extent_end, 1);
BUG_ON(ret);

if (found_type == BTRFS_FILE_EXTENT_REG ||
Expand Down Expand Up @@ -2843,9 +2841,8 @@ static int log_one_extent(struct btrfs_trans_handle *trans,
int ret;

if (BTRFS_I(inode)->logged_trans == trans->transid) {
u64 tmp;
ret = __btrfs_drop_extents(trans, log, inode, dst_path, start,
start + len, &tmp, 0);
start + len, 0);
if (ret)
return ret;
}
Expand Down

0 comments on commit 86773d2

Please sign in to comment.