Skip to content

Commit 513a4be

Browse files
committed
Merge branch 'for-4.9/block' of git://git.kernel.dk/linux-block
Pull block layer updates from Jens Axboe: "This is the main pull request for block layer changes in 4.9. As mentioned at the last merge window, I've changed things up and now do just one branch for core block layer changes, and driver changes. This avoids dependencies between the two branches. Outside of this main pull request, there are two topical branches coming as well. This pull request contains: - A set of fixes, and a conversion to blk-mq, of nbd. From Josef. - Set of fixes and updates for lightnvm from Matias, Simon, and Arnd. Followup dependency fix from Geert. - General fixes from Bart, Baoyou, Guoqing, and Linus W. - CFQ async write starvation fix from Glauber. - Add supprot for delayed kick of the requeue list, from Mike. - Pull out the scalable bitmap code from blk-mq-tag.c and make it generally available under the name of sbitmap. Only blk-mq-tag uses it for now, but the blk-mq scheduling bits will use it as well. From Omar. - bdev thaw error progagation from Pierre. - Improve the blk polling statistics, and allow the user to clear them. From Stephen. - Set of minor cleanups from Christoph in block/blk-mq. - Set of cleanups and optimizations from me for block/blk-mq. - Various nvme/nvmet/nvmeof fixes from the various folks" * 'for-4.9/block' of git://git.kernel.dk/linux-block: (54 commits) fs/block_dev.c: return the right error in thaw_bdev() nvme: Pass pointers, not dma addresses, to nvme_get/set_features() nvme/scsi: Remove power management support nvmet: Make dsm number of ranges zero based nvmet: Use direct IO for writes admin-cmd: Added smart-log command support. nvme-fabrics: Add host_traddr options field to host infrastructure nvme-fabrics: revise host transport option descriptions nvme-fabrics: rework nvmf_get_address() for variable options nbd: use BLK_MQ_F_BLOCKING blkcg: Annotate blkg_hint correctly cfq: fix starvation of asynchronous writes blk-mq: add flag for drivers wanting blocking ->queue_rq() blk-mq: remove non-blocking pass in blk_mq_map_request blk-mq: get rid of manual run of queue with __blk_mq_run_hw_queue() block: export bio_free_pages to other modules lightnvm: propagate device_add() error code lightnvm: expose device geometry through sysfs lightnvm: control life of nvm_dev in driver blk-mq: register device instead of disk ...
2 parents 87840a2 + 997198b commit 513a4be

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+1828
-1170
lines changed

Documentation/block/biodoc.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ i. Per-queue limits/values exported to the generic layer by the driver
115115

116116
Various parameters that the generic i/o scheduler logic uses are set at
117117
a per-queue level (e.g maximum request size, maximum number of segments in
118-
a scatter-gather list, hardsect size)
118+
a scatter-gather list, logical block size)
119119

120120
Some parameters that were earlier available as global arrays indexed by
121121
major/minor are now directly associated with the queue. Some of these may
@@ -156,7 +156,7 @@ Some new queue property settings:
156156
blk_queue_max_segment_size(q, max_seg_size)
157157
Maximum size of a clustered segment, 64kB default.
158158

159-
blk_queue_hardsect_size(q, hardsect_size)
159+
blk_queue_logical_block_size(q, logical_block_size)
160160
Lowest possible sector size that the hardware can operate
161161
on, 512 bytes default.
162162

MAINTAINERS

+1
Original file line numberDiff line numberDiff line change
@@ -2472,6 +2472,7 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git
24722472
S: Maintained
24732473
F: block/
24742474
F: kernel/trace/blktrace.c
2475+
F: lib/sbitmap.c
24752476

24762477
BLOCK2MTD DRIVER
24772478
M: Joern Engel <[email protected]>

block/Kconfig

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
menuconfig BLOCK
55
bool "Enable the block layer" if EXPERT
66
default y
7+
select SBITMAP
78
help
89
Provide block layer support for the kernel.
910

block/bio.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -1068,14 +1068,15 @@ static int bio_copy_to_iter(struct bio *bio, struct iov_iter iter)
10681068
return 0;
10691069
}
10701070

