Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
127c3d2e
Commit
127c3d2e
authored
Dec 24, 2020
by
Dan Williams
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'for-5.11/dax' into for-5.11/libnvdimm
Pull in miscellaneous device-dax fixups and cleanups for v5.11.
parents
4c467647
ff8da37d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
45 deletions
+29
-45
drivers/dax/bus.c
drivers/dax/bus.c
+27
-44
drivers/dax/pmem/core.c
drivers/dax/pmem/core.c
+1
-1
drivers/dax/super.c
drivers/dax/super.c
+1
-0
No files found.
drivers/dax/bus.c
View file @
127c3d2e
...
...
@@ -367,19 +367,28 @@ void kill_dev_dax(struct dev_dax *dev_dax)
}
EXPORT_SYMBOL_GPL
(
kill_dev_dax
);
static
void
free_dev_dax_ranges
(
struct
dev_dax
*
dev_dax
)
static
void
trim_dev_dax_range
(
struct
dev_dax
*
dev_dax
)
{
int
i
=
dev_dax
->
nr_range
-
1
;
struct
range
*
range
=
&
dev_dax
->
ranges
[
i
].
range
;
struct
dax_region
*
dax_region
=
dev_dax
->
region
;
int
i
;
device_lock_assert
(
dax_region
->
dev
);
for
(
i
=
0
;
i
<
dev_dax
->
nr_range
;
i
++
)
{
struct
range
*
range
=
&
dev_dax
->
ranges
[
i
].
range
;
__release_region
(
&
dax_region
->
res
,
range
->
start
,
range_len
(
range
));
dev_dbg
(
&
dev_dax
->
dev
,
"delete range[%d]: %#llx:%#llx
\n
"
,
i
,
(
unsigned
long
long
)
range
->
start
,
(
unsigned
long
long
)
range
->
end
);
__release_region
(
&
dax_region
->
res
,
range
->
start
,
range_len
(
range
));
if
(
--
dev_dax
->
nr_range
==
0
)
{
kfree
(
dev_dax
->
ranges
);
dev_dax
->
ranges
=
NULL
;
}
dev_dax
->
nr_range
=
0
;
}
static
void
free_dev_dax_ranges
(
struct
dev_dax
*
dev_dax
)
{
while
(
dev_dax
->
nr_range
)
trim_dev_dax_range
(
dev_dax
);
}
static
void
unregister_dev_dax
(
void
*
dev
)
...
...
@@ -763,22 +772,14 @@ static int alloc_dev_dax_range(struct dev_dax *dev_dax, u64 start,
return
0
;
}
ranges
=
krealloc
(
dev_dax
->
ranges
,
sizeof
(
*
ranges
)
*
(
dev_dax
->
nr_range
+
1
),
GFP_KERNEL
);
if
(
!
ranges
)
alloc
=
__request_region
(
res
,
start
,
size
,
dev_name
(
dev
),
0
);
if
(
!
alloc
)
return
-
ENOMEM
;
alloc
=
__request_region
(
res
,
start
,
size
,
dev_name
(
dev
),
0
);
if
(
!
alloc
)
{
/*
* If this was an empty set of ranges nothing else
* will release @ranges, so do it now.
*/
if
(
!
dev_dax
->
nr_range
)
{
kfree
(
ranges
);
ranges
=
NULL
;
}
dev_dax
->
ranges
=
ranges
;
ranges
=
krealloc
(
dev_dax
->
ranges
,
sizeof
(
*
ranges
)
*
(
dev_dax
->
nr_range
+
1
),
GFP_KERNEL
);
if
(
!
ranges
)
{
__release_region
(
res
,
alloc
->
start
,
resource_size
(
alloc
));
return
-
ENOMEM
;
}
...
...
@@ -804,15 +805,10 @@ static int alloc_dev_dax_range(struct dev_dax *dev_dax, u64 start,
return
0
;
rc
=
devm_register_dax_mapping
(
dev_dax
,
dev_dax
->
nr_range
-
1
);
if
(
rc
)
{
dev_dbg
(
dev
,
"delete range[%d]: %pa:%pa
\n
"
,
dev_dax
->
nr_range
-
1
,
&
alloc
->
start
,
&
alloc
->
end
);
dev_dax
->
nr_range
--
;
__release_region
(
res
,
alloc
->
start
,
resource_size
(
alloc
));
return
rc
;
}
if
(
rc
)
trim_dev_dax_range
(
dev_dax
);
return
0
;
return
rc
;
}
static
int
adjust_dev_dax_range
(
struct
dev_dax
*
dev_dax
,
struct
resource
*
res
,
resource_size_t
size
)
...
...
@@ -885,12 +881,7 @@ static int dev_dax_shrink(struct dev_dax *dev_dax, resource_size_t size)
if
(
shrink
>=
range_len
(
range
))
{
devm_release_action
(
dax_region
->
dev
,
unregister_dax_mapping
,
&
mapping
->
dev
);
__release_region
(
&
dax_region
->
res
,
range
->
start
,
range_len
(
range
));
dev_dax
->
nr_range
--
;
dev_dbg
(
dev
,
"delete range[%d]: %#llx:%#llx
\n
"
,
i
,
(
unsigned
long
long
)
range
->
start
,
(
unsigned
long
long
)
range
->
end
);
trim_dev_dax_range
(
dev_dax
);
to_shrink
-=
shrink
;
if
(
!
to_shrink
)
break
;
...
...
@@ -1114,16 +1105,9 @@ static ssize_t align_show(struct device *dev,
static
ssize_t
dev_dax_validate_align
(
struct
dev_dax
*
dev_dax
)
{
resource_size_t
dev_size
=
dev_dax_size
(
dev_dax
);
struct
device
*
dev
=
&
dev_dax
->
dev
;
int
i
;
if
(
dev_size
>
0
&&
!
alloc_is_aligned
(
dev_dax
,
dev_size
))
{
dev_dbg
(
dev
,
"%s: align %u invalid for size %pa
\n
"
,
__func__
,
dev_dax
->
align
,
&
dev_size
);
return
-
EINVAL
;
}
for
(
i
=
0
;
i
<
dev_dax
->
nr_range
;
i
++
)
{
size_t
len
=
range_len
(
&
dev_dax
->
ranges
[
i
].
range
);
...
...
@@ -1274,7 +1258,6 @@ static void dev_dax_release(struct device *dev)
put_dax
(
dax_dev
);
free_dev_dax_id
(
dev_dax
);
dax_region_put
(
dax_region
);
kfree
(
dev_dax
->
ranges
);
kfree
(
dev_dax
->
pgmap
);
kfree
(
dev_dax
);
}
...
...
drivers/dax/pmem/core.c
View file @
127c3d2e
...
...
@@ -52,7 +52,7 @@ struct dev_dax *__dax_pmem_probe(struct device *dev, enum dev_dax_subsys subsys)
/* adjust the dax_region range to the start of data */
range
=
pgmap
.
range
;
range
.
start
+=
offset
,
range
.
start
+=
offset
;
dax_region
=
alloc_dax_region
(
dev
,
region_id
,
&
range
,
nd_region
->
target_node
,
le32_to_cpu
(
pfn_sb
->
align
),
IORESOURCE_DAX_STATIC
);
...
...
drivers/dax/super.c
View file @
127c3d2e
...
...
@@ -752,6 +752,7 @@ static int __init dax_core_init(void)
static
void
__exit
dax_core_exit
(
void
)
{
dax_bus_exit
();
unregister_chrdev_region
(
dax_devt
,
MINORMASK
+
1
);
ida_destroy
(
&
dax_minor_ida
);
dax_fs_exit
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment