From e82fa18d3db21cb770f21b1a4c4b00950120758d Mon Sep 17 00:00:00 2001 From: Sami Tolvanen Date: Wed, 10 Jun 2015 15:58:12 +0000 Subject: Revert "Zero blocks before BLKDISCARD" This reverts commit 96392b97f6bf1670d478494fb6df89a3410e53fa. Change-Id: I77acc27158bad3cd8948390a3955197646a43a31 --- updater/blockimg.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/updater/blockimg.c b/updater/blockimg.c index dfba7e420..5d0f1560c 100644 --- a/updater/blockimg.c +++ b/updater/blockimg.c @@ -39,6 +39,11 @@ #define BLOCKSIZE 4096 +// Set this to 0 to interpret 'erase' transfers to mean do a +// BLKDISCARD ioctl (the normal behavior). Set to 1 to interpret +// erase to mean fill the region with zeroes. +#define DEBUG_ERASE 0 + #ifndef BLKDISCARD #define BLKDISCARD _IO(0x12,119) #endif @@ -1278,7 +1283,8 @@ static int PerformCommandZero(CommandParameters* params) { } if (params->cmdname[0] == 'z') { - // Update only for the zero command, as the erase command will call this + // Update only for the zero command, as the erase command will call + // this if DEBUG_ERASE is defined. params->written += tgt->size; } @@ -1464,10 +1470,8 @@ static int PerformCommandErase(CommandParameters* params) { struct stat st; uint64_t blocks[2]; - // Always zero the blocks first to work around possibly flaky BLKDISCARD - // Bug: 20881595 - if (PerformCommandZero(params) != 0) { - goto pceout; + if (DEBUG_ERASE) { + return PerformCommandZero(params); } if (!params) { -- cgit v1.2.3