diff options
author | Li Nan <linan122@huawei.com> | 2025-02-27 10:54:59 +0300 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2025-03-06 18:03:28 +0300 |
commit | 28243dcd1f49cc8be398a1396d16a45527882ce5 (patch) | |
tree | 84d65007a0437ddad90f03b23e72cb8b953de67f /tools/perf/scripts/python/flamegraph.py | |
parent | 32e9ad4d11f69949ff331e35a417871ee0d31d99 (diff) | |
download | linux-28243dcd1f49cc8be398a1396d16a45527882ce5.tar.xz |
badblocks: return error directly when setting badblocks exceeds 512
In the current handling of badblocks settings, a lot of processing has
been done for scenarios where the number of badblocks exceeds 512.
This makes the code look quite complex and also introduces some issues,
For example, if there is 512 badblocks already:
for((i=0; i<510; i++)); do ((sector=i*2)); echo "$sector 1" > bad_blocks; done
echo 2100 10 > bad_blocks
echo 2200 10 > bad_blocks
Set new one, exceed 512:
echo 2000 500 > bad_blocks
Expected:
2000 500
Actual:
2100 400
In fact, a disk shouldn't have too many badblocks, and for disks with
512 badblocks, attempting to set more bad blocks doesn't make much sense.
At that point, the more appropriate action would be to replace the disk.
Therefore, to resolve these issues and simplify the code somewhat, return
error directly when setting badblocks exceeds 512.
Fixes: aa511ff8218b ("badblocks: switch to the improved badblock handling code")
Signed-off-by: Li Nan <linan122@huawei.com>
Reviewed-by: Yu Kuai <yukuai3@huawei.com>
Link: https://lore.kernel.org/r/20250227075507.151331-5-zhengqixing@huaweicloud.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'tools/perf/scripts/python/flamegraph.py')
0 files changed, 0 insertions, 0 deletions