• Q
    btrfs: only write the sectors in the vertical stripe which has data stripes · bd8f7e62
    Qu Wenruo 提交于
    If we have only 8K partial write at the beginning of a full RAID56
    stripe, we will write the following contents:
    
                        0  8K           32K             64K
    Disk 1	(data):     |XX|            |               |
    Disk 2  (data):     |               |               |
    Disk 3  (parity):   |XXXXXXXXXXXXXXX|XXXXXXXXXXXXXXX|
    
    |X| means the sector will be written back to disk.
    
    Note that, although we won't write any sectors from disk 2, but we will
    write the full 64KiB of parity to disk.
    
    This behavior is fine for now, but not for the future (especially for
    RAID56J, as we waste quite some space to journal the unused parity
    stripes).
    
    So here we will also utilize the btrfs_raid_bio::dbitmap, anytime we
    queue a higher level bio into an rbio, we will update rbio::dbitmap to
    indicate which vertical stripes we need to writeback.
    
    And at finish_rmw(), we also check dbitmap to see if we need to write
    any sector in the vertical stripe.
    
    So after the patch, above example will only lead to the following
    writeback pattern:
    
                        0  8K           32K             64K
    Disk 1	(data):     |XX|            |               |
    Disk 2  (data):     |               |               |
    Disk 3  (parity):   |XX|            |               |
    Signed-off-by: NQu Wenruo <wqu@suse.com>
    Signed-off-by: NDavid Sterba <dsterba@suse.com>
    bd8f7e62
raid56.c 73.6 KB