summaryrefslogtreecommitdiff
path: root/fs/bcachefs/io.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2020-12-14 21:59:33 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:08:50 -0400
commit35a067b42dcfd884fb132128ae94f240c6511fea (patch)
tree39ec0fe89492d3322900902ae40f3dacd54d8291 /fs/bcachefs/io.h
parent3187aa8d57025f60f1b8f9e14b6fc33f5e2d2960 (diff)
downloadlwn-35a067b42dcfd884fb132128ae94f240c6511fea.tar.gz
lwn-35a067b42dcfd884fb132128ae94f240c6511fea.zip
bcachefs: Change when we allow overwrites
Originally, we'd check for -ENOSPC when getting a disk reservation whenever the new extent took up more space on disk than the old extent. Erasure coding screwed this up, because with erasure coding writes are initially replicated, and then in the background the extra replicas are dropped when the stripe is created. This means that with erasure coding enabled, writes will always take up more space on disk than the data they're overwriting - but, according to posix, overwrites aren't supposed to return ENOSPC. So, in this patch we fudge things: if the new extent has more replicas than the _effective_ replicas of the old extent, or if the old extent is compressed and the new one isn't, we check for ENOSPC when getting the disk reservation - otherwise, we don't. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/io.h')
-rw-r--r--fs/bcachefs/io.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/bcachefs/io.h b/fs/bcachefs/io.h
index 379263a935fa..6721440e8bc7 100644
--- a/fs/bcachefs/io.h
+++ b/fs/bcachefs/io.h
@@ -64,6 +64,8 @@ static inline struct workqueue_struct *index_update_wq(struct bch_write_op *op)
: op->c->wq;
}
+int bch2_sum_sector_overwrites(struct btree_trans *, struct btree_iter *,
+ struct bkey_i *, bool *, bool *, s64 *, s64 *);
int bch2_extent_update(struct btree_trans *, struct btree_iter *,
struct bkey_i *, struct disk_reservation *,
u64 *, u64, s64 *);