Commit 7fa4964b authored by Andreas Gruenbacher's avatar Andreas Gruenbacher

gfs2: Convert stuffed_readpage to folios

Change stuffed_readpage() to take a folio instead of a page.
Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
parent d6d64dac
...@@ -403,27 +403,27 @@ static int gfs2_jdata_writepages(struct address_space *mapping, ...@@ -403,27 +403,27 @@ static int gfs2_jdata_writepages(struct address_space *mapping,
} }
/** /**
* stuffed_readpage - Fill in a Linux page with stuffed file data * stuffed_readpage - Fill in a Linux folio with stuffed file data
* @ip: the inode * @ip: the inode
* @page: the page * @folio: the folio
* *
* Returns: errno * Returns: errno
*/ */
static int stuffed_readpage(struct gfs2_inode *ip, struct page *page) static int stuffed_readpage(struct gfs2_inode *ip, struct folio *folio)
{ {
struct buffer_head *dibh; struct buffer_head *dibh;
u64 dsize = i_size_read(&ip->i_inode); size_t i_size = i_size_read(&ip->i_inode);
void *kaddr; void *data;
int error; int error;
/* /*
* Due to the order of unstuffing files and ->fault(), we can be * Due to the order of unstuffing files and ->fault(), we can be
* asked for a zero page in the case of a stuffed file being extended, * asked for a zero folio in the case of a stuffed file being extended,
* so we need to supply one here. It doesn't happen often. * so we need to supply one here. It doesn't happen often.
*/ */
if (unlikely(page->index)) { if (unlikely(folio->index)) {
zero_user(page, 0, PAGE_SIZE); folio_zero_range(folio, 0, folio_size(folio));
SetPageUptodate(page); folio_mark_uptodate(folio);
return 0; return 0;
} }
...@@ -431,13 +431,11 @@ static int stuffed_readpage(struct gfs2_inode *ip, struct page *page) ...@@ -431,13 +431,11 @@ static int stuffed_readpage(struct gfs2_inode *ip, struct page *page)
if (error) if (error)
return error; return error;
kaddr = kmap_local_page(page); data = dibh->b_data + sizeof(struct gfs2_dinode);
memcpy(kaddr, dibh->b_data + sizeof(struct gfs2_dinode), dsize); memcpy_to_folio(folio, 0, data, i_size);
memset(kaddr + dsize, 0, PAGE_SIZE - dsize); folio_zero_range(folio, i_size, folio_size(folio) - i_size);
kunmap_local(kaddr);
flush_dcache_page(page);
brelse(dibh); brelse(dibh);
SetPageUptodate(page); folio_mark_uptodate(folio);
return 0; return 0;
} }
...@@ -458,7 +456,7 @@ static int gfs2_read_folio(struct file *file, struct folio *folio) ...@@ -458,7 +456,7 @@ static int gfs2_read_folio(struct file *file, struct folio *folio)
(i_blocksize(inode) == PAGE_SIZE && !folio_buffers(folio))) { (i_blocksize(inode) == PAGE_SIZE && !folio_buffers(folio))) {
error = iomap_read_folio(folio, &gfs2_iomap_ops); error = iomap_read_folio(folio, &gfs2_iomap_ops);
} else if (gfs2_is_stuffed(ip)) { } else if (gfs2_is_stuffed(ip)) {
error = stuffed_readpage(ip, &folio->page); error = stuffed_readpage(ip, folio);
folio_unlock(folio); folio_unlock(folio);
} else { } else {
error = mpage_read_folio(folio, gfs2_block_map); error = mpage_read_folio(folio, gfs2_block_map);
......
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