reiserfs: Convert reiserfs_write_begin() to use a folio

Remove a few calls to compound_head().

Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
Matthew Wilcox (Oracle) 2024-07-10 22:50:29 -04:00 committed by Christian Brauner
parent 24481ffdc0
commit cc67bcb2c3
No known key found for this signature in database
GPG Key ID: 91C61BC06578DCA2

View File

@ -2738,20 +2738,21 @@ static int reiserfs_write_begin(struct file *file,
struct page **pagep, void **fsdata) struct page **pagep, void **fsdata)
{ {
struct inode *inode; struct inode *inode;
struct page *page; struct folio *folio;
pgoff_t index; pgoff_t index;
int ret; int ret;
int old_ref = 0; int old_ref = 0;
inode = mapping->host; inode = mapping->host;
index = pos >> PAGE_SHIFT; index = pos >> PAGE_SHIFT;
page = grab_cache_page_write_begin(mapping, index); folio = __filemap_get_folio(mapping, index, FGP_WRITEBEGIN,
if (!page) mapping_gfp_mask(mapping));
return -ENOMEM; if (IS_ERR(folio))
*pagep = page; return PTR_ERR(folio);
*pagep = &folio->page;
reiserfs_wait_on_write_block(inode->i_sb); reiserfs_wait_on_write_block(inode->i_sb);
fix_tail_page_for_writing(page); fix_tail_page_for_writing(&folio->page);
if (reiserfs_transaction_running(inode->i_sb)) { if (reiserfs_transaction_running(inode->i_sb)) {
struct reiserfs_transaction_handle *th; struct reiserfs_transaction_handle *th;
th = (struct reiserfs_transaction_handle *)current-> th = (struct reiserfs_transaction_handle *)current->
@ -2761,7 +2762,7 @@ static int reiserfs_write_begin(struct file *file,
old_ref = th->t_refcount; old_ref = th->t_refcount;
th->t_refcount++; th->t_refcount++;
} }
ret = __block_write_begin(page, pos, len, reiserfs_get_block); ret = __block_write_begin(&folio->page, pos, len, reiserfs_get_block);
if (ret && reiserfs_transaction_running(inode->i_sb)) { if (ret && reiserfs_transaction_running(inode->i_sb)) {
struct reiserfs_transaction_handle *th = current->journal_info; struct reiserfs_transaction_handle *th = current->journal_info;
/* /*
@ -2791,8 +2792,8 @@ static int reiserfs_write_begin(struct file *file,
} }
} }
if (ret) { if (ret) {
unlock_page(page); folio_unlock(folio);
put_page(page); folio_put(folio);
/* Truncate allocated blocks */ /* Truncate allocated blocks */
reiserfs_truncate_failed_write(inode); reiserfs_truncate_failed_write(inode);
} }