Commit aff31330 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'vfs-6.11.pg_error' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs

Pull PG_error removal updates from Christian Brauner:
 "This contains work to remove almost all remaining users of PG_error
  from filesystems and filesystem helper libraries. An additional patch
  will be coming in via the jfs tree which tests the PG_error bit.

  Afterwards nothing will be testing it anymore and it's safe to remove
  all places which set or clear the PG_error bit.

  The goal is to fully remove PG_error by the next merge window"

* tag 'vfs-6.11.pg_error' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs:
  buffer: Remove calls to set and clear the folio error flag
  iomap: Remove calls to set and clear folio error flag
  vboxsf: Convert vboxsf_read_folio() to use a folio
  ufs: Remove call to set the folio error flag
  romfs: Convert romfs_read_folio() to use a folio
  reiserfs: Remove call to folio_set_error()
  orangefs: Remove calls to set/clear the error flag
  nfs: Remove calls to folio_set_error
  jffs2: Remove calls to set/clear the folio error flag
  hostfs: Convert hostfs_read_folio() to use a folio
  isofs: Convert rock_ridge_symlink_read_folio to use a folio
  hpfs: Convert hpfs_symlink_read_folio to use a folio
  efs: Convert efs_symlink_read_folio to use a folio
  cramfs: Convert cramfs_read_folio to use a folio
  coda: Convert coda_symlink_filler() to use folio_end_read()
  befs: Convert befs_symlink_read_folio() to use folio_end_read()
