Lines Matching full: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()
268 struct path_info *pi; in hst_add_path() local
289 pi = kmalloc(sizeof(*pi), GFP_KERNEL); in hst_add_path()
290 if (!pi) { in hst_add_path()
295 pi->path = path; in hst_add_path()
296 pi->repeat_count = repeat_count; in hst_add_path()
298 pi->historical_service_time = HST_FIXED_1; in hst_add_path()
300 spin_lock_init(&pi->lock); in hst_add_path()
301 pi->outstanding = 0; in hst_add_path()
303 pi->stale_after = 0; in hst_add_path()
304 pi->last_finish = 0; in hst_add_path()
306 path->pscontext = pi; in hst_add_path()
309 list_add_tail(&pi->list, &s->valid_paths); in hst_add_path()
319 struct path_info *pi = path->pscontext; in hst_fail_path() local
323 list_move(&pi->list, &s->failed_paths); in hst_fail_path()
331 struct path_info *pi = path->pscontext; in hst_reinstate_path() local
335 list_move_tail(&pi->list, &s->valid_paths); in hst_reinstate_path()
342 static void hst_fill_compare(struct path_info *pi, u64 *hst, in hst_fill_compare() argument
347 spin_lock_irqsave(&pi->lock, flags); in hst_fill_compare()
348 *hst = pi->historical_service_time; in hst_fill_compare()
349 *out = pi->outstanding; in hst_fill_compare()
350 *stale = pi->stale_after; in hst_fill_compare()
351 spin_unlock_irqrestore(&pi->lock, flags); in hst_fill_compare()
431 struct path_info *pi = NULL, *best = NULL; in hst_select_path() local
440 list_for_each_entry(pi, &s->valid_paths, list) { in hst_select_path()
441 if (!best || (hst_compare(pi, best, time_now, ps) < 0)) in hst_select_path()
442 best = pi; in hst_select_path()
461 struct path_info *pi = path->pscontext; in hst_start_io() local
464 spin_lock_irqsave(&pi->lock, flags); in hst_start_io()
465 pi->outstanding++; in hst_start_io()
466 spin_unlock_irqrestore(&pi->lock, flags); in hst_start_io()
471 static u64 path_service_time(struct path_info *pi, u64 start_time) in path_service_time() argument
479 if (time_after64(pi->last_finish, start_time)) in path_service_time()
480 start_time = pi->last_finish; in path_service_time()
482 pi->last_finish = sched_now; in path_service_time()
492 struct path_info *pi = path->pscontext; in hst_end_io() local
497 spin_lock_irqsave(&pi->lock, flags); in hst_end_io()
499 st = path_service_time(pi, start_time); in hst_end_io()
500 pi->outstanding--; in hst_end_io()
501 pi->historical_service_time = in hst_end_io()
502 fixed_ema(pi->historical_service_time, in hst_end_io()
512 pi->stale_after = pi->last_finish + in hst_end_io()
513 (s->valid_count * (pi->historical_service_time >> HST_FIXED_SHIFT)); in hst_end_io()
515 spin_unlock_irqrestore(&pi->lock, flags); in hst_end_io()