Commit 2671485d authored by Josef Bacik's avatar Josef Bacik Committed by Chris Mason

Btrfs: remove unused hint byte argument for btrfs_drop_extents

I audited all users of btrfs_drop_extents and found that nobody actually uses
the hint_byte argument.  I'm sure it was used for something at some point but
it's not used now, and the way the pinning works the disk bytenr would never be
immediately useful anyway so lets just remove it.  Thanks,
Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
parent d2794405
......@@ -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);
......
......@@ -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;
......@@ -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;
}
......@@ -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;
}
......@@ -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;
......@@ -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)
......@@ -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;
......@@ -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;
}
......
......@@ -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;
......@@ -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;
......@@ -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();
......@@ -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;
......@@ -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);
......@@ -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);
......
......@@ -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:
......@@ -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);
......@@ -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);
......
......@@ -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;
......@@ -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 ||
......@@ -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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment