diff options
Diffstat (limited to 'drivers/nvdimm')
| -rw-r--r-- | drivers/nvdimm/namespace_devs.c | 17 | ||||
| -rw-r--r-- | drivers/nvdimm/pfn_devs.c | 7 |
2 files changed, 12 insertions, 12 deletions
diff --git a/drivers/nvdimm/namespace_devs.c b/drivers/nvdimm/namespace_devs.c index a518cb1b59d4..ce3e8dfa10ad 100644 --- a/drivers/nvdimm/namespace_devs.c +++ b/drivers/nvdimm/namespace_devs.c | |||
| @@ -52,17 +52,17 @@ static void namespace_blk_release(struct device *dev) | |||
| 52 | kfree(nsblk); | 52 | kfree(nsblk); |
| 53 | } | 53 | } |
| 54 | 54 | ||
| 55 | static struct device_type namespace_io_device_type = { | 55 | static const struct device_type namespace_io_device_type = { |
| 56 | .name = "nd_namespace_io", | 56 | .name = "nd_namespace_io", |
| 57 | .release = namespace_io_release, | 57 | .release = namespace_io_release, |
| 58 | }; | 58 | }; |
| 59 | 59 | ||
| 60 | static struct device_type namespace_pmem_device_type = { | 60 | static const struct device_type namespace_pmem_device_type = { |
| 61 | .name = "nd_namespace_pmem", | 61 | .name = "nd_namespace_pmem", |
| 62 | .release = namespace_pmem_release, | 62 | .release = namespace_pmem_release, |
| 63 | }; | 63 | }; |
| 64 | 64 | ||
| 65 | static struct device_type namespace_blk_device_type = { | 65 | static const struct device_type namespace_blk_device_type = { |
| 66 | .name = "nd_namespace_blk", | 66 | .name = "nd_namespace_blk", |
| 67 | .release = namespace_blk_release, | 67 | .release = namespace_blk_release, |
| 68 | }; | 68 | }; |
| @@ -962,8 +962,8 @@ static ssize_t __size_store(struct device *dev, unsigned long long val) | |||
| 962 | struct nvdimm_drvdata *ndd; | 962 | struct nvdimm_drvdata *ndd; |
| 963 | struct nd_label_id label_id; | 963 | struct nd_label_id label_id; |
| 964 | u32 flags = 0, remainder; | 964 | u32 flags = 0, remainder; |
| 965 | int rc, i, id = -1; | ||
| 965 | u8 *uuid = NULL; | 966 | u8 *uuid = NULL; |
| 966 | int rc, i; | ||
| 967 | 967 | ||
| 968 | if (dev->driver || ndns->claim) | 968 | if (dev->driver || ndns->claim) |
| 969 | return -EBUSY; | 969 | return -EBUSY; |
| @@ -972,11 +972,13 @@ static ssize_t __size_store(struct device *dev, unsigned long long val) | |||
| 972 | struct nd_namespace_pmem *nspm = to_nd_namespace_pmem(dev); | 972 | struct nd_namespace_pmem *nspm = to_nd_namespace_pmem(dev); |
| 973 | 973 | ||
| 974 | uuid = nspm->uuid; | 974 | uuid = nspm->uuid; |
| 975 | id = nspm->id; | ||
| 975 | } else if (is_namespace_blk(dev)) { | 976 | } else if (is_namespace_blk(dev)) { |
| 976 | struct nd_namespace_blk *nsblk = to_nd_namespace_blk(dev); | 977 | struct nd_namespace_blk *nsblk = to_nd_namespace_blk(dev); |
| 977 | 978 | ||
| 978 | uuid = nsblk->uuid; | 979 | uuid = nsblk->uuid; |
| 979 | flags = NSLABEL_FLAG_LOCAL; | 980 | flags = NSLABEL_FLAG_LOCAL; |
| 981 | id = nsblk->id; | ||
| 980 | } | 982 | } |
| 981 | 983 | ||
| 982 | /* | 984 | /* |
| @@ -1039,10 +1041,11 @@ static ssize_t __size_store(struct device *dev, unsigned long long val) | |||
| 1039 | 1041 | ||
| 1040 | /* | 1042 | /* |
| 1041 | * Try to delete the namespace if we deleted all of its | 1043 | * Try to delete the namespace if we deleted all of its |
| 1042 | * allocation, this is not the seed device for the region, and | 1044 | * allocation, this is not the seed or 0th device for the |
| 1043 | * it is not actively claimed by a btt instance. | 1045 | * region, and it is not actively claimed by a btt, pfn, or dax |
| 1046 | * instance. | ||
| 1044 | */ | 1047 | */ |
| 1045 | if (val == 0 && nd_region->ns_seed != dev && !ndns->claim) | 1048 | if (val == 0 && id != 0 && nd_region->ns_seed != dev && !ndns->claim) |
| 1046 | nd_device_unregister(dev, ND_ASYNC); | 1049 | nd_device_unregister(dev, ND_ASYNC); |
| 1047 | 1050 | ||
| 1048 | return rc; | 1051 | return rc; |
diff --git a/drivers/nvdimm/pfn_devs.c b/drivers/nvdimm/pfn_devs.c index a2ac9e641aa9..6c033c9a2f06 100644 --- a/drivers/nvdimm/pfn_devs.c +++ b/drivers/nvdimm/pfn_devs.c | |||
| @@ -627,15 +627,12 @@ static int nd_pfn_init(struct nd_pfn *nd_pfn) | |||
| 627 | size = resource_size(&nsio->res); | 627 | size = resource_size(&nsio->res); |
| 628 | npfns = (size - start_pad - end_trunc - SZ_8K) / SZ_4K; | 628 | npfns = (size - start_pad - end_trunc - SZ_8K) / SZ_4K; |
| 629 | if (nd_pfn->mode == PFN_MODE_PMEM) { | 629 | if (nd_pfn->mode == PFN_MODE_PMEM) { |
| 630 | unsigned long memmap_size; | ||
| 631 | |||
| 632 | /* | 630 | /* |
| 633 | * vmemmap_populate_hugepages() allocates the memmap array in | 631 | * vmemmap_populate_hugepages() allocates the memmap array in |
| 634 | * HPAGE_SIZE chunks. | 632 | * HPAGE_SIZE chunks. |
| 635 | */ | 633 | */ |
| 636 | memmap_size = ALIGN(64 * npfns, HPAGE_SIZE); | 634 | offset = ALIGN(start + SZ_8K + 64 * npfns + dax_label_reserve, |
| 637 | offset = ALIGN(start + SZ_8K + memmap_size + dax_label_reserve, | 635 | max(nd_pfn->align, HPAGE_SIZE)) - start; |
| 638 | nd_pfn->align) - start; | ||
| 639 | } else if (nd_pfn->mode == PFN_MODE_RAM) | 636 | } else if (nd_pfn->mode == PFN_MODE_RAM) |
| 640 | offset = ALIGN(start + SZ_8K + dax_label_reserve, | 637 | offset = ALIGN(start + SZ_8K + dax_label_reserve, |
| 641 | nd_pfn->align) - start; | 638 | nd_pfn->align) - start; |
