aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/raid5.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2006-12-13 03:34:13 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-13 12:05:48 -0500
commit802ba064c49f655d20fed563f2a4924c8256ea10 (patch)
treef705b597b2da6583239e9f028fa0d6f6ec319682 /drivers/md/raid5.c
parent011e3a9ad4891ba1b27e281e085228189c56b137 (diff)
[PATCH] md: Don't assume that READ==0 and WRITE==1 - use the names explicitly
Thanks Jens for alerting me to this. Cc: Jens Axboe <jens.axboe@oracle.com> Cc: <raziebe@gmail.com> Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/md/raid5.c')
-rw-r--r--drivers/md/raid5.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 377f8bc9b78b..be008f034ada 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -1827,16 +1827,16 @@ static void handle_stripe5(struct stripe_head *sh)
1827 struct bio *bi; 1827 struct bio *bi;
1828 mdk_rdev_t *rdev; 1828 mdk_rdev_t *rdev;
1829 if (test_and_clear_bit(R5_Wantwrite, &sh->dev[i].flags)) 1829 if (test_and_clear_bit(R5_Wantwrite, &sh->dev[i].flags))
1830 rw = 1; 1830 rw = WRITE;
1831 else if (test_and_clear_bit(R5_Wantread, &sh->dev[i].flags)) 1831 else if (test_and_clear_bit(R5_Wantread, &sh->dev[i].flags))
1832 rw = 0; 1832 rw = READ;
1833 else 1833 else
1834 continue; 1834 continue;
1835 1835
1836 bi = &sh->dev[i].req; 1836 bi = &sh->dev[i].req;
1837 1837
1838 bi->bi_rw = rw; 1838 bi->bi_rw = rw;
1839 if (rw) 1839 if (rw == WRITE)
1840 bi->bi_end_io = raid5_end_write_request; 1840 bi->bi_end_io = raid5_end_write_request;
1841 else 1841 else
1842 bi->bi_end_io = raid5_end_read_request; 1842 bi->bi_end_io = raid5_end_read_request;
@@ -1872,7 +1872,7 @@ static void handle_stripe5(struct stripe_head *sh)
1872 atomic_add(STRIPE_SECTORS, &rdev->corrected_errors); 1872 atomic_add(STRIPE_SECTORS, &rdev->corrected_errors);
1873 generic_make_request(bi); 1873 generic_make_request(bi);
1874 } else { 1874 } else {
1875 if (rw == 1) 1875 if (rw == WRITE)
1876 set_bit(STRIPE_DEGRADED, &sh->state); 1876 set_bit(STRIPE_DEGRADED, &sh->state);
1877 PRINTK("skip op %ld on disc %d for sector %llu\n", 1877 PRINTK("skip op %ld on disc %d for sector %llu\n",
1878 bi->bi_rw, i, (unsigned long long)sh->sector); 1878 bi->bi_rw, i, (unsigned long long)sh->sector);
@@ -2370,16 +2370,16 @@ static void handle_stripe6(struct stripe_head *sh, struct page *tmp_page)
2370 struct bio *bi; 2370 struct bio *bi;
2371 mdk_rdev_t *rdev; 2371 mdk_rdev_t *rdev;
2372 if (test_and_clear_bit(R5_Wantwrite, &sh->dev[i].flags)) 2372 if (test_and_clear_bit(R5_Wantwrite, &sh->dev[i].flags))
2373 rw = 1; 2373 rw = WRITE;
2374 else if (test_and_clear_bit(R5_Wantread, &sh->dev[i].flags)) 2374 else if (test_and_clear_bit(R5_Wantread, &sh->dev[i].flags))
2375 rw = 0; 2375 rw = READ;
2376 else 2376 else
2377 continue; 2377 continue;
2378 2378
2379 bi = &sh->dev[i].req; 2379 bi = &sh->dev[i].req;
2380 2380
2381 bi->bi_rw = rw; 2381 bi->bi_rw = rw;
2382 if (rw) 2382 if (rw == WRITE)
2383 bi->bi_end_io = raid5_end_write_request; 2383 bi->bi_end_io = raid5_end_write_request;
2384 else 2384 else
2385 bi->bi_end_io = raid5_end_read_request; 2385 bi->bi_end_io = raid5_end_read_request;
@@ -2415,7 +2415,7 @@ static void handle_stripe6(struct stripe_head *sh, struct page *tmp_page)
2415 atomic_add(STRIPE_SECTORS, &rdev->corrected_errors); 2415 atomic_add(STRIPE_SECTORS, &rdev->corrected_errors);
2416 generic_make_request(bi); 2416 generic_make_request(bi);
2417 } else { 2417 } else {
2418 if (rw == 1) 2418 if (rw == WRITE)
2419 set_bit(STRIPE_DEGRADED, &sh->state); 2419 set_bit(STRIPE_DEGRADED, &sh->state);
2420 PRINTK("skip op %ld on disc %d for sector %llu\n", 2420 PRINTK("skip op %ld on disc %d for sector %llu\n",
2421 bi->bi_rw, i, (unsigned long long)sh->sector); 2421 bi->bi_rw, i, (unsigned long long)sh->sector);
@@ -2567,7 +2567,7 @@ static int raid5_mergeable_bvec(request_queue_t *q, struct bio *bio, struct bio_
2567 unsigned int chunk_sectors = mddev->chunk_size >> 9; 2567 unsigned int chunk_sectors = mddev->chunk_size >> 9;
2568 unsigned int bio_sectors = bio->bi_size >> 9; 2568 unsigned int bio_sectors = bio->bi_size >> 9;
2569 2569
2570 if (bio_data_dir(bio)) 2570 if (bio_data_dir(bio) == WRITE)
2571 return biovec->bv_len; /* always allow writes to be mergeable */ 2571 return biovec->bv_len; /* always allow writes to be mergeable */
2572 2572
2573 max = (chunk_sectors - ((sector & (chunk_sectors - 1)) + bio_sectors)) << 9; 2573 max = (chunk_sectors - ((sector & (chunk_sectors - 1)) + bio_sectors)) << 9;
@@ -2751,7 +2751,7 @@ static int make_request(request_queue_t *q, struct bio * bi)
2751 disk_stat_inc(mddev->gendisk, ios[rw]); 2751 disk_stat_inc(mddev->gendisk, ios[rw]);
2752 disk_stat_add(mddev->gendisk, sectors[rw], bio_sectors(bi)); 2752 disk_stat_add(mddev->gendisk, sectors[rw], bio_sectors(bi));
2753 2753
2754 if (bio_data_dir(bi) == READ && 2754 if (rw == READ &&
2755 mddev->reshape_position == MaxSector && 2755 mddev->reshape_position == MaxSector &&
2756 chunk_aligned_read(q,bi)) 2756 chunk_aligned_read(q,bi))
2757 return 0; 2757 return 0;