Skip to content

Commit aff3133

Browse files
committed
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()
2 parents b051320 + 7ad635e commit aff3133

File tree

20 files changed

+60
-168
lines changed

20 files changed

+60
-168
lines changed

fs/befs/linuxvfs.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,7 @@ static int befs_symlink_read_folio(struct file *unused, struct folio *folio)
475475
befs_data_stream *data = &befs_ino->i_data.ds;
476476
befs_off_t len = data->size;
477477
char *link = folio_address(folio);
478+
int err = -EIO;
478479

479480
if (len == 0 || len > PAGE_SIZE) {
480481
befs_error(sb, "Long symlink with illegal length");
@@ -487,13 +488,10 @@ static int befs_symlink_read_folio(struct file *unused, struct folio *folio)
487488
goto fail;
488489
}
489490
link[len - 1] = '\0';
490-
folio_mark_uptodate(folio);
491-
folio_unlock(folio);
492-
return 0;
491+
err = 0;
493492
fail:
494-
folio_set_error(folio);
495-
folio_unlock(folio);
496-
return -EIO;
493+
folio_end_read(folio, err == 0);
494+
return err;
497495
}
498496

499497
/*

fs/buffer.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,6 @@ static void end_buffer_async_read(struct buffer_head *bh, int uptodate)
258258
} else {
259259
clear_buffer_uptodate(bh);
260260
buffer_io_error(bh, ", async page read");
261-
folio_set_error(folio);
262261
}
263262

264263
/*
@@ -391,7 +390,6 @@ static void end_buffer_async_write(struct buffer_head *bh, int uptodate)
391390
buffer_io_error(bh, ", lost async page write");
392391
mark_buffer_write_io_error(bh);
393392
clear_buffer_uptodate(bh);
394-
folio_set_error(folio);
395393
}
396394

397395
first = folio_buffers(folio);
@@ -1960,7 +1958,6 @@ int __block_write_full_folio(struct inode *inode, struct folio *folio,
19601958
clear_buffer_dirty(bh);
19611959
}
19621960
} while ((bh = bh->b_this_page) != head);
1963-
folio_set_error(folio);
19641961
BUG_ON(folio_test_writeback(folio));
19651962
mapping_set_error(folio->mapping, err);
19661963
folio_start_writeback(folio);
@@ -2405,10 +2402,8 @@ int block_read_full_folio(struct folio *folio, get_block_t *get_block)
24052402
if (iblock < lblock) {
24062403
WARN_ON(bh->b_size != blocksize);
24072404
err = get_block(inode, iblock, bh, 0);
2408-
if (err) {
2409-
folio_set_error(folio);
2405+
if (err)
24102406
page_error = true;
2411-
}
24122407
}
24132408
if (!buffer_mapped(bh)) {
24142409
folio_zero_range(folio, i * blocksize,

fs/coda/symlink.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,7 @@ static int coda_symlink_filler(struct file *file, struct folio *folio)
3131
cii = ITOC(inode);
3232

3333
error = venus_readlink(inode->i_sb, &cii->c_fid, p, &len);
34-
if (error)
35-
goto fail;
36-
folio_mark_uptodate(folio);
37-
folio_unlock(folio);
38-
return 0;
39-
40-
fail:
41-
folio_set_error(folio);
42-
folio_unlock(folio);
34+
folio_end_read(folio, error == 0);
4335
return error;
4436
}
4537

fs/cramfs/inode.c

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -811,19 +811,19 @@ static struct dentry *cramfs_lookup(struct inode *dir, struct dentry *dentry, un
811811

812812
static int cramfs_read_folio(struct file *file, struct folio *folio)
813813
{
814-
struct page *page = &folio->page;
815-
struct inode *inode = page->mapping->host;
814+
struct inode *inode = folio->mapping->host;
816815
u32 maxblock;
817816
int bytes_filled;
818817
void *pgdata;
818+
bool success = false;
819819

820820
maxblock = (inode->i_size + PAGE_SIZE - 1) >> PAGE_SHIFT;
821821
bytes_filled = 0;
822-
pgdata = kmap_local_page(page);
822+
pgdata = kmap_local_folio(folio, 0);
823823

824-
if (page->index < maxblock) {
824+
if (folio->index < maxblock) {
825825
struct super_block *sb = inode->i_sb;
826-
u32 blkptr_offset = OFFSET(inode) + page->index * 4;
826+
u32 blkptr_offset = OFFSET(inode) + folio->index * 4;
827827
u32 block_ptr, block_start, block_len;
828828
bool uncompressed, direct;
829829

@@ -844,7 +844,7 @@ static int cramfs_read_folio(struct file *file, struct folio *folio)
844844
if (uncompressed) {
845845
block_len = PAGE_SIZE;
846846
/* if last block: cap to file length */
847-
if (page->index == maxblock - 1)
847+
if (folio->index == maxblock - 1)
848848
block_len =
849849
offset_in_page(inode->i_size);
850850
} else {
@@ -861,7 +861,7 @@ static int cramfs_read_folio(struct file *file, struct folio *folio)
861861
* from the previous block's pointer.
862862
*/
863863
block_start = OFFSET(inode) + maxblock * 4;
864-
if (page->index)
864+
if (folio->index)
865865
block_start = *(u32 *)
866866
cramfs_read(sb, blkptr_offset - 4, 4);
867867
/* Beware... previous ptr might be a direct ptr */
@@ -906,17 +906,12 @@ static int cramfs_read_folio(struct file *file, struct folio *folio)
906906
}
907907

