diff options
author | Kent Overstreet <koverstreet@google.com> | 2012-09-25 18:05:12 -0400 |
---|---|---|
committer | Kent Overstreet <koverstreet@google.com> | 2013-03-23 17:15:29 -0400 |
commit | f73a1c7d117d07a96d89475066188a2b79e53c48 (patch) | |
tree | b2343926df6cf7877ee398ba485a962148b67804 /drivers/md/raid5.c | |
parent | fb9e3534768c1daa0bd09dd00d1a8828e15079c8 (diff) |
block: Add bio_end_sector()
Just a little convenience macro - main reason to add it now is preparing
for immutable bio vecs, it'll reduce the size of the patch that puts
bi_sector/bi_size/bi_idx into a struct bvec_iter.
Signed-off-by: Kent Overstreet <koverstreet@google.com>
CC: Jens Axboe <axboe@kernel.dk>
CC: Lars Ellenberg <drbd-dev@lists.linbit.com>
CC: Jiri Kosina <jkosina@suse.cz>
CC: Alasdair Kergon <agk@redhat.com>
CC: dm-devel@redhat.com
CC: Neil Brown <neilb@suse.de>
CC: Martin Schwidefsky <schwidefsky@de.ibm.com>
CC: Heiko Carstens <heiko.carstens@de.ibm.com>
CC: linux-s390@vger.kernel.org
CC: Chris Mason <chris.mason@fusionio.com>
CC: Steven Whitehouse <swhiteho@redhat.com>
Acked-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'drivers/md/raid5.c')
-rw-r--r-- | drivers/md/raid5.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 3ee2912889e7..68706970d217 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -2384,11 +2384,11 @@ static int add_stripe_bio(struct stripe_head *sh, struct bio *bi, int dd_idx, in | |||
2384 | } else | 2384 | } else |
2385 | bip = &sh->dev[dd_idx].toread; | 2385 | bip = &sh->dev[dd_idx].toread; |
2386 | while (*bip && (*bip)->bi_sector < bi->bi_sector) { | 2386 | while (*bip && (*bip)->bi_sector < bi->bi_sector) { |
2387 | if ((*bip)->bi_sector + ((*bip)->bi_size >> 9) > bi->bi_sector) | 2387 | if (bio_end_sector(*bip) > bi->bi_sector) |
2388 | goto overlap; | 2388 | goto overlap; |
2389 | bip = & (*bip)->bi_next; | 2389 | bip = & (*bip)->bi_next; |
2390 | } | 2390 | } |
2391 | if (*bip && (*bip)->bi_sector < bi->bi_sector + ((bi->bi_size)>>9)) | 2391 | if (*bip && (*bip)->bi_sector < bio_end_sector(bi)) |
2392 | goto overlap; | 2392 | goto overlap; |
2393 | 2393 | ||
2394 | BUG_ON(*bip && bi->bi_next && (*bip) != bi->bi_next); | 2394 | BUG_ON(*bip && bi->bi_next && (*bip) != bi->bi_next); |
@@ -2404,8 +2404,8 @@ static int add_stripe_bio(struct stripe_head *sh, struct bio *bi, int dd_idx, in | |||
2404 | sector < sh->dev[dd_idx].sector + STRIPE_SECTORS && | 2404 | sector < sh->dev[dd_idx].sector + STRIPE_SECTORS && |
2405 | bi && bi->bi_sector <= sector; | 2405 | bi && bi->bi_sector <= sector; |
2406 | bi = r5_next_bio(bi, sh->dev[dd_idx].sector)) { | 2406 | bi = r5_next_bio(bi, sh->dev[dd_idx].sector)) { |
2407 | if (bi->bi_sector + (bi->bi_size>>9) >= sector) | 2407 | if (bio_end_sector(bi) >= sector) |
2408 | sector = bi->bi_sector + (bi->bi_size>>9); | 2408 | sector = bio_end_sector(bi); |
2409 | } | 2409 | } |
2410 | if (sector >= sh->dev[dd_idx].sector + STRIPE_SECTORS) | 2410 | if (sector >= sh->dev[dd_idx].sector + STRIPE_SECTORS) |
2411 | set_bit(R5_OVERWRITE, &sh->dev[dd_idx].flags); | 2411 | set_bit(R5_OVERWRITE, &sh->dev[dd_idx].flags); |
@@ -3941,7 +3941,7 @@ static int chunk_aligned_read(struct mddev *mddev, struct bio * raid_bio) | |||
3941 | 0, | 3941 | 0, |
3942 | &dd_idx, NULL); | 3942 | &dd_idx, NULL); |
3943 | 3943 | ||
3944 | end_sector = align_bi->bi_sector + (align_bi->bi_size >> 9); | 3944 | end_sector = bio_end_sector(align_bi); |
3945 | rcu_read_lock(); | 3945 | rcu_read_lock(); |
3946 | rdev = rcu_dereference(conf->disks[dd_idx].replacement); | 3946 | rdev = rcu_dereference(conf->disks[dd_idx].replacement); |
3947 | if (!rdev || test_bit(Faulty, &rdev->flags) || | 3947 | if (!rdev || test_bit(Faulty, &rdev->flags) || |
@@ -4216,7 +4216,7 @@ static void make_request(struct mddev *mddev, struct bio * bi) | |||
4216 | } | 4216 | } |
4217 | 4217 | ||
4218 | logical_sector = bi->bi_sector & ~((sector_t)STRIPE_SECTORS-1); | 4218 | logical_sector = bi->bi_sector & ~((sector_t)STRIPE_SECTORS-1); |
4219 | last_sector = bi->bi_sector + (bi->bi_size>>9); | 4219 | last_sector = bio_end_sector(bi); |
4220 | bi->bi_next = NULL; | 4220 | bi->bi_next = NULL; |
4221 | bi->bi_phys_segments = 1; /* over-loaded to count active stripes */ | 4221 | bi->bi_phys_segments = 1; /* over-loaded to count active stripes */ |
4222 | 4222 | ||
@@ -4679,7 +4679,7 @@ static int retry_aligned_read(struct r5conf *conf, struct bio *raid_bio) | |||
4679 | logical_sector = raid_bio->bi_sector & ~((sector_t)STRIPE_SECTORS-1); | 4679 | logical_sector = raid_bio->bi_sector & ~((sector_t)STRIPE_SECTORS-1); |
4680 | sector = raid5_compute_sector(conf, logical_sector, | 4680 | sector = raid5_compute_sector(conf, logical_sector, |
4681 | 0, &dd_idx, NULL); | 4681 | 0, &dd_idx, NULL); |
4682 | last_sector = raid_bio->bi_sector + (raid_bio->bi_size>>9); | 4682 | last_sector = bio_end_sector(raid_bio); |
4683 | 4683 | ||
4684 | for (; logical_sector < last_sector; | 4684 | for (; logical_sector < last_sector; |
4685 | logical_sector += STRIPE_SECTORS, | 4685 | logical_sector += STRIPE_SECTORS, |