Merge branch 'for-6.0/dax' into libnvdimm-fixes
authorDan Williams <dan.j.williams@intel.com>
Sun, 25 Sep 2022 01:14:12 +0000 (18:14 -0700)
committerDan Williams <dan.j.williams@intel.com>
Sun, 25 Sep 2022 01:14:12 +0000 (18:14 -0700)
Pick up another "Soft Reservation" fix for v6.0-final on top of some
straggling nvdimm fixes that missed v5.19.

drivers/nvdimm/namespace_devs.c
drivers/nvdimm/pmem.c
fs/dax.c
tools/testing/nvdimm/test/ndtest.c

index bf4f5c09d9b1b3685eb359b64733335d729061fc..bbe5099c836d72a510247bf1263df160384ee41f 100644 (file)
@@ -1712,8 +1712,6 @@ static struct device *create_namespace_pmem(struct nd_region *nd_region,
        res->flags = IORESOURCE_MEM;
 
        for (i = 0; i < nd_region->ndr_mappings; i++) {
-               uuid_t uuid;
-
                nsl_get_uuid(ndd, nd_label, &uuid);
                if (has_uuid_at_pos(nd_region, &uuid, cookie, i))
                        continue;
index 7e88cd24238051d5414aa5b513239657cd4904a4..96e6e9a5f235d82684c8005b4b0d317e7293ad3f 100644 (file)
@@ -45,7 +45,7 @@ static struct nd_region *to_region(struct pmem_device *pmem)
        return to_nd_region(to_dev(pmem)->parent);
 }
 
-static phys_addr_t to_phys(struct pmem_device *pmem, phys_addr_t offset)
+static phys_addr_t pmem_to_phys(struct pmem_device *pmem, phys_addr_t offset)
 {
        return pmem->phys_addr + offset;
 }
@@ -63,7 +63,7 @@ static phys_addr_t to_offset(struct pmem_device *pmem, sector_t sector)
 static void pmem_mkpage_present(struct pmem_device *pmem, phys_addr_t offset,
                unsigned int len)
 {
-       phys_addr_t phys = to_phys(pmem, offset);
+       phys_addr_t phys = pmem_to_phys(pmem, offset);
        unsigned long pfn_start, pfn_end, pfn;
 
        /* only pmem in the linear map supports HWPoison */
@@ -97,7 +97,7 @@ static void pmem_clear_bb(struct pmem_device *pmem, sector_t sector, long blks)
 static long __pmem_clear_poison(struct pmem_device *pmem,
                phys_addr_t offset, unsigned int len)
 {
-       phys_addr_t phys = to_phys(pmem, offset);
+       phys_addr_t phys = pmem_to_phys(pmem, offset);
        long cleared = nvdimm_clear_poison(to_dev(pmem), phys, len);
 
        if (cleared > 0) {
index c440dcef4b1bf1bfb5f9907e9e6163d40022f2de..1c6867810cbd67883074ce7ca9c84d77dd991b17 100644 (file)
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -1445,6 +1445,9 @@ dax_iomap_rw(struct kiocb *iocb, struct iov_iter *iter,
        loff_t done = 0;
        int ret;
 
+       if (!iomi.len)
+               return 0;
+
        if (iov_iter_rw(iter) == WRITE) {
                lockdep_assert_held_write(&iomi.inode->i_rwsem);
                iomi.flags |= IOMAP_WRITE;
index 4d1a947367f9b66ca81474e570c036e308bfbfff..01ceb98c15a08e5bbc81444897c8cfb761f55ffd 100644 (file)
@@ -134,39 +134,6 @@ static struct ndtest_mapping region1_mapping[] = {
        },
 };
 
-static struct ndtest_mapping region2_mapping[] = {
-       {
-               .dimm = 0,
-               .position = 0,
-               .start = 0,
-               .size = DIMM_SIZE,
-       },
-};
-
-static struct ndtest_mapping region3_mapping[] = {
-       {
-               .dimm = 1,
-               .start = 0,
-               .size = DIMM_SIZE,
-       }
-};
-
-static struct ndtest_mapping region4_mapping[] = {
-       {
-               .dimm = 2,
-               .start = 0,
-               .size = DIMM_SIZE,
-       }
-};
-
-static struct ndtest_mapping region5_mapping[] = {
-       {
-               .dimm = 3,
-               .start = 0,
-               .size = DIMM_SIZE,
-       }
-};
-
 static struct ndtest_region bus0_regions[] = {
        {
                .type = ND_DEVICE_NAMESPACE_PMEM,
@@ -182,34 +149,6 @@ static struct ndtest_region bus0_regions[] = {
                .size = DIMM_SIZE * 2,
                .range_index = 2,
        },
-       {
-               .type = ND_DEVICE_NAMESPACE_BLK,
-               .num_mappings = ARRAY_SIZE(region2_mapping),
-               .mapping = region2_mapping,
-               .size = DIMM_SIZE,
-               .range_index = 3,
-       },
-       {
-               .type = ND_DEVICE_NAMESPACE_BLK,
-               .num_mappings = ARRAY_SIZE(region3_mapping),
-               .mapping = region3_mapping,
-               .size = DIMM_SIZE,
-               .range_index = 4,
-       },
-       {
-               .type = ND_DEVICE_NAMESPACE_BLK,
-               .num_mappings = ARRAY_SIZE(region4_mapping),
-               .mapping = region4_mapping,
-               .size = DIMM_SIZE,
-               .range_index = 5,
-       },
-       {
-               .type = ND_DEVICE_NAMESPACE_BLK,
-               .num_mappings = ARRAY_SIZE(region5_mapping),
-               .mapping = region5_mapping,
-               .size = DIMM_SIZE,
-               .range_index = 6,
-       },
 };
 
 static struct ndtest_mapping region6_mapping[] = {
@@ -501,21 +440,6 @@ static int ndtest_create_region(struct ndtest_priv *p,
        nd_set->altcookie = nd_set->cookie1;
        ndr_desc->nd_set = nd_set;
 
-       if (region->type == ND_DEVICE_NAMESPACE_BLK) {
-               mappings[0].start = 0;
-               mappings[0].size = DIMM_SIZE;
-               mappings[0].nvdimm = p->config->dimms[ndimm].nvdimm;
-
-               ndr_desc->mapping = &mappings[0];
-               ndr_desc->num_mappings = 1;
-               ndr_desc->num_lanes = 1;
-               ndbr_desc.enable = ndtest_blk_region_enable;
-               ndbr_desc.do_io = ndtest_blk_do_io;
-               region->region = nvdimm_blk_region_create(p->bus, ndr_desc);
-
-               goto done;
-       }
-
        for (i = 0; i < region->num_mappings; i++) {
                ndimm = region->mapping[i].dimm;
                mappings[i].start = region->mapping[i].start;
@@ -527,7 +451,6 @@ static int ndtest_create_region(struct ndtest_priv *p,
        ndr_desc->num_mappings = region->num_mappings;
        region->region = nvdimm_pmem_region_create(p->bus, ndr_desc);
 
-done:
        if (!region->region) {
                dev_err(&p->pdev.dev, "Error registering region %pR\n",
                        ndr_desc->res);