Lines Matching refs:res
46 kfree(nsblk->res); in namespace_blk_release()
271 struct resource *res; in nd_namespace_blk_size() local
276 for_each_dpa_resource(ndd, res) in nd_namespace_blk_size()
277 if (strcmp(res->name, label_id.id) == 0) in nd_namespace_blk_size()
278 size += resource_size(res); in nd_namespace_blk_size()
288 struct resource *res; in __nd_namespace_blk_validate() local
296 for_each_dpa_resource(ndd, res) { in __nd_namespace_blk_validate()
297 if (strcmp(res->name, label_id.id) != 0) in __nd_namespace_blk_validate()
303 if (res->flags & DPA_RESOURCE_ADJUSTED) in __nd_namespace_blk_validate()
315 for_each_dpa_resource(ndd, res) in __nd_namespace_blk_validate()
316 if (res == nsblk->res[i]) { in __nd_namespace_blk_validate()
317 found = res; in __nd_namespace_blk_validate()
355 resource_size_t size = resource_size(&nspm->nsio.res); in nd_namespace_label_update()
425 struct resource *res, *last; in scan_free() local
429 for_each_dpa_resource(ndd, res) in scan_free()
430 if (strcmp(res->name, label_id->id) == 0) in scan_free()
431 last = res; in scan_free()
432 res = last; in scan_free()
433 if (!res) in scan_free()
436 if (n >= resource_size(res)) { in scan_free()
437 n -= resource_size(res); in scan_free()
438 nd_dbg_dpa(nd_region, ndd, res, "delete %d\n", rc); in scan_free()
439 nvdimm_free_dpa(ndd, res); in scan_free()
449 new_start = res->start + n; in scan_free()
451 new_start = res->start; in scan_free()
453 rc = adjust_resource(res, new_start, resource_size(res) - n); in scan_free()
455 res->flags |= DPA_RESOURCE_ADJUSTED; in scan_free()
456 nd_dbg_dpa(nd_region, ndd, res, "shrink %d\n", rc); in scan_free()
498 struct resource *res; in init_dpa_allocation() local
508 res = nvdimm_allocate_dpa(ndd, label_id, first_dpa, n); in init_dpa_allocation()
509 if (!res) in init_dpa_allocation()
512 nd_dbg_dpa(nd_region, ndd, res, "init %d\n", rc); in init_dpa_allocation()
517 struct nd_label_id *label_id, struct resource *res) in space_valid() argument
526 if (!res || strcmp(res->name, label_id->id) == 0) in space_valid()
544 struct resource *res; in scan_allocate() local
549 for_each_dpa_resource(ndd, res) { in scan_allocate()
551 struct resource *next = res->sibling, *new_res = NULL; in scan_allocate()
557 if (res->start > mapping_end) in scan_allocate()
559 if (res->end < nd_mapping->start) in scan_allocate()
563 if (!first++ && res->start > nd_mapping->start) { in scan_allocate()
565 available = res->start - free_start; in scan_allocate()
572 free_start = res->start + resource_size(res); in scan_allocate()
574 if (space_valid(is_pmem, is_reserve, label_id, res) in scan_allocate()
583 free_start = res->start + resource_size(res); in scan_allocate()
585 if (space_valid(is_pmem, is_reserve, label_id, res) in scan_allocate()
597 if (strcmp(res->name, label_id->id) == 0) { in scan_allocate()
601 rc = adjust_resource(res, res->start - allocate, in scan_allocate()
602 resource_size(res) + allocate); in scan_allocate()
617 } else if (strcmp(res->name, label_id->id) == 0) { in scan_allocate()
623 if (strcmp(res->name, label_id->id) == 0) in scan_allocate()
645 rc = adjust_resource(res, res->start, resource_size(res) in scan_allocate()
648 res->flags |= DPA_RESOURCE_ADJUSTED; in scan_allocate()
652 new_res = res; in scan_allocate()
688 struct resource *res; in merge_dpa() local
693 for_each_dpa_resource(ndd, res) { in merge_dpa()
695 struct resource *next = res->sibling; in merge_dpa()
696 resource_size_t end = res->start + resource_size(res); in merge_dpa()
698 if (!next || strcmp(res->name, label_id->id) != 0 in merge_dpa()
704 rc = adjust_resource(res, res->start, end - res->start); in merge_dpa()
705 nd_dbg_dpa(nd_region, ndd, res, "merge %d\n", rc); in merge_dpa()
708 res->flags |= DPA_RESOURCE_ADJUSTED; in merge_dpa()
756 struct resource *res, *_res; in release_free_pmem() local
758 for_each_dpa_resource_safe(ndd, res, _res) in release_free_pmem()
759 if (strcmp(res->name, "pmem-reserve") == 0) in release_free_pmem()
760 nvdimm_free_dpa(ndd, res); in release_free_pmem()
841 struct resource *res = &nspm->nsio.res; in nd_namespace_pmem_set_size() local
843 res->start = nd_region->ndr_start; in nd_namespace_pmem_set_size()
844 res->end = nd_region->ndr_start + size - 1; in nd_namespace_pmem_set_size()
992 return resource_size(&nspm->nsio.res); in __nvdimm_namespace_capacity()
998 return resource_size(&nsio->res); in __nvdimm_namespace_capacity()
1091 struct resource *res; in namespace_update_uuid() local
1093 for_each_dpa_resource(ndd, res) in namespace_update_uuid()
1094 if (strcmp(res->name, old_label_id.id) == 0) in namespace_update_uuid()
1095 sprintf((void *) res->name, "%s", in namespace_update_uuid()
1148 struct resource *res; in resource_show() local
1153 res = &nspm->nsio.res; in resource_show()
1157 res = &nsio->res; in resource_show()
1162 if (resource_size(res) == 0) in resource_show()
1164 return sprintf(buf, "%#llx\n", (unsigned long long) res->start); in resource_show()
1240 struct resource *res; in dpa_extents_show() local
1242 for_each_dpa_resource(ndd, res) in dpa_extents_show()
1243 if (strcmp(res->name, label_id.id) == 0) in dpa_extents_show()
1419 struct resource *res; in create_namespace_io() local
1434 res = &nsio->res; in create_namespace_io()
1435 res->name = dev_name(&nd_region->dev); in create_namespace_io()
1436 res->flags = IORESOURCE_MEM; in create_namespace_io()
1437 res->start = nd_region->ndr_start; in create_namespace_io()
1438 res->end = res->start + nd_region->ndr_size - 1; in create_namespace_io()
1638 struct resource *res; in create_namespace_pmem() local
1648 res = &nspm->nsio.res; in create_namespace_pmem()
1649 res->name = dev_name(&nd_region->dev); in create_namespace_pmem()
1650 res->flags = IORESOURCE_MEM; in create_namespace_pmem()
1687 struct resource *res; in nsblk_add_resource() local
1690 res = krealloc(nsblk->res, in nsblk_add_resource()
1693 if (!res) in nsblk_add_resource()
1695 nsblk->res = (struct resource **) res; in nsblk_add_resource()
1696 for_each_dpa_resource(ndd, res) in nsblk_add_resource()
1697 if (strcmp(res->name, label_id.id) == 0 in nsblk_add_resource()
1698 && res->start == start) { in nsblk_add_resource()
1699 nsblk->res[nsblk->num_resources++] = res; in nsblk_add_resource()
1700 return res; in nsblk_add_resource()
1765 struct resource *res; in create_namespace_blk() local
1785 res = nsblk_add_resource(nd_region, ndd, nsblk, in create_namespace_blk()
1787 if (!res) in create_namespace_blk()
1789 nd_dbg_dpa(nd_region, ndd, res, "%s assign\n", in create_namespace_blk()
1821 res = nsblk_add_resource(nd_region, ndd, nsblk, in create_namespace_blk()
1823 if (!res) in create_namespace_blk()
1825 nd_dbg_dpa(nd_region, ndd, res, "%s assign\n", in create_namespace_blk()