Commit ff9c301f authored by Kent Overstreet's avatar Kent Overstreet

bcachefs: bio_for_each_segment_all() -> bio_for_each_folio_all()

This converts the writepage end_io path to folios.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 30bff594
...@@ -1316,34 +1316,33 @@ static void bch2_writepage_io_done(struct bch_write_op *op) ...@@ -1316,34 +1316,33 @@ static void bch2_writepage_io_done(struct bch_write_op *op)
container_of(op, struct bch_writepage_io, op); container_of(op, struct bch_writepage_io, op);
struct bch_fs *c = io->op.c; struct bch_fs *c = io->op.c;
struct bio *bio = &io->op.wbio.bio; struct bio *bio = &io->op.wbio.bio;
struct bvec_iter_all iter; struct folio_iter fi;
struct bio_vec *bvec;
unsigned i; unsigned i;
if (io->op.error) { if (io->op.error) {
set_bit(EI_INODE_ERROR, &io->inode->ei_flags); set_bit(EI_INODE_ERROR, &io->inode->ei_flags);
bio_for_each_segment_all(bvec, bio, iter) { bio_for_each_folio_all(fi, bio) {
struct bch_folio *s; struct bch_folio *s;
SetPageError(bvec->bv_page); folio_set_error(fi.folio);
mapping_set_error(bvec->bv_page->mapping, -EIO); mapping_set_error(fi.folio->mapping, -EIO);
s = __bch2_folio(page_folio(bvec->bv_page)); s = __bch2_folio(fi.folio);
spin_lock(&s->lock); spin_lock(&s->lock);
for (i = 0; i < PAGE_SECTORS; i++) for (i = 0; i < folio_sectors(fi.folio); i++)
s->s[i].nr_replicas = 0; s->s[i].nr_replicas = 0;
spin_unlock(&s->lock); spin_unlock(&s->lock);
} }
} }
if (io->op.flags & BCH_WRITE_WROTE_DATA_INLINE) { if (io->op.flags & BCH_WRITE_WROTE_DATA_INLINE) {
bio_for_each_segment_all(bvec, bio, iter) { bio_for_each_folio_all(fi, bio) {
struct bch_folio *s; struct bch_folio *s;
s = __bch2_folio(page_folio(bvec->bv_page)); s = __bch2_folio(fi.folio);
spin_lock(&s->lock); spin_lock(&s->lock);
for (i = 0; i < PAGE_SECTORS; i++) for (i = 0; i < folio_sectors(fi.folio); i++)
s->s[i].nr_replicas = 0; s->s[i].nr_replicas = 0;
spin_unlock(&s->lock); spin_unlock(&s->lock);
} }
...@@ -1368,12 +1367,11 @@ static void bch2_writepage_io_done(struct bch_write_op *op) ...@@ -1368,12 +1367,11 @@ static void bch2_writepage_io_done(struct bch_write_op *op)
*/ */
i_sectors_acct(c, io->inode, NULL, io->op.i_sectors_delta); i_sectors_acct(c, io->inode, NULL, io->op.i_sectors_delta);
bio_for_each_segment_all(bvec, bio, iter) { bio_for_each_folio_all(fi, bio) {
struct folio *folio = page_folio(bvec->bv_page); struct bch_folio *s = __bch2_folio(fi.folio);
struct bch_folio *s = __bch2_folio(folio);
if (atomic_dec_and_test(&s->write_count)) if (atomic_dec_and_test(&s->write_count))
folio_end_writeback(folio); folio_end_writeback(fi.folio);
} }
bio_put(&io->op.wbio.bio); bio_put(&io->op.wbio.bio);
......
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