Lines Matching refs:iop

482 	struct data_insert_op	iop;  member
499 s->iop.status = bio->bi_status; in bch_cache_read_endio()
501 ptr_stale(s->iop.c, &b->key, 0)) { in bch_cache_read_endio()
502 atomic_long_inc(&s->iop.c->cache_read_races); in bch_cache_read_endio()
503 s->iop.status = BLK_STS_IOERR; in bch_cache_read_endio()
506 bch_bbio_endio(s->iop.c, bio, bio->bi_status, "reading from cache"); in bch_cache_read_endio()
520 if (bkey_cmp(k, &KEY(s->iop.inode, bio->bi_iter.bi_sector, 0)) <= 0) in cache_lookup_fn()
523 if (KEY_INODE(k) != s->iop.inode || in cache_lookup_fn()
526 unsigned int sectors = KEY_INODE(k) == s->iop.inode in cache_lookup_fn()
557 bch_cut_front(&KEY(s->iop.inode, n->bi_iter.bi_sector, 0), bio_key); in cache_lookup_fn()
558 bch_cut_back(&KEY(s->iop.inode, bio_end_sector(n), 0), bio_key); in cache_lookup_fn()
580 struct search *s = container_of(cl, struct search, iop.cl); in cache_lookup()
587 ret = bch_btree_map_keys(&s->op, s->iop.c, in cache_lookup()
588 &KEY(s->iop.inode, bio->bi_iter.bi_sector, 0), in cache_lookup()
612 if (!s->iop.status) in cache_lookup()
613 s->iop.status = BLK_STS_IOERR; in cache_lookup()
628 s->iop.status = bio->bi_status; in request_endio()
652 if (unlikely(s->iop.writeback && in backing_request_endio()
658 s->iop.status = bio->bi_status; in backing_request_endio()
676 s->orig_bio->bi_status = s->iop.status; in bio_complete()
705 atomic_dec(&s->iop.c->search_inflight); in search_free()
707 if (s->iop.bio) in search_free()
708 bio_put(s->iop.bio); in search_free()
712 mempool_free(s, &s->iop.c->search); in search_free()
737 s->iop.c = d->c; in search_alloc()
738 s->iop.bio = NULL; in search_alloc()
739 s->iop.inode = d->id; in search_alloc()
740 s->iop.write_point = hash_long((unsigned long) current, 16); in search_alloc()
741 s->iop.write_prio = 0; in search_alloc()
742 s->iop.status = 0; in search_alloc()
743 s->iop.flags = 0; in search_alloc()
744 s->iop.flush_journal = op_is_flush(bio->bi_opf); in search_alloc()
745 s->iop.wq = bcache_wq; in search_alloc()
767 if (s->iop.replace_collision) in cached_dev_read_error_done()
768 bch_mark_cache_miss_collision(s->iop.c, s->d); in cached_dev_read_error_done()
770 if (s->iop.bio) in cached_dev_read_error_done()
771 bio_free_pages(s->iop.bio); in cached_dev_read_error_done()
792 s->iop.status = 0; in cached_dev_read_error()
798 closure_bio_submit(s->iop.c, bio, cl); in cached_dev_read_error()
809 if (s->iop.replace_collision) in cached_dev_cache_miss_done()
810 bch_mark_cache_miss_collision(s->iop.c, s->d); in cached_dev_cache_miss_done()
812 if (s->iop.bio) in cached_dev_cache_miss_done()
813 bio_free_pages(s->iop.bio); in cached_dev_cache_miss_done()
832 if (s->iop.bio) { in cached_dev_read_done()
833 bio_reset(s->iop.bio, s->cache_miss->bi_bdev, REQ_OP_READ); in cached_dev_read_done()
834 s->iop.bio->bi_iter.bi_sector = in cached_dev_read_done()
836 s->iop.bio->bi_iter.bi_size = s->insert_bio_sectors << 9; in cached_dev_read_done()
837 bio_clone_blkg_association(s->iop.bio, s->cache_miss); in cached_dev_read_done()
838 bch_bio_map(s->iop.bio, NULL); in cached_dev_read_done()
840 bio_copy_data(s->cache_miss, s->iop.bio); in cached_dev_read_done()
852 if (s->iop.bio && in cached_dev_read_done()
853 !test_bit(CACHE_SET_STOPPING, &s->iop.c->flags)) { in cached_dev_read_done()
854 BUG_ON(!s->iop.replace); in cached_dev_read_done()
855 closure_call(&s->iop.cl, bch_data_insert, NULL, cl); in cached_dev_read_done()
866 bch_mark_cache_accounting(s->iop.c, s->d, in cached_dev_read_done_bh()
867 !s->cache_missed, s->iop.bypass); in cached_dev_read_done_bh()
868 trace_bcache_read(s->orig_bio, !s->cache_missed, s->iop.bypass); in cached_dev_read_done_bh()
870 if (s->iop.status) in cached_dev_read_done_bh()
872 else if (s->iop.bio || verify(dc)) in cached_dev_read_done_bh()
888 if (s->cache_miss || s->iop.bypass) { in cached_dev_cache_miss()
899 s->iop.replace_key = KEY(s->iop.inode, in cached_dev_cache_miss()
903 ret = bch_btree_insert_check_key(b, &s->op, &s->iop.replace_key); in cached_dev_cache_miss()
907 s->iop.replace = true; in cached_dev_cache_miss()
932 s->iop.bio = cache_bio; in cached_dev_cache_miss()
935 closure_bio_submit(s->iop.c, cache_bio, &s->cl); in cached_dev_cache_miss()
944 closure_bio_submit(s->iop.c, miss, &s->cl); in cached_dev_cache_miss()
952 closure_call(&s->iop.cl, cache_lookup, NULL, cl); in cached_dev_read()
974 bch_keybuf_check_overlapping(&s->iop.c->moving_gc_keys, &start, &end); in cached_dev_write()
982 s->iop.bypass = false; in cached_dev_write()
983 s->iop.writeback = true; in cached_dev_write()
994 s->iop.bypass = true; in cached_dev_write()
998 s->iop.bypass)) { in cached_dev_write()
999 s->iop.bypass = false; in cached_dev_write()
1000 s->iop.writeback = true; in cached_dev_write()
1003 if (s->iop.bypass) { in cached_dev_write()
1004 s->iop.bio = s->orig_bio; in cached_dev_write()
1005 bio_get(s->iop.bio); in cached_dev_write()
1013 closure_bio_submit(s->iop.c, bio, cl); in cached_dev_write()
1015 } else if (s->iop.writeback) { in cached_dev_write()
1017 s->iop.bio = bio; in cached_dev_write()
1030 s->iop.status = BLK_STS_RESOURCE; in cached_dev_write()
1036 closure_bio_submit(s->iop.c, flush, cl); in cached_dev_write()
1039 s->iop.bio = bio_alloc_clone(bio->bi_bdev, bio, GFP_NOIO, in cached_dev_write()
1043 closure_bio_submit(s->iop.c, bio, cl); in cached_dev_write()
1047 closure_call(&s->iop.cl, bch_data_insert, NULL, cl); in cached_dev_write()
1056 if (s->iop.flush_journal) in cached_dev_nodata()
1057 bch_journal_meta(s->iop.c, cl); in cached_dev_nodata()
1061 closure_bio_submit(s->iop.c, bio, cl); in cached_dev_nodata()
1219 s->iop.bypass = check_should_bypass(dc, bio); in cached_dev_submit_bio()
1272 if (s->iop.flush_journal) in flash_dev_nodata()
1273 bch_journal_meta(s->iop.c, cl); in flash_dev_nodata()
1305 bch_keybuf_check_overlapping(&s->iop.c->moving_gc_keys, in flash_dev_submit_bio()
1309 s->iop.bypass = (bio_op(bio) == REQ_OP_DISCARD) != 0; in flash_dev_submit_bio()
1310 s->iop.writeback = true; in flash_dev_submit_bio()
1311 s->iop.bio = bio; in flash_dev_submit_bio()
1313 closure_call(&s->iop.cl, bch_data_insert, NULL, cl); in flash_dev_submit_bio()
1315 closure_call(&s->iop.cl, cache_lookup, NULL, cl); in flash_dev_submit_bio()