908908
memset(pgdata + bytes_filled, 0, PAGE_SIZE - bytes_filled);
909-
flush_dcache_page(page);
910-
kunmap_local(pgdata);
911-
SetPageUptodate(page);
912-
unlock_page(page);
913-
return 0;
909+
flush_dcache_folio(folio);
914910

911+
success = true;
915912
err:
916913
kunmap_local(pgdata);
917-
ClearPageUptodate(page);
918-
SetPageError(page);
919-
unlock_page(page);
914+
folio_end_read(folio, success);
920915
return 0;
921916
}
922917

fs/efs/symlink.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@
1414

1515
static int efs_symlink_read_folio(struct file *file, struct folio *folio)
1616
{
17-
struct page *page = &folio->page;
18-
char *link = page_address(page);
19-
struct buffer_head * bh;
20-
struct inode * inode = page->mapping->host;
17+
char *link = folio_address(folio);
18+
struct buffer_head *bh;
19+
struct inode *inode = folio->mapping->host;
2120
efs_block_t size = inode->i_size;
2221
int err;
2322

@@ -40,12 +39,9 @@ static int efs_symlink_read_folio(struct file *file, struct folio *folio)
4039
brelse(bh);
4140
}
4241
link[size] = '\0';
43-
SetPageUptodate(page);
44-
unlock_page(page);
45-
return 0;
42+
err = 0;
4643
fail:
47-
SetPageError(page);
48-
unlock_page(page);
44+
folio_end_read(folio, err == 0);
4945
return err;
5046
}
5147

fs/hostfs/hostfs_kern.c

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -432,31 +432,20 @@ static int hostfs_writepage(struct page *page, struct writeback_control *wbc)
432432

433433
static int hostfs_read_folio(struct file *file, struct folio *folio)
434434
{
435-
struct page *page = &folio->page;
436435
char *buffer;
437-
loff_t start = page_offset(page);
436+
loff_t start = folio_pos(folio);
438437
int bytes_read, ret = 0;
439438

440-
buffer = kmap_local_page(page);
439+
buffer = kmap_local_folio(folio, 0);
441440
bytes_read = read_file(FILE_HOSTFS_I(file)->fd, &start, buffer,
442441
PAGE_SIZE);
443-
if (bytes_read < 0) {
444-
ClearPageUptodate(page);
445-
SetPageError(page);
442+
if (bytes_read < 0)
446443
ret = bytes_read;
447-
goto out;
448-
}
449-
450-
memset(buffer + bytes_read, 0, PAGE_SIZE - bytes_read);
451-
452-
ClearPageError(page);
453-
SetPageUptodate(page);
454-
455-
out:
456-
flush_dcache_page(page);
444+
else
445+
buffer = folio_zero_tail(folio, bytes_read, buffer);
457446
kunmap_local(buffer);
458-
unlock_page(page);
459447

448+
folio_end_read(folio, ret == 0);
460449
return ret;
461450
}
462451

fs/hpfs/namei.c

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -472,9 +472,8 @@ static int hpfs_rmdir(struct inode *dir, struct dentry *dentry)
472472

473473
static int hpfs_symlink_read_folio(struct file *file, struct folio *folio)
474474
{
475-
struct page *page = &folio->page;
476-
char *link = page_address(page);
477-
struct inode *i = page->mapping->host;
475+
char *link = folio_address(folio);
476+
struct inode *i = folio->mapping->host;
478477
struct fnode *fnode;
479478
struct buffer_head *bh;
480479
int err;
@@ -485,17 +484,9 @@ static int hpfs_symlink_read_folio(struct file *file, struct folio *folio)
485484
goto fail;
486485
err = hpfs_read_ea(i->i_sb, fnode, "SYMLINK", link, PAGE_SIZE);
487486
brelse(bh);
488-
if (err)
489-
goto fail;
490-
hpfs_unlock(i->i_sb);
491-
SetPageUptodate(page);
492-
unlock_page(page);
493-
return 0;
494-
495487
fail:
496488
hpfs_unlock(i->i_sb);
497-
SetPageError(page);
498-
unlock_page(page);
489+
folio_end_read(folio, err == 0);
499490
return err;
500491
}
501492

