• Andrew Morton's avatar
    [PATCH] md: merge_bvec_fn needs to know about partitions. · 00d1b0e9
    Andrew Morton authored
    From: Neil Brown <neilb@cse.unsw.edu.au>
    
    Addresses http://bugme.osdl.org/show_bug.cgi?id=2355
    
    It seems that a merge_bvec_fn needs to be aware of partitioning...  who
    would have thought it :-(
    
    The following patch should fix the merge_bvec_fn for both linear and raid0.
    We teach linear and raid0 about partitions in the merge_bvec_fn.
    
    ->merge_bvec_fn needs to make decisions based on the physical geometry of the
    device.  For raid0, it needs to decide if adding the bvec to the bio will
    make the bio span two drives.
    
    To do this, it needs to know where the request is (what the sector number is)
    in the whole device.
    
    However when called from bio_add_page, bi_sector is the sector number
    relative to the current partition, as generic_make_request hasn't been called
    yet.
    
    So raid_mergeable_bvec needs to map bio->bi_sector (which is partition
    relative) to a bi_sector which is device relative, so it can perform proper
    calculations about when chunk boundaries are.
    00d1b0e9
raid0.c 13.2 KB