Skip to content

Commit 04fee68

Browse files
author
Kent Overstreet
committed
bcachefs: Kill __GFP_NOFAIL in buffered read path
Recently, we fixed our __GFP_NOFAIL usage in the readahead path, but the easy one in read_single_folio() (where wa can return an error) was missed - oops. Fixes: Signed-off-by: Kent Overstreet <[email protected]>
1 parent 1f62622 commit 04fee68

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

fs/bcachefs/fs-io-buffered.c

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -303,18 +303,6 @@ void bch2_readahead(struct readahead_control *ractl)
303303
darray_exit(&readpages_iter.folios);
304304
}
305305

306-
static void __bchfs_readfolio(struct bch_fs *c, struct bch_read_bio *rbio,
307-
subvol_inum inum, struct folio *folio)
308-
{
309-
bch2_folio_create(folio, __GFP_NOFAIL);
310-
311-
rbio->bio.bi_opf = REQ_OP_READ|REQ_SYNC;
312-
rbio->bio.bi_iter.bi_sector = folio_sector(folio);
313-
BUG_ON(!bio_add_folio(&rbio->bio, folio, folio_size(folio), 0));
314-
315-
bch2_trans_run(c, (bchfs_read(trans, rbio, inum, NULL), 0));
316-
}
317-
318306
static void bch2_read_single_folio_end_io(struct bio *bio)
319307
{
320308
complete(bio->bi_private);
@@ -329,14 +317,21 @@ int bch2_read_single_folio(struct folio *folio, struct address_space *mapping)
329317
int ret;
330318
DECLARE_COMPLETION_ONSTACK(done);
331319

320+
if (!bch2_folio_create(folio, GFP_KERNEL))
321+
return -ENOMEM;
322+
332323
bch2_inode_opts_get(&opts, c, &inode->ei_inode);
333324

334325
rbio = rbio_init(bio_alloc_bioset(NULL, 1, REQ_OP_READ, GFP_KERNEL, &c->bio_read),
335326
opts);
336327
rbio->bio.bi_private = &done;
337328
rbio->bio.bi_end_io = bch2_read_single_folio_end_io;
338329

339-
__bchfs_readfolio(c, rbio, inode_inum(inode), folio);
330+
rbio->bio.bi_opf = REQ_OP_READ|REQ_SYNC;
331+
rbio->bio.bi_iter.bi_sector = folio_sector(folio);
332+
BUG_ON(!bio_add_folio(&rbio->bio, folio, folio_size(folio), 0));
333+
334+
bch2_trans_run(c, (bchfs_read(trans, rbio, inode_inum(inode), NULL), 0));
340335
wait_for_completion(&done);
341336

342337
ret = blk_status_to_errno(rbio->bio.bi_status);

0 commit comments

Comments
 (0)