Commit ff27668c authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe
Browse files

bcache: pass the make_request methods to blk_queue_make_request



bcache is the only driver not actually passing its make_request
methods to blk_queue_make_request, but instead just sets them up
manually a little later.  Make bcache follow the common way of
setting up make_request based queues.

Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 8d96a111
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -1161,8 +1161,7 @@ static void quit_max_writeback_rate(struct cache_set *c,

/* Cached devices - read & write stuff */

static blk_qc_t cached_dev_make_request(struct request_queue *q,
					struct bio *bio)
blk_qc_t cached_dev_make_request(struct request_queue *q, struct bio *bio)
{
	struct search *s;
	struct bcache_device *d = bio->bi_disk->private_data;
@@ -1266,7 +1265,6 @@ void bch_cached_dev_request_init(struct cached_dev *dc)
{
	struct gendisk *g = dc->disk.disk;

	g->queue->make_request_fn		= cached_dev_make_request;
	g->queue->backing_dev_info->congested_fn = cached_dev_congested;
	dc->disk.cache_miss			= cached_dev_cache_miss;
	dc->disk.ioctl				= cached_dev_ioctl;
@@ -1301,8 +1299,7 @@ static void flash_dev_nodata(struct closure *cl)
	continue_at(cl, search_free, NULL);
}

static blk_qc_t flash_dev_make_request(struct request_queue *q,
					     struct bio *bio)
blk_qc_t flash_dev_make_request(struct request_queue *q, struct bio *bio)
{
	struct search *s;
	struct closure *cl;
+3 −0
Original line number Diff line number Diff line
@@ -37,7 +37,10 @@ unsigned int bch_get_congested(const struct cache_set *c);
void bch_data_insert(struct closure *cl);

void bch_cached_dev_request_init(struct cached_dev *dc);
blk_qc_t cached_dev_make_request(struct request_queue *q, struct bio *bio);

void bch_flash_dev_request_init(struct bcache_device *d);
blk_qc_t flash_dev_make_request(struct request_queue *q, struct bio *bio);

extern struct kmem_cache *bch_search_cache;

+6 −4
Original line number Diff line number Diff line
@@ -816,7 +816,7 @@ static void bcache_device_free(struct bcache_device *d)
}

static int bcache_device_init(struct bcache_device *d, unsigned int block_size,
			      sector_t sectors)
			      sector_t sectors, make_request_fn make_request_fn)
{
	struct request_queue *q;
	const size_t max_stripes = min_t(size_t, INT_MAX,
@@ -870,7 +870,7 @@ static int bcache_device_init(struct bcache_device *d, unsigned int block_size,
	if (!q)
		return -ENOMEM;

	blk_queue_make_request(q, NULL);
	blk_queue_make_request(q, make_request_fn);
	d->disk->queue			= q;
	q->queuedata			= d;
	q->backing_dev_info->congested_data = d;
@@ -1339,7 +1339,8 @@ static int cached_dev_init(struct cached_dev *dc, unsigned int block_size)
			q->limits.raid_partial_stripes_expensive;

	ret = bcache_device_init(&dc->disk, block_size,
			 dc->bdev->bd_part->nr_sects - dc->sb.data_offset);
			 dc->bdev->bd_part->nr_sects - dc->sb.data_offset,
			 cached_dev_make_request);
	if (ret)
		return ret;

@@ -1451,7 +1452,8 @@ static int flash_dev_run(struct cache_set *c, struct uuid_entry *u)

	kobject_init(&d->kobj, &bch_flash_dev_ktype);

	if (bcache_device_init(d, block_bytes(c), u->sectors))
	if (bcache_device_init(d, block_bytes(c), u->sectors,
			flash_dev_make_request))
		goto err;

	bcache_device_attach(d, c, u - c->uuids);