1071-
static void bio_free_pages(struct bio *bio)
1071+
void bio_free_pages(struct bio *bio)
10721072
{
10731073
struct bio_vec *bvec;
10741074
int i;
10751075

10761076
bio_for_each_segment_all(bvec, bio, i)
10771077
__free_page(bvec->bv_page);
10781078
}
1079+
EXPORT_SYMBOL(bio_free_pages);
10791080

10801081
/**
10811082
* bio_uncopy_user - finish previously mapped bio
@@ -1274,7 +1275,7 @@ struct bio *bio_map_user_iov(struct request_queue *q,
12741275

12751276
nr_pages += end - start;
12761277
/*
1277-
* buffer must be aligned to at least hardsector size for now
1278+
* buffer must be aligned to at least logical block size for now
12781279
*/
12791280
if (uaddr & queue_dma_alignment(q))
12801281
return ERR_PTR(-EINVAL);

block/blk-core.c

+13-3
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ void blk_sync_queue(struct request_queue *q)
288288
int i;
289289

290290
queue_for_each_hw_ctx(q, hctx, i) {
291-
cancel_delayed_work_sync(&hctx->run_work);
291+
cancel_work_sync(&hctx->run_work);
292292
cancel_delayed_work_sync(&hctx->delay_work);
293293
}
294294
} else {
@@ -3097,6 +3097,12 @@ int kblockd_schedule_work(struct work_struct *work)
30973097
}
30983098
EXPORT_SYMBOL(kblockd_schedule_work);
30993099

