• Kirill Smelkov's avatar
    bigfile/virtmem: Introduce "mmap overlay" mode · fae045cc
    Kirill Smelkov authored
    with the intention to later use WCFS through it.
    
    Before this patch virtmem had only one mode: a BigFile backend was
    providing loadblk and storeblk methods, and on every block access
    loadblk was called to load block data into allocated RAM page.
    
    However with WCFS virtmem won't be needed to do anything to load data -
    because loading from head/bigfile/f mmaped through OS will be handled by
    OS directly. Thus for wcfs, that leaves virtmem only to handle dirtying
    and writeout.
    
    -> Introduce "mmap overlay" mode into virtmem to handle WCFS-like
    BigFile backends - that can provide read-only base layer suitable for
    mmapping.
    
    This patch is organized as follows:
    
    - fileh_open is added flags argument to indicate which mode to use for
      opened fileh. BigFileH is added .mmap_overlay bitfield correspondingly.
      (virtmem.h)
    
    - struct bigfile_ops is extended with 3 optional methods that a BigFile
      backend might provide to support mmap-overlay mode:
    
      * mmap_setup_read,
      ...
    fae045cc