Lines Matching refs:resv

255 static long region_add(struct resv_map *resv, long f, long t)  in region_add()  argument
257 struct list_head *head = &resv->regions; in region_add()
261 spin_lock(&resv->lock); in region_add()
274 VM_BUG_ON(resv->region_cache_count <= 0); in region_add()
276 resv->region_cache_count--; in region_add()
277 nrg = list_first_entry(&resv->region_cache, struct file_region, in region_add()
323 resv->adds_in_progress--; in region_add()
324 spin_unlock(&resv->lock); in region_add()
351 static long region_chg(struct resv_map *resv, long f, long t) in region_chg() argument
353 struct list_head *head = &resv->regions; in region_chg()
358 spin_lock(&resv->lock); in region_chg()
360 resv->adds_in_progress++; in region_chg()
366 if (resv->adds_in_progress > resv->region_cache_count) { in region_chg()
369 VM_BUG_ON(resv->adds_in_progress - resv->region_cache_count > 1); in region_chg()
371 resv->adds_in_progress--; in region_chg()
372 spin_unlock(&resv->lock); in region_chg()
380 spin_lock(&resv->lock); in region_chg()
381 list_add(&trg->link, &resv->region_cache); in region_chg()
382 resv->region_cache_count++; in region_chg()
396 resv->adds_in_progress--; in region_chg()
397 spin_unlock(&resv->lock); in region_chg()
436 spin_unlock(&resv->lock); in region_chg()
441 spin_unlock(&resv->lock); in region_chg()
456 static void region_abort(struct resv_map *resv, long f, long t) in region_abort() argument
458 spin_lock(&resv->lock); in region_abort()
459 VM_BUG_ON(!resv->region_cache_count); in region_abort()
460 resv->adds_in_progress--; in region_abort()
461 spin_unlock(&resv->lock); in region_abort()
478 static long region_del(struct resv_map *resv, long f, long t) in region_del() argument
480 struct list_head *head = &resv->regions; in region_del()
486 spin_lock(&resv->lock); in region_del()
507 resv->region_cache_count > resv->adds_in_progress) { in region_del()
508 nrg = list_first_entry(&resv->region_cache, in region_del()
512 resv->region_cache_count--; in region_del()
516 spin_unlock(&resv->lock); in region_del()
554 spin_unlock(&resv->lock); in region_del()
585 static long region_count(struct resv_map *resv, long f, long t) in region_count() argument
587 struct list_head *head = &resv->regions; in region_count()
591 spin_lock(&resv->lock); in region_count()
607 spin_unlock(&resv->lock); in region_count()
1788 struct resv_map *resv; in __vma_reservation_common() local
1792 resv = vma_resv_map(vma); in __vma_reservation_common()
1793 if (!resv) in __vma_reservation_common()
1799 ret = region_chg(resv, idx, idx + 1); in __vma_reservation_common()
1802 ret = region_add(resv, idx, idx + 1); in __vma_reservation_common()
1805 region_abort(resv, idx, idx + 1); in __vma_reservation_common()
2963 struct resv_map *resv = vma_resv_map(vma); in hugetlb_vm_op_open() local
2973 if (resv && is_vma_resv_set(vma, HPAGE_RESV_OWNER)) in hugetlb_vm_op_open()
2974 kref_get(&resv->refs); in hugetlb_vm_op_open()
2980 struct resv_map *resv = vma_resv_map(vma); in hugetlb_vm_op_close() local
2985 if (!resv || !is_vma_resv_set(vma, HPAGE_RESV_OWNER)) in hugetlb_vm_op_close()
2991 reserve = (end - start) - region_count(resv, start, end); in hugetlb_vm_op_close()
2993 kref_put(&resv->refs, resv_map_release); in hugetlb_vm_op_close()