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
nexedi
linux
Commits
7f1b2159
Commit
7f1b2159
authored
Oct 04, 2016
by
Mike Snitzer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dm cache metadata: use cursor api in blocks_are_clean_separate_dirty()
Signed-off-by:
Mike Snitzer
<
snitzer@redhat.com
>
parent
9b696229
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
7 deletions
+26
-7
drivers/md/dm-cache-metadata.c
drivers/md/dm-cache-metadata.c
+26
-7
No files found.
drivers/md/dm-cache-metadata.c
View file @
7f1b2159
...
...
@@ -931,27 +931,46 @@ static int blocks_are_clean_separate_dirty(struct dm_cache_metadata *cmd,
bool
dirty_flag
;
*
result
=
true
;
// FIXME: use a cursor so we can benefit from preloading metadata.
r
=
dm_bitset_cursor_begin
(
&
cmd
->
dirty_info
,
cmd
->
dirty_root
,
from_cblock
(
begin
),
&
cmd
->
dirty_cursor
);
if
(
r
)
{
DMERR
(
"%s: dm_bitset_cursor_begin for dirty failed"
,
__func__
);
return
r
;
}
r
=
dm_bitset_cursor_skip
(
&
cmd
->
dirty_cursor
,
from_cblock
(
begin
));
if
(
r
)
{
DMERR
(
"%s: dm_bitset_cursor_skip for dirty failed"
,
__func__
);
dm_bitset_cursor_end
(
&
cmd
->
dirty_cursor
);
return
r
;
}
while
(
begin
!=
end
)
{
/*
* We assume that unmapped blocks have their dirty bit
* cleared.
*/
r
=
dm_bitset_test_bit
(
&
cmd
->
dirty_info
,
cmd
->
dirty_root
,
from_cblock
(
begin
),
&
cmd
->
dirty_root
,
&
dirty_flag
);
if
(
r
)
return
r
;
dirty_flag
=
dm_bitset_cursor_get_value
(
&
cmd
->
dirty_cursor
);
if
(
dirty_flag
)
{
DMERR
(
"
cache block %llu is dirty"
,
DMERR
(
"
%s: cache block %llu is dirty"
,
__func__
,
(
unsigned
long
long
)
from_cblock
(
begin
));
dm_bitset_cursor_end
(
&
cmd
->
dirty_cursor
);
*
result
=
false
;
return
0
;
}
r
=
dm_bitset_cursor_next
(
&
cmd
->
dirty_cursor
);
if
(
r
)
{
DMERR
(
"%s: dm_bitset_cursor_next for dirty failed"
,
__func__
);
dm_bitset_cursor_end
(
&
cmd
->
dirty_cursor
);
return
r
;
}
begin
=
to_cblock
(
from_cblock
(
begin
)
+
1
);
}
dm_bitset_cursor_end
(
&
cmd
->
dirty_cursor
);
return
0
;
}
...
...
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