From 98a658bb5457e5527911b78be8d4bc6de092198e Mon Sep 17 00:00:00 2001 From: Connor O'Brien Date: Tue, 24 Jan 2017 17:31:14 -0800 Subject: Use flash erase & logical block size for userdata wipe If flash erase and logical block size are available, then pass them to libext4_utils when rebuilding userdata. Test: Factory reset marlin in recovery, confirmed params passed correctly Bug: 33243520 Change-Id: I6bed976a73e7a64a80eaac50f48fbacb6d812517 Signed-off-by: Connor O'Brien --- roots.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/roots.cpp b/roots.cpp index 14018fcdc..376fcbd1b 100644 --- a/roots.cpp +++ b/roots.cpp @@ -215,7 +215,12 @@ int format_volume(const char* volume, const char* directory) { } int result; if (strcmp(v->fs_type, "ext4") == 0) { - result = make_ext4fs_directory(v->blk_device, length, volume, sehandle, directory); + if (v->erase_blk_size != 0 && v->logical_blk_size != 0) { + result = make_ext4fs_directory_align(v->blk_device, length, volume, sehandle, + directory, v->erase_blk_size, v->logical_blk_size); + } else { + result = make_ext4fs_directory(v->blk_device, length, volume, sehandle, directory); + } } else { /* Has to be f2fs because we checked earlier. */ if (v->key_loc != NULL && strcmp(v->key_loc, "footer") == 0 && length < 0) { LOG(ERROR) << "format_volume: crypt footer + negative length (" << length -- cgit v1.2.3