summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2025-03-25 11:36:39 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2025-03-25 11:36:39 -0400
commit4caf885e08eb0411f7959a475307dae53de06f43 (patch)
tree1362d5e4e501e9132362fc98a577042a3e43ad37
parentb8054419f5d44254c62de303c8274a119a149108 (diff)
-rw-r--r--fs/bcachefs/io_write.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/bcachefs/io_write.c b/fs/bcachefs/io_write.c
index 9bb77335e781..c38a184e1a28 100644
--- a/fs/bcachefs/io_write.c
+++ b/fs/bcachefs/io_write.c
@@ -844,7 +844,6 @@ static noinline int bch2_write_prep_encoded_data(struct bch_write_op *op, struct
{
struct bch_fs *c = op->c;
struct bio *bio = &op->wbio.bio;
- struct nonce nonce = extent_nonce(op->version, op->crc);
int ret = 0;
BUG_ON(bio_sectors(bio) != op->crc.compressed_size);
@@ -871,6 +870,7 @@ static noinline int bch2_write_prep_encoded_data(struct bch_write_op *op, struct
*/
if (crc_is_compressed(op->crc)) {
/* Last point we can still verify checksum: */
+ struct nonce nonce = extent_nonce(op->version, op->crc);
struct bch_csum csum = bch2_checksum_bio(c, op->crc.csum_type, nonce, bio);
if (bch2_crc_cmp(op->crc.csum, csum) && !c->opts.no_data_io) {
bch2_write_csum_err_msg(op, "for decompress");
@@ -912,6 +912,7 @@ static noinline int bch2_write_prep_encoded_data(struct bch_write_op *op, struct
*/
if (bch2_csum_type_is_encryption(op->crc.csum_type) &&
(op->compression_opt || op->crc.csum_type != op->csum_type)) {
+ struct nonce nonce = extent_nonce(op->version, op->crc);
struct bch_csum csum = bch2_checksum_bio(c, op->crc.csum_type, nonce, bio);
if (bch2_crc_cmp(op->crc.csum, csum) && !c->opts.no_data_io) {
bch2_write_csum_err_msg(op, "for decrypt");