Merge "fastboot: handle small flash block sizes correctly"
This commit is contained in:
commit
ebcfa44937
2 changed files with 4 additions and 3 deletions
|
|
@ -1365,9 +1365,8 @@ static unsigned fb_get_flash_block_size(Transport* transport, std::string name)
|
||||||
fprintf(stderr, "Couldn't parse %s '%s'.\n", name.c_str(), sizeString.c_str());
|
fprintf(stderr, "Couldn't parse %s '%s'.\n", name.c_str(), sizeString.c_str());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (size < 4096 || (size & (size - 1)) != 0) {
|
if ((size & (size - 1)) != 0) {
|
||||||
fprintf(stderr, "Invalid %s %u: must be a power of 2 and at least 4096.\n",
|
fprintf(stderr, "Invalid %s %u: must be a power of 2.\n", name.c_str(), size);
|
||||||
name.c_str(), size);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return size;
|
return size;
|
||||||
|
|
|
||||||
|
|
@ -119,6 +119,8 @@ static int generate_ext4_image(const char* fileName, long long partSize,
|
||||||
int raid_stripe_width = eraseBlkSize / block_size;
|
int raid_stripe_width = eraseBlkSize / block_size;
|
||||||
// stride should be the max of 8kb and logical block size
|
// stride should be the max of 8kb and logical block size
|
||||||
if (logicalBlkSize != 0 && logicalBlkSize < 8192) raid_stride = 8192 / block_size;
|
if (logicalBlkSize != 0 && logicalBlkSize < 8192) raid_stride = 8192 / block_size;
|
||||||
|
// stripe width should be >= stride
|
||||||
|
if (raid_stripe_width < raid_stride) raid_stripe_width = raid_stride;
|
||||||
ext_attr += StringPrintf(",stride=%d,stripe-width=%d", raid_stride, raid_stripe_width);
|
ext_attr += StringPrintf(",stride=%d,stripe-width=%d", raid_stride, raid_stripe_width);
|
||||||
}
|
}
|
||||||
mke2fs_args.push_back("-E");
|
mke2fs_args.push_back("-E");
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue