Commit cf3075fb authored by Qu Wenruo's avatar Qu Wenruo Committed by David Sterba

btrfs: remove unnecessary parameter delalloc_start for writepage_delalloc()

In function __extent_writepage() we always pass page start to
@delalloc_start for writepage_delalloc().

Thus we don't really need @delalloc_start parameter as we can extract it
from @page.

Remove @delalloc_start parameter and make __extent_writepage() to
declare @page_start and @page_end as const.
Signed-off-by: default avatarQu Wenruo <wqu@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent cd9255be
...@@ -3768,10 +3768,11 @@ static void update_nr_written(struct writeback_control *wbc, ...@@ -3768,10 +3768,11 @@ static void update_nr_written(struct writeback_control *wbc,
*/ */
static noinline_for_stack int writepage_delalloc(struct btrfs_inode *inode, static noinline_for_stack int writepage_delalloc(struct btrfs_inode *inode,
struct page *page, struct writeback_control *wbc, struct page *page, struct writeback_control *wbc,
u64 delalloc_start, unsigned long *nr_written) unsigned long *nr_written)
{ {
u64 page_end = delalloc_start + PAGE_SIZE - 1; u64 page_end = page_offset(page) + PAGE_SIZE - 1;
bool found; bool found;
u64 delalloc_start = page_offset(page);
u64 delalloc_to_write = 0; u64 delalloc_to_write = 0;
u64 delalloc_end = 0; u64 delalloc_end = 0;
int ret; int ret;
...@@ -4049,8 +4050,8 @@ static int __extent_writepage(struct page *page, struct writeback_control *wbc, ...@@ -4049,8 +4050,8 @@ static int __extent_writepage(struct page *page, struct writeback_control *wbc,
struct extent_page_data *epd) struct extent_page_data *epd)
{ {
struct inode *inode = page->mapping->host; struct inode *inode = page->mapping->host;
u64 start = page_offset(page); const u64 page_start = page_offset(page);
u64 page_end = start + PAGE_SIZE - 1; const u64 page_end = page_start + PAGE_SIZE - 1;
int ret; int ret;
int nr = 0; int nr = 0;
size_t pg_offset; size_t pg_offset;
...@@ -4085,8 +4086,7 @@ static int __extent_writepage(struct page *page, struct writeback_control *wbc, ...@@ -4085,8 +4086,7 @@ static int __extent_writepage(struct page *page, struct writeback_control *wbc,
} }
if (!epd->extent_locked) { if (!epd->extent_locked) {
ret = writepage_delalloc(BTRFS_I(inode), page, wbc, start, ret = writepage_delalloc(BTRFS_I(inode), page, wbc, &nr_written);
&nr_written);
if (ret == 1) if (ret == 1)
return 0; return 0;
if (ret) if (ret)
...@@ -4136,7 +4136,7 @@ static int __extent_writepage(struct page *page, struct writeback_control *wbc, ...@@ -4136,7 +4136,7 @@ static int __extent_writepage(struct page *page, struct writeback_control *wbc,
* capable of that. * capable of that.
*/ */
if (PageError(page)) if (PageError(page))
end_extent_writepage(page, ret, start, page_end); end_extent_writepage(page, ret, page_start, page_end);
unlock_page(page); unlock_page(page);
ASSERT(ret <= 0); ASSERT(ret <= 0);
return ret; return ret;
......
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