Skip to content
  • Mike Hibler's avatar
    Add client '-f' option for using O_DIRECT open mode for the output device. · 46a62612
    Mike Hibler authored
    On Linux, device IO goes through the buffer cache by default. This makes
    frisbee run really fast...until it closes the output device. Then it sits
    for minutes while it flushes disk data out of the cache. This is
    technically okay, but wasteful, since frisbee allocates its own memory
    for caching disk write data. By using direct IO on the output device,
    writes do not go through the cache.
    
    Aren't two caches better than one? No. They can compete for memory and it
    just causes an extra data copy. Frisbee is faster when using O_DIRECT.
    
    Note that this change is complicated somewhat because Linux requires that
    the IO buffer for an O_DIRECT opened file be sector aligned. So we play
    some games to do this.
    
    This should have no effect on FreeBSD where device writes don't go through
    the buffer cache.
    46a62612