Re: [PATCH v3 06/26] block: Add bio_end_sector()

From
Lars Ellenberg <hidden>
Date
2012-09-26 15:16:53
Also in
dm-devel, lkml
Reply to
Kent Overstreet, 2012-09-25
On Tue, Sep 25, 2012 at 03:06:24PM -0700, Kent Overstreet wrote:
On Tue, Sep 25, 2012 at 01:54:52PM +0200, Lars Ellenberg wrote:
quoted
On Mon, Sep 24, 2012 at 03:34:46PM -0700, Kent Overstreet wrote:
quoted
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.

For the DRBD part:
quoted hunk ↗ jump to hunk
Version below look good?
diff --git a/drivers/block/drbd/drbd_req.c b/drivers/block/drbd/drbd_req.c
index 01b2ac6..47f55db 100644
--- a/drivers/block/drbd/drbd_req.c
+++ b/drivers/block/drbd/drbd_req.c
@@ -1144,7 +1144,7 @@ void drbd_make_request(struct request_queue *q, struct bio *bio)
 	/* to make some things easier, force alignment of requests within the
 	 * granularity of our hash tables */
 	s_enr = bio->bi_sector >> HT_SHIFT;
-	e_enr = bio->bi_size ? (bio->bi_sector+(bio->bi_size>>9)-1) >> HT_SHIFT : s_enr;
+	e_enr = bio->bi_size ? (bio_end_sector(bio) - 1) >> HT_SHIFT : s_enr;
 
 	if (likely(s_enr == e_enr)) {
 		do {
Sure.

Cheers,

	Lars
Thread (68 messages) 68 messages, 7 authors, last reply 2012-10-04
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help