aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
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
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')
-rw-r--r--drivers/md/faulty.c2
-rw-r--r--drivers/md/raid1.c2
-rw-r--r--drivers/md/raid10.c6
-rw-r--r--drivers/md/raid5.c20
4 files changed, 15 insertions, 15 deletions
diff --git a/drivers/md/faulty.c b/drivers/md/faulty.c
index a7a5ab554338..4ebd0f2a75ec 100644
--- a/drivers/md/faulty.c
+++ b/drivers/md/faulty.c
@@ -173,7 +173,7 @@ static int make_request(request_queue_t *q, struct bio *bio)
173 conf_t *conf = (conf_t*)mddev->private; 173 conf_t *conf = (conf_t*)mddev->private;
174 int failit = 0; 174 int failit = 0;
175 175
176 if (bio->bi_rw & 1) { 176 if (bio_data_dir(bio) == WRITE) {
177 /* write request */ 177 /* write request */
178 if (atomic_read(&conf->counters[WriteAll])) { 178 if (atomic_read(&conf->counters[WriteAll])) {
179 /* special case - don't decrement, don't generic_make_request, 179 /* special case - don't decrement, don't generic_make_request,
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index b3c5e12f081d..b30f74be3982 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -1736,7 +1736,7 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i
1736 /* take from bio_init */ 1736 /* take from bio_init */
1737 bio->bi_next = NULL; 1737 bio->bi_next = NULL;
1738 bio->bi_flags |= 1 << BIO_UPTODATE; 1738 bio->bi_flags |= 1 << BIO_UPTODATE;
1739 bio->bi_rw = 0; 1739 bio->bi_rw = READ;
1740 bio->bi_vcnt = 0; 1740 bio->bi_vcnt = 0;
1741 bio->bi_idx = 0; 1741 bio->bi_idx = 0;
1742 bio->bi_phys_segments = 0; 1742 bio->bi_phys_segments = 0;
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 7492d6033ac6..f0141910bb8d 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -1785,7 +1785,7 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i
1785 biolist = bio; 1785 biolist = bio;
1786 bio->bi_private = r10_bio; 1786 bio->bi_private = r10_bio;
1787 bio->bi_end_io = end_sync_read; 1787 bio->bi_end_io = end_sync_read;
1788 bio->bi_rw = 0; 1788 bio->bi_rw = READ;
1789 bio->bi_sector = r10_bio->devs[j].addr + 1789 bio->bi_sector = r10_bio->devs[j].addr +
1790 conf->mirrors[d].rdev->data_offset; 1790 conf->mirrors[d].rdev->data_offset;
1791 bio->bi_bdev = conf->mirrors[d].rdev->bdev; 1791 bio->bi_bdev = conf->mirrors[d].rdev->bdev;
@@ -1801,7 +1801,7 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i
1801 biolist = bio; 1801 biolist = bio;
1802 bio->bi_private = r10_bio; 1802 bio->bi_private = r10_bio;
1803 bio->bi_end_io = end_sync_write; 1803 bio->bi_end_io = end_sync_write;
1804 bio->bi_rw = 1; 1804 bio->bi_rw = WRITE;
1805 bio->bi_sector = r10_bio->devs[k].addr + 1805 bio->bi_sector = r10_bio->devs[k].addr +
1806 conf->mirrors[i].rdev->data_offset; 1806 conf->mirrors[i].rdev->data_offset;
1807 bio->bi_bdev = conf->mirrors[i].rdev->bdev; 1807 bio->bi_bdev = conf->mirrors[i].rdev->bdev;
@@ -1870,7 +1870,7 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i
1870 biolist = bio; 1870 biolist = bio;
1871 bio->bi_private = r10_bio; 1871 bio->bi_private = r10_bio;
1872 bio->bi_end_io = end_sync_read; 1872 bio->bi_end_io = end_sync_read;
1873 bio->bi_rw = 0; 1873 bio->bi_rw = READ;
1874 bio->bi_sector = r10_bio->devs[i].addr + 1874 bio->bi_sector = r10_bio->devs[i].addr +
1875 conf->mirrors[d].rdev->data_offset; 1875 conf->mirrors[d].rdev->data_offset;
1876 bio->bi_bdev = conf->mirrors[d].rdev->bdev; 1876 bio->bi_bdev = conf->mirrors[d].rdev->bdev;
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;