• Nils Goroll's avatar
    Correct stack regionlist size used during fellow_log_entries_prep() · 20d8a157
    Nils Goroll authored
    First and foremost, fellow_log_prep_max_regions was defined wrong:
    
    Except in fellow_cache_test, we call log submission with a maximum of
    FELLOW_DISK_LOG_BLOCK_ENTRIES = 56 DLEs. The intention of the
    fellow_log_prep_max_regions was was to allocate space to track return
    of the maximum number of regions possibly contained. The exact maximum
    would be (FELLOW_DISK_LOG_BLOCK_ENTRIES - 1) * DLE_REG_NREGION + 1 =
    (55 * 4) + 1 = 221, which is higher than FELLOW_DISK_LOG_BLOCK_ENTRIES
    * DLE_BAN_REG_NREGION = 56 * 3 = 168.
    
    Yet it seems prudent to not reply on any fixed maximum, and also our
    test cases call for a higher value, so we now define the maximum three
    times the actually used value, and also ensure that we batch the code
    to this size.
    
    In addition, one assertion in fellow_log_entries_prep() was wrong (it
    compared a number of DLEs with a number of regions).
    
    We also tighten some assertions to help future analysis of possible
    issues in this area:
    
    - Ensure that the data path via fellow_log_entries_prep() only ever
      uses a region list on the stack.
    
    - By using the regionlist_onlystk_add() macro, ensure that we hit an
      assertion on the array on stack, rather than one on the regionlist
      pointer.
    
    Diff best viewed with -b
    
    Fixes #18
    20d8a157
fellow_regionlist.h 7.52 KB