From 9c67aa2d2b60858d3315c09eb72f1a3ffeabd3f0 Mon Sep 17 00:00:00 2001 From: Tao Bao Date: Tue, 30 Jun 2015 23:09:12 -0700 Subject: Revert "Zero blocks before BLKDISCARD" This reverts commit b65f0272c860771f2105668accd175be1ed95ae9. 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: I016e3b47313e3113f01bb4f8eb3c14856bdc35e5 (cherry picked from commit 7125f9594db027ce4313d940ce2cafac67ae8c31) --- updater/blockimg.c | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/updater/blockimg.c b/updater/blockimg.c index 0bd2559f7..a6a389507 100644 --- a/updater/blockimg.c +++ b/updater/blockimg.c @@ -1465,7 +1465,6 @@ pcdout: static int PerformCommandErase(CommandParameters* params) { char* range = NULL; int i; - int j; int rc = -1; RangeSet* tgt = NULL; struct stat st; @@ -1492,7 +1491,7 @@ static int PerformCommandErase(CommandParameters* params) { range = strtok_r(NULL, " ", ¶ms->cpos); if (range == NULL) { - fprintf(stderr, "missing target blocks for erase\n"); + fprintf(stderr, "missing target blocks for zero\n"); goto pceout; } @@ -1501,22 +1500,7 @@ static int PerformCommandErase(CommandParameters* params) { if (params->canwrite) { 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) { - // 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 blocks[0] = tgt->pos[i * 2] * (uint64_t) BLOCKSIZE; // length in bytes -- cgit v1.2.3