a code question on raid5.c

From
Ming Lei <hidden>
Date
2012-11-15 19:14:44
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.
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help