Unverified Commit 4c7e1385 authored by Matthew Wilcox (Oracle)'s avatar Matthew Wilcox (Oracle) Committed by Christian Brauner
Browse files

orangefs: Convert orangefs_write_begin() to use a folio



Retrieve a folio from the page cache instead of a page.  This
function was previously mostly converted to use a folio, so it's
a fairly small change.

Reviewed-by: default avatarJosef Bacik <josef@toxicpanda.com>
Signed-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
parent 87969292
Loading
Loading
Loading
Loading
+5 −9
Original line number Diff line number Diff line
@@ -313,18 +313,14 @@ static int orangefs_write_begin(struct file *file,
{
	struct orangefs_write_range *wr;
	struct folio *folio;
	struct page *page;
	pgoff_t index;
	int ret;

	index = pos >> PAGE_SHIFT;
	folio = __filemap_get_folio(mapping, pos / PAGE_SIZE, FGP_WRITEBEGIN,
			mapping_gfp_mask(mapping));
	if (IS_ERR(folio))
		return PTR_ERR(folio);

	page = grab_cache_page_write_begin(mapping, index);
	if (!page)
		return -ENOMEM;

	*pagep = page;
	folio = page_folio(page);
	*pagep = &folio->page;

	if (folio_test_dirty(folio) && !folio_test_private(folio)) {
		/*