Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f73a1c7d authored by Kent Overstreet's avatar Kent Overstreet
Browse files

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: default avatarKent 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: default avatarSteven Whitehouse <swhiteho@redhat.com>
parent fb9e3534
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -1586,7 +1586,7 @@ static void handle_bad_sector(struct bio *bio)
	printk(KERN_INFO "%s: rw=%ld, want=%Lu, limit=%Lu\n",
	printk(KERN_INFO "%s: rw=%ld, want=%Lu, limit=%Lu\n",
			bdevname(bio->bi_bdev, b),
			bdevname(bio->bi_bdev, b),
			bio->bi_rw,
			bio->bi_rw,
			(unsigned long long)bio->bi_sector + bio_sectors(bio),
			(unsigned long long)bio_end_sector(bio),
			(long long)(i_size_read(bio->bi_bdev->bd_inode) >> 9));
			(long long)(i_size_read(bio->bi_bdev->bd_inode) >> 9));


	set_bit(BIO_EOF, &bio->bi_flags);
	set_bit(BIO_EOF, &bio->bi_flags);
+2 −5
Original line number Original line Diff line number Diff line
@@ -2270,11 +2270,8 @@ cfq_find_rq_fmerge(struct cfq_data *cfqd, struct bio *bio)
		return NULL;
		return NULL;


	cfqq = cic_to_cfqq(cic, cfq_bio_sync(bio));
	cfqq = cic_to_cfqq(cic, cfq_bio_sync(bio));
	if (cfqq) {
	if (cfqq)
		sector_t sector = bio->bi_sector + bio_sectors(bio);
		return elv_rb_find(&cfqq->sort_list, bio_end_sector(bio));

		return elv_rb_find(&cfqq->sort_list, sector);
	}


	return NULL;
	return NULL;
}
}
+1 −1
Original line number Original line Diff line number Diff line
@@ -132,7 +132,7 @@ deadline_merge(struct request_queue *q, struct request **req, struct bio *bio)
	 * check for front merge
	 * check for front merge
	 */
	 */
	if (dd->front_merges) {
	if (dd->front_merges) {
		sector_t sector = bio->bi_sector + bio_sectors(bio);
		sector_t sector = bio_end_sector(bio);


		__rq = elv_rb_find(&dd->sort_list[bio_data_dir(bio)], sector);
		__rq = elv_rb_find(&dd->sort_list[bio_data_dir(bio)], sector);
		if (__rq) {
		if (__rq) {
+1 −2
Original line number Original line Diff line number Diff line
@@ -334,8 +334,7 @@ static void brd_make_request(struct request_queue *q, struct bio *bio)
	int err = -EIO;
	int err = -EIO;


	sector = bio->bi_sector;
	sector = bio->bi_sector;
	if (sector + (bio->bi_size >> SECTOR_SHIFT) >
	if (bio_end_sector(bio) > get_capacity(bdev->bd_disk))
						get_capacity(bdev->bd_disk))
		goto out;
		goto out;


	if (unlikely(bio->bi_rw & REQ_DISCARD)) {
	if (unlikely(bio->bi_rw & REQ_DISCARD)) {
+3 −3
Original line number Original line Diff line number Diff line
@@ -901,7 +901,7 @@ static void pkt_iosched_process_queue(struct pktcdvd_device *pd)
			pd->iosched.successive_reads += bio->bi_size >> 10;
			pd->iosched.successive_reads += bio->bi_size >> 10;
		else {
		else {
			pd->iosched.successive_reads = 0;
			pd->iosched.successive_reads = 0;
			pd->iosched.last_write = bio->bi_sector + bio_sectors(bio);
			pd->iosched.last_write = bio_end_sector(bio);
		}
		}
		if (pd->iosched.successive_reads >= HI_SPEED_SWITCH) {
		if (pd->iosched.successive_reads >= HI_SPEED_SWITCH) {
			if (pd->read_speed == pd->write_speed) {
			if (pd->read_speed == pd->write_speed) {
@@ -2454,7 +2454,7 @@ static void pkt_make_request(struct request_queue *q, struct bio *bio)
	zone = ZONE(bio->bi_sector, pd);
	zone = ZONE(bio->bi_sector, pd);
	VPRINTK("pkt_make_request: start = %6llx stop = %6llx\n",
	VPRINTK("pkt_make_request: start = %6llx stop = %6llx\n",
		(unsigned long long)bio->bi_sector,
		(unsigned long long)bio->bi_sector,
		(unsigned long long)(bio->bi_sector + bio_sectors(bio)));
		(unsigned long long)bio_end_sector(bio));


	/* Check if we have to split the bio */
	/* Check if we have to split the bio */
	{
	{
@@ -2462,7 +2462,7 @@ static void pkt_make_request(struct request_queue *q, struct bio *bio)
		sector_t last_zone;
		sector_t last_zone;
		int first_sectors;
		int first_sectors;


		last_zone = ZONE(bio->bi_sector + bio_sectors(bio) - 1, pd);
		last_zone = ZONE(bio_end_sector(bio) - 1, pd);
		if (last_zone != zone) {
		if (last_zone != zone) {
			BUG_ON(last_zone != zone + pd->settings.size);
			BUG_ON(last_zone != zone + pd->settings.size);
			first_sectors = last_zone - bio->bi_sector;
			first_sectors = last_zone - bio->bi_sector;
Loading