orangefs: Remove calls to set/clear the error flag

Nobody checks the error flag on orangefs folios, so stop setting and
clearing it.  We can also use folio_end_read() to simplify
orangefs_read_folio().

Cc: Martin Brandenburg <martin@omnibond.com>
Cc: devel@lists.orangefs.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Link: https://lore.kernel.org/r/20240530202110.2653630-11-willy@infradead.org
Tested-by: Mike Marshall <hubcap@omnibond.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
Matthew Wilcox (Oracle) 2024-05-30 21:21:02 +01:00 committed by Christian Brauner
parent 8f3ab6e4be
commit 86b3d5f6df
No known key found for this signature in database
GPG Key ID: 91C61BC06578DCA2
2 changed files with 4 additions and 13 deletions

View File

@ -56,7 +56,6 @@ static int orangefs_writepage_locked(struct page *page,
ret = wait_for_direct_io(ORANGEFS_IO_WRITE, inode, &off, &iter, wlen, ret = wait_for_direct_io(ORANGEFS_IO_WRITE, inode, &off, &iter, wlen,
len, wr, NULL, NULL); len, wr, NULL, NULL);
if (ret < 0) { if (ret < 0) {
SetPageError(page);
mapping_set_error(page->mapping, ret); mapping_set_error(page->mapping, ret);
} else { } else {
ret = 0; ret = 0;
@ -119,7 +118,6 @@ static int orangefs_writepages_work(struct orangefs_writepages *ow,
0, &wr, NULL, NULL); 0, &wr, NULL, NULL);
if (ret < 0) { if (ret < 0) {
for (i = 0; i < ow->npages; i++) { for (i = 0; i < ow->npages; i++) {
SetPageError(ow->pages[i]);
mapping_set_error(ow->pages[i]->mapping, ret); mapping_set_error(ow->pages[i]->mapping, ret);
if (PagePrivate(ow->pages[i])) { if (PagePrivate(ow->pages[i])) {
wrp = (struct orangefs_write_range *) wrp = (struct orangefs_write_range *)
@ -303,15 +301,10 @@ static int orangefs_read_folio(struct file *file, struct folio *folio)
iov_iter_zero(~0U, &iter); iov_iter_zero(~0U, &iter);
/* takes care of potential aliasing */ /* takes care of potential aliasing */
flush_dcache_folio(folio); flush_dcache_folio(folio);
if (ret < 0) { if (ret > 0)
folio_set_error(folio);
} else {
folio_mark_uptodate(folio);
ret = 0; ret = 0;
} folio_end_read(folio, ret == 0);
/* unlock the folio after the ->read_folio() routine completes */ return ret;
folio_unlock(folio);
return ret;
} }
static int orangefs_write_begin(struct file *file, static int orangefs_write_begin(struct file *file,

View File

@ -274,10 +274,8 @@ orangefs_bufmap_map(struct orangefs_bufmap *bufmap,
gossip_err("orangefs error: asked for %d pages, only got %d.\n", gossip_err("orangefs error: asked for %d pages, only got %d.\n",
bufmap->page_count, ret); bufmap->page_count, ret);
for (i = 0; i < ret; i++) { for (i = 0; i < ret; i++)
SetPageError(bufmap->page_array[i]);
unpin_user_page(bufmap->page_array[i]); unpin_user_page(bufmap->page_array[i]);
}
return -ENOMEM; return -ENOMEM;
} }