summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fs/bcachefs/io.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/bcachefs/io.c b/fs/bcachefs/io.c
index 93a3f1dec422..ede1ac1b62d1 100644
--- a/fs/bcachefs/io.c
+++ b/fs/bcachefs/io.c
@@ -408,6 +408,7 @@ static void init_append_extent(struct bch_write_op *op,
struct bch_extent_crc_unpacked crc)
{
struct bkey_i_extent *e = bkey_extent_init(op->insert_keys.top);
+ struct bch_extent_ptr *ptr;
op->pos.offset += crc.uncompressed_size;
e->k.p = op->pos;
@@ -418,6 +419,10 @@ static void init_append_extent(struct bch_write_op *op,
bch2_alloc_sectors_append_ptrs(op->c, wp, &e->k_i,
crc.compressed_size);
+ if (op->flags & BCH_WRITE_CACHED)
+ extent_for_each_ptr(extent_i_to_s(e), ptr)
+ ptr->cached = true;
+
bch2_keylist_push(&op->insert_keys);
}