• Qu Wenruo's avatar
    btrfs: raid56: introduce btrfs_raid_bio::stripe_sectors · eb357060
    Qu Wenruo authored
    The new member is an array of sector_ptr pointers, they will represent
    all sectors inside a full stripe (including P/Q).
    
    They co-operate with btrfs_raid_bio::stripe_pages:
    
    stripe_pages:   | Page 0, range [0, 64K)   | Page 1 ...
    stripe_sectors: |  |  | ...             |  |
                    |  |                    \- sector 15, page 0, pgoff=60K
                    |  \- sector 1, page 0, pgoff=4K
                    \---- sector 0, page 0, pfoff=0
    
    With such structure, we can represent subpage sectors without using
    extra pages.
    
    Here we introduce a new helper, index_stripe_sectors(), to update
    stripe_sectors[] to point to correct page and pgoff.
    
    So every time rbio::stripe_pages[] pointer gets updated, the new helper
    should be called.
    
    The following functions have to call the new helper:
    
    - steal_rbio()
    - alloc_rbio_pages()
    - alloc_rbio_parity_pages()
    - alloc_rbio_essential_pages()
    Signed-off-by: default avatarQu Wenruo <wqu@suse.com>
    Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    eb357060
raid56.c 68.2 KB