• Chris Mason's avatar
    Btrfs: Optimize compressed writeback and reads · 771ed689
    Chris Mason authored
    When reading compressed extents, try to put pages into the page cache
    for any pages covered by the compressed extent that readpages didn't already
    Add an async work queue to handle transformations at delayed allocation processing
    time.  Right now this is just compression.  The workflow is:
    1) Find offsets in the file marked for delayed allocation
    2) Lock the pages
    3) Lock the state bits
    4) Call the async delalloc code
    The async delalloc code clears the state lock bits and delalloc bits.  It is
    important this happens before the range goes into the work queue because
    otherwise it might deadlock with other work queue items that try to lock
    those extent bits.
    The file pages are compressed, and if the compression doesn't work the
    pages are written back directly.
    An ordered work queue is used to make sure the inodes are written in the same
    order that pdflush or writepages sent them down.
    This changes extent_write_cache_pages to let the writepage function
    update the wbc nr_written count.
    Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>