Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
halo
build
Commits
db08d835
Commit
db08d835
authored
9 years ago
by
Tao Bao
Committed by
Gerrit Code Review
9 years ago
Browse files
Options
Download
Plain Diff
Merge "Fix calculation of stashed blocks."
parents
bcb9240a
21b37d83
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
tools/releasetools/blockimgdiff.py
tools/releasetools/blockimgdiff.py
+6
-2
No files found.
tools/releasetools/blockimgdiff.py
View file @
db08d835
...
...
@@ -338,8 +338,8 @@ class BlockImageDiff(object):
sid
=
next_stash_id
next_stash_id
+=
1
stashes
[
s
]
=
sid
stashed_blocks
+=
sr
.
size
()
if
self
.
version
==
2
:
stashed_blocks
+=
sr
.
size
()
out
.
append
(
"stash %d %s
\n
"
%
(
sid
,
sr
.
to_string_raw
()))
else
:
sh
=
self
.
HashBlocks
(
self
.
src
,
sr
)
...
...
@@ -347,12 +347,14 @@ class BlockImageDiff(object):
stashes
[
sh
]
+=
1
else
:
stashes
[
sh
]
=
1
stashed_blocks
+=
sr
.
size
()
out
.
append
(
"stash %s %s
\n
"
%
(
sh
,
sr
.
to_string_raw
()))
if
stashed_blocks
>
max_stashed_blocks
:
max_stashed_blocks
=
stashed_blocks
free_string
=
[]
free_size
=
0
if
self
.
version
==
1
:
src_str
=
xf
.
src_ranges
.
to_string_raw
()
if
xf
.
src_ranges
else
""
...
...
@@ -371,7 +373,6 @@ class BlockImageDiff(object):
mapped_stashes
=
[]
for
s
,
sr
in
xf
.
use_stash
:
sid
=
stashes
.
pop
(
s
)
stashed_blocks
-=
sr
.
size
()
unstashed_src_ranges
=
unstashed_src_ranges
.
subtract
(
sr
)
sh
=
self
.
HashBlocks
(
self
.
src
,
sr
)
sr
=
xf
.
src_ranges
.
map_within
(
sr
)
...
...
@@ -384,11 +385,13 @@ class BlockImageDiff(object):
# and lead to OTA failures.
# Bug: 23119955
free_string
.
append
(
"free %d
\n
"
%
(
sid
,))
free_size
+=
sr
.
size
()
else
:
assert
sh
in
stashes
src_str
.
append
(
"%s:%s"
%
(
sh
,
sr
.
to_string_raw
()))
stashes
[
sh
]
-=
1
if
stashes
[
sh
]
==
0
:
free_size
+=
sr
.
size
()
free_string
.
append
(
"free %s
\n
"
%
(
sh
))
stashes
.
pop
(
sh
)
heapq
.
heappush
(
free_stash_ids
,
sid
)
...
...
@@ -492,6 +495,7 @@ class BlockImageDiff(object):
if
free_string
:
out
.
append
(
""
.
join
(
free_string
))
stashed_blocks
-=
free_size
if
self
.
version
>=
2
and
common
.
OPTIONS
.
cache_size
is
not
None
:
# Sanity check: abort if we're going to need more stash space than
...
...
This diff is collapsed.
Click to expand it.
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