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

ext4: Use a folio in ext4_journalled_write_end()

Convert the incoming page to a folio to remove a few calls to
compound_head().
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-19-willy@infradead.orgSigned-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
parent 64fb3136
...@@ -1392,6 +1392,7 @@ static int ext4_journalled_write_end(struct file *file, ...@@ -1392,6 +1392,7 @@ static int ext4_journalled_write_end(struct file *file,
loff_t pos, unsigned len, unsigned copied, loff_t pos, unsigned len, unsigned copied,
struct page *page, void *fsdata) struct page *page, void *fsdata)
{ {
struct folio *folio = page_folio(page);
handle_t *handle = ext4_journal_current_handle(); handle_t *handle = ext4_journal_current_handle();
struct inode *inode = mapping->host; struct inode *inode = mapping->host;
loff_t old_size = inode->i_size; loff_t old_size = inode->i_size;
...@@ -1410,25 +1411,26 @@ static int ext4_journalled_write_end(struct file *file, ...@@ -1410,25 +1411,26 @@ static int ext4_journalled_write_end(struct file *file,
if (ext4_has_inline_data(inode)) if (ext4_has_inline_data(inode))
return ext4_write_inline_data_end(inode, pos, len, copied, page); return ext4_write_inline_data_end(inode, pos, len, copied, page);
if (unlikely(copied < len) && !PageUptodate(page)) { if (unlikely(copied < len) && !folio_test_uptodate(folio)) {
copied = 0; copied = 0;
ext4_journalled_zero_new_buffers(handle, inode, page, from, to); ext4_journalled_zero_new_buffers(handle, inode, page, from, to);
} else { } else {
if (unlikely(copied < len)) if (unlikely(copied < len))
ext4_journalled_zero_new_buffers(handle, inode, page, ext4_journalled_zero_new_buffers(handle, inode, page,
from + copied, to); from + copied, to);
ret = ext4_walk_page_buffers(handle, inode, page_buffers(page), ret = ext4_walk_page_buffers(handle, inode,
folio_buffers(folio),
from, from + copied, &partial, from, from + copied, &partial,
write_end_fn); write_end_fn);
if (!partial) if (!partial)
SetPageUptodate(page); folio_mark_uptodate(folio);
} }
if (!verity) if (!verity)
size_changed = ext4_update_inode_size(inode, pos + copied); size_changed = ext4_update_inode_size(inode, pos + copied);
ext4_set_inode_state(inode, EXT4_STATE_JDATA); ext4_set_inode_state(inode, EXT4_STATE_JDATA);
EXT4_I(inode)->i_datasync_tid = handle->h_transaction->t_tid; EXT4_I(inode)->i_datasync_tid = handle->h_transaction->t_tid;
unlock_page(page); folio_unlock(folio);
put_page(page); folio_put(folio);
if (old_size < pos && !verity) if (old_size < pos && !verity)
pagecache_isize_extended(inode, old_size, pos); pagecache_isize_extended(inode, old_size, pos);
......
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