[PATCH 02/12] btrfs: Make btrfs_lookup_first_ordered_extent take btrfs_inode

Nikolay Borisov
2020-08-31T11:54:10Z

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
fs/btrfs/file.c | 6 ++++--
fs/btrfs/inode.c | 3 ++-
fs/btrfs/ordered-data.c | 6 +++---
fs/btrfs/ordered-data.h | 2 +-
4 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index b62679382799..8a3bf5fec655 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -2508,7 +2508,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
@@ -3367,7 +3368,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 &&
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index c59615efab9e..74321962cd0f 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -8600,7 +8600,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 {
diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c
index 4732c5b89460..5a7e9c5872d3 100644
--- a/fs/btrfs/ordered-data.c
+++ b/fs/btrfs/ordered-data.c
@@ -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) {
@@ -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)
diff --git a/fs/btrfs/ordered-data.h b/fs/btrfs/ordered-data.h
index 644258a7dfb1..b287a2a403e6 100644
--- a/fs/btrfs/ordered-data.h
+++ b/fs/btrfs/ordered-data.h
@@ -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,
--
2.17.1