Commit e8d6062c authored by Matthew Wilcox's avatar Matthew Wilcox Committed by Theodore Ts'o

ext4: Convert ext4_bio_write_page() to ext4_bio_write_folio()

The only caller now has a folio so pass it in directly and avoid the call
to page_folio() at the beginning.
Signed-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: default avatarTheodore Ts'o <tytso@mit.edu>
Link: https://lore.kernel.org/r/20230324180129.1220691-9-willy@infradead.orgSigned-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
parent 33483b3b
...@@ -3756,9 +3756,8 @@ extern void ext4_io_submit_init(struct ext4_io_submit *io, ...@@ -3756,9 +3756,8 @@ extern void ext4_io_submit_init(struct ext4_io_submit *io,
struct writeback_control *wbc); struct writeback_control *wbc);
extern void ext4_end_io_rsv_work(struct work_struct *work); extern void ext4_end_io_rsv_work(struct work_struct *work);
extern void ext4_io_submit(struct ext4_io_submit *io); extern void ext4_io_submit(struct ext4_io_submit *io);
extern int ext4_bio_write_page(struct ext4_io_submit *io, int ext4_bio_write_folio(struct ext4_io_submit *io, struct folio *page,
struct page *page, size_t len);
int len);
extern struct ext4_io_end_vec *ext4_alloc_io_end_vec(ext4_io_end_t *io_end); extern struct ext4_io_end_vec *ext4_alloc_io_end_vec(ext4_io_end_t *io_end);
extern struct ext4_io_end_vec *ext4_last_io_end_vec(ext4_io_end_t *io_end); extern struct ext4_io_end_vec *ext4_last_io_end_vec(ext4_io_end_t *io_end);
......
...@@ -1885,8 +1885,8 @@ static int mpage_submit_folio(struct mpage_da_data *mpd, struct folio *folio) ...@@ -1885,8 +1885,8 @@ static int mpage_submit_folio(struct mpage_da_data *mpd, struct folio *folio)
* write-protects our page in page tables and the page cannot get * write-protects our page in page tables and the page cannot get
* written to again until we release folio lock. So only after * written to again until we release folio lock. So only after
* folio_clear_dirty_for_io() we are safe to sample i_size for * folio_clear_dirty_for_io() we are safe to sample i_size for
* ext4_bio_write_page() to zero-out tail of the written page. We rely * ext4_bio_write_folio() to zero-out tail of the written page. We rely
* on the barrier provided by TestClearPageDirty in * on the barrier provided by folio_test_clear_dirty() in
* folio_clear_dirty_for_io() to make sure i_size is really sampled only * folio_clear_dirty_for_io() to make sure i_size is really sampled only
* after page tables are updated. * after page tables are updated.
*/ */
...@@ -1895,7 +1895,7 @@ static int mpage_submit_folio(struct mpage_da_data *mpd, struct folio *folio) ...@@ -1895,7 +1895,7 @@ static int mpage_submit_folio(struct mpage_da_data *mpd, struct folio *folio)
if (folio_pos(folio) + len > size && if (folio_pos(folio) + len > size &&
!ext4_verity_in_progress(mpd->inode)) !ext4_verity_in_progress(mpd->inode))
len = size & ~PAGE_MASK; len = size & ~PAGE_MASK;
err = ext4_bio_write_page(&mpd->io_submit, &folio->page, len); err = ext4_bio_write_folio(&mpd->io_submit, folio, len);
if (!err) if (!err)
mpd->wbc->nr_to_write--; mpd->wbc->nr_to_write--;
......
...@@ -426,11 +426,9 @@ static void io_submit_add_bh(struct ext4_io_submit *io, ...@@ -426,11 +426,9 @@ static void io_submit_add_bh(struct ext4_io_submit *io,
io->io_next_block++; io->io_next_block++;
} }
int ext4_bio_write_page(struct ext4_io_submit *io, int ext4_bio_write_folio(struct ext4_io_submit *io, struct folio *folio,
struct page *page, size_t len)
int len)
{ {
struct folio *folio = page_folio(page);
struct folio *io_folio = folio; struct folio *io_folio = folio;
struct inode *inode = folio->mapping->host; struct inode *inode = folio->mapping->host;
unsigned block_start; unsigned block_start;
...@@ -523,8 +521,8 @@ int ext4_bio_write_page(struct ext4_io_submit *io, ...@@ -523,8 +521,8 @@ int ext4_bio_write_page(struct ext4_io_submit *io,
if (io->io_bio) if (io->io_bio)
gfp_flags = GFP_NOWAIT | __GFP_NOWARN; gfp_flags = GFP_NOWAIT | __GFP_NOWARN;
retry_encrypt: retry_encrypt:
bounce_page = fscrypt_encrypt_pagecache_blocks(page, enc_bytes, bounce_page = fscrypt_encrypt_pagecache_blocks(&folio->page,
0, gfp_flags); enc_bytes, 0, gfp_flags);
if (IS_ERR(bounce_page)) { if (IS_ERR(bounce_page)) {
ret = PTR_ERR(bounce_page); ret = PTR_ERR(bounce_page);
if (ret == -ENOMEM && if (ret == -ENOMEM &&
......
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