Skip to contentSkip to conversation

two small cleanups

PATCH In review Christoph Hellwig 3 participants 6 messages Jun 19, 2017 – Jun 21, 2017 Block layer

lore
Share & tools
lore
#0 lore raw

Stop relying on bio_page and a page_address in the Write Same code and remove an unused macro.

#1 lore raw

PATCH 1/2 block: remove the unused bio_to_phys macro

---
 include/linux/bio.h | 1 -
 1 file changed, 1 deletion(-)
include/linux/bio.h +0 -1
index 40d054185277..83f9edb39d3f 100644
@@ -118,7 +118,6 @@ static inline void *bio_data(struct bio *bio)
 /*
  * will die
  */
-#define bio_to_phys(bio)	(page_to_phys(bio_page((bio))) + (unsigned long) bio_offset((bio)))
 #define bvec_to_phys(bv)	(page_to_phys((bv)->bv_page) + (unsigned long) (bv)->bv_offset)
 
 /*
Signature · 1 line
2.11.0
#3 lore raw

PATCH 2/2 block: stop using bio_data() in blk_write_same_mergeable

In reply to Christoph Hellwig

While the Write Same page currently always is in low-level it is just as easy and safer to just compare the page and offset directly.

---
 include/linux/blkdev.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
include/linux/blkdev.h +2 -1
index db2b7a7450bd..a61907438139 100644
@@ -815,7 +815,8 @@ static inline bool rq_mergeable(struct request *rq)
 
 static inline bool blk_write_same_mergeable(struct bio *a, struct bio *b)
 {
-	if (bio_data(a) == bio_data(b))
+	if (bio_page(a) == bio_page(b) &&
+	    bio_offset(a) == bio_offset(b))
 		return true;
 
 	return false;
Signature · 1 line
2.11.0
Reviewed-by on v1 2/2
#4 lore raw

Re: [PATCH 2/2] block: stop using bio_data() in blk_write_same_mergeable

Christoph,

Quoted 2 lines

While the Write Same page currently always is in low-level it is just as easy and safer to just compare the page and offset directly.

Also fine.

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
maintainer Applied
#5 lore raw
In reply to Christoph Hellwig
Quoted 2 lines · Christoph Hellwig

Stop relying on bio_page and a page_address in the Write Same code and remove an unused macro.

Applied, thanks.

Signature · 1 line
Jens Axboe