parents b051320d 7ad635ea
...@@ -475,6 +475,7 @@ static int befs_symlink_read_folio(struct file *unused, struct folio *folio) ...@@ -475,6 +475,7 @@ static int befs_symlink_read_folio(struct file *unused, struct folio *folio)
befs_data_stream *data = &befs_ino->i_data.ds; befs_data_stream *data = &befs_ino->i_data.ds;
befs_off_t len = data->size; befs_off_t len = data->size;
char *link = folio_address(folio); char *link = folio_address(folio);
int err = -EIO;
if (len == 0 || len > PAGE_SIZE) { if (len == 0 || len > PAGE_SIZE) {
befs_error(sb, "Long symlink with illegal length"); befs_error(sb, "Long symlink with illegal length");
...@@ -487,13 +488,10 @@ static int befs_symlink_read_folio(struct file *unused, struct folio *folio) ...@@ -487,13 +488,10 @@ static int befs_symlink_read_folio(struct file *unused, struct folio *folio)
goto fail; goto fail;
} }
link[len - 1] = '\0'; link[len - 1] = '\0';
folio_mark_uptodate(folio); err = 0;
folio_unlock(folio);
return 0;
fail: fail:
folio_set_error(folio); folio_end_read(folio, err == 0);
folio_unlock(folio); return err;
return -EIO;
} }
/* /*
......
...@@ -258,7 +258,6 @@ static void end_buffer_async_read(struct buffer_head *bh, int uptodate) ...@@ -258,7 +258,6 @@ static void end_buffer_async_read(struct buffer_head *bh, int uptodate)
} else { } else {
clear_buffer_uptodate(bh); clear_buffer_uptodate(bh);
buffer_io_error(bh, ", async page read"); buffer_io_error(bh, ", async page read");
folio_set_error(folio);
} }
/* /*
...@@ -391,7 +390,6 @@ static void end_buffer_async_write(struct buffer_head *bh, int uptodate) ...@@ -391,7 +390,6 @@ static void end_buffer_async_write(struct buffer_head *bh, int uptodate)
buffer_io_error(bh, ", lost async page write"); buffer_io_error(bh, ", lost async page write");
mark_buffer_write_io_error(bh); mark_buffer_write_io_error(bh);
clear_buffer_uptodate(bh); clear_buffer_uptodate(bh);
folio_set_error(folio);
} }
first = folio_buffers(folio); first = folio_buffers(folio);
...@@ -1960,7 +1958,6 @@ int __block_write_full_folio(struct inode *inode, struct folio *folio, ...@@ -1960,7 +1958,6 @@ int __block_write_full_folio(struct inode *inode, struct folio *folio,
clear_buffer_dirty(bh); clear_buffer_dirty(bh);
} }
} while ((bh = bh->b_this_page) != head); } while ((bh = bh->b_this_page) != head);
folio_set_error(folio);
BUG_ON(folio_test_writeback(folio)); BUG_ON(folio_test_writeback(folio));
mapping_set_error(folio->mapping, err); mapping_set_error(folio->mapping, err);
folio_start_writeback(folio); folio_start_writeback(folio);
...@@ -2405,11 +2402,9 @@ int block_read_full_folio(struct folio *folio, get_block_t *get_block) ...@@ -2405,11 +2402,9 @@ int block_read_full_folio(struct folio *folio, get_block_t *get_block)
if (iblock < lblock) { if (iblock < lblock) {
WARN_ON(bh->b_size != blocksize); WARN_ON(bh->b_size != blocksize);
err = get_block(inode, iblock, bh, 0); err = get_block(inode, iblock, bh, 0);
if (err) { if (err)
folio_set_error(folio);
page_error = true; page_error = true;
} }
}
if (!buffer_mapped(bh)) { if (!buffer_mapped(bh)) {
folio_zero_range(folio, i * blocksize, folio_zero_range(folio, i * blocksize,
blocksize); blocksize);
......
...@@ -31,15 +31,7 @@ static int coda_symlink_filler(struct file *file, struct folio *folio) ...@@ -31,15 +31,7 @@ static int coda_symlink_filler(struct file *file, struct folio *folio)
cii = ITOC(inode); cii = ITOC(inode);
error = venus_readlink(inode->i_sb, &cii->c_fid, p, &len); error = venus_readlink(inode->i_sb, &cii->c_fid, p, &len);
if (error) folio_end_read(folio, error == 0);
goto fail;
folio_mark_uptodate(folio);
folio_unlock(folio);
return 0;
fail:
folio_set_error(folio);
folio_unlock(folio);
return error; return error;
} }
......
...@@ -811,19 +811,19 @@ static struct dentry *cramfs_lookup(struct inode *dir, struct dentry *dentry, un ...@@ -811,19 +811,19 @@ static struct dentry *cramfs_lookup(struct inode *dir, struct dentry *dentry, un
static int cramfs_read_folio(struct file *file, struct folio *folio) static int cramfs_read_folio(struct file *file, struct folio *folio)
{ {
struct page *page = &folio->page; struct inode *inode = folio->mapping->host;
struct inode *inode = page->mapping->host;
u32 maxblock; u32 maxblock;
int bytes_filled; int bytes_filled;
void *pgdata; void *pgdata;
bool success = false;
maxblock = (inode->i_size + PAGE_SIZE - 1) >> PAGE_SHIFT; maxblock = (inode->i_size + PAGE_SIZE - 1) >> PAGE_SHIFT;
bytes_filled = 0; bytes_filled = 0;
pgdata = kmap_local_page(page); pgdata = kmap_local_folio(folio, 0);
if (page->index < maxblock) { if (folio->index < maxblock) {
struct super_block *sb = inode->i_sb; struct super_block *sb = inode->i_sb;
u32 blkptr_offset = OFFSET(inode) + page->index * 4; u32 blkptr_offset = OFFSET(inode) + folio->index * 4;
u32 block_ptr, block_start, block_len; u32 block_ptr, block_start, block_len;
bool uncompressed, direct; bool uncompressed, direct;
...@@ -844,7 +844,7 @@ static int cramfs_read_folio(struct file *file, struct folio *folio) ...@@ -844,7 +844,7 @@ static int cramfs_read_folio(struct file *file, struct folio *folio)
if (uncompressed) { if (uncompressed) {
block_len = PAGE_SIZE; block_len = PAGE_SIZE;
/* if last block: cap to file length */ /* if last block: cap to file length */
if (page->index == maxblock - 1) if (folio->index == maxblock - 1)
block_len = block_len =
offset_in_page(inode->i_size); offset_in_page(inode->i_size);
} else { } else {
...@@ -861,7 +861,7 @@ static int cramfs_read_folio(struct file *file, struct folio *folio) ...@@ -861,7 +861,7 @@ static int cramfs_read_folio(struct file *file, struct folio *folio)
* from the previous block's pointer. * from the previous block's pointer.
*/ */
block_start = OFFSET(inode) + maxblock * 4; block_start = OFFSET(inode) + maxblock * 4;
if (page->index) if (folio->index)
block_start = *(u32 *) block_start = *(u32 *)
cramfs_read(sb, blkptr_offset - 4, 4); cramfs_read(sb, blkptr_offset - 4, 4);
/* Beware... previous ptr might be a direct ptr */ /* Beware... previous ptr might be a direct ptr */
...@@ -906,17 +906,12 @@ static int cramfs_read_folio(struct file *file, struct folio *folio) ...@@ -906,17 +906,12 @@ static int cramfs_read_folio(struct file *file, struct folio *folio)
} }
memset(pgdata + bytes_filled, 0, PAGE_SIZE - bytes_filled); memset(pgdata + bytes_filled, 0, PAGE_SIZE - bytes_filled);
flush_dcache_page(page); flush_dcache_folio(folio);
kunmap_local(pgdata);
SetPageUptodate(page);
unlock_page(page);
return 0;
success = true;
err: err:
kunmap_local(pgdata); kunmap_local(pgdata);
ClearPageUptodate(page); folio_end_read(folio, success);
SetPageError(page);
unlock_page(page);
return 0; return 0;
} }
......
...@@ -14,10 +14,9 @@ ...@@ -14,10 +14,9 @@
static int efs_symlink_read_folio(struct file *file, struct folio *folio) static int efs_symlink_read_folio(struct file *file, struct folio *folio)
{ {
struct page *page = &folio->page; char *link = folio_address(folio);
char *link = page_address(page); struct buffer_head *bh;
struct buffer_head * bh; struct inode *inode = folio->mapping->host;
struct inode * inode = page->mapping->host;
efs_block_t size = inode->i_size; efs_block_t size = inode->i_size;
int err; int err;
...@@ -40,12 +39,9 @@ static int efs_symlink_read_folio(struct file *file, struct folio *folio) ...@@ -40,12 +39,9 @@ static int efs_symlink_read_folio(struct file *file, struct folio *folio)
brelse(bh); brelse(bh);
} }
link[size] = '\0'; link[size] = '\0';
SetPageUptodate(page); err = 0;
unlock_page(page);
return 0;
fail: fail:
SetPageError(page); folio_end_read(folio, err == 0);
unlock_page(page);
return err; return err;
} }
......
...@@ -432,31 +432,20 @@ static int hostfs_writepage(struct page *page, struct writeback_control *wbc) ...@@ -432,31 +432,20 @@ static int hostfs_writepage(struct page *page, struct writeback_control *wbc)
static int hostfs_read_folio(struct file *file, struct folio *folio) static int hostfs_read_folio(struct file *file, struct folio *folio)
{ {
struct page *page = &folio->page;
char *buffer; char *buffer;
loff_t start = page_offset(page); loff_t start = folio_pos(folio);
int bytes_read, ret = 0; int bytes_read, ret = 0;
buffer = kmap_local_page(page); buffer = kmap_local_folio(folio, 0);
bytes_read = read_file(FILE_HOSTFS_I(file)->fd, &start, buffer, bytes_read = read_file(FILE_HOSTFS_I(file)->fd, &start, buffer,
PAGE_SIZE); PAGE_SIZE);
if (bytes_read < 0) { if (bytes_read < 0)
ClearPageUptodate(page);
SetPageError(page);
ret = bytes_read; ret = bytes_read;
goto out; else
} buffer = folio_zero_tail(folio, bytes_read, buffer);
memset(buffer + bytes_read, 0, PAGE_SIZE - bytes_read);
ClearPageError(page);
SetPageUptodate(page);
out:
flush_dcache_page(page);
kunmap_local(buffer); kunmap_local(buffer);
unlock_page(page);
folio_end_read(folio, ret == 0);
return ret; return ret;
} }
......
...@@ -472,9 +472,8 @@ static int hpfs_rmdir(struct inode *dir, struct dentry *dentry) ...@@ -472,9 +472,8 @@ static int hpfs_rmdir(struct inode *dir, struct dentry *dentry)
static int hpfs_symlink_read_folio(struct file *file, struct folio *folio) static int hpfs_symlink_read_folio(struct file *file, struct folio *folio)
{ {
struct page *page = &folio->page; char *link = folio_address(folio);
char *link = page_address(page); struct inode *i = folio->mapping->host;
struct inode *i = page->mapping->host;
struct fnode *fnode; struct fnode *fnode;
struct buffer_head *bh; struct buffer_head *bh;
int err; int err;
...@@ -485,17 +484,9 @@ static int hpfs_symlink_read_folio(struct file *file, struct folio *folio) ...@@ -485,17 +484,9 @@ static int hpfs_symlink_read_folio(struct file *file, struct folio *folio)
goto fail; goto fail;
err = hpfs_read_ea(i->i_sb, fnode, "SYMLINK", link, PAGE_SIZE); err = hpfs_read_ea(i->i_sb, fnode, "SYMLINK", link, PAGE_SIZE);
brelse(bh); brelse(bh);
if (err)
goto fail;
hpfs_unlock(i->i_sb);
SetPageUptodate(page);
unlock_page(page);
return 0;
fail: fail:
hpfs_unlock(i->i_sb); hpfs_unlock(i->i_sb);
SetPageError(page); folio_end_read(folio, err == 0);
unlock_page(page);
return err; return err;
} }
......
...@@ -307,8 +307,6 @@ static void iomap_finish_folio_read(struct folio *folio, size_t off, ...@@ -307,8 +307,6 @@ static void iomap_finish_folio_read(struct folio *folio, size_t off,
spin_unlock_irqrestore(&ifs->state_lock, flags); spin_unlock_irqrestore(&ifs->state_lock, flags);
} }
if (error)
folio_set_error(folio);
if (finished) if (finished)
folio_end_read(folio, uptodate); folio_end_read(folio, uptodate);
} }
...@@ -461,9 +459,6 @@ int iomap_read_folio(struct folio *folio, const struct iomap_ops *ops) ...@@ -461,9 +459,6 @@ int iomap_read_folio(struct folio *folio, const struct iomap_ops *ops)
while ((ret = iomap_iter(&iter, ops)) > 0) while ((ret = iomap_iter(&iter, ops)) > 0)
iter.processed = iomap_readpage_iter(&iter, &ctx, 0); iter.processed = iomap_readpage_iter(&iter, &ctx, 0);
if (ret < 0)
folio_set_error(folio);
if (ctx.bio) { if (ctx.bio) {
submit_bio(ctx.bio); submit_bio(ctx.bio);
WARN_ON_ONCE(!ctx.cur_folio_in_bio); WARN_ON_ONCE(!ctx.cur_folio_in_bio);
...@@ -698,7 +693,6 @@ static int __iomap_write_begin(const struct iomap_iter *iter, loff_t pos, ...@@ -698,7 +693,6 @@ static int __iomap_write_begin(const struct iomap_iter *iter, loff_t pos,
if (folio_test_uptodate(folio)) if (folio_test_uptodate(folio))
return 0; return 0;
folio_clear_error(folio);
do { do {
iomap_adjust_read_range(iter->inode, folio, &block_start, iomap_adjust_read_range(iter->inode, folio, &block_start,
...@@ -1539,8 +1533,6 @@ iomap_finish_ioend(struct iomap_ioend *ioend, int error) ...@@ -1539,8 +1533,6 @@ iomap_finish_ioend(struct iomap_ioend *ioend, int error)
/* walk all folios in bio, ending page IO on them */ /* walk all folios in bio, ending page IO on them */
bio_for_each_folio_all(fi, bio) { bio_for_each_folio_all(fi, bio) {
if (error)
folio_set_error(fi.folio);
iomap_finish_folio_write(inode, fi.folio, fi.length); iomap_finish_folio_write(inode, fi.folio, fi.length);
folio_count++; folio_count++;
} }
......
...@@ -688,11 +688,10 @@ int parse_rock_ridge_inode(struct iso_directory_record *de, struct inode *inode, ...@@ -688,11 +688,10 @@ int parse_rock_ridge_inode(struct iso_directory_record *de, struct inode *inode,
*/ */
static int rock_ridge_symlink_read_folio(struct file *file, struct folio *folio) static int rock_ridge_symlink_read_folio(struct file *file, struct folio *folio)
{ {
struct page *page = &folio->page; struct inode *inode = folio->mapping->host;
struct inode *inode = page->mapping->host;
struct iso_inode_info *ei = ISOFS_I(inode); struct iso_inode_info *ei = ISOFS_I(inode);
struct isofs_sb_info *sbi = ISOFS_SB(inode->i_sb); struct isofs_sb_info *sbi = ISOFS_SB(inode->i_sb);
char *link = page_address(page); char *link = folio_address(folio);
unsigned long bufsize = ISOFS_BUFFER_SIZE(inode); unsigned long bufsize = ISOFS_BUFFER_SIZE(inode);
struct buffer_head *bh; struct buffer_head *bh;
char *rpnt = link; char *rpnt = link;
...@@ -779,9 +778,10 @@ static int rock_ridge_symlink_read_folio(struct file *file, struct folio *folio) ...@@ -779,9 +778,10 @@ static int rock_ridge_symlink_read_folio(struct file *file, struct folio *folio)
goto fail; goto fail;
brelse(bh); brelse(bh);
*rpnt = '\0'; *rpnt = '\0';
SetPageUptodate(page); ret = 0;
unlock_page(page); end:
return 0; folio_end_read(folio, ret == 0);
return ret;
/* error exit from macro */ /* error exit from macro */
out: out:
...@@ -795,9 +795,8 @@ static int rock_ridge_symlink_read_folio(struct file *file, struct folio *folio) ...@@ -795,9 +795,8 @@ static int rock_ridge_symlink_read_folio(struct file *file, struct folio *folio)
fail: fail:
brelse(bh); brelse(bh);
error: error:
SetPageError(page); ret = -EIO;
unlock_page(page); goto end;
return -EIO;
} }
const struct address_space_operations isofs_symlink_aops = { const struct address_space_operations isofs_symlink_aops = {
......
...@@ -95,13 +95,8 @@ static int jffs2_do_readpage_nolock (struct inode *inode, struct page *pg) ...@@ -95,13 +95,8 @@ static int jffs2_do_readpage_nolock (struct inode *inode, struct page *pg)
ret = jffs2_read_inode_range(c, f, pg_buf, pg->index << PAGE_SHIFT, ret = jffs2_read_inode_range(c, f, pg_buf, pg->index << PAGE_SHIFT,
PAGE_SIZE); PAGE_SIZE);
if (ret) { if (!ret)
ClearPageUptodate(pg);
SetPageError(pg);
} else {
SetPageUptodate(pg); SetPageUptodate(pg);
ClearPageError(pg);
}
flush_dcache_page(pg); flush_dcache_page(pg);
kunmap(pg); kunmap(pg);
...@@ -304,10 +299,8 @@ static int jffs2_write_end(struct file *filp, struct address_space *mapping, ...@@ -304,10 +299,8 @@ static int jffs2_write_end(struct file *filp, struct address_space *mapping,
kunmap(pg); kunmap(pg);
if (ret) { if (ret)
/* There was an error writing. */ mapping_set_error(mapping, ret);
SetPageError(pg);
}
/* Adjust writtenlen for the padding we did, so we don't confuse our caller */ /* Adjust writtenlen for the padding we did, so we don't confuse our caller */
writtenlen -= min(writtenlen, (start - aligned_start)); writtenlen -= min(writtenlen, (start - aligned_start));
...@@ -330,7 +323,6 @@ static int jffs2_write_end(struct file *filp, struct address_space *mapping, ...@@ -330,7 +323,6 @@ static int jffs2_write_end(struct file *filp, struct address_space *mapping,
it gets reread */ it gets reread */
jffs2_dbg(1, "%s(): Not all bytes written. Marking page !uptodate\n", jffs2_dbg(1, "%s(): Not all bytes written. Marking page !uptodate\n",
__func__); __func__);
SetPageError(pg);
ClearPageUptodate(pg); ClearPageUptodate(pg);
} }
......
...@@ -48,13 +48,8 @@ static void mpage_read_end_io(struct bio *bio) ...@@ -48,13 +48,8 @@ static void mpage_read_end_io(struct bio *bio)
struct folio_iter fi; struct folio_iter fi;
int err = blk_status_to_errno(bio->bi_status); int err = blk_status_to_errno(bio->bi_status);
bio_for_each_folio_all(fi, bio) { bio_for_each_folio_all(fi, bio)
if (err) folio_end_read(fi.folio, err == 0);
folio_set_error(fi.folio);
else
folio_mark_uptodate(fi.folio);
folio_unlock(fi.folio);
}
bio_put(bio); bio_put(bio);
} }
...@@ -65,10 +60,8 @@ static void mpage_write_end_io(struct bio *bio) ...@@ -65,10 +60,8 @@ static void mpage_write_end_io(struct bio *bio)
int err = blk_status_to_errno(bio->bi_status); int err = blk_status_to_errno(bio->bi_status);
bio_for_each_folio_all(fi, bio) { bio_for_each_folio_all(fi, bio) {
if (err) { if (err)
folio_set_error(fi.folio);
mapping_set_error(fi.folio->mapping, err); mapping_set_error(fi.folio->mapping, err);
}
folio_end_writeback(fi.folio); folio_end_writeback(fi.folio);
} }
......
...@@ -122,8 +122,6 @@ static void nfs_readpage_release(struct nfs_page *req, int error) ...@@ -122,8 +122,6 @@ static void nfs_readpage_release(struct nfs_page *req, int error)
{ {
struct folio *folio = nfs_page_to_folio(req); struct folio *folio = nfs_page_to_folio(req);
if (nfs_error_is_fatal_on_server(error) && error != -ETIMEDOUT)
folio_set_error(folio);
if (nfs_page_group_sync_on_bit(req, PG_UNLOCKPAGE)) if (nfs_page_group_sync_on_bit(req, PG_UNLOCKPAGE))
if (nfs_netfs_folio_unlock(folio)) if (nfs_netfs_folio_unlock(folio))
folio_unlock(folio); folio_unlock(folio);
......
...@@ -32,15 +32,7 @@ static int nfs_symlink_filler(struct file *file, struct folio *folio) ...@@ -32,15 +32,7 @@ static int nfs_symlink_filler(struct file *file, struct folio *folio)
int error; int error;
error = NFS_PROTO(inode)->readlink(inode, &folio->page, 0, PAGE_SIZE); error = NFS_PROTO(inode)->readlink(inode, &folio->page, 0, PAGE_SIZE);
if (error < 0) folio_end_read(folio, error == 0);
goto error;
folio_mark_uptodate(folio);
folio_unlock(folio);
return 0;
error:
folio_set_error(folio);
folio_unlock(folio);
return error; return error;
} }
......
...@@ -311,7 +311,6 @@ static void nfs_mapping_set_error(struct folio *folio, int error) ...@@ -311,7 +311,6 @@ static void nfs_mapping_set_error(struct folio *folio, int error)
{ {
struct address_space *mapping = folio_file_mapping(folio); struct address_space *mapping = folio_file_mapping(folio);
folio_set_error(folio);
filemap_set_wb_err(mapping, error); filemap_set_wb_err(mapping, error);
if (mapping->host) if (mapping->host)
errseq_set(&mapping->host->i_sb->s_wb_err, errseq_set(&mapping->host->i_sb->s_wb_err,
......
...@@ -56,7 +56,6 @@ static int orangefs_writepage_locked(struct page *page, ...@@ -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, ...@@ -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,14 +301,9 @@ static int orangefs_read_folio(struct file *file, struct folio *folio) ...@@ -303,14 +301,9 @@ 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 */
folio_unlock(folio);
return ret; return ret;
} }
......
...@@ -274,10 +274,8 @@ orangefs_bufmap_map(struct orangefs_bufmap *bufmap, ...@@ -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;
} }
......
...@@ -2699,7 +2699,6 @@ static int reiserfs_write_folio(struct folio *folio, ...@@ -2699,7 +2699,6 @@ static int reiserfs_write_folio(struct folio *folio,
} }
bh = bh->b_this_page; bh = bh->b_this_page;
} while (bh != head); } while (bh != head);
folio_set_error(folio);
BUG_ON(folio_test_writeback(folio)); BUG_ON(folio_test_writeback(folio));
folio_start_writeback(folio); folio_start_writeback(folio);
folio_unlock(folio); folio_unlock(folio);
......
...@@ -101,19 +101,15 @@ static struct inode *romfs_iget(struct super_block *sb, unsigned long pos); ...@@ -101,19 +101,15 @@ static struct inode *romfs_iget(struct super_block *sb, unsigned long pos);
*/ */
static int romfs_read_folio(struct file *file, struct folio *folio) static int romfs_read_folio(struct file *file, struct folio *folio)
{ {
struct page *page = &folio->page; struct inode *inode = folio->mapping->host;
struct inode *inode = page->mapping->host;
loff_t offset, size; loff_t offset, size;
unsigned long fillsize, pos; unsigned long fillsize, pos;
void *buf; void *buf;
int ret; int ret;
buf = kmap(page); buf = kmap_local_folio(folio, 0);
if (!buf)
return -ENOMEM;
/* 32 bit warning -- but not for us :) */ offset = folio_pos(folio);
offset = page_offset(page);
size = i_size_read(inode); size = i_size_read(inode);
fillsize = 0; fillsize = 0;
ret = 0; ret = 0;
...@@ -125,20 +121,14 @@ static int romfs_read_folio(struct file *file, struct folio *folio) ...@@ -125,20 +121,14 @@ static int romfs_read_folio(struct file *file, struct folio *folio)
ret = romfs_dev_read(inode->i_sb, pos, buf, fillsize); ret = romfs_dev_read(inode->i_sb, pos, buf, fillsize);
if (ret < 0) { if (ret < 0) {
SetPageError(page);
fillsize = 0; fillsize = 0;
ret = -EIO; ret = -EIO;
} }
} }
if (fillsize < PAGE_SIZE) buf = folio_zero_tail(folio, fillsize, buf);
memset(buf + fillsize, 0, PAGE_SIZE - fillsize); kunmap_local(buf);
if (ret == 0) folio_end_read(folio, ret == 0);
SetPageUptodate(page);
flush_dcache_page(page);
kunmap(page);
unlock_page(page);
return ret; return ret;
} }
......
...@@ -188,7 +188,6 @@ static bool ufs_check_page(struct page *page) ...@@ -188,7 +188,6 @@ static bool ufs_check_page(struct page *page)
"offset=%lu", "offset=%lu",
dir->i_ino, (page->index<<PAGE_SHIFT)+offs); dir->i_ino, (page->index<<PAGE_SHIFT)+offs);
fail: fail:
SetPageError(page);
return false; return false;
} }
......
...@@ -228,26 +228,19 @@ const struct inode_operations vboxsf_reg_iops = { ...@@ -228,26 +228,19 @@ const struct inode_operations vboxsf_reg_iops = {
static int vboxsf_read_folio(struct file *file, struct folio *folio) static int vboxsf_read_folio(struct file *file, struct folio *folio)
{ {
struct page *page = &folio->page;
struct vboxsf_handle *sf_handle = file->private_data; struct vboxsf_handle *sf_handle = file->private_data;
loff_t off = page_offset(page); loff_t off = folio_pos(folio);
u32 nread = PAGE_SIZE; u32 nread = PAGE_SIZE;
u8 *buf; u8 *buf;
int err; int err;
buf = kmap(page); buf = kmap_local_folio(folio, 0);
err = vboxsf_read(sf_handle->root, sf_handle->handle, off, &nread, buf); err = vboxsf_read(sf_handle->root, sf_handle->handle, off, &nread, buf);
if (err == 0) { buf = folio_zero_tail(folio, nread, buf + nread);
memset(&buf[nread], 0, PAGE_SIZE - nread);
flush_dcache_page(page);
SetPageUptodate(page);
} else {
SetPageError(page);
}
kunmap(page); kunmap_local(buf);
unlock_page(page); folio_end_read(folio, err == 0);
return err; return err;
} }
...@@ -295,7 +288,6 @@ static int vboxsf_writepage(struct page *page, struct writeback_control *wbc) ...@@ -295,7 +288,6 @@ static int vboxsf_writepage(struct page *page, struct writeback_control *wbc)
kref_put(&sf_handle->refcount, vboxsf_handle_release); kref_put(&sf_handle->refcount, vboxsf_handle_release);
if (err == 0) { if (err == 0) {
ClearPageError(page);
/* mtime changed */ /* mtime changed */
sf_i->force_restat = 1; sf_i->force_restat = 1;
} else { } else {
......
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