Lines Matching full:wp

561 static inline void __wp_update_state(struct write_point *wp, enum write_point_state state)  in __wp_update_state()  argument
563 if (state != wp->state) { in __wp_update_state()
566 if (wp->last_state_change && in __wp_update_state()
567 time_after64(now, wp->last_state_change)) in __wp_update_state()
568 wp->time[wp->state] += now - wp->last_state_change; in __wp_update_state()
569 wp->state = state; in __wp_update_state()
570 wp->last_state_change = now; in __wp_update_state()
574 static inline void wp_update_state(struct write_point *wp, bool running) in wp_update_state() argument
579 !list_empty(&wp->writes) ? WRITE_POINT_waiting_io in wp_update_state()
582 __wp_update_state(wp, state); in wp_update_state()
588 struct write_point *wp = op->wp; in CLOSURE_CALLBACK() local
596 spin_lock_irqsave(&wp->writes_lock, flags); in CLOSURE_CALLBACK()
597 if (wp->state == WRITE_POINT_waiting_io) in CLOSURE_CALLBACK()
598 __wp_update_state(wp, WRITE_POINT_waiting_work); in CLOSURE_CALLBACK()
599 list_add_tail(&op->wp_list, &wp->writes); in CLOSURE_CALLBACK()
600 spin_unlock_irqrestore (&wp->writes_lock, flags); in CLOSURE_CALLBACK()
602 queue_work(wq, &wp->index_update_work); in CLOSURE_CALLBACK()
605 static inline void bch2_write_queue(struct bch_write_op *op, struct write_point *wp) in bch2_write_queue() argument
607 op->wp = wp; in bch2_write_queue()
609 if (wp->state == WRITE_POINT_stopped) { in bch2_write_queue()
610 spin_lock_irq(&wp->writes_lock); in bch2_write_queue()
611 __wp_update_state(wp, WRITE_POINT_waiting_io); in bch2_write_queue()
612 spin_unlock_irq(&wp->writes_lock); in bch2_write_queue()
618 struct write_point *wp = in bch2_write_point_do_index_updates() local
623 spin_lock_irq(&wp->writes_lock); in bch2_write_point_do_index_updates()
624 op = list_first_entry_or_null(&wp->writes, struct bch_write_op, wp_list); in bch2_write_point_do_index_updates()
627 wp_update_state(wp, op != NULL); in bch2_write_point_do_index_updates()
628 spin_unlock_irq(&wp->writes_lock); in bch2_write_point_do_index_updates()
689 struct write_point *wp, in init_append_extent() argument
707 bch2_alloc_sectors_append_ptrs_inlined(op->c, wp, &e->k_i, crc.compressed_size, in init_append_extent()
714 struct write_point *wp, in bch2_write_bio_alloc() argument
722 min(wp->sectors_free << 9, src->bi_iter.bi_size); in bch2_write_bio_alloc()
820 } bch2_write_prep_encoded_data(struct bch_write_op *op, struct write_point *wp) in bch2_write_prep_encoded_data() argument
833 op->crc.compressed_size <= wp->sectors_free && in bch2_write_prep_encoded_data()
893 static int bch2_write_extent(struct bch_write_op *op, struct write_point *wp, in bch2_write_extent() argument
907 ec_buf = bch2_writepoint_ec_buf(c, wp); in bch2_write_extent()
909 switch (bch2_write_prep_encoded_data(op, wp)) { in bch2_write_extent()
920 dst = bch2_write_bio_alloc(c, wp, src, in bch2_write_extent()
926 init_append_extent(op, wp, op->version, op->crc); in bch2_write_extent()
936 dst = bch2_write_bio_alloc(c, wp, src, in bch2_write_extent()
950 dst->bi_iter.bi_size < (wp->sectors_free << 9) && in bch2_write_extent()
967 dst_len = min_t(unsigned, dst_len, wp->sectors_free << 9); in bch2_write_extent()
1049 init_append_extent(op, wp, version, crc); in bch2_write_extent()
1058 wp->sectors_free && in bch2_write_extent()
1401 struct write_point *wp = NULL; in __bch2_write() local
1447 &op->cl, &wp))); in __bch2_write()
1455 EBUG_ON(!wp); in __bch2_write()
1457 bch2_open_bucket_get(c, wp, &op->open_buckets); in __bch2_write()
1458 ret = bch2_write_extent(op, wp, &bio); in __bch2_write()
1460 bch2_alloc_sectors_done_inlined(c, wp); in __bch2_write()
1509 bch2_write_queue(op, wp); in __bch2_write()