Skip to content

Commit

Permalink
blk: remove bio_set arg from blk_queue_split()
Browse files Browse the repository at this point in the history
blk_queue_split() is always called with the last arg being q->bio_split,
where 'q' is the first arg.

Also blk_queue_split() sometimes uses the passed-in 'bs' and sometimes uses
q->bio_split.

This is inconsistent and unnecessary.  Remove the last arg and always use
q->bio_split inside blk_queue_split()

Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Credit-to: Javier González <jg@lightnvm.io> (Noticed that lightnvm was missed)
Reviewed-by: Javier González <javier@cnexlabs.com>
Tested-by: Javier González <javier@cnexlabs.com>
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
NeilBrown authored and axboe committed Jun 18, 2017
1 parent e4cdf1a commit af67c31
Show file tree
Hide file tree
Showing 14 changed files with 18 additions and 20 deletions.
2 changes: 1 addition & 1 deletion block/blk-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1723,7 +1723,7 @@ static blk_qc_t blk_queue_bio(struct request_queue *q, struct bio *bio)
*/
blk_queue_bounce(q, &bio);

blk_queue_split(q, &bio, q->bio_split);
blk_queue_split(q, &bio);

if (bio_integrity_enabled(bio) && bio_integrity_prep(bio)) {
bio->bi_status = BLK_STS_IOERR;
Expand Down
9 changes: 4 additions & 5 deletions block/blk-merge.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,22 +202,21 @@ static struct bio *blk_bio_segment_split(struct request_queue *q,
return do_split ? new : NULL;
}

void blk_queue_split(struct request_queue *q, struct bio **bio,
struct bio_set *bs)
void blk_queue_split(struct request_queue *q, struct bio **bio)
{
struct bio *split, *res;
unsigned nsegs;

switch (bio_op(*bio)) {
case REQ_OP_DISCARD:
case REQ_OP_SECURE_ERASE:
split = blk_bio_discard_split(q, *bio, bs, &nsegs);
split = blk_bio_discard_split(q, *bio, q->bio_split, &nsegs);
break;
case REQ_OP_WRITE_ZEROES:
split = blk_bio_write_zeroes_split(q, *bio, bs, &nsegs);
split = blk_bio_write_zeroes_split(q, *bio, q->bio_split, &nsegs);
break;
case REQ_OP_WRITE_SAME:
split = blk_bio_write_same_split(q, *bio, bs, &nsegs);
split = blk_bio_write_same_split(q, *bio, q->bio_split, &nsegs);
break;
default:
split = blk_bio_segment_split(q, *bio, q->bio_split, &nsegs);
Expand Down
2 changes: 1 addition & 1 deletion block/blk-mq.c
Original file line number Diff line number Diff line change
Expand Up @@ -1499,7 +1499,7 @@ static blk_qc_t blk_mq_make_request(struct request_queue *q, struct bio *bio)

blk_queue_bounce(q, &bio);

blk_queue_split(q, &bio, q->bio_split);
blk_queue_split(q, &bio);

if (bio_integrity_enabled(bio) && bio_integrity_prep(bio)) {
bio_io_error(bio);
Expand Down
2 changes: 1 addition & 1 deletion drivers/block/drbd/drbd_req.c
Original file line number Diff line number Diff line change
Expand Up @@ -1560,7 +1560,7 @@ blk_qc_t drbd_make_request(struct request_queue *q, struct bio *bio)
struct drbd_device *device = (struct drbd_device *) q->queuedata;
unsigned long start_jif;

blk_queue_split(q, &bio, q->bio_split);
blk_queue_split(q, &bio);

start_jif = jiffies;

Expand Down
2 changes: 1 addition & 1 deletion drivers/block/pktcdvd.c
Original file line number Diff line number Diff line change
Expand Up @@ -2414,7 +2414,7 @@ static blk_qc_t pkt_make_request(struct request_queue *q, struct bio *bio)

blk_queue_bounce(q, &bio);

blk_queue_split(q, &bio, q->bio_split);
blk_queue_split(q, &bio);

pd = q->queuedata;
if (!pd) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/block/ps3vram.c
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ static blk_qc_t ps3vram_make_request(struct request_queue *q, struct bio *bio)

dev_dbg(&dev->core, "%s\n", __func__);

blk_queue_split(q, &bio, q->bio_split);
blk_queue_split(q, &bio);

spin_lock_irq(&priv->lock);
busy = !bio_list_empty(&priv->list);
Expand Down
2 changes: 1 addition & 1 deletion drivers/block/rsxx/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ static blk_qc_t rsxx_make_request(struct request_queue *q, struct bio *bio)
struct rsxx_bio_meta *bio_meta;
blk_status_t st = BLK_STS_IOERR;

blk_queue_split(q, &bio, q->bio_split);
blk_queue_split(q, &bio);

might_sleep();

Expand Down
2 changes: 1 addition & 1 deletion drivers/block/umem.c
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ static blk_qc_t mm_make_request(struct request_queue *q, struct bio *bio)
(unsigned long long)bio->bi_iter.bi_sector,
bio->bi_iter.bi_size);

blk_queue_split(q, &bio, q->bio_split);
blk_queue_split(q, &bio);

spin_lock_irq(&card->lock);
*card->biotail = bio;
Expand Down
4 changes: 2 additions & 2 deletions drivers/lightnvm/pblk-init.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ static int pblk_rw_io(struct request_queue *q, struct pblk *pblk,
* constraint. Writes can be of arbitrary size.
*/
if (bio_data_dir(bio) == READ) {
blk_queue_split(q, &bio, q->bio_split);
blk_queue_split(q, &bio);
ret = pblk_submit_read(pblk, bio);
if (ret == NVM_IO_DONE && bio_flagged(bio, BIO_CLONED))
bio_put(bio);
Expand All @@ -46,7 +46,7 @@ static int pblk_rw_io(struct request_queue *q, struct pblk *pblk,
* available for user I/O.
*/
if (unlikely(pblk_get_secs(bio) >= pblk_rl_sysfs_rate_show(&pblk->rl)))
blk_queue_split(q, &bio, q->bio_split);
blk_queue_split(q, &bio);

return pblk_write_to_cache(pblk, bio, PBLK_IOTYPE_USER);
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/lightnvm/rrpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,7 @@ static blk_qc_t rrpc_make_rq(struct request_queue *q, struct bio *bio)
struct nvm_rq *rqd;
int err;

blk_queue_split(q, &bio, q->bio_split);
blk_queue_split(q, &bio);

if (bio_op(bio) == REQ_OP_DISCARD) {
rrpc_discard(rrpc, bio);
Expand Down
2 changes: 1 addition & 1 deletion drivers/md/md.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ static blk_qc_t md_make_request(struct request_queue *q, struct bio *bio)
unsigned int sectors;
int cpu;

blk_queue_split(q, &bio, q->bio_split);
blk_queue_split(q, &bio);

if (mddev == NULL || mddev->pers == NULL) {
bio_io_error(bio);
Expand Down
2 changes: 1 addition & 1 deletion drivers/s390/block/dcssblk.c
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,7 @@ dcssblk_make_request(struct request_queue *q, struct bio *bio)
unsigned long source_addr;
unsigned long bytes_done;

blk_queue_split(q, &bio, q->bio_split);
blk_queue_split(q, &bio);

bytes_done = 0;
dev_info = bio->bi_bdev->bd_disk->private_data;
Expand Down
2 changes: 1 addition & 1 deletion drivers/s390/block/xpram.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ static blk_qc_t xpram_make_request(struct request_queue *q, struct bio *bio)
unsigned long page_addr;
unsigned long bytes;

blk_queue_split(q, &bio, q->bio_split);
blk_queue_split(q, &bio);

if ((bio->bi_iter.bi_sector & 7) != 0 ||
(bio->bi_iter.bi_size & 4095) != 0)
Expand Down
3 changes: 1 addition & 2 deletions include/linux/blkdev.h
Original file line number Diff line number Diff line change
Expand Up @@ -944,8 +944,7 @@ extern blk_status_t blk_insert_cloned_request(struct request_queue *q,
struct request *rq);
extern int blk_rq_append_bio(struct request *rq, struct bio *bio);
extern void blk_delay_queue(struct request_queue *, unsigned long);
extern void blk_queue_split(struct request_queue *, struct bio **,
struct bio_set *);
extern void blk_queue_split(struct request_queue *, struct bio **);
extern void blk_recount_segments(struct request_queue *, struct bio *);
extern int scsi_verify_blk_ioctl(struct block_device *, unsigned int);
extern int scsi_cmd_blk_ioctl(struct block_device *, fmode_t,
Expand Down

0 comments on commit af67c31

Please sign in to comment.