Skip to contentSkip to conversation

two simple block patches

PATCH In review Christoph Hellwig 2 participants 4 messages Feb 11, 2015 Block layer

lore
Share & tools
lore
#0 lore raw

First is a fix for a regression recently introduced by me in the block/for-next tree, and the second is a trivial removal of an unused function.

#1 lore raw

PATCH 1/2 block: handle the null_mapped flag correctly in blk_rq_map_user_iov

The tape drivers (and the sg driver in a special case that doesn't matter here) use the null_mapped flag to tell blk_rq_map_user to not copy around any data into or out of the bounce buffers. blk_rq_map_user_iov never got that treatment, which didn't matter until I refactored blk_rq_map_user to be implemented in terms of blk_rq_map_user_iov.

---
 block/blk-map.c | 3 +++
 1 file changed, 3 insertions(+)
block/blk-map.c +3 -0
index 0f22911..b8d2725 100644
@@ -93,6 +93,9 @@ int blk_rq_map_user_iov(struct request_queue *q, struct request *rq,
 	if (IS_ERR(bio))
 		return PTR_ERR(bio);
 
+	if (map_data && map_data->null_mapped)
+		bio->bi_flags |= (1 << BIO_NULL_MAPPED);
+
 	if (bio->bi_iter.bi_size != iter->count) {
 		/*
 		 * Grab an extra reference to this bio, as bio_unmap_user()
Signature · 1 line
1.9.1
Reviewed-by Ming Lei on v1 1/2
#2 lore raw

Re: [PATCH 1/2] block: handle the null_mapped flag correctly in blk_rq_map_user_iov

Quoted 5 lines · Christoph Hellwig

The tape drivers (and the sg driver in a special case that doesn't matter here) use the null_mapped flag to tell blk_rq_map_user to not copy around any data into or out of the bounce buffers. blk_rq_map_user_iov never got that treatment, which didn't matter until I refactored blk_rq_map_user to be implemented in terms of blk_rq_map_user_iov.

So this fixes a regression caused by:

commit ddad8dd0a162fde61646a627a3017c258601dc8a

Author: Christoph Hellwig <[email protected]>
Date:   Sun Jan 18 16:16:29 2015 +0100

block: use blk_rq_map_user_iov to implement blk_rq_map_user

which we should probably note in the commit. I'll add that.

Signature · 1 line
Jens Axboe
#3 lore raw

PATCH 2/2 block: remove unused function blk_bio_map_sg

In reply to Christoph Hellwig
---
 block/blk-merge.c      | 29 -----------------------------
 include/linux/blkdev.h |  2 --
 2 files changed, 31 deletions(-)
block/blk-merge.c +0 -29
index 89b97b5..891611a 100644
@@ -283,35 +283,6 @@ int blk_rq_map_sg(struct request_queue *q, struct request *rq,
 }
 EXPORT_SYMBOL(blk_rq_map_sg);
 
-/**
- * blk_bio_map_sg - map a bio to a scatterlist
- * @q: request_queue in question
- * @bio: bio being mapped
- * @sglist: scatterlist being mapped
- *
- * Note:
- *    Caller must make sure sg can hold bio->bi_phys_segments entries
- *
- * Will return the number of sg entries setup
- */
-int blk_bio_map_sg(struct request_queue *q, struct bio *bio,
-		   struct scatterlist *sglist)
-{
-	struct scatterlist *sg = NULL;
-	int nsegs;
-	struct bio *next = bio->bi_next;
-	bio->bi_next = NULL;
-
-	nsegs = __blk_bios_map_sg(q, bio, sglist, &sg);
-	bio->bi_next = next;
-	if (sg)
-		sg_mark_end(sg);
-
-	BUG_ON(bio->bi_phys_segments && nsegs > bio->bi_phys_segments);
-	return nsegs;
-}
-EXPORT_SYMBOL(blk_bio_map_sg);
-
 static inline int ll_new_hw_segment(struct request_queue *q,
 				    struct request *req,
 				    struct bio *bio)
include/linux/blkdev.h +0 -2
index bf4ef66..7f9a516 100644
@@ -1049,8 +1049,6 @@ extern void blk_queue_flush_queueable(struct request_queue *q, bool queueable);
 extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev);
 
 extern int blk_rq_map_sg(struct request_queue *, struct request *, struct scatterlist *);
-extern int blk_bio_map_sg(struct request_queue *q, struct bio *bio,
-			  struct scatterlist *sglist);
 extern void blk_dump_rq_flags(struct request *, char *);
 extern long nr_blockdev_pages(void);
 
Signature · 1 line
1.9.1