Revert "Zero blocks before BLKDISCARD"
This reverts commit b65f0272c8.
It slows down the update too much on some devices (e.g. increased
from 8 mins to 40 mins to take a full OTA update).
Bug: 22129621
Change-Id: I4e8d4f6734967caf4f0d19c734027f7b6c107370
This commit is contained in:
+1
-17
@@ -1404,7 +1404,6 @@ pcdout:
|
|||||||
static int PerformCommandErase(CommandParameters* params) {
|
static int PerformCommandErase(CommandParameters* params) {
|
||||||
char* range = NULL;
|
char* range = NULL;
|
||||||
int i;
|
int i;
|
||||||
int j;
|
|
||||||
int rc = -1;
|
int rc = -1;
|
||||||
RangeSet* tgt = NULL;
|
RangeSet* tgt = NULL;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
@@ -1431,7 +1430,7 @@ static int PerformCommandErase(CommandParameters* params) {
|
|||||||
range = strtok_r(NULL, " ", ¶ms->cpos);
|
range = strtok_r(NULL, " ", ¶ms->cpos);
|
||||||
|
|
||||||
if (range == NULL) {
|
if (range == NULL) {
|
||||||
fprintf(stderr, "missing target blocks for erase\n");
|
fprintf(stderr, "missing target blocks for zero\n");
|
||||||
goto pceout;
|
goto pceout;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1440,22 +1439,7 @@ static int PerformCommandErase(CommandParameters* params) {
|
|||||||
if (params->canwrite) {
|
if (params->canwrite) {
|
||||||
fprintf(stderr, " erasing %d blocks\n", tgt->size);
|
fprintf(stderr, " erasing %d blocks\n", tgt->size);
|
||||||
|
|
||||||
allocate(BLOCKSIZE, ¶ms->buffer, ¶ms->bufsize);
|
|
||||||
memset(params->buffer, 0, BLOCKSIZE);
|
|
||||||
|
|
||||||
for (i = 0; i < tgt->count; ++i) {
|
for (i = 0; i < tgt->count; ++i) {
|
||||||
// Always zero the blocks first to work around possibly flaky BLKDISCARD
|
|
||||||
// Bug: 20881595
|
|
||||||
if (!check_lseek(params->fd, (off64_t) tgt->pos[i * 2] * BLOCKSIZE, SEEK_SET)) {
|
|
||||||
goto pceout;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (j = tgt->pos[i * 2]; j < tgt->pos[i * 2 + 1]; ++j) {
|
|
||||||
if (write_all(params->fd, params->buffer, BLOCKSIZE) == -1) {
|
|
||||||
goto pceout;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// offset in bytes
|
// offset in bytes
|
||||||
blocks[0] = tgt->pos[i * 2] * (uint64_t) BLOCKSIZE;
|
blocks[0] = tgt->pos[i * 2] * (uint64_t) BLOCKSIZE;
|
||||||
// length in bytes
|
// length in bytes
|
||||||
|
|||||||
Reference in New Issue
Block a user