]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
bcachefs: Mark space as unallocated on write failure
authorKent Overstreet <kent.overstreet@gmail.com>
Tue, 13 Aug 2019 07:16:52 +0000 (03:16 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:08:25 +0000 (17:08 -0400)
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/fs-io.c

index 913e26487efb1e6e5aaa6cd2e674fdc63cc04054..91a34ca5e4e1a83271e64153c0adb99013d0a075 100644 (file)
@@ -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);
                }
        }