Skip to content

rework bitmap_parselist

Yuri Norov lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4bitmap_parselist: don't calculate length of the input stringlib/bitmap.c+1 -40 replies
2/4bitmap_parselist: move part of logic to helperslib/bitmap.c+53 -110 replies
3/4bitmap_parselist: rework input string parserlib/bitmap.c+148 -992 replies
4/4test_bitmap: add testcases for bitmap_parselistlib/test_bitmap.c+17 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/4] rework bitmap_parselist

bitmap_parselist evolved from a pretty simple idea for long and now lacks for refactoring. It is not structured, has nested loops and a set of opaque-named variables. All this leads to extremely hard understanding of the code. Once during the optimization of it I missed a scenario which leads to kernel hangup. Tetsuo Handa spotted this and found it simpler to rewrite the code instead fixing it. (Though, that attempt had some flaws.)
https://lkml.org/lkml/2018/4/1/93

Things are more complicated than they may be because bitmap_parselist() is part of user interface, and its behavior should not change.

In this patchset __bitmap_parselist() is split to a set of smaller functions doing only one thing.

Yury Norov (4):
bitmap_parselist: don't calculate length of the input string
bitmap_parselist: move part of logic to helpers
bitmap_parselist: rework input string parser
test_bitmap: add testcases for bitmap_parselist

 lib/bitmap.c      | 294 ++++++++++++++++++++++++++++++----------------
 lib/test_bitmap.c |  18 ++-
 2 files changed, 208 insertions(+), 104 deletions(-)
Signature · 1 line
2.17.1