diff options
author | Connor O'Brien <connoro@google.com> | 2017-01-05 16:53:58 -0800 |
---|---|---|
committer | Connor O'Brien <connoro@google.com> | 2017-01-10 11:33:38 -0800 |
commit | 923a928134fc09ea5f24d67cc1e78d8f70bcb4f8 (patch) | |
tree | 87fe5ad5fb2fc8cb83bcfff8ba45bf5547caaed5 | |
parent | 1a1fc822ed14eda41d306d9d3b375cf5dd63a58d (diff) | |
download | extras-923a928134fc09ea5f24d67cc1e78d8f70bcb4f8.tar.gz |
Pass stripe_width and stride parameters to mke2fs
If available, use flash erase & logical block sizes to tune stride
and stripe parameters to mke2fs.
Test: Built & flashed userdata; checked stride & stripe values
Bug: 33243520
Change-Id: I07319a0bc3d3418b1f4e74e61b10e02dc78fb4db
Signed-off-by: Connor O'Brien <connoro@google.com>
-rwxr-xr-x | ext4_utils/mkuserimg_mke2fs.sh | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/ext4_utils/mkuserimg_mke2fs.sh b/ext4_utils/mkuserimg_mke2fs.sh index f8aef217..8dbbcb54 100755 --- a/ext4_utils/mkuserimg_mke2fs.sh +++ b/ext4_utils/mkuserimg_mke2fs.sh @@ -8,15 +8,18 @@ Usage: mkuserimg.sh [-s] SRC_DIR OUTPUT_FILE EXT_VARIANT MOUNT_POINT SIZE [-j <journal_size>] [-T TIMESTAMP] [-C FS_CONFIG] [-D PRODUCT_OUT] [-B BLOCK_LIST_FILE] [-d BASE_ALLOC_FILE_IN ] [-A BASE_ALLOC_FILE_OUT ] [-L LABEL] - [ -i INODES ] [FILE_CONTEXTS] + [-i INODES ] [-e ERASE_BLOCK_SIZE] [-o FLASH_BLOCK_SIZE] [FILE_CONTEXTS] EOT } +BLOCKSIZE=4096 + MKE2FS_OPTS="" +MKE2FS_EXTENDED_OPTS="" E2FSDROID_OPTS="" if [ "$1" = "-s" ]; then - MKE2FS_OPTS+="-E android_sparse" + MKE2FS_EXTENDED_OPTS+="android_sparse" shift else E2FSDROID_OPTS+="-e" @@ -88,6 +91,27 @@ if [[ "$1" == "-i" ]]; then shift; shift fi +if [[ "$1" == "-e" ]]; then + if [[ MKE2FS_EXTENDED_OPTS ]]; then + MKE2FS_EXTENDED_OPTS+="," + fi + MKE2FS_EXTENDED_OPTS+="stripe_width=$(($2/BLOCKSIZE))" + shift; shift +fi + +if [[ "$1" == "-o" ]]; then + if [[ MKE2FS_EXTENDED_OPTS ]]; then + MKE2FS_EXTENDED_OPTS+="," + fi + # stride should be the max of 8kb and the logical block size + MKE2FS_EXTENDED_OPTS+="stride=$((($2 > 8192 ? $2 : 8192) / BLOCKSIZE))" + shift; shift +fi + +if [[ MKE2FS_EXTENDED_OPTS ]]; then + MKE2FS_OPTS+=" -E $MKE2FS_EXTENDED_OPTS" +fi + E2FSDROID_OPTS+=" -S $1" case $EXT_VARIANT in @@ -109,7 +133,6 @@ if [ -z $SIZE ]; then exit 2 fi -BLOCKSIZE=4096 # Round down the filesystem length to be a multiple of the block size SIZE=$((SIZE / BLOCKSIZE)) |