Commit 90c0304c authored by Nikolay Borisov's avatar Nikolay Borisov Committed by David Sterba

btrfs: make btrfs_dec_test_ordered_pending 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 acbf1dd0
...@@ -2781,8 +2781,8 @@ void btrfs_writepage_endio_finish_ordered(struct page *page, u64 start, ...@@ -2781,8 +2781,8 @@ void btrfs_writepage_endio_finish_ordered(struct page *page, u64 start,
trace_btrfs_writepage_end_io_hook(page, start, end, uptodate); trace_btrfs_writepage_end_io_hook(page, start, end, uptodate);
ClearPagePrivate2(page); ClearPagePrivate2(page);
if (!btrfs_dec_test_ordered_pending(inode, &ordered_extent, start, if (!btrfs_dec_test_ordered_pending(BTRFS_I(inode), &ordered_extent,
end - start + 1, uptodate)) start, end - start + 1, uptodate))
return; return;
if (btrfs_is_free_space_inode(BTRFS_I(inode))) if (btrfs_is_free_space_inode(BTRFS_I(inode)))
...@@ -8184,8 +8184,8 @@ static void btrfs_invalidatepage(struct page *page, unsigned int offset, ...@@ -8184,8 +8184,8 @@ static void btrfs_invalidatepage(struct page *page, unsigned int offset,
ordered->truncated_len = new_len; ordered->truncated_len = new_len;
spin_unlock_irq(&tree->lock); spin_unlock_irq(&tree->lock);
if (btrfs_dec_test_ordered_pending(inode, &ordered, if (btrfs_dec_test_ordered_pending(BTRFS_I(inode),
start, &ordered, start,
end - start + 1, 1)) end - start + 1, 1))
btrfs_finish_ordered_io(ordered); btrfs_finish_ordered_io(ordered);
} }
......
...@@ -378,17 +378,16 @@ int btrfs_dec_test_first_ordered_pending(struct btrfs_inode *inode, ...@@ -378,17 +378,16 @@ int btrfs_dec_test_first_ordered_pending(struct btrfs_inode *inode,
* test_and_set_bit on a flag in the struct btrfs_ordered_extent is used * test_and_set_bit on a flag in the struct btrfs_ordered_extent is used
* to make sure this function only returns 1 once for a given ordered extent. * to make sure this function only returns 1 once for a given ordered extent.
*/ */
int btrfs_dec_test_ordered_pending(struct inode *inode, int btrfs_dec_test_ordered_pending(struct btrfs_inode *inode,
struct btrfs_ordered_extent **cached, struct btrfs_ordered_extent **cached,
u64 file_offset, u64 io_size, int uptodate) u64 file_offset, u64 io_size, int uptodate)
{ {
struct btrfs_ordered_inode_tree *tree; struct btrfs_ordered_inode_tree *tree = &inode->ordered_tree;
struct rb_node *node; struct rb_node *node;
struct btrfs_ordered_extent *entry = NULL; struct btrfs_ordered_extent *entry = NULL;
unsigned long flags; unsigned long flags;
int ret; int ret;
tree = &BTRFS_I(inode)->ordered_tree;
spin_lock_irqsave(&tree->lock, flags); spin_lock_irqsave(&tree->lock, flags);
if (cached && *cached) { if (cached && *cached) {
entry = *cached; entry = *cached;
...@@ -409,7 +408,7 @@ int btrfs_dec_test_ordered_pending(struct inode *inode, ...@@ -409,7 +408,7 @@ int btrfs_dec_test_ordered_pending(struct inode *inode,
} }
if (io_size > entry->bytes_left) { if (io_size > entry->bytes_left) {
btrfs_crit(BTRFS_I(inode)->root->fs_info, btrfs_crit(inode->root->fs_info,
"bad ordered accounting left %llu size %llu", "bad ordered accounting left %llu size %llu",
entry->bytes_left, io_size); entry->bytes_left, io_size);
} }
......
...@@ -153,7 +153,7 @@ btrfs_ordered_inode_tree_init(struct btrfs_ordered_inode_tree *t) ...@@ -153,7 +153,7 @@ btrfs_ordered_inode_tree_init(struct btrfs_ordered_inode_tree *t)
void btrfs_put_ordered_extent(struct btrfs_ordered_extent *entry); void btrfs_put_ordered_extent(struct btrfs_ordered_extent *entry);
void btrfs_remove_ordered_extent(struct inode *inode, void btrfs_remove_ordered_extent(struct inode *inode,
struct btrfs_ordered_extent *entry); struct btrfs_ordered_extent *entry);
int btrfs_dec_test_ordered_pending(struct inode *inode, int btrfs_dec_test_ordered_pending(struct btrfs_inode *inode,
struct btrfs_ordered_extent **cached, struct btrfs_ordered_extent **cached,
u64 file_offset, u64 io_size, int uptodate); u64 file_offset, u64 io_size, int uptodate);
int btrfs_dec_test_first_ordered_pending(struct btrfs_inode *inode, int btrfs_dec_test_first_ordered_pending(struct btrfs_inode *inode,
......
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