Lines Matching refs:nr_entries
55 rb->nr_entries = (1 << power_size); in pblk_rb_init()
122 pblk_rl_init(&pblk->rl, rb->nr_entries); in pblk_rb_init()
130 unsigned int pblk_rb_calculate_size(unsigned int nr_entries) in pblk_rb_calculate_size() argument
133 return (1 << max(get_count_order(nr_entries), 7)); in pblk_rb_calculate_size()
168 return pblk_rb_ring_space(rb, mem, sync, rb->nr_entries); in pblk_rb_space()
180 return pblk_rb_ring_count(mem, subm, rb->nr_entries); in pblk_rb_read_count()
188 return pblk_rb_ring_count(mem, sync, rb->nr_entries); in pblk_rb_sync_count()
191 unsigned int pblk_rb_read_commit(struct pblk_rb *rb, unsigned int nr_entries) in pblk_rb_read_commit() argument
198 (subm + nr_entries) & (rb->nr_entries - 1)); in pblk_rb_read_commit()
231 rb->l2p_update = (rb->l2p_update + 1) & (rb->nr_entries - 1); in __pblk_rb_update_l2p()
244 static int pblk_rb_update_l2p(struct pblk_rb *rb, unsigned int nr_entries, in pblk_rb_update_l2p() argument
253 space = pblk_rb_ring_space(rb, mem, rb->l2p_update, rb->nr_entries); in pblk_rb_update_l2p()
254 if (space > nr_entries) in pblk_rb_update_l2p()
257 count = nr_entries - space; in pblk_rb_update_l2p()
280 to_update = pblk_rb_ring_count(sync, rb->l2p_update, rb->nr_entries); in pblk_rb_sync_l2p()
369 flush_point = (pos == 0) ? (rb->nr_entries - 1) : (pos - 1); in pblk_rb_flush_point_set()
383 static int __pblk_rb_may_write(struct pblk_rb *rb, unsigned int nr_entries, in __pblk_rb_may_write() argument
392 if (pblk_rb_ring_space(rb, mem, sync, rb->nr_entries) < nr_entries) in __pblk_rb_may_write()
395 if (pblk_rb_update_l2p(rb, nr_entries, mem, sync)) in __pblk_rb_may_write()
403 static int pblk_rb_may_write(struct pblk_rb *rb, unsigned int nr_entries, in pblk_rb_may_write() argument
406 if (!__pblk_rb_may_write(rb, nr_entries, pos)) in pblk_rb_may_write()
410 smp_store_release(&rb->mem, (*pos + nr_entries) & (rb->nr_entries - 1)); in pblk_rb_may_write()
425 static int pblk_rb_may_write_flush(struct pblk_rb *rb, unsigned int nr_entries, in pblk_rb_may_write_flush() argument
431 if (!__pblk_rb_may_write(rb, nr_entries, pos)) in pblk_rb_may_write_flush()
434 mem = (*pos + nr_entries) & (rb->nr_entries - 1); in pblk_rb_may_write_flush()
457 unsigned int nr_entries, unsigned int *pos) in pblk_rb_may_write_user() argument
463 io_ret = pblk_rl_user_may_insert(&pblk->rl, nr_entries); in pblk_rb_may_write_user()
469 if (!pblk_rb_may_write_flush(rb, nr_entries, pos, bio, &io_ret)) { in pblk_rb_may_write_user()
474 pblk_rl_user_in(&pblk->rl, nr_entries); in pblk_rb_may_write_user()
483 int pblk_rb_may_write_gc(struct pblk_rb *rb, unsigned int nr_entries, in pblk_rb_may_write_gc() argument
489 if (!pblk_rl_gc_may_insert(&pblk->rl, nr_entries)) { in pblk_rb_may_write_gc()
494 if (!pblk_rb_may_write(rb, nr_entries, pos)) { in pblk_rb_may_write_gc()
499 pblk_rl_gc_in(&pblk->rl, nr_entries); in pblk_rb_may_write_gc()
513 unsigned int pos, unsigned int nr_entries, in pblk_rb_read_to_bio() argument
522 unsigned int pad = 0, to_read = nr_entries; in pblk_rb_read_to_bio()
526 if (count < nr_entries) { in pblk_rb_read_to_bio()
527 pad = nr_entries - count; in pblk_rb_read_to_bio()
574 pos = (pos + 1) & (rb->nr_entries - 1); in pblk_rb_read_to_bio()
618 BUG_ON(pos >= rb->nr_entries); in pblk_rb_copy_to_bio()
654 unsigned int entry = pos & (rb->nr_entries - 1); in pblk_rb_w_ctx()
681 unsigned int pblk_rb_sync_advance(struct pblk_rb *rb, unsigned int nr_entries) in pblk_rb_sync_advance() argument
693 rb->nr_entries); in pblk_rb_sync_advance()
694 if (secs_to_flush < nr_entries) { in pblk_rb_sync_advance()
700 sync = (sync + nr_entries) & (rb->nr_entries - 1); in pblk_rb_sync_advance()
723 submitted = pblk_rb_ring_count(subm, sync, rb->nr_entries); in pblk_rb_flush_point_count()
726 to_flush = pblk_rb_ring_count(flush_point, sync, rb->nr_entries) + 1; in pblk_rb_flush_point_count()
749 count = pblk_rb_ring_count(subm, sync, rb->nr_entries); in pblk_rb_sync_scan_entry()
752 sync = (sync + 1) & (rb->nr_entries - 1); in pblk_rb_sync_scan_entry()
777 for (i = 0; i < rb->nr_entries; i++) { in pblk_rb_tear_down_check()
795 return (pos & (rb->nr_entries - 1)); in pblk_rb_wrap_pos()
800 return (pos >= rb->nr_entries); in pblk_rb_pos_oob()
818 rb->nr_entries, in pblk_rb_sysfs()
836 rb->nr_entries, in pblk_rb_sysfs()