Commit b3fce09c authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: Mark space as unallocated on write failure

Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 1904a65a
......@@ -1219,11 +1219,20 @@ static void bch2_writepage_io_done(struct closure *cl)
struct bio *bio = &io->op.op.wbio.bio;
struct bvec_iter_all iter;
struct bio_vec *bvec;
unsigned i;
if (io->op.op.error) {
bio_for_each_segment_all(bvec, bio, iter) {
struct bch_page_state *s;
SetPageError(bvec->bv_page);
mapping_set_error(bvec->bv_page->mapping, -EIO);
lock_page(bvec->bv_page);
s = bch2_page_state(bvec->bv_page);
for (i = 0; i < PAGE_SECTORS; i++)
s->s[i].nr_replicas = 0;
unlock_page(bvec->bv_page);
}
}
......
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