Lines Matching full:wp

842 			 struct write_point *wp,  in bucket_alloc_from_stripe()  argument
871 devs_sorted = bch2_dev_alloc_list(c, &wp->stripe, devs_may_alloc); in bucket_alloc_from_stripe()
900 struct write_point *wp, in want_bucket() argument
910 if (ob->data_type != wp->data_type) in want_bucket()
914 (wp->data_type == BCH_DATA_btree || ec || *have_cache)) in want_bucket()
925 struct write_point *wp, in bucket_alloc_set_writepoint() argument
937 open_bucket_for_each(c, &wp->ptrs, ob, i) { in bucket_alloc_set_writepoint()
938 if (!ret && want_bucket(c, wp, devs_may_alloc, in bucket_alloc_set_writepoint()
946 wp->ptrs = ptrs_skip; in bucket_alloc_set_writepoint()
953 struct write_point *wp, in bucket_alloc_set_partial() argument
973 if (want_bucket(c, wp, devs_may_alloc, have_cache, ec, ob)) { in bucket_alloc_set_partial()
1006 struct write_point *wp, in __open_bucket_add_buckets() argument
1024 devs = target_rw_devs(c, wp->data_type, target); in __open_bucket_add_buckets()
1033 ret = bucket_alloc_set_writepoint(c, ptrs, wp, &devs, in __open_bucket_add_buckets()
1039 ret = bucket_alloc_set_partial(c, ptrs, wp, &devs, in __open_bucket_add_buckets()
1046 ret = bucket_alloc_from_stripe(trans, ptrs, wp, &devs, in __open_bucket_add_buckets()
1057 ret = bch2_bucket_alloc_set_trans(trans, ptrs, &wp->stripe, &devs, in __open_bucket_add_buckets()
1059 flags, wp->data_type, watermark, cl); in __open_bucket_add_buckets()
1074 struct write_point *wp, in open_bucket_add_buckets() argument
1088 ret = __open_bucket_add_buckets(trans, ptrs, wp, in open_bucket_add_buckets()
1101 ret = __open_bucket_add_buckets(trans, ptrs, wp, in open_bucket_add_buckets()
1154 bool ec, struct write_point *wp) in bch2_writepoint_stop() argument
1160 mutex_lock(&wp->lock); in bch2_writepoint_stop()
1161 open_bucket_for_each(c, &wp->ptrs, ob, i) in bch2_writepoint_stop()
1166 wp->ptrs = ptrs; in bch2_writepoint_stop()
1167 mutex_unlock(&wp->lock); in bch2_writepoint_stop()
1233 struct write_point *wp; in __writepoint_find() local
1236 hlist_for_each_entry_rcu(wp, head, node) in __writepoint_find()
1237 if (wp->write_point == write_point) in __writepoint_find()
1239 wp = NULL; in __writepoint_find()
1242 return wp; in __writepoint_find()
1255 struct write_point *wp; in try_increase_writepoints() local
1261 wp = c->write_points + c->write_points_nr++; in try_increase_writepoints()
1262 hlist_add_head_rcu(&wp->node, writepoint_hash(c, wp->write_point)); in try_increase_writepoints()
1269 struct write_point *wp; in try_decrease_writepoints() local
1285 wp = c->write_points + --c->write_points_nr; in try_decrease_writepoints()
1287 hlist_del_rcu(&wp->node); in try_decrease_writepoints()
1290 bch2_trans_mutex_lock_norelock(trans, &wp->lock); in try_decrease_writepoints()
1291 open_bucket_for_each(c, &wp->ptrs, ob, i) in try_decrease_writepoints()
1293 wp->ptrs.nr = 0; in try_decrease_writepoints()
1294 mutex_unlock(&wp->lock); in try_decrease_writepoints()
1302 struct write_point *wp, *oldest; in writepoint_find() local
1306 wp = (struct write_point *) write_point; in writepoint_find()
1307 bch2_trans_mutex_lock_norelock(trans, &wp->lock); in writepoint_find()
1308 return wp; in writepoint_find()
1313 wp = __writepoint_find(head, write_point); in writepoint_find()
1314 if (wp) { in writepoint_find()
1316 bch2_trans_mutex_lock_norelock(trans, &wp->lock); in writepoint_find()
1317 if (wp->write_point == write_point) in writepoint_find()
1319 mutex_unlock(&wp->lock); in writepoint_find()
1324 for (wp = c->write_points; in writepoint_find()
1325 wp < c->write_points + c->write_points_nr; wp++) in writepoint_find()
1326 if (!oldest || time_before64(wp->last_used, oldest->last_used)) in writepoint_find()
1327 oldest = wp; in writepoint_find()
1338 wp = __writepoint_find(head, write_point); in writepoint_find()
1339 if (wp && wp != oldest) { in writepoint_find()
1345 wp = oldest; in writepoint_find()
1346 hlist_del_rcu(&wp->node); in writepoint_find()
1347 wp->write_point = write_point; in writepoint_find()
1348 hlist_add_head_rcu(&wp->node, head); in writepoint_find()
1351 wp->last_used = local_clock(); in writepoint_find()
1352 return wp; in writepoint_find()
1395 struct write_point *wp; in bch2_alloc_sectors_start_trans() local
1413 *wp_ret = wp = writepoint_find(trans, write_point.v); in bch2_alloc_sectors_start_trans()
1420 if (wp->data_type != BCH_DATA_user) in bch2_alloc_sectors_start_trans()
1424 ret = open_bucket_add_buckets(trans, &ptrs, wp, devs_have, in bch2_alloc_sectors_start_trans()
1435 int ret2 = open_bucket_add_buckets(trans, &ptrs, wp, devs_have, in bch2_alloc_sectors_start_trans()
1454 ret = open_bucket_add_buckets(trans, &ptrs, wp, devs_have, in bch2_alloc_sectors_start_trans()
1460 ret = open_bucket_add_buckets(trans, &ptrs, wp, devs_have, in bch2_alloc_sectors_start_trans()
1480 deallocate_extra_replicas(c, &ptrs, &wp->ptrs, nr_effective - nr_replicas); in bch2_alloc_sectors_start_trans()
1483 open_bucket_for_each(c, &wp->ptrs, ob, i) in bch2_alloc_sectors_start_trans()
1486 wp->ptrs = ptrs; in bch2_alloc_sectors_start_trans()
1488 wp->sectors_free = UINT_MAX; in bch2_alloc_sectors_start_trans()
1490 open_bucket_for_each(c, &wp->ptrs, ob, i) in bch2_alloc_sectors_start_trans()
1491 wp->sectors_free = min(wp->sectors_free, ob->sectors_free); in bch2_alloc_sectors_start_trans()
1493 BUG_ON(!wp->sectors_free || wp->sectors_free == UINT_MAX); in bch2_alloc_sectors_start_trans()
1497 open_bucket_for_each(c, &wp->ptrs, ob, i) in bch2_alloc_sectors_start_trans()
1502 wp->ptrs = ptrs; in bch2_alloc_sectors_start_trans()
1504 mutex_unlock(&wp->lock); in bch2_alloc_sectors_start_trans()
1534 void bch2_alloc_sectors_append_ptrs(struct bch_fs *c, struct write_point *wp, in bch2_alloc_sectors_append_ptrs() argument
1538 bch2_alloc_sectors_append_ptrs_inlined(c, wp, k, sectors, cached); in bch2_alloc_sectors_append_ptrs()
1545 void bch2_alloc_sectors_done(struct bch_fs *c, struct write_point *wp) in bch2_alloc_sectors_done() argument
1547 bch2_alloc_sectors_done_inlined(c, wp); in bch2_alloc_sectors_done()
1550 static inline void writepoint_init(struct write_point *wp, in writepoint_init() argument
1553 mutex_init(&wp->lock); in writepoint_init()
1554 wp->data_type = type; in writepoint_init()
1556 INIT_WORK(&wp->index_update_work, bch2_write_point_do_index_updates); in writepoint_init()
1557 INIT_LIST_HEAD(&wp->writes); in writepoint_init()
1558 spin_lock_init(&wp->writes_lock); in writepoint_init()
1564 struct write_point *wp; in bch2_fs_allocator_foreground_init() local
1585 for (wp = c->write_points; in bch2_fs_allocator_foreground_init()
1586 wp < c->write_points + c->write_points_nr; wp++) { in bch2_fs_allocator_foreground_init()
1587 writepoint_init(wp, BCH_DATA_user); in bch2_fs_allocator_foreground_init()
1589 wp->last_used = local_clock(); in bch2_fs_allocator_foreground_init()
1590 wp->write_point = (unsigned long) wp; in bch2_fs_allocator_foreground_init()
1591 hlist_add_head_rcu(&wp->node, in bch2_fs_allocator_foreground_init()
1592 writepoint_hash(c, wp->write_point)); in bch2_fs_allocator_foreground_init()
1658 struct write_point *wp) in bch2_write_point_to_text() argument
1663 prt_printf(out, "%lu: ", wp->write_point); in bch2_write_point_to_text()
1664 prt_human_readable_u64(out, wp->sectors_allocated); in bch2_write_point_to_text()
1667 bch2_pr_time_units(out, sched_clock() - wp->last_used); in bch2_write_point_to_text()
1671 bch2_pr_time_units(out, wp->time[i]); in bch2_write_point_to_text()
1677 open_bucket_for_each(c, &wp->ptrs, ob, i) in bch2_write_point_to_text()
1684 struct write_point *wp; in bch2_write_points_to_text() local
1687 for (wp = c->write_points; in bch2_write_points_to_text()
1688 wp < c->write_points + ARRAY_SIZE(c->write_points); in bch2_write_points_to_text()
1689 wp++) in bch2_write_points_to_text()
1690 bch2_write_point_to_text(out, c, wp); in bch2_write_points_to_text()