• Zhao Lei's avatar
    btrfs: Fix calculate typo caused by ambiguous meaning of logic_end · a0dd59de
    Zhao Lei authored
    For example, in scrub_raid56_parity(), following lines are used
    to judge is all data processed:
     place1: if (key.objectid > logic_end) ...
     place2: if (logic_start >= logic_end) ...
     ...
     (place2 is typo, is should be ">", it is copied from other
      place, where logic_end's meaning is different, long story...)
    
    We can fix above typo directly, but the root reason is ambiguous
    meaning of logic_end in scrub raid56 parity.
    
    In other place, XXX_end is pointed to data which is not included,
    and we need to process segment of [XXX_start, XXX_end).
    
    But for scrub raid56 parity, logic_end is pointed to lattest data
    need to process, and introduced many "+ 1" and "- 1" in code as
    below:
     length = sparity->logic_end - sparity->logic_start + 1
     logic_end - logic_start + 1
     stripe_logical + increment - 1
    
    This patch changed logic_end's meaning to make it in normal understanding
    in raid56 parity functions and data struct alone with above bugfix.
    Signed-off-by: default avatarZhao Lei <zhaolei@cn.fujitsu.com>
    Signed-off-by: default avatarChris Mason <clm@fb.com>
    a0dd59de
scrub.c 111 KB