• Kirill Smelkov's avatar
    bigfile/virtmem: Client API to invalidate a fileh page · cb779c7b
    Kirill Smelkov authored
    FileH is a handle representing snapshot of a file. If, for a pgoffset,
    fileh already has loaded page, but we know the content of the file has
    changed externally after loading has been done, we need to propagate to
    fileh that such-and-such page should be invalidated (and reloaded on
    next access).
    
    This patch introduces
    
        fileh_invalidate_page(fileh, pgoffset)
    
    to do just that.
    
    In the next patch we'll use this facility to propagate invalidations of
    ZBlk ZODB objects to virtmem subsystem.
    
    NOTE
    
    Since invalidation removes "dirtiness" from a page state, several
    subsequent invalidations can make a fileh completely non-dirty
    (invalidating all dirty page). Previously fileh->dirty was just a one
    bit, so we needed to improve how we track dirtiness.
    
    One way would be to have a dirty list for fileh pages and operate on
    that. This has advantage to even optimize dirty pages processing like
    fileh_dirty_writeout() where we currently scan through all fileh pages
    just to write only PAGE_DIRTY ones.
    
    Another simpler way is to make fileh->dirty a counter and maintain that.
    
    Since we are going to move virtmem subsystem back into the kernel, here,
    a simpler less-intrusive approach is used.
    cb779c7b
test_virtmem.c 35.3 KB