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

ext4: Convert ext4_journalled_zero_new_buffers() to use a folio

Remove a call to compound_head().
Signed-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
Link: https://lore.kernel.org/r/20230324180129.1220691-20-willy@infradead.orgSigned-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
parent feb22b77
...@@ -1359,24 +1359,24 @@ static int ext4_write_end(struct file *file, ...@@ -1359,24 +1359,24 @@ static int ext4_write_end(struct file *file,
*/ */
static void ext4_journalled_zero_new_buffers(handle_t *handle, static void ext4_journalled_zero_new_buffers(handle_t *handle,
struct inode *inode, struct inode *inode,
struct page *page, struct folio *folio,
unsigned from, unsigned to) unsigned from, unsigned to)
{ {
unsigned int block_start = 0, block_end; unsigned int block_start = 0, block_end;
struct buffer_head *head, *bh; struct buffer_head *head, *bh;
bh = head = page_buffers(page); bh = head = folio_buffers(folio);
do { do {
block_end = block_start + bh->b_size; block_end = block_start + bh->b_size;
if (buffer_new(bh)) { if (buffer_new(bh)) {
if (block_end > from && block_start < to) { if (block_end > from && block_start < to) {
if (!PageUptodate(page)) { if (!folio_test_uptodate(folio)) {
unsigned start, size; unsigned start, size;
start = max(from, block_start); start = max(from, block_start);
size = min(to, block_end) - start; size = min(to, block_end) - start;
zero_user(page, start, size); folio_zero_range(folio, start, size);
write_end_fn(handle, inode, bh); write_end_fn(handle, inode, bh);
} }
clear_buffer_new(bh); clear_buffer_new(bh);
...@@ -1413,10 +1413,11 @@ static int ext4_journalled_write_end(struct file *file, ...@@ -1413,10 +1413,11 @@ static int ext4_journalled_write_end(struct file *file,
if (unlikely(copied < len) && !folio_test_uptodate(folio)) { 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, folio,
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, folio,
from + copied, to); from + copied, to);
ret = ext4_walk_page_buffers(handle, inode, ret = ext4_walk_page_buffers(handle, inode,
folio_buffers(folio), folio_buffers(folio),
......
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