Commit f1496362 authored by Jan Kara's avatar Jan Kara Committed by Theodore Ts'o

ext4: Don't unlock page in ext4_bio_write_page()

Do not unlock the written page in ext4_bio_write_page(). Instead leave
the page locked and unlock it in the callers. We'll need to keep the
page locked for data=journal writeback for a bit longer.
Signed-off-by: default avatarJan Kara <jack@suse.cz>
Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
Link: https://lore.kernel.org/r/20230228051319.4085470-5-tytso@mit.edu
parent 3f5d3063
...@@ -2076,6 +2076,7 @@ static int ext4_writepage(struct page *page, ...@@ -2076,6 +2076,7 @@ static int ext4_writepage(struct page *page,
return -ENOMEM; return -ENOMEM;
} }
ret = ext4_bio_write_page(&io_submit, page, len); ret = ext4_bio_write_page(&io_submit, page, len);
unlock_page(page);
ext4_io_submit(&io_submit); ext4_io_submit(&io_submit);
/* Drop io_end reference we got from init */ /* Drop io_end reference we got from init */
ext4_put_io_end_defer(io_submit.io_end); ext4_put_io_end_defer(io_submit.io_end);
...@@ -2110,6 +2111,7 @@ static int mpage_submit_page(struct mpage_da_data *mpd, struct page *page) ...@@ -2110,6 +2111,7 @@ static int mpage_submit_page(struct mpage_da_data *mpd, struct page *page)
else else
len = PAGE_SIZE; len = PAGE_SIZE;
err = ext4_bio_write_page(&mpd->io_submit, page, len); err = ext4_bio_write_page(&mpd->io_submit, page, len);
unlock_page(page);
if (!err) if (!err)
mpd->wbc->nr_to_write--; mpd->wbc->nr_to_write--;
mpd->first_page++; mpd->first_page++;
......
...@@ -502,7 +502,7 @@ int ext4_bio_write_page(struct ext4_io_submit *io, ...@@ -502,7 +502,7 @@ int ext4_bio_write_page(struct ext4_io_submit *io,
/* Nothing to submit? Just unlock the page... */ /* Nothing to submit? Just unlock the page... */
if (!nr_to_submit) if (!nr_to_submit)
goto unlock; return 0;
bh = head = page_buffers(page); bh = head = page_buffers(page);
...@@ -550,7 +550,8 @@ int ext4_bio_write_page(struct ext4_io_submit *io, ...@@ -550,7 +550,8 @@ int ext4_bio_write_page(struct ext4_io_submit *io,
} }
bh = bh->b_this_page; bh = bh->b_this_page;
} while (bh != head); } while (bh != head);
goto unlock;
return ret;
} }
} }
...@@ -565,7 +566,6 @@ int ext4_bio_write_page(struct ext4_io_submit *io, ...@@ -565,7 +566,6 @@ int ext4_bio_write_page(struct ext4_io_submit *io,
continue; continue;
io_submit_add_bh(io, inode, page, bounce_page, bh); io_submit_add_bh(io, inode, page, bounce_page, bh);
} while ((bh = bh->b_this_page) != head); } while ((bh = bh->b_this_page) != head);
unlock:
unlock_page(page); return 0;
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