Lines Matching refs:pi
219 struct path_info *pi, *next; in free_paths() local
221 list_for_each_entry_safe(pi, next, paths, list) { in free_paths()
222 list_del(&pi->list); in free_paths()
223 kfree(pi); in free_paths()
241 struct path_info *pi; in hst_status() local
248 pi = path->pscontext; in hst_status()
252 DMEMIT("%llu %llu %llu ", pi->historical_service_time, in hst_status()
253 pi->outstanding, pi->stale_after); in hst_status()
271 struct path_info *pi; in hst_add_path() local
292 pi = kmalloc(sizeof(*pi), GFP_KERNEL); in hst_add_path()
293 if (!pi) { in hst_add_path()
298 pi->path = path; in hst_add_path()
299 pi->repeat_count = repeat_count; in hst_add_path()
301 pi->historical_service_time = HST_FIXED_1; in hst_add_path()
303 spin_lock_init(&pi->lock); in hst_add_path()
304 pi->outstanding = 0; in hst_add_path()
306 pi->stale_after = 0; in hst_add_path()
307 pi->last_finish = 0; in hst_add_path()
309 path->pscontext = pi; in hst_add_path()
312 list_add_tail(&pi->list, &s->valid_paths); in hst_add_path()
322 struct path_info *pi = path->pscontext; in hst_fail_path() local
326 list_move(&pi->list, &s->failed_paths); in hst_fail_path()
334 struct path_info *pi = path->pscontext; in hst_reinstate_path() local
338 list_move_tail(&pi->list, &s->valid_paths); in hst_reinstate_path()
345 static void hst_fill_compare(struct path_info *pi, u64 *hst, in hst_fill_compare() argument
350 spin_lock_irqsave(&pi->lock, flags); in hst_fill_compare()
351 *hst = pi->historical_service_time; in hst_fill_compare()
352 *out = pi->outstanding; in hst_fill_compare()
353 *stale = pi->stale_after; in hst_fill_compare()
354 spin_unlock_irqrestore(&pi->lock, flags); in hst_fill_compare()
434 struct path_info *pi = NULL, *best = NULL; in hst_select_path() local
443 list_for_each_entry(pi, &s->valid_paths, list) { in hst_select_path()
444 if (!best || (hst_compare(pi, best, time_now, ps) < 0)) in hst_select_path()
445 best = pi; in hst_select_path()
464 struct path_info *pi = path->pscontext; in hst_start_io() local
467 spin_lock_irqsave(&pi->lock, flags); in hst_start_io()
468 pi->outstanding++; in hst_start_io()
469 spin_unlock_irqrestore(&pi->lock, flags); in hst_start_io()
474 static u64 path_service_time(struct path_info *pi, u64 start_time) in path_service_time() argument
482 if (time_after64(pi->last_finish, start_time)) in path_service_time()
483 start_time = pi->last_finish; in path_service_time()
485 pi->last_finish = now; in path_service_time()
495 struct path_info *pi = path->pscontext; in hst_end_io() local
500 spin_lock_irqsave(&pi->lock, flags); in hst_end_io()
502 st = path_service_time(pi, start_time); in hst_end_io()
503 pi->outstanding--; in hst_end_io()
504 pi->historical_service_time = in hst_end_io()
505 fixed_ema(pi->historical_service_time, in hst_end_io()
515 pi->stale_after = pi->last_finish + in hst_end_io()
516 (s->valid_count * (pi->historical_service_time >> HST_FIXED_SHIFT)); in hst_end_io()
518 spin_unlock_irqrestore(&pi->lock, flags); in hst_end_io()