Skip to content

Commit

Permalink
btrfs: make btrfs_lookup_first_ordered_extent take btrfs_inode
Browse files Browse the repository at this point in the history
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
  • Loading branch information
Nikolay Borisov authored and David Sterba committed Oct 7, 2020
1 parent b79b724 commit 6d072c8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
6 changes: 4 additions & 2 deletions fs/btrfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -2541,7 +2541,8 @@ static int btrfs_punch_hole_lock_range(struct inode *inode,

lock_extent_bits(&BTRFS_I(inode)->io_tree, lockstart, lockend,
cached_state);
ordered = btrfs_lookup_first_ordered_extent(inode, lockend);
ordered = btrfs_lookup_first_ordered_extent(BTRFS_I(inode),
lockend);

/*
* We need to make sure we have no ordered extents in this range
Expand Down Expand Up @@ -3400,7 +3401,8 @@ static long btrfs_fallocate(struct file *file, int mode,
*/
lock_extent_bits(&BTRFS_I(inode)->io_tree, alloc_start,
locked_end, &cached_state);
ordered = btrfs_lookup_first_ordered_extent(inode, locked_end);
ordered = btrfs_lookup_first_ordered_extent(BTRFS_I(inode),
locked_end);

if (ordered &&
ordered->file_offset + ordered->num_bytes > alloc_start &&
Expand Down
3 changes: 2 additions & 1 deletion fs/btrfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -8672,7 +8672,8 @@ void btrfs_destroy_inode(struct inode *inode)
return;

while (1) {
ordered = btrfs_lookup_first_ordered_extent(inode, (u64)-1);
ordered = btrfs_lookup_first_ordered_extent(BTRFS_I(inode),
(u64)-1);
if (!ordered)
break;
else {
Expand Down
6 changes: 3 additions & 3 deletions fs/btrfs/ordered-data.c
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ int btrfs_wait_ordered_range(struct inode *inode, u64 start, u64 len)

end = orig_end;
while (1) {
ordered = btrfs_lookup_first_ordered_extent(inode, end);
ordered = btrfs_lookup_first_ordered_extent(BTRFS_I(inode), end);
if (!ordered)
break;
if (ordered->file_offset > orig_end) {
Expand Down Expand Up @@ -838,13 +838,13 @@ void btrfs_get_ordered_extents_for_logging(struct btrfs_inode *inode,
* if none is found
*/
struct btrfs_ordered_extent *
btrfs_lookup_first_ordered_extent(struct inode *inode, u64 file_offset)
btrfs_lookup_first_ordered_extent(struct btrfs_inode *inode, u64 file_offset)
{
struct btrfs_ordered_inode_tree *tree;
struct rb_node *node;
struct btrfs_ordered_extent *entry = NULL;

tree = &BTRFS_I(inode)->ordered_tree;
tree = &inode->ordered_tree;
spin_lock_irq(&tree->lock);
node = tree_search(tree, file_offset);
if (!node)
Expand Down
2 changes: 1 addition & 1 deletion fs/btrfs/ordered-data.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ void btrfs_start_ordered_extent(struct inode *inode,
struct btrfs_ordered_extent *entry, int wait);
int btrfs_wait_ordered_range(struct inode *inode, u64 start, u64 len);
struct btrfs_ordered_extent *
btrfs_lookup_first_ordered_extent(struct inode * inode, u64 file_offset);
btrfs_lookup_first_ordered_extent(struct btrfs_inode *inode, u64 file_offset);
struct btrfs_ordered_extent *btrfs_lookup_ordered_range(
struct btrfs_inode *inode,
u64 file_offset,
Expand Down

0 comments on commit 6d072c8

Please sign in to comment.