fs/iomap/buffered-io.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,6 @@ static void iomap_finish_folio_read(struct folio *folio, size_t off,
307307
spin_unlock_irqrestore(&ifs->state_lock, flags);
308308
}
309309

310-
if (error)
311-
folio_set_error(folio);
312310
if (finished)
313311
folio_end_read(folio, uptodate);
314312
}
@@ -461,9 +459,6 @@ int iomap_read_folio(struct folio *folio, const struct iomap_ops *ops)
461459
while ((ret = iomap_iter(&iter, ops)) > 0)
462460
iter.processed = iomap_readpage_iter(&iter, &ctx, 0);
463461

464-
if (ret < 0)
465-
folio_set_error(folio);
466-
467462
if (ctx.bio) {
468463
submit_bio(ctx.bio);
469464
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,
698693

699694
if (folio_test_uptodate(folio))
700695
return 0;
701-
folio_clear_error(folio);
702696

703697
do {
704698
iomap_adjust_read_range(iter->inode, folio, &block_start,
@@ -1539,8 +1533,6 @@ iomap_finish_ioend(struct iomap_ioend *ioend, int error)
15391533

15401534
/* walk all folios in bio, ending page IO on them */
15411535
bio_for_each_folio_all(fi, bio) {
1542-
if (error)
1543-
folio_set_error(fi.folio);
15441536
iomap_finish_folio_write(inode, fi.folio, fi.length);
15451537
folio_count++;
15461538
}

fs/isofs/rock.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -688,11 +688,10 @@ int parse_rock_ridge_inode(struct iso_directory_record *de, struct inode *inode,
688688
*/
689689
static int rock_ridge_symlink_read_folio(struct file *file, struct folio *folio)
690690
{
691-
struct page *page = &folio->page;
692-
struct inode *inode = page->mapping->host;
691+
struct inode *inode = folio->mapping->host;
693692
struct iso_inode_info *ei = ISOFS_I(inode);
694693
struct isofs_sb_info *sbi = ISOFS_SB(inode->i_sb);
695-
char *link = page_address(page);
694+
char *link = folio_address(folio);
696695
unsigned long bufsize = ISOFS_BUFFER_SIZE(inode);
697696
struct buffer_head *bh;
698697
char *rpnt = link;
@@ -779,9 +778,10 @@ static int rock_ridge_symlink_read_folio(struct file *file, struct folio *folio)
779778
goto fail;
780779
brelse(bh);
781780
*rpnt = '\0';
782-
SetPageUptodate(page);
783-
unlock_page(page);
784-
return 0;
781+
ret = 0;
782+
end:
783+
folio_end_read(folio, ret == 0);
784+
return ret;
785785

786786
/* error exit from macro */
787787
out:
@@ -795,9 +795,8 @@ static int rock_ridge_symlink_read_folio(struct file *file, struct folio *folio)
795795
fail:
796796
brelse(bh);
797797
error:
798-
SetPageError(page);
799-
unlock_page(page);
800-
return -EIO;
798+
ret = -EIO;
799+
goto end;
801800
}
802801

803802
const struct address_space_operations isofs_symlink_aops = {

fs/jffs2/file.c

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,8 @@ static int jffs2_do_readpage_nolock (struct inode *inode, struct page *pg)
9595
ret = jffs2_read_inode_range(c, f, pg_buf, pg->index << PAGE_SHIFT,
9696
PAGE_SIZE);
9797

98-
if (ret) {
99-
ClearPageUptodate(pg);
100-
SetPageError(pg);
101-
} else {
98+
if (!ret)
10299
SetPageUptodate(pg);
103-
ClearPageError(pg);
104-
}
105100

106101
flush_dcache_page(pg);
107102
kunmap(pg);
@@ -304,10 +299,8 @@ static int jffs2_write_end(struct file *filp, struct address_space *mapping,
304299

305300
kunmap(pg);
306301

307-
if (ret) {
308-
/* There was an error writing. */
309-
SetPageError(pg);
310-
}
302+
if (ret)
303+
mapping_set_error(mapping, ret);
311304

312305
/* Adjust writtenlen for the padding we did, so we don't confuse our caller */
313306
writtenlen -= min(writtenlen, (start - aligned_start));
@@ -330,7 +323,6 @@ static int jffs2_write_end(struct file *filp, struct address_space *mapping,
330323
it gets reread */
331324
jffs2_dbg(1, "%s(): Not all bytes written. Marking page !uptodate\n",
332325
__func__);
333-
SetPageError(pg);
334326
ClearPageUptodate(pg);
335327
}
336328

0 commit comments

Comments
 (0)