Lines Matching refs:rg

258 	struct file_region *rg, *nrg, *trg;  in region_add()  local
263 list_for_each_entry(rg, head, link) in region_add()
264 if (f <= rg->to) in region_add()
273 if (&rg->link == head || t < rg->from) { in region_add()
283 list_add(&nrg->link, rg->link.prev); in region_add()
290 if (f > rg->from) in region_add()
291 f = rg->from; in region_add()
294 nrg = rg; in region_add()
295 list_for_each_entry_safe(rg, trg, rg->link.prev, link) { in region_add()
296 if (&rg->link == head) in region_add()
298 if (rg->from > t) in region_add()
304 if (rg->to > t) in region_add()
305 t = rg->to; in region_add()
306 if (rg != nrg) { in region_add()
311 add -= (rg->to - rg->from); in region_add()
312 list_del(&rg->link); in region_add()
313 kfree(rg); in region_add()
354 struct file_region *rg, *nrg = NULL; in region_chg() local
387 list_for_each_entry(rg, head, link) in region_chg()
388 if (f <= rg->to) in region_chg()
394 if (&rg->link == head || t < rg->from) { in region_chg()
408 list_add(&nrg->link, rg->link.prev); in region_chg()
414 if (f > rg->from) in region_chg()
415 f = rg->from; in region_chg()
419 list_for_each_entry(rg, rg->link.prev, link) { in region_chg()
420 if (&rg->link == head) in region_chg()
422 if (rg->from > t) in region_chg()
428 if (rg->to > t) { in region_chg()
429 chg += rg->to - t; in region_chg()
430 t = rg->to; in region_chg()
432 chg -= rg->to - rg->from; in region_chg()
481 struct file_region *rg, *trg; in region_del() local
487 list_for_each_entry_safe(rg, trg, head, link) { in region_del()
495 if (rg->to <= f && (rg->to != rg->from || rg->to != f)) in region_del()
498 if (rg->from >= t) in region_del()
501 if (f > rg->from && t < rg->to) { /* Must split region */ in region_del()
527 nrg->to = rg->to; in region_del()
531 rg->to = f; in region_del()
533 list_add(&nrg->link, &rg->link); in region_del()
538 if (f <= rg->from && t >= rg->to) { /* Remove entire region */ in region_del()
539 del += rg->to - rg->from; in region_del()
540 list_del(&rg->link); in region_del()
541 kfree(rg); in region_del()
545 if (f <= rg->from) { /* Trim beginning of region */ in region_del()
546 del += t - rg->from; in region_del()
547 rg->from = t; in region_del()
549 del += rg->to - f; in region_del()
550 rg->to = f; in region_del()
588 struct file_region *rg; in region_count() local
593 list_for_each_entry(rg, head, link) { in region_count()
597 if (rg->to <= f) in region_count()
599 if (rg->from >= t) in region_count()
602 seg_from = max(rg->from, f); in region_count()
603 seg_to = min(rg->to, t); in region_count()
701 struct file_region *rg = kmalloc(sizeof(*rg), GFP_KERNEL); in resv_map_alloc() local
703 if (!resv_map || !rg) { in resv_map_alloc()
705 kfree(rg); in resv_map_alloc()
716 list_add(&rg->link, &resv_map->region_cache); in resv_map_alloc()
726 struct file_region *rg, *trg; in resv_map_release() local
732 list_for_each_entry_safe(rg, trg, head, link) { in resv_map_release()
733 list_del(&rg->link); in resv_map_release()
734 kfree(rg); in resv_map_release()