Commit 65d87f79 authored by Nikolay Borisov's avatar Nikolay Borisov Committed by David Sterba

btrfs: remove BTRFS_I calls in btrfs_writepage_fixup_worker

All of its children functions use btrfs_inode.
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 e5b7231e
...@@ -2281,7 +2281,7 @@ static void btrfs_writepage_fixup_worker(struct btrfs_work *work) ...@@ -2281,7 +2281,7 @@ static void btrfs_writepage_fixup_worker(struct btrfs_work *work)
struct extent_state *cached_state = NULL; struct extent_state *cached_state = NULL;
struct extent_changeset *data_reserved = NULL; struct extent_changeset *data_reserved = NULL;
struct page *page; struct page *page;
struct inode *inode; struct btrfs_inode *inode;
u64 page_start; u64 page_start;
u64 page_end; u64 page_end;
int ret = 0; int ret = 0;
...@@ -2289,7 +2289,7 @@ static void btrfs_writepage_fixup_worker(struct btrfs_work *work) ...@@ -2289,7 +2289,7 @@ static void btrfs_writepage_fixup_worker(struct btrfs_work *work)
fixup = container_of(work, struct btrfs_writepage_fixup, work); fixup = container_of(work, struct btrfs_writepage_fixup, work);
page = fixup->page; page = fixup->page;
inode = fixup->inode; inode = BTRFS_I(fixup->inode);
page_start = page_offset(page); page_start = page_offset(page);
page_end = page_offset(page) + PAGE_SIZE - 1; page_end = page_offset(page) + PAGE_SIZE - 1;
...@@ -2297,8 +2297,8 @@ static void btrfs_writepage_fixup_worker(struct btrfs_work *work) ...@@ -2297,8 +2297,8 @@ static void btrfs_writepage_fixup_worker(struct btrfs_work *work)
* This is similar to page_mkwrite, we need to reserve the space before * This is similar to page_mkwrite, we need to reserve the space before
* we take the page lock. * we take the page lock.
*/ */
ret = btrfs_delalloc_reserve_space(BTRFS_I(inode), &data_reserved, ret = btrfs_delalloc_reserve_space(inode, &data_reserved, page_start,
page_start, PAGE_SIZE); PAGE_SIZE);
again: again:
lock_page(page); lock_page(page);
...@@ -2326,10 +2326,8 @@ static void btrfs_writepage_fixup_worker(struct btrfs_work *work) ...@@ -2326,10 +2326,8 @@ static void btrfs_writepage_fixup_worker(struct btrfs_work *work)
* when the page was already properly dealt with. * when the page was already properly dealt with.
*/ */
if (!ret) { if (!ret) {
btrfs_delalloc_release_extents(BTRFS_I(inode), btrfs_delalloc_release_extents(inode, PAGE_SIZE);
PAGE_SIZE); btrfs_delalloc_release_space(inode, data_reserved,
btrfs_delalloc_release_space(BTRFS_I(inode),
data_reserved,
page_start, PAGE_SIZE, page_start, PAGE_SIZE,
true); true);
} }
...@@ -2344,25 +2342,23 @@ static void btrfs_writepage_fixup_worker(struct btrfs_work *work) ...@@ -2344,25 +2342,23 @@ static void btrfs_writepage_fixup_worker(struct btrfs_work *work)
if (ret) if (ret)
goto out_page; goto out_page;
lock_extent_bits(&BTRFS_I(inode)->io_tree, page_start, page_end, lock_extent_bits(&inode->io_tree, page_start, page_end, &cached_state);
&cached_state);
/* already ordered? We're done */ /* already ordered? We're done */
if (PagePrivate2(page)) if (PagePrivate2(page))
goto out_reserved; goto out_reserved;
ordered = btrfs_lookup_ordered_range(BTRFS_I(inode), page_start, ordered = btrfs_lookup_ordered_range(inode, page_start, PAGE_SIZE);
PAGE_SIZE);
if (ordered) { if (ordered) {
unlock_extent_cached(&BTRFS_I(inode)->io_tree, page_start, unlock_extent_cached(&inode->io_tree, page_start, page_end,
page_end, &cached_state); &cached_state);
unlock_page(page); unlock_page(page);
btrfs_start_ordered_extent(inode, ordered, 1); btrfs_start_ordered_extent(&inode->vfs_inode, ordered, 1);
btrfs_put_ordered_extent(ordered); btrfs_put_ordered_extent(ordered);
goto again; goto again;
} }
ret = btrfs_set_extent_delalloc(BTRFS_I(inode), page_start, page_end, 0, ret = btrfs_set_extent_delalloc(inode, page_start, page_end, 0,
&cached_state); &cached_state);
if (ret) if (ret)
goto out_reserved; goto out_reserved;
...@@ -2377,11 +2373,11 @@ static void btrfs_writepage_fixup_worker(struct btrfs_work *work) ...@@ -2377,11 +2373,11 @@ static void btrfs_writepage_fixup_worker(struct btrfs_work *work)
BUG_ON(!PageDirty(page)); BUG_ON(!PageDirty(page));
free_delalloc_space = false; free_delalloc_space = false;
out_reserved: out_reserved:
btrfs_delalloc_release_extents(BTRFS_I(inode), PAGE_SIZE); btrfs_delalloc_release_extents(inode, PAGE_SIZE);
if (free_delalloc_space) if (free_delalloc_space)
btrfs_delalloc_release_space(BTRFS_I(inode), data_reserved, btrfs_delalloc_release_space(inode, data_reserved, page_start,
page_start, PAGE_SIZE, true); PAGE_SIZE, true);
unlock_extent_cached(&BTRFS_I(inode)->io_tree, page_start, page_end, unlock_extent_cached(&inode->io_tree, page_start, page_end,
&cached_state); &cached_state);
out_page: out_page:
if (ret) { if (ret) {
...@@ -2404,7 +2400,7 @@ static void btrfs_writepage_fixup_worker(struct btrfs_work *work) ...@@ -2404,7 +2400,7 @@ static void btrfs_writepage_fixup_worker(struct btrfs_work *work)
* that could need flushing space. Recursing back to fixup worker would * that could need flushing space. Recursing back to fixup worker would
* deadlock. * deadlock.
*/ */
btrfs_add_delayed_iput(inode); btrfs_add_delayed_iput(&inode->vfs_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