summaryrefslogtreecommitdiffstats
path: root/drivers/target
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-01-29 14:51:49 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2018-01-29 14:51:49 -0500
commit0a4b6e2f80aad46fb55a5cf7b1664c0aef030ee0 (patch)
treecefccd67dc1f27bb45830f6b8065dd4a1c05e83b /drivers/target
parent9697e9da84299d0d715d515dd2cc48f1eceb277d (diff)
parent796baeeef85a40b3495a907fb7425086e7010102 (diff)
Merge branch 'for-4.16/block' of git://git.kernel.dk/linux-block
Pull block updates from Jens Axboe: "This is the main pull request for block IO related changes for the 4.16 kernel. Nothing major in this pull request, but a good amount of improvements and fixes all over the map. This contains: - BFQ improvements, fixes, and cleanups from Angelo, Chiara, and Paolo. - Support for SMR zones for deadline and mq-deadline from Damien and Christoph. - Set of fixes for bcache by way of Michael Lyle, including fixes from himself, Kent, Rui, Tang, and Coly. - Series from Matias for lightnvm with fixes from Hans Holmberg, Javier, and Matias. Mostly centered around pblk, and the removing rrpc 1.2 in preparation for supporting 2.0. - A couple of NVMe pull requests from Christoph. Nothing major in here, just fixes and cleanups, and support for command tracing from Johannes. - Support for blk-throttle for tracking reads and writes separately. From Joseph Qi. A few cleanups/fixes also for blk-throttle from Weiping. - Series from Mike Snitzer that enables dm to register its queue more logically, something that's alwways been problematic on dm since it's a stacked device. - Series from Ming cleaning up some of the bio accessor use, in preparation for supporting multipage bvecs. - Various fixes from Ming closing up holes around queue mapping and quiescing. - BSD partition fix from Richard Narron, fixing a problem where we can't mount newer (10/11) FreeBSD partitions. - Series from Tejun reworking blk-mq timeout handling. The previous scheme relied on atomic bits, but it had races where we would think a request had timed out if it to reused at the wrong time. - null_blk now supports faking timeouts, to enable us to better exercise and test that functionality separately. From me. - Kill the separate atomic poll bit in the request struct. After this, we don't use the atomic bits on blk-mq anymore at all. From me. - sgl_alloc/free helpers from Bart. - Heavily contended tag case scalability improvement from me. - Various little fixes and cleanups from Arnd, Bart, Corentin, Douglas, Eryu, Goldwyn, and myself" * 'for-4.16/block' of git://git.kernel.dk/linux-block: (186 commits) block: remove smart1,2.h nvme: add tracepoint for nvme_complete_rq nvme: add tracepoint for nvme_setup_cmd nvme-pci: introduce RECONNECTING state to mark initializing procedure nvme-rdma: remove redundant boolean for inline_data nvme: don't free uuid pointer before printing it nvme-pci: Suspend queues after deleting them bsg: use pr_debug instead of hand crafted macros blk-mq-debugfs: don't allow write on attributes with seq_operations set nvme-pci: Fix queue double allocations block: Set BIO_TRACE_COMPLETION on new bio during split blk-throttle: use queue_is_rq_based block: Remove kblockd_schedule_delayed_work{,_on}() blk-mq: Avoid that blk_mq_delay_run_hw_queue() introduces unintended delays blk-mq: Rename blk_mq_request_direct_issue() into blk_mq_request_issue_directly() lib/scatterlist: Fix chaining support in sgl_alloc_order() blk-throttle: track read and write request individually block: add bdev_read_only() checks to common helpers block: fail op_is_write() requests to read-only partitions blk-throttle: export io_serviced_recursive, io_service_bytes_recursive ...
Diffstat (limited to 'drivers/target')
-rw-r--r--drivers/target/Kconfig1
-rw-r--r--drivers/target/target_core_transport.c46
2 files changed, 5 insertions, 42 deletions
diff --git a/drivers/target/Kconfig b/drivers/target/Kconfig
index e2bc99980f75..4c44d7bed01a 100644
--- a/drivers/target/Kconfig
+++ b/drivers/target/Kconfig
@@ -5,6 +5,7 @@ menuconfig TARGET_CORE
5 select CONFIGFS_FS 5 select CONFIGFS_FS
6 select CRC_T10DIF 6 select CRC_T10DIF
7 select BLK_SCSI_REQUEST # only for scsi_command_size_tbl.. 7 select BLK_SCSI_REQUEST # only for scsi_command_size_tbl..
8 select SGL_ALLOC
8 default n 9 default n
9 help 10 help
10 Say Y or M here to enable the TCM Storage Engine and ConfigFS enabled 11 Say Y or M here to enable the TCM Storage Engine and ConfigFS enabled
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index 58caacd54a3b..c03a78ee26cd 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -2300,13 +2300,7 @@ queue_full:
2300 2300
2301void target_free_sgl(struct scatterlist *sgl, int nents) 2301void target_free_sgl(struct scatterlist *sgl, int nents)
2302{ 2302{
2303 struct scatterlist *sg; 2303 sgl_free_n_order(sgl, nents, 0);
2304 int count;
2305
2306 for_each_sg(sgl, sg, nents, count)
2307 __free_page(sg_page(sg));
2308
2309 kfree(sgl);
2310} 2304}
2311EXPORT_SYMBOL(target_free_sgl); 2305EXPORT_SYMBOL(target_free_sgl);
2312 2306
@@ -2414,42 +2408,10 @@ int
2414target_alloc_sgl(struct scatterlist **sgl, unsigned int *nents, u32 length, 2408target_alloc_sgl(struct scatterlist **sgl, unsigned int *nents, u32 length,
2415 bool zero_page, bool chainable) 2409 bool zero_page, bool chainable)
2416{ 2410{
2417 struct scatterlist *sg; 2411 gfp_t gfp = GFP_KERNEL | (zero_page ? __GFP_ZERO : 0);
2418 struct page *page;
2419 gfp_t zero_flag = (zero_page) ? __GFP_ZERO : 0;
2420 unsigned int nalloc, nent;
2421 int i = 0;
2422
2423 nalloc = nent = DIV_ROUND_UP(length, PAGE_SIZE);
2424 if (chainable)
2425 nalloc++;
2426 sg = kmalloc_array(nalloc, sizeof(struct scatterlist), GFP_KERNEL);
2427 if (!sg)
2428 return -ENOMEM;
2429 2412
2430 sg_init_table(sg, nalloc); 2413 *sgl = sgl_alloc_order(length, 0, chainable, gfp, nents);
2431 2414 return *sgl ? 0 : -ENOMEM;
2432 while (length) {
2433 u32 page_len = min_t(u32, length, PAGE_SIZE);
2434 page = alloc_page(GFP_KERNEL | zero_flag);
2435 if (!page)
2436 goto out;
2437
2438 sg_set_page(&sg[i], page, page_len, 0);
2439 length -= page_len;
2440 i++;
2441 }
2442 *sgl = sg;
2443 *nents = nent;
2444 return 0;
2445
2446out:
2447 while (i > 0) {
2448 i--;
2449 __free_page(sg_page(&sg[i]));
2450 }
2451 kfree(sg);
2452 return -ENOMEM;
2453} 2415}
2454EXPORT_SYMBOL(target_alloc_sgl); 2416EXPORT_SYMBOL(target_alloc_sgl);
2455 2417