• Q
    btrfs: scrub: introduce scrub_block::pages for more efficient memory usage for subpage · f3e01e0e
    Qu Wenruo 提交于
    [BACKGROUND]
    Currently for scrub, we allocate one page for one sector, this is fine
    for PAGE_SIZE == sectorsize support, but can waste extra memory for
    subpage support.
    
    [CODE CHANGE]
    Make scrub_block contain all the pages, so if we're scrubbing an extent
    sized 64K, and our page size is also 64K, we only need to allocate one
    page.
    
    [LIFESPAN CHANGE]
    Since now scrub_sector no longer holds a page, but is using
    scrub_block::pages[] instead, we have to ensure scrub_block has a longer
    lifespan for write bio. The lifespan for read bio is already large
    enough.
    
    Now scrub_block will only be released after the write bio finished.
    
    [COMING NEXT]
    Currently we only added scrub_block::pages[] for this purpose, but
    scrub_sector is still utilizing the old scrub_sector::page.
    
    The switch will happen in the next patch.
    Signed-off-by: NQu Wenruo <wqu@suse.com>
    Signed-off-by: NDavid Sterba <dsterba@suse.com>
    f3e01e0e
scrub.c 122.3 KB