Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

dax: move dax_pgoff_to_phys from [drivers/dax/] device.c to bus.c

This function will be used by both device.c and fsdev.c, but both are
loadable modules. Moving to bus.c puts it in core and makes it available
to both.

No code changes - just relocated.

Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Signed-off-by: John Groves <john@groves.net>
Link: https://patch.msgid.link/0100019d311c90eb-a582ff97-93ba-49f3-8140-6c5c4bf8bc62-000000@email.amazonses.com
Signed-off-by: Ira Weiny <ira.weiny@intel.com>

authored by

John Groves and committed by
Ira Weiny
a73cc506 7aaa8047

+20 -23
+20
drivers/dax/bus.c
··· 1417 1417 .groups = dax_attribute_groups, 1418 1418 }; 1419 1419 1420 + /* see "strong" declaration in tools/testing/nvdimm/dax-dev.c */ 1421 + __weak phys_addr_t dax_pgoff_to_phys(struct dev_dax *dev_dax, pgoff_t pgoff, 1422 + unsigned long size) 1423 + { 1424 + for (int i = 0; i < dev_dax->nr_range; i++) { 1425 + struct dev_dax_range *dax_range = &dev_dax->ranges[i]; 1426 + struct range *range = &dax_range->range; 1427 + phys_addr_t phys; 1428 + 1429 + if (!in_range(pgoff, dax_range->pgoff, PHYS_PFN(range_len(range)))) 1430 + continue; 1431 + phys = PFN_PHYS(pgoff - dax_range->pgoff) + range->start; 1432 + if (phys + size - 1 <= range->end) 1433 + return phys; 1434 + break; 1435 + } 1436 + return -1; 1437 + } 1438 + EXPORT_SYMBOL_GPL(dax_pgoff_to_phys); 1439 + 1420 1440 static struct dev_dax *__devm_create_dev_dax(struct dev_dax_data *data) 1421 1441 { 1422 1442 struct dax_region *dax_region = data->dax_region;
-23
drivers/dax/device.c
··· 57 57 vma->vm_file, func); 58 58 } 59 59 60 - /* see "strong" declaration in tools/testing/nvdimm/dax-dev.c */ 61 - __weak phys_addr_t dax_pgoff_to_phys(struct dev_dax *dev_dax, pgoff_t pgoff, 62 - unsigned long size) 63 - { 64 - int i; 65 - 66 - for (i = 0; i < dev_dax->nr_range; i++) { 67 - struct dev_dax_range *dax_range = &dev_dax->ranges[i]; 68 - struct range *range = &dax_range->range; 69 - unsigned long long pgoff_end; 70 - phys_addr_t phys; 71 - 72 - pgoff_end = dax_range->pgoff + PHYS_PFN(range_len(range)) - 1; 73 - if (pgoff < dax_range->pgoff || pgoff > pgoff_end) 74 - continue; 75 - phys = PFN_PHYS(pgoff - dax_range->pgoff) + range->start; 76 - if (phys + size - 1 <= range->end) 77 - return phys; 78 - break; 79 - } 80 - return -1; 81 - } 82 - 83 60 static void dax_set_mapping(struct vm_fault *vmf, unsigned long pfn, 84 61 unsigned long fault_size) 85 62 {