Commit 6d072c8e authored by Nikolay Borisov's avatar Nikolay Borisov Committed by David Sterba

btrfs: make btrfs_lookup_first_ordered_extent take btrfs_inode

Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: default avatarJosef Bacik <josef@toxicpanda.com>
Signed-off-by: default avatarNikolay Borisov <nborisov@suse.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent b79b7249
...@@ -2541,7 +2541,8 @@ static int btrfs_punch_hole_lock_range(struct inode *inode, ...@@ -2541,7 +2541,8 @@ static int btrfs_punch_hole_lock_range(struct inode *inode,
lock_extent_bits(&BTRFS_I(inode)->io_tree, lockstart, lockend, lock_extent_bits(&BTRFS_I(inode)->io_tree, lockstart, lockend,
cached_state); 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 * We need to make sure we have no ordered extents in this range
...@@ -3400,7 +3401,8 @@ static long btrfs_fallocate(struct file *file, int mode, ...@@ -3400,7 +3401,8 @@ static long btrfs_fallocate(struct file *file, int mode,
*/ */
lock_extent_bits(&BTRFS_I(inode)->io_tree, alloc_start, lock_extent_bits(&BTRFS_I(inode)->io_tree, alloc_start,
locked_end, &cached_state); 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 && if (ordered &&
ordered->file_offset + ordered->num_bytes > alloc_start && ordered->file_offset + ordered->num_bytes > alloc_start &&
......
...@@ -8672,7 +8672,8 @@ void btrfs_destroy_inode(struct inode *inode) ...@@ -8672,7 +8672,8 @@ void btrfs_destroy_inode(struct inode *inode)
return; return;
while (1) { while (1) {
ordered = btrfs_lookup_first_ordered_extent(inode, (u64)-1); ordered = btrfs_lookup_first_ordered_extent(BTRFS_I(inode),
(u64)-1);
if (!ordered) if (!ordered)
break; break;
else { else {
......
...@@ -710,7 +710,7 @@ int btrfs_wait_ordered_range(struct inode *inode, u64 start, u64 len) ...@@ -710,7 +710,7 @@ int btrfs_wait_ordered_range(struct inode *inode, u64 start, u64 len)
end = orig_end; end = orig_end;
while (1) { while (1) {
ordered = btrfs_lookup_first_ordered_extent(inode, end); ordered = btrfs_lookup_first_ordered_extent(BTRFS_I(inode), end);
if (!ordered) if (!ordered)
break; break;
if (ordered->file_offset > orig_end) { if (ordered->file_offset > orig_end) {
...@@ -838,13 +838,13 @@ void btrfs_get_ordered_extents_for_logging(struct btrfs_inode *inode, ...@@ -838,13 +838,13 @@ void btrfs_get_ordered_extents_for_logging(struct btrfs_inode *inode,
* if none is found * if none is found
*/ */
struct btrfs_ordered_extent * 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 btrfs_ordered_inode_tree *tree;
struct rb_node *node; struct rb_node *node;
struct btrfs_ordered_extent *entry = NULL; struct btrfs_ordered_extent *entry = NULL;
tree = &BTRFS_I(inode)->ordered_tree; tree = &inode->ordered_tree;
spin_lock_irq(&tree->lock); spin_lock_irq(&tree->lock);
node = tree_search(tree, file_offset); node = tree_search(tree, file_offset);
if (!node) if (!node)
......
...@@ -178,7 +178,7 @@ void btrfs_start_ordered_extent(struct inode *inode, ...@@ -178,7 +178,7 @@ void btrfs_start_ordered_extent(struct inode *inode,
struct btrfs_ordered_extent *entry, int wait); struct btrfs_ordered_extent *entry, int wait);
int btrfs_wait_ordered_range(struct inode *inode, u64 start, u64 len); int btrfs_wait_ordered_range(struct inode *inode, u64 start, u64 len);
struct btrfs_ordered_extent * 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_ordered_extent *btrfs_lookup_ordered_range(
struct btrfs_inode *inode, struct btrfs_inode *inode,
u64 file_offset, u64 file_offset,
......
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