Re: Re: fr1-2.16 patch for 2.6.10 kernel

"Peter T. Breuer" <[email protected]>
Newsgroups gmane.linux.enbd.general
Message-ID <[email protected]>
"Also sprach Peter T. Breuer:"
> > I put a printk here, and it is never hit...
> 
> It WILL be hit every time one enters this routine . Are you saying that 
>  r1_bio->nonoperational > 0?

OK - this is the explanation ...

First of all, the code in raid_end_bio_io (that could clear some bitmap
bits) IS run. But it's responsible for finishing off writes originating
from elsewhere, not resync writes from within the driver. 

It really does work. Her's an "echo hi" with both disks in the mirror:

  raid1: end_bio_io type 0 with nonop count 0, block 0 size 4KB
  raid1: mark bitmap block 0 size 4KB
  raid1: end_bio_io type 1 with nonop count 0, block 0 size 4KB
  raid1: clear bitmap block 0 size 4KB

(it's a read first to pad the block, then a write).

Now faulting one disk and repeating:

  raid1: end_bio_io type 0 with nonop count 0, block 0 size 4KB
  raid1: mark bitmap block 0 size 4KB
  raid1: end_bio_io type 1 with nonop count 1, block 0 size 4KB

(the nonoperational disks count is always zero for the read) And one can
see that the write occurs, and that the bitmap is alays marked
beforehand. If there is a disk faulted, the nonop count is > 0,

During resync, requests are finsihed and the bitmap is cleared in a
different place, in raid1_end_sync_write:

  md: using 128k window, over a total of 7936 blocks.
  md0: repair bit set on sb so retained bitmap ce382ee0
  raid1: synced dirty sectors 0-255
  raid1: end sync write clear bitmap block 0 size 64KB
  raid1: skipped clean sectors 256-15871
  md: md0: sync done.

Now, there is a problem that I saw by instrumenting this - the details
of which sectors to clear on the map seems to have been gotten at once
place from unreliable data.

#ifdef CONFIG_MD_FR1
                /* clean the bitmap after resync */
                struct bitmap * bitmap = conf->bitmap;
                if (bitmap && bitmap->active(bitmap)) {
-                       bitmap->clearbits(bitmap, r1_bio->sector >> 1,
-                               r1_bio->master_bio->bi_size >> 10);
+                       bitmap->clearbits(bitmap, r1_bio->sector >> 1,
+                               r1_bio->sectors >> 1);
                }
#endif /* CONFIG_MD_FR1 */

and that's better! There's another clearbits call too, but it seems t
be OK as is. Maybe you can check.

There as also a setbits call whse data seemed suspicious to me:

#ifdef CONFIG_MD_FR1
        /* zero the bad disk count on the r1bio by default */
        r1_bio->nonoperational = 0;
        /* mark the bitmap before write, just in case */
        if (bitmap->active(bitmap)) {
-                 bitmap->setbits(bitmap, bio->bi_sector >> 1,
-                          bio_sectors(bio) >> 1); 
+                 bitmap->setbits(bitmap, r1_bio->sector >> 1,
+                          r1_bio->sectors >> 1);
        }       
#endif /* CONFIG_MD_FR1 */

That's the only call. It's certainly alright as I have it now.


Peter
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.