Lines Matching refs:op
365 static int bch2_write_index_default(struct bch_write_op *op) in bch2_write_index_default() argument
367 struct bch_fs *c = op->c; in bch2_write_index_default()
369 struct keylist *keys = &op->insert_keys; in bch2_write_index_default()
374 .subvol = op->subvol, in bch2_write_index_default()
400 ret = bch2_bkey_set_needs_rebalance(c, &op->opts, sk.k) ?: in bch2_write_index_default()
402 &op->res, in bch2_write_index_default()
403 op->new_i_size, &op->i_sectors_delta, in bch2_write_index_default()
404 op->flags & BCH_WRITE_check_enospc); in bch2_write_index_default()
413 bch2_keylist_pop_front(&op->insert_keys); in bch2_write_index_default()
426 void bch2_write_op_error(struct bch_write_op *op, u64 offset, const char *fmt, ...) in bch2_write_op_error() argument
430 if (op->subvol) { in bch2_write_op_error()
431 bch2_inum_offset_err_msg(op->c, &buf, in bch2_write_op_error()
432 (subvol_inum) { op->subvol, op->pos.inode, }, in bch2_write_op_error()
435 struct bpos pos = op->pos; in bch2_write_op_error()
437 bch2_inum_snap_offset_err_msg(op->c, &buf, pos); in bch2_write_op_error()
447 if (op->flags & BCH_WRITE_move) { in bch2_write_op_error()
448 struct data_update *u = container_of(op, struct data_update, op); in bch2_write_op_error()
451 bch2_bkey_val_to_text(&buf, op->c, bkey_i_to_s_c(u->k.k)); in bch2_write_op_error()
454 bch_err_ratelimited(op->c, "%s", buf.buf); in bch2_write_op_error()
527 struct bch_write_op *op = container_of(cl, struct bch_write_op, cl); in bch2_write_done() local
528 struct bch_fs *c = op->c; in bch2_write_done()
530 EBUG_ON(op->open_buckets.nr); in bch2_write_done()
532 bch2_time_stats_update(&c->times[BCH_TIME_data_write], op->start_time); in bch2_write_done()
533 bch2_disk_reservation_put(c, &op->res); in bch2_write_done()
535 if (!(op->flags & BCH_WRITE_move)) in bch2_write_done()
537 bch2_keylist_free(&op->insert_keys, op->inline_keys); in bch2_write_done()
541 if (op->end_io) in bch2_write_done()
542 op->end_io(op); in bch2_write_done()
545 static noinline int bch2_write_drop_io_error_ptrs(struct bch_write_op *op) in bch2_write_drop_io_error_ptrs() argument
547 struct keylist *keys = &op->insert_keys; in bch2_write_drop_io_error_ptrs()
555 test_bit(ptr->dev, op->failed.d)); in bch2_write_drop_io_error_ptrs()
574 static void __bch2_write_index(struct bch_write_op *op) in __bch2_write_index() argument
576 struct bch_fs *c = op->c; in __bch2_write_index()
577 struct keylist *keys = &op->insert_keys; in __bch2_write_index()
581 if (unlikely(op->flags & BCH_WRITE_io_error)) { in __bch2_write_index()
582 ret = bch2_write_drop_io_error_ptrs(op); in __bch2_write_index()
590 ret = !(op->flags & BCH_WRITE_move) in __bch2_write_index()
591 ? bch2_write_index_default(op) in __bch2_write_index()
592 : bch2_data_update_index_update(op); in __bch2_write_index()
597 op->written += sectors_start - keylist_sectors(keys); in __bch2_write_index()
600 struct bkey_i *insert = bch2_keylist_front(&op->insert_keys); in __bch2_write_index()
602 bch2_write_op_error(op, bkey_start_offset(&insert->k), in __bch2_write_index()
611 for_each_set_bit(dev, op->failed.d, BCH_SB_MEMBERS_MAX) in __bch2_write_index()
612 bch2_open_bucket_write_error(c, &op->open_buckets, dev, -BCH_ERR_data_write_io); in __bch2_write_index()
614 bch2_open_buckets_put(c, &op->open_buckets); in __bch2_write_index()
618 op->error = ret; in __bch2_write_index()
619 op->flags |= BCH_WRITE_submitted; in __bch2_write_index()
657 closure_type(op, struct bch_write_op, cl); in CLOSURE_CALLBACK()
658 struct write_point *wp = op->wp; in CLOSURE_CALLBACK()
659 struct workqueue_struct *wq = index_update_wq(op); in CLOSURE_CALLBACK()
662 if ((op->flags & BCH_WRITE_submitted) && in CLOSURE_CALLBACK()
663 (op->flags & BCH_WRITE_move)) in CLOSURE_CALLBACK()
664 bch2_bio_free_pages_pool(op->c, &op->wbio.bio); in CLOSURE_CALLBACK()
669 list_add_tail(&op->wp_list, &wp->writes); in CLOSURE_CALLBACK()
675 static inline void bch2_write_queue(struct bch_write_op *op, struct write_point *wp) in bch2_write_queue() argument
677 op->wp = wp; in bch2_write_queue()
690 struct bch_write_op *op; in bch2_write_point_do_index_updates() local
694 op = list_pop_entry(&wp->writes, struct bch_write_op, wp_list); in bch2_write_point_do_index_updates()
695 wp_update_state(wp, op != NULL); in bch2_write_point_do_index_updates()
698 if (!op) in bch2_write_point_do_index_updates()
701 op->flags |= BCH_WRITE_in_worker; in bch2_write_point_do_index_updates()
703 __bch2_write_index(op); in bch2_write_point_do_index_updates()
705 if (!(op->flags & BCH_WRITE_submitted)) in bch2_write_point_do_index_updates()
706 __bch2_write(op); in bch2_write_point_do_index_updates()
708 bch2_write_done(&op->cl); in bch2_write_point_do_index_updates()
715 struct bch_write_op *op = container_of(cl, struct bch_write_op, cl); in bch2_write_endio() local
729 op->pos.inode, in bch2_write_endio()
735 op->pos.inode, in bch2_write_endio()
739 set_bit(wbio->dev, op->failed.d); in bch2_write_endio()
740 op->flags |= BCH_WRITE_io_error; in bch2_write_endio()
747 set_bit(wbio->dev, op->devs_need_flush->d); in bch2_write_endio()
765 static void init_append_extent(struct bch_write_op *op, in init_append_extent() argument
772 op->pos.offset += crc.uncompressed_size; in init_append_extent()
774 e = bkey_extent_init(op->insert_keys.top); in init_append_extent()
775 e->k.p = op->pos; in init_append_extent()
784 bch2_alloc_sectors_append_ptrs_inlined(op->c, wp, &e->k_i, crc.compressed_size, in init_append_extent()
785 op->flags & BCH_WRITE_cached); in init_append_extent()
787 bch2_keylist_push(&op->insert_keys); in init_append_extent()
840 struct bch_write_op *op, in bch2_write_rechecksum() argument
843 struct bio *bio = &op->wbio.bio; in bch2_write_rechecksum()
848 if (bch2_csum_type_is_encryption(op->crc.csum_type) != in bch2_write_rechecksum()
850 new_csum_type = op->crc.csum_type; in bch2_write_rechecksum()
852 int ret = bch2_rechecksum_bio(c, bio, op->version, op->crc, in bch2_write_rechecksum()
854 op->crc.offset, op->crc.live_size, in bch2_write_rechecksum()
859 bio_advance(bio, op->crc.offset << 9); in bch2_write_rechecksum()
860 bio->bi_iter.bi_size = op->crc.live_size << 9; in bch2_write_rechecksum()
861 op->crc = new_crc; in bch2_write_rechecksum()
865 static noinline int bch2_write_prep_encoded_data(struct bch_write_op *op, struct write_point *wp) in bch2_write_prep_encoded_data() argument
867 struct bch_fs *c = op->c; in bch2_write_prep_encoded_data()
868 struct bio *bio = &op->wbio.bio; in bch2_write_prep_encoded_data()
872 BUG_ON(bio_sectors(bio) != op->crc.compressed_size); in bch2_write_prep_encoded_data()
875 if (op->crc.uncompressed_size == op->crc.live_size && in bch2_write_prep_encoded_data()
876 op->crc.uncompressed_size <= c->opts.encoded_extent_max >> 9 && in bch2_write_prep_encoded_data()
877 op->crc.compressed_size <= wp->sectors_free && in bch2_write_prep_encoded_data()
878 (op->crc.compression_type == bch2_compression_opt_to_type(op->compression_opt) || in bch2_write_prep_encoded_data()
879 op->incompressible)) { in bch2_write_prep_encoded_data()
880 if (!crc_is_compressed(op->crc) && in bch2_write_prep_encoded_data()
881 op->csum_type != op->crc.csum_type) { in bch2_write_prep_encoded_data()
882 ret = bch2_write_rechecksum(c, op, op->csum_type); in bch2_write_prep_encoded_data()
894 if (crc_is_compressed(op->crc)) { in bch2_write_prep_encoded_data()
896 struct nonce nonce = extent_nonce(op->version, op->crc); in bch2_write_prep_encoded_data()
897 csum = bch2_checksum_bio(c, op->crc.csum_type, nonce, bio); in bch2_write_prep_encoded_data()
898 if (bch2_crc_cmp(op->crc.csum, csum) && !c->opts.no_data_io) in bch2_write_prep_encoded_data()
901 if (bch2_csum_type_is_encryption(op->crc.csum_type)) { in bch2_write_prep_encoded_data()
902 ret = bch2_encrypt_bio(c, op->crc.csum_type, nonce, bio); in bch2_write_prep_encoded_data()
906 op->crc.csum_type = 0; in bch2_write_prep_encoded_data()
907 op->crc.csum = (struct bch_csum) { 0, 0 }; in bch2_write_prep_encoded_data()
910 ret = bch2_bio_uncompress_inplace(op, bio); in bch2_write_prep_encoded_data()
924 if (op->crc.live_size != op->crc.uncompressed_size || in bch2_write_prep_encoded_data()
925 op->crc.csum_type != op->csum_type) { in bch2_write_prep_encoded_data()
926 ret = bch2_write_rechecksum(c, op, op->csum_type); in bch2_write_prep_encoded_data()
934 if (bch2_csum_type_is_encryption(op->crc.csum_type) && in bch2_write_prep_encoded_data()
935 (op->compression_opt || op->crc.csum_type != op->csum_type)) { in bch2_write_prep_encoded_data()
936 struct nonce nonce = extent_nonce(op->version, op->crc); in bch2_write_prep_encoded_data()
937 csum = bch2_checksum_bio(c, op->crc.csum_type, nonce, bio); in bch2_write_prep_encoded_data()
938 if (bch2_crc_cmp(op->crc.csum, csum) && !c->opts.no_data_io) in bch2_write_prep_encoded_data()
941 ret = bch2_encrypt_bio(c, op->crc.csum_type, nonce, bio); in bch2_write_prep_encoded_data()
945 op->crc.csum_type = 0; in bch2_write_prep_encoded_data()
946 op->crc.csum = (struct bch_csum) { 0, 0 }; in bch2_write_prep_encoded_data()
951 bch2_write_op_error(op, op->pos.offset, in bch2_write_prep_encoded_data()
954 op->crc.csum.hi, in bch2_write_prep_encoded_data()
955 op->crc.csum.lo, in bch2_write_prep_encoded_data()
958 op->crc.csum_type < BCH_CSUM_NR in bch2_write_prep_encoded_data()
959 ? __bch2_csum_types[op->crc.csum_type] in bch2_write_prep_encoded_data()
964 static int bch2_write_extent(struct bch_write_op *op, struct write_point *wp, in bch2_write_extent() argument
967 struct bch_fs *c = op->c; in bch2_write_extent()
968 struct bio *src = &op->wbio.bio, *dst = src; in bch2_write_extent()
976 if (op->incompressible) in bch2_write_extent()
977 op->compression_opt = 0; in bch2_write_extent()
983 if (unlikely(op->flags & BCH_WRITE_data_encoded)) { in bch2_write_extent()
984 ret = bch2_write_prep_encoded_data(op, wp); in bch2_write_extent()
995 init_append_extent(op, wp, op->version, op->crc); in bch2_write_extent()
1001 op->compression_opt || in bch2_write_extent()
1002 (op->csum_type && in bch2_write_extent()
1003 !(op->flags & BCH_WRITE_pages_stable)) || in bch2_write_extent()
1004 (bch2_csum_type_is_encryption(op->csum_type) && in bch2_write_extent()
1005 !(op->flags & BCH_WRITE_pages_owned))) { in bch2_write_extent()
1025 struct bversion version = op->version; in bch2_write_extent()
1033 BUG_ON(op->compression_opt && in bch2_write_extent()
1034 (op->flags & BCH_WRITE_data_encoded) && in bch2_write_extent()
1035 bch2_csum_type_is_encryption(op->crc.csum_type)); in bch2_write_extent()
1036 BUG_ON(op->compression_opt && !bounce); in bch2_write_extent()
1038 crc.compression_type = op->incompressible in bch2_write_extent()
1040 : op->compression_opt in bch2_write_extent()
1042 op->compression_opt) in bch2_write_extent()
1048 if (op->csum_type) in bch2_write_extent()
1063 if (bch2_csum_type_is_encryption(op->csum_type)) { in bch2_write_extent()
1067 crc.nonce = op->nonce; in bch2_write_extent()
1068 op->nonce += src_len >> 9; in bch2_write_extent()
1072 if ((op->flags & BCH_WRITE_data_encoded) && in bch2_write_extent()
1074 bch2_csum_type_is_encryption(op->crc.csum_type) == in bch2_write_extent()
1075 bch2_csum_type_is_encryption(op->csum_type)) { in bch2_write_extent()
1090 ret = bch2_rechecksum_bio(c, src, version, op->crc, in bch2_write_extent()
1091 &crc, &op->crc, in bch2_write_extent()
1094 op->csum_type); in bch2_write_extent()
1105 if ((op->flags & BCH_WRITE_data_encoded) && in bch2_write_extent()
1106 (ret = bch2_rechecksum_bio(c, src, version, op->crc, in bch2_write_extent()
1107 NULL, &op->crc, in bch2_write_extent()
1110 op->crc.csum_type))) in bch2_write_extent()
1118 ret = bch2_encrypt_bio(c, op->csum_type, in bch2_write_extent()
1123 crc.csum = bch2_checksum_bio(c, op->csum_type, in bch2_write_extent()
1125 crc.csum_type = op->csum_type; in bch2_write_extent()
1129 init_append_extent(op, wp, version, crc); in bch2_write_extent()
1147 !bch2_keylist_realloc(&op->insert_keys, in bch2_write_extent()
1148 op->inline_keys, in bch2_write_extent()
1149 ARRAY_SIZE(op->inline_keys), in bch2_write_extent()
1179 static bool bch2_extent_is_writeable(struct bch_write_op *op, in bch2_extent_is_writeable() argument
1182 struct bch_fs *c = op->c; in bch2_extent_is_writeable()
1204 return replicas >= op->opts.data_replicas; in bch2_extent_is_writeable()
1243 static void bch2_nocow_write_convert_unwritten(struct bch_write_op *op) in bch2_nocow_write_convert_unwritten() argument
1245 struct bch_fs *c = op->c; in bch2_nocow_write_convert_unwritten()
1249 for_each_keylist_key(&op->insert_keys, orig) { in bch2_nocow_write_convert_unwritten()
1254 bch2_nocow_write_convert_one_unwritten(trans, &iter, orig, k, op->new_i_size); in bch2_nocow_write_convert_unwritten()
1263 struct bkey_i *insert = bch2_keylist_front(&op->insert_keys); in bch2_nocow_write_convert_unwritten()
1264 bch2_write_op_error(op, bkey_start_offset(&insert->k), in bch2_nocow_write_convert_unwritten()
1269 op->error = ret; in bch2_nocow_write_convert_unwritten()
1272 static void __bch2_nocow_write_done(struct bch_write_op *op) in __bch2_nocow_write_done() argument
1274 if (unlikely(op->flags & BCH_WRITE_io_error)) { in __bch2_nocow_write_done()
1275 op->error = -BCH_ERR_data_write_io; in __bch2_nocow_write_done()
1276 } else if (unlikely(op->flags & BCH_WRITE_convert_unwritten)) in __bch2_nocow_write_done()
1277 bch2_nocow_write_convert_unwritten(op); in __bch2_nocow_write_done()
1282 closure_type(op, struct bch_write_op, cl); in CLOSURE_CALLBACK()
1284 __bch2_nocow_write_done(op); in CLOSURE_CALLBACK()
1294 static void bch2_nocow_write(struct bch_write_op *op) in bch2_nocow_write() argument
1296 struct bch_fs *c = op->c; in bch2_nocow_write()
1305 if (op->flags & BCH_WRITE_move) in bch2_nocow_write()
1313 ret = bch2_subvolume_get_snapshot(trans, op->subvol, &snapshot); in bch2_nocow_write()
1318 SPOS(op->pos.inode, op->pos.offset, snapshot), in bch2_nocow_write()
1321 struct bio *bio = &op->wbio.bio; in bch2_nocow_write()
1336 !bch2_extent_is_writeable(op, k))) in bch2_nocow_write()
1339 if (bch2_keylist_realloc(&op->insert_keys, in bch2_nocow_write()
1340 op->inline_keys, in bch2_nocow_write()
1341 ARRAY_SIZE(op->inline_keys), in bch2_nocow_write()
1363 op->flags |= BCH_WRITE_convert_unwritten; in bch2_nocow_write()
1367 bkey_reassemble(op->insert_keys.top, k); in bch2_nocow_write()
1370 bch2_cut_front(op->pos, op->insert_keys.top); in bch2_nocow_write()
1371 if (op->flags & BCH_WRITE_convert_unwritten) in bch2_nocow_write()
1372 bch2_cut_back(POS(op->pos.inode, op->pos.offset + bio_sectors(bio)), op->insert_keys.top); in bch2_nocow_write()
1389 bio = &op->wbio.bio; in bch2_nocow_write()
1390 if (k.k->p.offset < op->pos.offset + bio_sectors(bio)) { in bch2_nocow_write()
1391 bio = bio_split(bio, k.k->p.offset - op->pos.offset, in bch2_nocow_write()
1394 bio->bi_opf = op->wbio.bio.bi_opf; in bch2_nocow_write()
1396 op->flags |= BCH_WRITE_submitted; in bch2_nocow_write()
1399 op->pos.offset += bio_sectors(bio); in bch2_nocow_write()
1400 op->written += bio_sectors(bio); in bch2_nocow_write()
1403 bio->bi_private = &op->cl; in bch2_nocow_write()
1405 closure_get(&op->cl); in bch2_nocow_write()
1408 op->insert_keys.top, true); in bch2_nocow_write()
1410 bch2_keylist_push(&op->insert_keys); in bch2_nocow_write()
1411 if (op->flags & BCH_WRITE_submitted) in bch2_nocow_write()
1425 bch2_write_op_error(op, op->pos.offset, in bch2_nocow_write()
1427 op->error = ret; in bch2_nocow_write()
1428 op->flags |= BCH_WRITE_submitted; in bch2_nocow_write()
1432 if (!(op->flags & BCH_WRITE_submitted)) { in bch2_nocow_write()
1433 closure_sync(&op->cl); in bch2_nocow_write()
1434 __bch2_nocow_write_done(op); in bch2_nocow_write()
1435 op->insert_keys.top = op->insert_keys.keys; in bch2_nocow_write()
1436 } else if (op->flags & BCH_WRITE_sync) { in bch2_nocow_write()
1437 closure_sync(&op->cl); in bch2_nocow_write()
1438 bch2_nocow_write_done(&op->cl.work); in bch2_nocow_write()
1445 continue_at(&op->cl, bch2_nocow_write_done, index_update_wq(op)); in bch2_nocow_write()
1476 static void __bch2_write(struct bch_write_op *op) in __bch2_write() argument
1478 struct bch_fs *c = op->c; in __bch2_write()
1486 if (unlikely(op->opts.nocow && c->opts.nocow_enabled)) { in __bch2_write()
1487 bch2_nocow_write(op); in __bch2_write()
1488 if (op->flags & BCH_WRITE_submitted) in __bch2_write()
1492 memset(&op->failed, 0, sizeof(op->failed)); in __bch2_write()
1496 unsigned key_to_write_offset = op->insert_keys.top_p - in __bch2_write()
1497 op->insert_keys.keys_p; in __bch2_write()
1500 if (op->open_buckets.nr + op->nr_replicas + 1 > in __bch2_write()
1501 ARRAY_SIZE(op->open_buckets.v)) in __bch2_write()
1504 if (bch2_keylist_realloc(&op->insert_keys, in __bch2_write()
1505 op->inline_keys, in __bch2_write()
1506 ARRAY_SIZE(op->inline_keys), in __bch2_write()
1517 op->target, in __bch2_write()
1518 op->opts.erasure_code && !(op->flags & BCH_WRITE_cached), in __bch2_write()
1519 op->write_point, in __bch2_write()
1520 &op->devs_have, in __bch2_write()
1521 op->nr_replicas, in __bch2_write()
1522 op->nr_replicas_required, in __bch2_write()
1523 op->watermark, in __bch2_write()
1524 op->flags, in __bch2_write()
1525 &op->cl, &wp))); in __bch2_write()
1535 bch2_open_bucket_get(c, wp, &op->open_buckets); in __bch2_write()
1536 ret = bch2_write_extent(op, wp, &bio); in __bch2_write()
1541 op->flags |= BCH_WRITE_submitted; in __bch2_write()
1544 if (!(op->flags & BCH_WRITE_alloc_nowait)) in __bch2_write()
1545 bch2_write_op_error(op, op->pos.offset, in __bch2_write()
1547 op->error = ret; in __bch2_write()
1553 bio->bi_private = &op->cl; in __bch2_write()
1558 key_to_write = (void *) (op->insert_keys.keys_p + in __bch2_write()
1572 if ((op->flags & BCH_WRITE_sync) || in __bch2_write()
1573 (!(op->flags & BCH_WRITE_submitted) && in __bch2_write()
1574 !(op->flags & BCH_WRITE_in_worker))) { in __bch2_write()
1575 bch2_wait_on_allocator(c, &op->cl); in __bch2_write()
1577 __bch2_write_index(op); in __bch2_write()
1579 if (!(op->flags & BCH_WRITE_submitted)) in __bch2_write()
1581 bch2_write_done(&op->cl); in __bch2_write()
1583 bch2_write_queue(op, wp); in __bch2_write()
1584 continue_at(&op->cl, bch2_write_index, NULL); in __bch2_write()
1590 static void bch2_write_data_inline(struct bch_write_op *op, unsigned data_len) in bch2_write_data_inline() argument
1592 struct bio *bio = &op->wbio.bio; in bch2_write_data_inline()
1598 memset(&op->failed, 0, sizeof(op->failed)); in bch2_write_data_inline()
1600 op->flags |= BCH_WRITE_wrote_data_inline; in bch2_write_data_inline()
1601 op->flags |= BCH_WRITE_submitted; in bch2_write_data_inline()
1603 bch2_check_set_feature(op->c, BCH_FEATURE_inline_data); in bch2_write_data_inline()
1605 ret = bch2_keylist_realloc(&op->insert_keys, op->inline_keys, in bch2_write_data_inline()
1606 ARRAY_SIZE(op->inline_keys), in bch2_write_data_inline()
1609 op->error = ret; in bch2_write_data_inline()
1614 op->pos.offset += sectors; in bch2_write_data_inline()
1616 id = bkey_inline_data_init(op->insert_keys.top); in bch2_write_data_inline()
1617 id->k.p = op->pos; in bch2_write_data_inline()
1618 id->k.bversion = op->version; in bch2_write_data_inline()
1628 bch2_keylist_push(&op->insert_keys); in bch2_write_data_inline()
1630 __bch2_write_index(op); in bch2_write_data_inline()
1632 bch2_write_done(&op->cl); in bch2_write_data_inline()
1654 closure_type(op, struct bch_write_op, cl); in CLOSURE_CALLBACK()
1655 struct bio *bio = &op->wbio.bio; in CLOSURE_CALLBACK()
1656 struct bch_fs *c = op->c; in CLOSURE_CALLBACK()
1659 EBUG_ON(op->cl.parent); in CLOSURE_CALLBACK()
1660 BUG_ON(!op->nr_replicas); in CLOSURE_CALLBACK()
1661 BUG_ON(!op->write_point.v); in CLOSURE_CALLBACK()
1662 BUG_ON(bkey_eq(op->pos, POS_MAX)); in CLOSURE_CALLBACK()
1664 if (op->flags & BCH_WRITE_only_specified_devs) in CLOSURE_CALLBACK()
1665 op->flags |= BCH_WRITE_alloc_nowait; in CLOSURE_CALLBACK()
1667 op->nr_replicas_required = min_t(unsigned, op->nr_replicas_required, op->nr_replicas); in CLOSURE_CALLBACK()
1668 op->start_time = local_clock(); in CLOSURE_CALLBACK()
1669 bch2_keylist_init(&op->insert_keys, op->inline_keys); in CLOSURE_CALLBACK()
1673 bch2_write_op_error(op, op->pos.offset, "misaligned write"); in CLOSURE_CALLBACK()
1674 op->error = -BCH_ERR_data_write_misaligned; in CLOSURE_CALLBACK()
1679 op->error = -BCH_ERR_erofs_no_writes; in CLOSURE_CALLBACK()
1683 if (!(op->flags & BCH_WRITE_move) && in CLOSURE_CALLBACK()
1685 op->error = -BCH_ERR_erofs_no_writes; in CLOSURE_CALLBACK()
1689 if (!(op->flags & BCH_WRITE_move)) in CLOSURE_CALLBACK()
1694 op->new_i_size - (op->pos.offset << 9)); in CLOSURE_CALLBACK()
1698 bch2_write_data_inline(op, data_len); in CLOSURE_CALLBACK()
1702 __bch2_write(op); in CLOSURE_CALLBACK()
1705 bch2_disk_reservation_put(c, &op->res); in CLOSURE_CALLBACK()
1707 closure_debug_destroy(&op->cl); in CLOSURE_CALLBACK()
1708 if (op->end_io) in CLOSURE_CALLBACK()
1709 op->end_io(op); in CLOSURE_CALLBACK()
1719 void bch2_write_op_to_text(struct printbuf *out, struct bch_write_op *op) in bch2_write_op_to_text() argument
1725 bch2_bpos_to_text(out, op->pos); in bch2_write_op_to_text()
1730 bch2_pr_time_units(out, local_clock() - op->start_time); in bch2_write_op_to_text()
1734 prt_bitflags(out, bch2_write_flags, op->flags); in bch2_write_op_to_text()
1737 prt_printf(out, "nr_replicas:\t%u\n", op->nr_replicas); in bch2_write_op_to_text()
1738 prt_printf(out, "nr_replicas_required:\t%u\n", op->nr_replicas_required); in bch2_write_op_to_text()
1740 prt_printf(out, "ref:\t%u\n", closure_nr_remaining(&op->cl)); in bch2_write_op_to_text()