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
4d020b3a
Commit
4d020b3a
authored
Jul 12, 2021
by
Mike Snitzer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dm writecache: factor out writecache_map_remap_origin()
Signed-off-by:
Mike Snitzer
<
snitzer@redhat.com
>
parent
cdd4d783
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
15 deletions
+15
-15
drivers/md/dm-writecache.c
drivers/md/dm-writecache.c
+15
-15
No files found.
drivers/md/dm-writecache.c
View file @
4d020b3a
...
@@ -1301,6 +1301,19 @@ enum wc_map_op {
...
@@ -1301,6 +1301,19 @@ enum wc_map_op {
WC_MAP_ERROR
,
WC_MAP_ERROR
,
};
};
static
enum
wc_map_op
writecache_map_remap_origin
(
struct
dm_writecache
*
wc
,
struct
bio
*
bio
,
struct
wc_entry
*
e
)
{
if
(
e
)
{
sector_t
next_boundary
=
read_original_sector
(
wc
,
e
)
-
bio
->
bi_iter
.
bi_sector
;
if
(
next_boundary
<
bio
->
bi_iter
.
bi_size
>>
SECTOR_SHIFT
)
dm_accept_partial_bio
(
bio
,
next_boundary
);
}
return
WC_MAP_REMAP_ORIGIN
;
}
static
enum
wc_map_op
writecache_map_read
(
struct
dm_writecache
*
wc
,
struct
bio
*
bio
)
static
enum
wc_map_op
writecache_map_read
(
struct
dm_writecache
*
wc
,
struct
bio
*
bio
)
{
{
enum
wc_map_op
map_op
;
enum
wc_map_op
map_op
;
...
@@ -1323,13 +1336,7 @@ static enum wc_map_op writecache_map_read(struct dm_writecache *wc, struct bio *
...
@@ -1323,13 +1336,7 @@ static enum wc_map_op writecache_map_read(struct dm_writecache *wc, struct bio *
map_op
=
WC_MAP_REMAP
;
map_op
=
WC_MAP_REMAP
;
}
}
}
else
{
}
else
{
if
(
e
)
{
map_op
=
writecache_map_remap_origin
(
wc
,
bio
,
e
);
sector_t
next_boundary
=
read_original_sector
(
wc
,
e
)
-
bio
->
bi_iter
.
bi_sector
;
if
(
next_boundary
<
bio
->
bi_iter
.
bi_size
>>
SECTOR_SHIFT
)
dm_accept_partial_bio
(
bio
,
next_boundary
);
}
map_op
=
WC_MAP_REMAP_ORIGIN
;
}
}
return
map_op
;
return
map_op
;
...
@@ -1417,14 +1424,7 @@ static enum wc_map_op writecache_map_write(struct dm_writecache *wc, struct bio
...
@@ -1417,14 +1424,7 @@ static enum wc_map_op writecache_map_write(struct dm_writecache *wc, struct bio
if
(
!
WC_MODE_PMEM
(
wc
)
&&
!
found_entry
)
{
if
(
!
WC_MODE_PMEM
(
wc
)
&&
!
found_entry
)
{
direct_write:
direct_write:
e
=
writecache_find_entry
(
wc
,
bio
->
bi_iter
.
bi_sector
,
WFE_RETURN_FOLLOWING
);
e
=
writecache_find_entry
(
wc
,
bio
->
bi_iter
.
bi_sector
,
WFE_RETURN_FOLLOWING
);
if
(
e
)
{
return
writecache_map_remap_origin
(
wc
,
bio
,
e
);
sector_t
next_boundary
=
read_original_sector
(
wc
,
e
)
-
bio
->
bi_iter
.
bi_sector
;
BUG_ON
(
!
next_boundary
);
if
(
next_boundary
<
bio
->
bi_iter
.
bi_size
>>
SECTOR_SHIFT
)
{
dm_accept_partial_bio
(
bio
,
next_boundary
);
}
}
return
WC_MAP_REMAP_ORIGIN
;
}
}
writecache_wait_on_freelist
(
wc
);
writecache_wait_on_freelist
(
wc
);
continue
;
continue
;
...
...
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