Commit c0a43603 authored by Nikolay Borisov's avatar Nikolay Borisov Committed by David Sterba

btrfs: remove inode argument from btrfs_start_ordered_extent

The passed in ordered_extent struct is always well-formed and contains
the inode making the explicit argument redundant.
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 510f85ed
...@@ -1491,8 +1491,7 @@ lock_and_cleanup_extent_if_need(struct btrfs_inode *inode, struct page **pages, ...@@ -1491,8 +1491,7 @@ lock_and_cleanup_extent_if_need(struct btrfs_inode *inode, struct page **pages,
unlock_page(pages[i]); unlock_page(pages[i]);
put_page(pages[i]); put_page(pages[i]);
} }
btrfs_start_ordered_extent(&inode->vfs_inode, btrfs_start_ordered_extent(ordered, 1);
ordered, 1);
btrfs_put_ordered_extent(ordered); btrfs_put_ordered_extent(ordered);
return -EAGAIN; return -EAGAIN;
} }
......
...@@ -2357,7 +2357,7 @@ static void btrfs_writepage_fixup_worker(struct btrfs_work *work) ...@@ -2357,7 +2357,7 @@ static void btrfs_writepage_fixup_worker(struct btrfs_work *work)
unlock_extent_cached(&inode->io_tree, page_start, page_end, unlock_extent_cached(&inode->io_tree, page_start, page_end,
&cached_state); &cached_state);
unlock_page(page); unlock_page(page);
btrfs_start_ordered_extent(&inode->vfs_inode, ordered, 1); btrfs_start_ordered_extent(ordered, 1);
btrfs_put_ordered_extent(ordered); btrfs_put_ordered_extent(ordered);
goto again; goto again;
} }
...@@ -4581,7 +4581,7 @@ int btrfs_truncate_block(struct inode *inode, loff_t from, loff_t len, ...@@ -4581,7 +4581,7 @@ int btrfs_truncate_block(struct inode *inode, loff_t from, loff_t len,
&cached_state); &cached_state);
unlock_page(page); unlock_page(page);
put_page(page); put_page(page);
btrfs_start_ordered_extent(inode, ordered, 1); btrfs_start_ordered_extent(ordered, 1);
btrfs_put_ordered_extent(ordered); btrfs_put_ordered_extent(ordered);
goto again; goto again;
} }
...@@ -7149,7 +7149,7 @@ static int lock_extent_direct(struct inode *inode, u64 lockstart, u64 lockend, ...@@ -7149,7 +7149,7 @@ static int lock_extent_direct(struct inode *inode, u64 lockstart, u64 lockend,
*/ */
if (writing || if (writing ||
test_bit(BTRFS_ORDERED_DIRECT, &ordered->flags)) test_bit(BTRFS_ORDERED_DIRECT, &ordered->flags))
btrfs_start_ordered_extent(inode, ordered, 1); btrfs_start_ordered_extent(ordered, 1);
else else
ret = -ENOTBLK; ret = -ENOTBLK;
btrfs_put_ordered_extent(ordered); btrfs_put_ordered_extent(ordered);
...@@ -8324,7 +8324,7 @@ vm_fault_t btrfs_page_mkwrite(struct vm_fault *vmf) ...@@ -8324,7 +8324,7 @@ vm_fault_t btrfs_page_mkwrite(struct vm_fault *vmf)
unlock_extent_cached(io_tree, page_start, page_end, unlock_extent_cached(io_tree, page_start, page_end,
&cached_state); &cached_state);
unlock_page(page); unlock_page(page);
btrfs_start_ordered_extent(inode, ordered, 1); btrfs_start_ordered_extent(ordered, 1);
btrfs_put_ordered_extent(ordered); btrfs_put_ordered_extent(ordered);
goto again; goto again;
} }
......
...@@ -1319,7 +1319,7 @@ static int cluster_pages_for_defrag(struct inode *inode, ...@@ -1319,7 +1319,7 @@ static int cluster_pages_for_defrag(struct inode *inode,
break; break;
unlock_page(page); unlock_page(page);
btrfs_start_ordered_extent(inode, ordered, 1); btrfs_start_ordered_extent(ordered, 1);
btrfs_put_ordered_extent(ordered); btrfs_put_ordered_extent(ordered);
lock_page(page); lock_page(page);
/* /*
......
...@@ -543,7 +543,7 @@ static void btrfs_run_ordered_extent_work(struct btrfs_work *work) ...@@ -543,7 +543,7 @@ static void btrfs_run_ordered_extent_work(struct btrfs_work *work)
struct btrfs_ordered_extent *ordered; struct btrfs_ordered_extent *ordered;
ordered = container_of(work, struct btrfs_ordered_extent, flush_work); ordered = container_of(work, struct btrfs_ordered_extent, flush_work);
btrfs_start_ordered_extent(ordered->inode, ordered, 1); btrfs_start_ordered_extent(ordered, 1);
complete(&ordered->completion); complete(&ordered->completion);
} }
...@@ -649,14 +649,13 @@ void btrfs_wait_ordered_roots(struct btrfs_fs_info *fs_info, u64 nr, ...@@ -649,14 +649,13 @@ void btrfs_wait_ordered_roots(struct btrfs_fs_info *fs_info, u64 nr,
* in the extent, and it waits on the io completion code to insert * in the extent, and it waits on the io completion code to insert
* metadata into the btree corresponding to the extent * metadata into the btree corresponding to the extent
*/ */
void btrfs_start_ordered_extent(struct inode *inode, void btrfs_start_ordered_extent(struct btrfs_ordered_extent *entry, int wait)
struct btrfs_ordered_extent *entry,
int wait)
{ {
u64 start = entry->file_offset; u64 start = entry->file_offset;
u64 end = start + entry->num_bytes - 1; u64 end = start + entry->num_bytes - 1;
struct btrfs_inode *inode = BTRFS_I(entry->inode);
trace_btrfs_ordered_extent_start(BTRFS_I(inode), entry); trace_btrfs_ordered_extent_start(inode, entry);
/* /*
* pages in the range can be dirty, clean or writeback. We * pages in the range can be dirty, clean or writeback. We
...@@ -664,7 +663,7 @@ void btrfs_start_ordered_extent(struct inode *inode, ...@@ -664,7 +663,7 @@ void btrfs_start_ordered_extent(struct inode *inode,
* for the flusher thread to find them * for the flusher thread to find them
*/ */
if (!test_bit(BTRFS_ORDERED_DIRECT, &entry->flags)) if (!test_bit(BTRFS_ORDERED_DIRECT, &entry->flags))
filemap_fdatawrite_range(inode->i_mapping, start, end); filemap_fdatawrite_range(inode->vfs_inode.i_mapping, start, end);
if (wait) { if (wait) {
wait_event(entry->wait, test_bit(BTRFS_ORDERED_COMPLETE, wait_event(entry->wait, test_bit(BTRFS_ORDERED_COMPLETE,
&entry->flags)); &entry->flags));
...@@ -719,7 +718,7 @@ int btrfs_wait_ordered_range(struct inode *inode, u64 start, u64 len) ...@@ -719,7 +718,7 @@ int btrfs_wait_ordered_range(struct inode *inode, u64 start, u64 len)
btrfs_put_ordered_extent(ordered); btrfs_put_ordered_extent(ordered);
break; break;
} }
btrfs_start_ordered_extent(inode, ordered, 1); btrfs_start_ordered_extent(ordered, 1);
end = ordered->file_offset; end = ordered->file_offset;
/* /*
* If the ordered extent had an error save the error but don't * If the ordered extent had an error save the error but don't
...@@ -939,7 +938,7 @@ void btrfs_lock_and_flush_ordered_range(struct btrfs_inode *inode, u64 start, ...@@ -939,7 +938,7 @@ void btrfs_lock_and_flush_ordered_range(struct btrfs_inode *inode, u64 start,
break; break;
} }
unlock_extent_cached(&inode->io_tree, start, end, cachedp); unlock_extent_cached(&inode->io_tree, start, end, cachedp);
btrfs_start_ordered_extent(&inode->vfs_inode, ordered, 1); btrfs_start_ordered_extent(ordered, 1);
btrfs_put_ordered_extent(ordered); btrfs_put_ordered_extent(ordered);
} }
} }
......
...@@ -174,8 +174,7 @@ void btrfs_add_ordered_sum(struct btrfs_ordered_extent *entry, ...@@ -174,8 +174,7 @@ void btrfs_add_ordered_sum(struct btrfs_ordered_extent *entry,
struct btrfs_ordered_sum *sum); struct btrfs_ordered_sum *sum);
struct btrfs_ordered_extent *btrfs_lookup_ordered_extent(struct btrfs_inode *inode, struct btrfs_ordered_extent *btrfs_lookup_ordered_extent(struct btrfs_inode *inode,
u64 file_offset); u64 file_offset);
void btrfs_start_ordered_extent(struct inode *inode, void btrfs_start_ordered_extent(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 btrfs_inode *inode, u64 file_offset); btrfs_lookup_first_ordered_extent(struct btrfs_inode *inode, 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