]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] Fix Raid5/6 above 2 Terabytes
authorAndrew Morton <akpm@osdl.org>
Mon, 12 Apr 2004 08:01:30 +0000 (01:01 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Mon, 12 Apr 2004 08:01:30 +0000 (01:01 -0700)
From: Evan Felix <evan.felix@pnl.gov>

Here is a patch that fixes a major issue in the raid5/6 code.  It seems
that the code:

logical_sector = bi->bi_sector & ~(STRIPE_SECTORS-1);
(sector_t)     = (sector_t)    & (constant)

that the right side of the & does not get extended correctly when the
constant is promoted to the sector_t type.  I have CONFIG_LBD turned on so
sector_t should be 64bits wide.  This fails to properly mask the value of
4294967296 (2TB/512) to 4294967296.  in my case it was coming out 0.  this
cause the loop following this code to read from 0 to 4294967296 blocks so
it could write one character.

As you might imagine this makes a format of a 3.5TB filesystem take a very
long time.

drivers/md/raid5.c
drivers/md/raid6main.c

index 05087b8ae0568ea3860724d7935fdcd02e83c479..a88c56a94297dc5b984d5f195c12501e402aa663 100644 (file)
@@ -1358,9 +1358,8 @@ static int make_request (request_queue_t *q, struct bio * bi)
                disk_stat_add(mddev->gendisk, read_sectors, bio_sectors(bi));
        }
 
-       logical_sector = bi->bi_sector & ~(STRIPE_SECTORS-1);
+       logical_sector = bi->bi_sector & ~((sector_t)STRIPE_SECTORS-1);
        last_sector = bi->bi_sector + (bi->bi_size>>9);
-
        bi->bi_next = NULL;
        bi->bi_phys_segments = 1;       /* over-loaded to count active stripes */
        if ( bio_data_dir(bi) == WRITE )
index 99d08d67342fbd5127912f63401a814da8706a4a..3055f2d31abcc1046388036d417f7d60cba156ae 100644 (file)
@@ -1521,7 +1521,7 @@ static int make_request (request_queue_t *q, struct bio * bi)
                disk_stat_add(mddev->gendisk, read_sectors, bio_sectors(bi));
        }
 
-       logical_sector = bi->bi_sector & ~(STRIPE_SECTORS-1);
+       logical_sector = bi->bi_sector & ~((sector_t)STRIPE_SECTORS-1);
        last_sector = bi->bi_sector + (bi->bi_size>>9);
 
        bi->bi_next = NULL;