summaryrefslogtreecommitdiffstats
path: root/updater/blockimg.c
diff options
context:
space:
mode:
authorSami Tolvanen <samitolvanen@google.com>2015-06-10 17:52:04 +0200
committerThe Android Automerger <android-build@google.com>2015-06-10 18:54:41 +0200
commit0460f697a18fa2ea2b98380e663b7d33d9cbdb00 (patch)
treea626f37dc489f48f4d0d5b6c251e0884f53bf1a3 /updater/blockimg.c
parentZero blocks before BLKDISCARD (diff)
downloadandroid_bootable_recovery-0460f697a18fa2ea2b98380e663b7d33d9cbdb00.tar
android_bootable_recovery-0460f697a18fa2ea2b98380e663b7d33d9cbdb00.tar.gz
android_bootable_recovery-0460f697a18fa2ea2b98380e663b7d33d9cbdb00.tar.bz2
android_bootable_recovery-0460f697a18fa2ea2b98380e663b7d33d9cbdb00.tar.lz
android_bootable_recovery-0460f697a18fa2ea2b98380e663b7d33d9cbdb00.tar.xz
android_bootable_recovery-0460f697a18fa2ea2b98380e663b7d33d9cbdb00.tar.zst
android_bootable_recovery-0460f697a18fa2ea2b98380e663b7d33d9cbdb00.zip
Diffstat (limited to 'updater/blockimg.c')
-rw-r--r--updater/blockimg.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/updater/blockimg.c b/updater/blockimg.c
index a2786c832..7b8721dbf 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
@@ -1217,7 +1222,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;
}
@@ -1403,10 +1409,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) {