Skip to content

Commit 7594558

Browse files
jagalacticweiny2
authored andcommitted
dax: Save the kva from memremap
Save the kva from memremap because we need it for iomap rw support. Prior to famfs, there were no iomap users of /dev/dax - so the virtual address from memremap was not needed. Reviewed-by: Ira Weiny <[email protected]> Reviewed-by: Dave Jiang <[email protected]> Reviewed-by: Jonathan Cameron <[email protected]> Signed-off-by: John Groves <[email protected]> Link: https://patch.msgid.link/0100019d311d1d08-dd372cb9-5934-43b8-bef8-089660d04a81-000000@email.amazonses.com Signed-off-by: Ira Weiny <[email protected]>
1 parent d5406bd commit 7594558

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

drivers/dax/dax-private.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ struct dev_dax_range {
6969
* data while the device is activated in the driver.
7070
* @region: parent region
7171
* @dax_dev: core dax functionality
72+
* @virt_addr: kva from memremap; used by fsdev_dax
7273
* @align: alignment of this instance
7374
* @target_node: effective numa node if dev_dax memory range is onlined
7475
* @dyn_id: is this a dynamic or statically created instance
@@ -83,6 +84,7 @@ struct dev_dax_range {
8384
struct dev_dax {
8485
struct dax_region *region;
8586
struct dax_device *dax_dev;
87+
void *virt_addr;
8688
unsigned int align;
8789
int target_node;
8890
bool dyn_id;

drivers/dax/fsdev.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ static int fsdev_dax_probe(struct dev_dax *dev_dax)
121121
struct device *dev = &dev_dax->dev;
122122
struct dev_pagemap *pgmap;
123123
struct inode *inode;
124+
u64 data_offset = 0;
124125
struct cdev *cdev;
125126
void *addr;
126127
int rc, i;
@@ -196,14 +197,14 @@ static int fsdev_dax_probe(struct dev_dax *dev_dax)
196197
if (pgmap->range.start != dev_dax->ranges[0].range.start) {
197198
u64 phys = dev_dax->ranges[0].range.start;
198199
u64 pgmap_phys = dev_dax->pgmap[0].range.start;
199-
u64 data_offset = 0;
200200

201201
if (!WARN_ON(pgmap_phys > phys))
202202
data_offset = phys - pgmap_phys;
203203

204204
pr_debug("%s: offset detected phys=%llx pgmap_phys=%llx offset=%llx\n",
205205
__func__, phys, pgmap_phys, data_offset);
206206
}
207+
dev_dax->virt_addr = addr + data_offset;
207208

208209
inode = dax_inode(dax_dev);
209210
cdev = inode->i_cdev;

0 commit comments

Comments
 (0)