3100+
int kblockd_schedule_work_on(int cpu, struct work_struct *work)
3101+
{
3102+
return queue_work_on(cpu, kblockd_workqueue, work);
3103+
}
3104+
EXPORT_SYMBOL(kblockd_schedule_work_on);
3105+
31003106
int kblockd_schedule_delayed_work(struct delayed_work *dwork,
31013107
unsigned long delay)
31023108
{
@@ -3301,19 +3307,23 @@ bool blk_poll(struct request_queue *q, blk_qc_t cookie)
33013307
{
33023308
struct blk_plug *plug;
33033309
long state;
3310+
unsigned int queue_num;
3311+
struct blk_mq_hw_ctx *hctx;
33043312

33053313
if (!q->mq_ops || !q->mq_ops->poll || !blk_qc_t_valid(cookie) ||
33063314
!test_bit(QUEUE_FLAG_POLL, &q->queue_flags))
33073315
return false;
33083316

3317+
queue_num = blk_qc_t_to_queue_num(cookie);
3318+
hctx = q->queue_hw_ctx[queue_num];
3319+
hctx->poll_considered++;
3320+
33093321
plug = current->plug;
33103322
if (plug)
33113323
blk_flush_plug_list(plug, false);
33123324

33133325
state = current->state;
33143326
while (!need_resched()) {
3315-
unsigned int queue_num = blk_qc_t_to_queue_num(cookie);
3316-
struct blk_mq_hw_ctx *hctx = q->queue_hw_ctx[queue_num];
33173327
int ret;
33183328

33193329
hctx->poll_invoked++;

block/blk-mq-sysfs.c

+25-15
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,17 @@ static ssize_t blk_mq_sysfs_rq_list_show(struct blk_mq_ctx *ctx, char *page)
176176

177177
static ssize_t blk_mq_hw_sysfs_poll_show(struct blk_mq_hw_ctx *hctx, char *page)
178178
{
179-
return sprintf(page, "invoked=%lu, success=%lu\n", hctx->poll_invoked, hctx->poll_success);
179+
return sprintf(page, "considered=%lu, invoked=%lu, success=%lu\n",
180+
hctx->poll_considered, hctx->poll_invoked,
181+
hctx->poll_success);
182+
}
183+
184+
static ssize_t blk_mq_hw_sysfs_poll_store(struct blk_mq_hw_ctx *hctx,
185+
const char *page, size_t size)
186+
{
187+
hctx->poll_considered = hctx->poll_invoked = hctx->poll_success = 0;
188+
189+
return size;
180190
}
181191

182192
static ssize_t blk_mq_hw_sysfs_queued_show(struct blk_mq_hw_ctx *hctx,
@@ -198,12 +208,14 @@ static ssize_t blk_mq_hw_sysfs_dispatched_show(struct blk_mq_hw_ctx *hctx,
198208

199209
page += sprintf(page, "%8u\t%lu\n", 0U, hctx->dispatched[0]);
200210

201-
for (i = 1; i < BLK_MQ_MAX_DISPATCH_ORDER; i++) {
202-
unsigned long d = 1U << (i - 1);
211+
for (i = 1; i < BLK_MQ_MAX_DISPATCH_ORDER - 1; i++) {
212+
unsigned int d = 1U << (i - 1);
203213

204-
page += sprintf(page, "%8lu\t%lu\n", d, hctx->dispatched[i]);
214+
page += sprintf(page, "%8u\t%lu\n", d, hctx->dispatched[i]);
205215
}
206216

217+
page += sprintf(page, "%8u+\t%lu\n", 1U << (i - 1),
218+
hctx->dispatched[i]);
207219
return page - start_page;
208220
}
209221

@@ -301,8 +313,9 @@ static struct blk_mq_hw_ctx_sysfs_entry blk_mq_hw_sysfs_cpus = {
301313
.show = blk_mq_hw_sysfs_cpus_show,
302314
};
303315
static struct blk_mq_hw_ctx_sysfs_entry blk_mq_hw_sysfs_poll = {
304-
.attr = {.name = "io_poll", .mode = S_IRUGO },
316+
.attr = {.name = "io_poll", .mode = S_IWUSR | S_IRUGO },
305317
.show = blk_mq_hw_sysfs_poll_show,
318+
.store = blk_mq_hw_sysfs_poll_store,
306319
};
307320

308321
static struct attribute *default_hw_ctx_attrs[] = {
@@ -380,9 +393,8 @@ static int blk_mq_register_hctx(struct blk_mq_hw_ctx *hctx)
380393
return ret;
381394
}
382395

383-
static void __blk_mq_unregister_disk(struct gendisk *disk)
396+
static void __blk_mq_unregister_dev(struct device *dev, struct request_queue *q)
384397
{
385-
struct request_queue *q = disk->queue;
386398
struct blk_mq_hw_ctx *hctx;
387399
struct blk_mq_ctx *ctx;
388400
int i, j;
@@ -400,15 +412,15 @@ static void __blk_mq_unregister_disk(struct gendisk *disk)
400412
kobject_del(&q->mq_kobj);
401413
kobject_put(&q->mq_kobj);
402414

403-
kobject_put(&disk_to_dev(disk)->kobj);
415+
kobject_put(&dev->kobj);
404416

405417
q->mq_sysfs_init_done = false;
406418
}
407419

408-
void blk_mq_unregister_disk(struct gendisk *disk)
420+
void blk_mq_unregister_dev(struct device *dev, struct request_queue *q)
409421
{
410422
blk_mq_disable_hotplug();
411-
__blk_mq_unregister_disk(disk);
423+
__blk_mq_unregister_dev(dev, q);
412424
blk_mq_enable_hotplug();
413425
}
414426

@@ -430,10 +442,8 @@ static void blk_mq_sysfs_init(struct request_queue *q)
430442
}
431443
}
432444

433-
int blk_mq_register_disk(struct gendisk *disk)
445+
int blk_mq_register_dev(struct device *dev, struct request_queue *q)
434446
{
435-
struct device *dev = disk_to_dev(disk);
436-
struct request_queue *q = disk->queue;
437447
struct blk_mq_hw_ctx *hctx;
438448
int ret, i;
439449

@@ -454,15 +464,15 @@ int blk_mq_register_disk(struct gendisk *disk)
454464
}
455465

456466
if (ret)
457-
__blk_mq_unregister_disk(disk);
467+
__blk_mq_unregister_dev(dev, q);
458468
else
459469
q->mq_sysfs_init_done = true;
460470
out:
461471
blk_mq_enable_hotplug();
462472

463473
return ret;
464474
}
465-
EXPORT_SYMBOL_GPL(blk_mq_register_disk);
475+
EXPORT_SYMBOL_GPL(blk_mq_register_dev);
466476

467477
void blk_mq_sysfs_unregister(struct request_queue *q)
468478
{

0 commit comments

Comments
 (0)