Lines Matching refs:cw
395 static void dmz_handle_bio(struct dmz_target *dmz, struct dm_chunk_work *cw, in dmz_handle_bio() argument
457 static inline void dmz_get_chunk_work(struct dm_chunk_work *cw) in dmz_get_chunk_work() argument
459 refcount_inc(&cw->refcount); in dmz_get_chunk_work()
466 static void dmz_put_chunk_work(struct dm_chunk_work *cw) in dmz_put_chunk_work() argument
468 if (refcount_dec_and_test(&cw->refcount)) { in dmz_put_chunk_work()
469 WARN_ON(!bio_list_empty(&cw->bio_list)); in dmz_put_chunk_work()
470 radix_tree_delete(&cw->target->chunk_rxtree, cw->chunk); in dmz_put_chunk_work()
471 kfree(cw); in dmz_put_chunk_work()
480 struct dm_chunk_work *cw = container_of(work, struct dm_chunk_work, work); in dmz_chunk_work() local
481 struct dmz_target *dmz = cw->target; in dmz_chunk_work()
487 while ((bio = bio_list_pop(&cw->bio_list))) { in dmz_chunk_work()
489 dmz_handle_bio(dmz, cw, bio); in dmz_chunk_work()
491 dmz_put_chunk_work(cw); in dmz_chunk_work()
495 dmz_put_chunk_work(cw); in dmz_chunk_work()
537 struct dm_chunk_work *cw; in dmz_queue_chunk_work() local
543 cw = radix_tree_lookup(&dmz->chunk_rxtree, chunk); in dmz_queue_chunk_work()
544 if (cw) { in dmz_queue_chunk_work()
545 dmz_get_chunk_work(cw); in dmz_queue_chunk_work()
548 cw = kmalloc(sizeof(struct dm_chunk_work), GFP_NOIO); in dmz_queue_chunk_work()
549 if (unlikely(!cw)) { in dmz_queue_chunk_work()
554 INIT_WORK(&cw->work, dmz_chunk_work); in dmz_queue_chunk_work()
555 refcount_set(&cw->refcount, 1); in dmz_queue_chunk_work()
556 cw->target = dmz; in dmz_queue_chunk_work()
557 cw->chunk = chunk; in dmz_queue_chunk_work()
558 bio_list_init(&cw->bio_list); in dmz_queue_chunk_work()
560 ret = radix_tree_insert(&dmz->chunk_rxtree, chunk, cw); in dmz_queue_chunk_work()
562 kfree(cw); in dmz_queue_chunk_work()
567 bio_list_add(&cw->bio_list, bio); in dmz_queue_chunk_work()
569 if (queue_work(dmz->chunk_wq, &cw->work)) in dmz_queue_chunk_work()
570 dmz_get_chunk_work(cw); in dmz_queue_chunk_work()