• Eugene Kosov's avatar
    MDEV-18235: Changes related to fsync() · 31d0727a
    Eugene Kosov authored
    Remove fil_node_t::sync_event.
    
    I had a discussion with kernel fellows and they said it's safe to call
    fsync() simultaneously at least on VFS and ext4. So initially I wanted
    to disable check for recent Linux but than I realized code is buggy.
    
    Consider a case when one thread is inside fsync() and two others are
    waiting inside os_event. First thread after fsync() calls os_event_set()
    which is a broadcast! So two waiting threads will awake and may call
    fsync() at the same time.
    
    One fix is to add a notify_one() functionality to os_event but I decided
    to remove incorrect check completely. Note, it works for one waiting
    thread but not for more than one.
    
    IMO it's ok to avoid existing bugs but there is not too much sense in
    avoiding possible(!) bugs as this code does.
    
    fil_space_t::is_in_rotation_list(), fil_space_t::is_in_unflushed_spaces():
    Replace redundant bool fields with member functions.
    
    fil_node_t::needs_flush: Replaces fil_node_t::modification_counter and
    fil_node_t::flush_counter. We need to know whether there _are_ some
    unflushed writes and we do not need to know _how many_ writes.
    
    fil_system_t::modification_counter: Remove as not needed.
    Even if we needed fil_node_t::modification_counter, every file
    could have its own counter that would be incremented on each write.
    
    fil_system_t::modification_counter is a global modification counter
    for all files. It was incremented on every write. But whether some
    file was flushed or not is an internal fil_node_t deal/state and
    this makes fil_system_t::modification_counter useless.
    
    Closes #1061
    31d0727a
fil0fil.cc 165 KB