a code question on raid5.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In add_stripe_bio() there is some code as shown below:
 
    if (forwrite) {
        /* check if page is covered */
        sector_t sector = sh->dev[dd_idx].sector;
        for (bi=sh->dev[dd_idx].towrite;
             sector < sh->dev[dd_idx].sector + STRIPE_SECTORS &&
                 bi && bi->bi_sector <= sector;
             bi = r5_next_bio(bi, sh->dev[dd_idx].sector)) {
            if (bi->bi_sector + (bi->bi_size>>9) >= sector)
                sector = bi->bi_sector + (bi->bi_size>>9);
        }
        if (sector >= sh->dev[dd_idx].sector + STRIPE_SECTORS)
            set_bit(R5_OVERWRITE, &sh->dev[dd_idx].flags);
    }

Say I have 3 bio(s) that is:
1. bi->bi_sector = 654618968;
    bi->bi_size = 2*512;
2. bi->bi_sector = 654618970;
    bi->bi_size = 1*512;
3. bi->bi_sector = 654618973;
    bi->bi_size = 5*512;

I expected that the third bio could cause R5_OVERWRITE be set. But I didn't see this bit got set. What does this code really do? I thought it checks if the single 4K page can cover the bio chains targeted at this stripe cache(4K).

Thanks
M.
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux