From: Youling Tang <youling.tang@linux.dev>
To: Kent Overstreet <kent.overstreet@linux.dev>
Cc: linux-bcachefs@vger.kernel.org, linux-kernel@vger.kernel.org,
youling.tang@linux.dev, Youling Tang <tangyouling@kylinos.cn>
Subject: [PATCH 2/2] bcachefs: Use bio_add_folio_nofail() for unfailable operations
Date: Thu, 5 Jun 2025 10:06:39 +0800 [thread overview]
Message-ID: <20250605020639.6868-2-youling.tang@linux.dev> (raw)
In-Reply-To: <20250605020639.6868-1-youling.tang@linux.dev>
From: Youling Tang <tangyouling@kylinos.cn>
Use bio_add_folio_nofail() to replace the unfailable bio_add_folio()
operation.
Signed-off-by: Youling Tang <tangyouling@kylinos.cn>
---
fs/bcachefs/fs-io-buffered.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/fs/bcachefs/fs-io-buffered.c b/fs/bcachefs/fs-io-buffered.c
index 66bacdd49f78..dad48d44f47b 100644
--- a/fs/bcachefs/fs-io-buffered.c
+++ b/fs/bcachefs/fs-io-buffered.c
@@ -145,7 +145,7 @@ static int readpage_bio_extend(struct btree_trans *trans,
BUG_ON(folio_sector(folio) != bio_end_sector(bio));
- BUG_ON(!bio_add_folio(bio, folio, folio_size(folio), 0));
+ bio_add_folio_nofail(bio, folio, folio_size(folio), 0);
}
return bch2_trans_relock(trans);
@@ -311,7 +311,7 @@ void bch2_readahead(struct readahead_control *ractl)
readpage_iter_advance(&readpages_iter);
rbio->bio.bi_iter.bi_sector = folio_sector(folio);
- BUG_ON(!bio_add_folio(&rbio->bio, folio, folio_size(folio), 0));
+ bio_add_folio_nofail(&rbio->bio, folio, folio_size(folio), 0);
bchfs_read(trans, rbio, inode_inum(inode),
&readpages_iter);
@@ -354,7 +354,7 @@ int bch2_read_single_folio(struct folio *folio, struct address_space *mapping)
rbio->bio.bi_private = &done;
rbio->bio.bi_opf = REQ_OP_READ|REQ_SYNC;
rbio->bio.bi_iter.bi_sector = folio_sector(folio);
- BUG_ON(!bio_add_folio(&rbio->bio, folio, folio_size(folio), 0));
+ bio_add_folio_nofail(&rbio->bio, folio, folio_size(folio), 0);
blk_start_plug(&plug);
bch2_trans_run(c, (bchfs_read(trans, rbio, inode_inum(inode), NULL), 0));
@@ -639,8 +639,8 @@ static int __bch2_writepage(struct folio *folio,
atomic_inc(&s->write_count);
BUG_ON(inode != w->io->inode);
- BUG_ON(!bio_add_folio(&w->io->op.wbio.bio, folio,
- sectors << 9, offset << 9));
+ bio_add_folio_nofail(&w->io->op.wbio.bio, folio,
+ sectors << 9, offset << 9);
w->io->op.res.sectors += reserved_sectors;
w->io->op.i_sectors_delta -= dirty_sectors;
--
2.34.1
next prev parent reply other threads:[~2025-06-05 2:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-05 2:06 [PATCH 1/2] bcachefs: Simplify bch2_bio_map() Youling Tang
2025-06-05 2:06 ` Youling Tang [this message]
2025-06-05 2:14 ` Kent Overstreet
2025-06-27 2:16 ` Kent Overstreet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250605020639.6868-2-youling.tang@linux.dev \
--to=youling.tang@linux.dev \
--cc=kent.overstreet@linux.dev \
--cc=linux-bcachefs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tangyouling@kylinos.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox