[<prev] [next>] [day] [month] [year] [list]
Message-ID: <201609052304.afblXlvE%fengguang.wu@intel.com>
Date: Mon, 5 Sep 2016 23:00:08 +0800
From: kbuild test robot <fengguang.wu@...el.com>
To: Christoph Hellwig <hch@....de>
Cc: kbuild-all@...org, linux-kernel@...r.kernel.org,
Sagi Grimberg <sagi@...mberg.me>,
Jay Freyensee <james_p_freyensee@...ux.intel.com>
Subject: drivers/nvme/host/core.c:202:2: note: in expansion of macro
'spin_lock_irqsave'
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: c6935931c1894ff857616ff8549b61236a19148f
commit: aa71987472a974f4f6dc4be377720564079ef42e nvme: fabrics drivers don't need the nvme-pci driver
date: 2 weeks ago
config: x86_64-randconfig-n0-09052021 (attached as .config)
compiler: gcc-4.8 (Debian 4.8.4-1) 4.8.4
reproduce:
git checkout aa71987472a974f4f6dc4be377720564079ef42e
# save the attached .config to linux build tree
make ARCH=x86_64
All warnings (new ones prefixed by >>):
In file included from drivers/nvme/host/core.c:16:0:
include/linux/blk-mq.h:61:18: error: field 'kobj' has incomplete type
struct kobject kobj;
^
include/linux/blk-mq.h:128:2: error: unknown type name 'softirq_done_fn'
softirq_done_fn *complete;
^
include/linux/blk-mq.h:181:33: warning: 'struct gendisk' declared inside parameter list [enabled by default]
int blk_mq_register_disk(struct gendisk *);
^
include/linux/blk-mq.h:181:33: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]
include/linux/blk-mq.h:182:36: warning: 'struct gendisk' declared inside parameter list [enabled by default]
void blk_mq_unregister_disk(struct gendisk *);
^
include/linux/blk-mq.h: In function 'blk_mq_rq_from_pdu':
include/linux/blk-mq.h:260:22: error: invalid application of 'sizeof' to incomplete type 'struct request'
return pdu - sizeof(struct request);
^
include/linux/blk-mq.h: In function 'blk_mq_rq_to_pdu':
include/linux/blk-mq.h:264:2: error: invalid use of undefined type 'struct request'
return rq + 1;
^
In file included from drivers/nvme/host/core.c:32:0:
drivers/nvme/host/nvme.h: In function 'nvme_map_len':
drivers/nvme/host/nvme.h:217:2: error: implicit declaration of function 'req_op' [-Werror=implicit-function-declaration]
if (req_op(rq) == REQ_OP_DISCARD)
^
drivers/nvme/host/nvme.h:220:3: error: implicit declaration of function 'blk_rq_bytes' [-Werror=implicit-function-declaration]
return blk_rq_bytes(rq);
^
drivers/nvme/host/nvme.h: In function 'nvme_cleanup_cmd':
drivers/nvme/host/nvme.h:226:12: error: dereferencing pointer to incomplete type
kfree(req->completion_data);
^
drivers/nvme/host/nvme.h: In function 'nvme_req_needs_retry':
drivers/nvme/host/nvme.h:243:2: error: implicit declaration of function 'blk_noretry_request' [-Werror=implicit-function-declaration]
return !(status & NVME_SC_DNR || blk_noretry_request(req)) &&
^
drivers/nvme/host/nvme.h:244:17: error: dereferencing pointer to incomplete type
(jiffies - req->start_time) < req->timeout &&
^
drivers/nvme/host/nvme.h:244:36: error: dereferencing pointer to incomplete type
(jiffies - req->start_time) < req->timeout &&
^
drivers/nvme/host/nvme.h:245:6: error: dereferencing pointer to incomplete type
req->retries < nvme_max_retries;
^
In file included from include/linux/pci.h:30:0,
from drivers/nvme/host/nvme.h:18,
from drivers/nvme/host/core.c:32:
drivers/nvme/host/core.c: In function 'nvme_cancel_request':
drivers/nvme/host/core.c:72:29: error: dereferencing pointer to incomplete type
"Cancelling I/O %d", req->tag);
^
include/linux/device.h:1294:38: note: in definition of macro 'dev_dbg_ratelimited'
dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); \
^
drivers/nvme/host/core.c:75:2: error: implicit declaration of function 'blk_queue_dying' [-Werror=implicit-function-declaration]
if (blk_queue_dying(req->q))
^
drivers/nvme/host/core.c:75:25: error: dereferencing pointer to incomplete type
if (blk_queue_dying(req->q))
^
drivers/nvme/host/core.c: In function 'nvme_free_ns':
drivers/nvme/host/core.c:157:42: error: dereferencing pointer to incomplete type
nvme_nvm_unregister(ns->queue, ns->disk->disk_name);
^
drivers/nvme/host/core.c:160:10: error: dereferencing pointer to incomplete type
ns->disk->private_data = NULL;
^
drivers/nvme/host/core.c:163:2: error: implicit declaration of function 'put_disk' [-Werror=implicit-function-declaration]
put_disk(ns->disk);
^
drivers/nvme/host/core.c: In function 'nvme_get_ns_from_disk':
drivers/nvme/host/core.c:179:11: error: dereferencing pointer to incomplete type
ns = disk->private_data;
^
In file included from include/linux/seqlock.h:35:0,
from include/linux/time.h:5,
from include/uapi/linux/timex.h:56,
from include/linux/timex.h:56,
from include/linux/sched.h:19,
from include/linux/blkdev.h:4,
from drivers/nvme/host/core.c:15:
drivers/nvme/host/core.c: In function 'nvme_requeue_req':
drivers/nvme/host/core.c:202:23: error: dereferencing pointer to incomplete type
spin_lock_irqsave(req->q->queue_lock, flags);
^
include/linux/spinlock.h:208:34: note: in definition of macro 'raw_spin_lock_irqsave'
flags = _raw_spin_lock_irqsave(lock); \
^
>> drivers/nvme/host/core.c:202:2: note: in expansion of macro 'spin_lock_irqsave'
spin_lock_irqsave(req->q->queue_lock, flags);
^
drivers/nvme/host/core.c:203:2: error: implicit declaration of function 'blk_queue_stopped' [-Werror=implicit-function-declaration]
if (!blk_queue_stopped(req->q))
^
drivers/nvme/host/core.c:203:28: error: dereferencing pointer to incomplete type
if (!blk_queue_stopped(req->q))
^
drivers/nvme/host/core.c:204:31: error: dereferencing pointer to incomplete type
blk_mq_kick_requeue_list(req->q);
^
drivers/nvme/host/core.c:205:28: error: dereferencing pointer to incomplete type
spin_unlock_irqrestore(req->q->queue_lock, flags);
^
drivers/nvme/host/core.c: In function 'nvme_alloc_request':
drivers/nvme/host/core.c:223:5: error: dereferencing pointer to incomplete type
req->cmd_type = REQ_TYPE_DRV_PRIV;
^
drivers/nvme/host/core.c:223:18: error: 'REQ_TYPE_DRV_PRIV' undeclared (first use in this function)
req->cmd_type = REQ_TYPE_DRV_PRIV;
^
drivers/nvme/host/core.c:223:18: note: each undeclared identifier is reported only once for each function it appears in
drivers/nvme/host/core.c:224:5: error: dereferencing pointer to incomplete type
req->cmd_flags |= REQ_FAILFAST_DRIVER;
^
drivers/nvme/host/core.c:225:5: error: dereferencing pointer to incomplete type
req->cmd = (unsigned char *)cmd;
^
drivers/nvme/host/core.c:226:5: error: dereferencing pointer to incomplete type
req->cmd_len = sizeof(struct nvme_command);
^
drivers/nvme/host/core.c: In function 'nvme_setup_discard':
drivers/nvme/host/core.c:254:2: error: implicit declaration of function 'blk_rq_pos' [-Werror=implicit-function-declaration]
range->slba = cpu_to_le64(nvme_block_nr(ns, blk_rq_pos(req)));
^
drivers/nvme/host/core.c:262:5: error: dereferencing pointer to incomplete type
req->completion_data = range;
^
drivers/nvme/host/core.c:265:2: error: implicit declaration of function 'blk_add_request_payload' [-Werror=implicit-function-declaration]
blk_add_request_payload(req, page, offset, sizeof(*range));
^
drivers/nvme/host/core.c:272:5: error: dereferencing pointer to incomplete type
req->__data_len = nr_bytes;
^
drivers/nvme/host/core.c: In function 'nvme_setup_rw':
drivers/nvme/host/core.c:283:9: error: dereferencing pointer to incomplete type
if (req->cmd_flags & REQ_FUA)
^
drivers/nvme/host/core.c:285:9: error: dereferencing pointer to incomplete type
if (req->cmd_flags & (REQ_FAILFAST_DEV | REQ_RAHEAD))
^
drivers/nvme/host/core.c:288:9: error: dereferencing pointer to incomplete type
if (req->cmd_flags & REQ_RAHEAD)
^
drivers/nvme/host/core.c:292:2: error: implicit declaration of function 'rq_data_dir' [-Werror=implicit-function-declaration]
cmnd->rw.opcode = (rq_data_dir(req) ? nvme_cmd_write : nvme_cmd_read);
^
drivers/nvme/host/core.c:293:27: error: dereferencing pointer to incomplete type
cmnd->rw.command_id = req->tag;
^
drivers/nvme/host/core.c:311:3: error: implicit declaration of function 'blk_integrity_rq' [-Werror=implicit-function-declaration]
if (!blk_integrity_rq(req))
^
drivers/nvme/host/core.c: In function 'nvme_setup_cmd':
drivers/nvme/host/core.c:324:9: error: dereferencing pointer to incomplete type
if (req->cmd_type == REQ_TYPE_DRV_PRIV)
^
drivers/nvme/host/core.c:324:23: error: 'REQ_TYPE_DRV_PRIV' undeclared (first use in this function)
if (req->cmd_type == REQ_TYPE_DRV_PRIV)
^
drivers/nvme/host/core.c:325:18: error: dereferencing pointer to incomplete type
memcpy(cmd, req->cmd, sizeof(*cmd));
^
drivers/nvme/host/core.c: In function '__nvme_submit_sync_cmd':
drivers/nvme/host/core.c:352:5: error: dereferencing pointer to incomplete type
req->timeout = timeout ? timeout : ADMIN_TIMEOUT;
^
drivers/nvme/host/core.c:353:5: error: dereferencing pointer to incomplete type
req->special = cqe;
^
drivers/nvme/host/core.c:356:3: error: implicit declaration of function 'blk_rq_map_kern' [-Werror=implicit-function-declaration]
ret = blk_rq_map_kern(q, req, buffer, bufflen, GFP_KERNEL);
^
drivers/nvme/host/core.c:361:2: error: implicit declaration of function 'blk_execute_rq' [-Werror=implicit-function-declaration]
blk_execute_rq(req->q, NULL, req, at_head);
^
drivers/nvme/host/core.c:361:20: error: dereferencing pointer to incomplete type
blk_execute_rq(req->q, NULL, req, at_head);
^
drivers/nvme/host/core.c:362:11: error: dereferencing pointer to incomplete type
ret = req->errors;
^
drivers/nvme/host/core.c: In function '__nvme_submit_user_cmd':
drivers/nvme/host/core.c:384:24: error: dereferencing pointer to incomplete type
struct nvme_ns *ns = q->queuedata;
^
drivers/nvme/host/core.c:395:5: error: dereferencing pointer to incomplete type
req->timeout = timeout ? timeout : ADMIN_TIMEOUT;
^
drivers/nvme/host/core.c:396:5: error: dereferencing pointer to incomplete type
--
.getgeo = nvme_getgeo,
^
drivers/nvme/host/core.c:1065:2: warning: excess elements in struct initializer [enabled by default]
drivers/nvme/host/core.c:1065:2: warning: (near initialization for 'nvme_fops') [enabled by default]
drivers/nvme/host/core.c:1066:2: error: unknown field 'revalidate_disk' specified in initializer
.revalidate_disk= nvme_revalidate_disk,
^
drivers/nvme/host/core.c:1066:2: warning: excess elements in struct initializer [enabled by default]
drivers/nvme/host/core.c:1066:2: warning: (near initialization for 'nvme_fops') [enabled by default]
drivers/nvme/host/core.c:1067:2: error: unknown field 'pr_ops' specified in initializer
.pr_ops = &nvme_pr_ops,
^
drivers/nvme/host/core.c:1067:2: warning: excess elements in struct initializer [enabled by default]
drivers/nvme/host/core.c:1067:2: warning: (near initialization for 'nvme_fops') [enabled by default]
drivers/nvme/host/core.c: In function 'nvme_set_queue_limits':
drivers/nvme/host/core.c:1196:3: error: implicit declaration of function 'blk_queue_max_hw_sectors' [-Werror=implicit-function-declaration]
blk_queue_max_hw_sectors(q, ctrl->max_hw_sectors);
^
drivers/nvme/host/core.c:1197:3: error: implicit declaration of function 'blk_queue_max_segments' [-Werror=implicit-function-declaration]
blk_queue_max_segments(q, min_t(u32, max_segments, USHRT_MAX));
^
drivers/nvme/host/core.c:1200:3: error: implicit declaration of function 'blk_queue_chunk_sectors' [-Werror=implicit-function-declaration]
blk_queue_chunk_sectors(q, ctrl->stripe_size >> 9);
^
drivers/nvme/host/core.c:1201:2: error: implicit declaration of function 'blk_queue_virt_boundary' [-Werror=implicit-function-declaration]
blk_queue_virt_boundary(q, ctrl->page_size - 1);
^
drivers/nvme/host/core.c:1204:2: error: implicit declaration of function 'blk_queue_write_cache' [-Werror=implicit-function-declaration]
blk_queue_write_cache(q, vwc, vwc);
^
drivers/nvme/host/core.c: In function 'wwid_show':
drivers/nvme/host/core.c:1425:9: error: implicit declaration of function 'dev_to_disk' [-Werror=implicit-function-declaration]
struct nvme_ns *ns = dev_to_disk(dev)->private_data;
^
drivers/nvme/host/core.c:1425:39: error: invalid type argument of '->' (have 'int')
struct nvme_ns *ns = dev_to_disk(dev)->private_data;
^
drivers/nvme/host/core.c: In function 'uuid_show':
drivers/nvme/host/core.c:1449:39: error: invalid type argument of '->' (have 'int')
struct nvme_ns *ns = dev_to_disk(dev)->private_data;
^
drivers/nvme/host/core.c: In function 'eui_show':
drivers/nvme/host/core.c:1457:39: error: invalid type argument of '->' (have 'int')
struct nvme_ns *ns = dev_to_disk(dev)->private_data;
^
drivers/nvme/host/core.c: In function 'nsid_show':
drivers/nvme/host/core.c:1465:39: error: invalid type argument of '->' (have 'int')
struct nvme_ns *ns = dev_to_disk(dev)->private_data;
^
drivers/nvme/host/core.c: In function 'nvme_ns_attrs_are_visible':
drivers/nvme/host/core.c:1482:39: error: invalid type argument of '->' (have 'int')
struct nvme_ns *ns = dev_to_disk(dev)->private_data;
^
drivers/nvme/host/core.c: In function 'nvme_alloc_ns':
drivers/nvme/host/core.c:1655:26: error: 'QUEUE_FLAG_NONROT' undeclared (first use in this function)
queue_flag_set_unlocked(QUEUE_FLAG_NONROT, ns->queue);
^
drivers/nvme/host/core.c:1656:11: error: dereferencing pointer to incomplete type
ns->queue->queuedata = ns;
^
drivers/nvme/host/core.c:1659:2: error: implicit declaration of function 'alloc_disk_node' [-Werror=implicit-function-declaration]
disk = alloc_disk_node(0, node);
^
drivers/nvme/host/core.c:1659:7: warning: assignment makes pointer from integer without a cast [enabled by default]
disk = alloc_disk_node(0, node);
^
drivers/nvme/host/core.c:1672:6: error: dereferencing pointer to incomplete type
disk->fops = &nvme_fops;
^
drivers/nvme/host/core.c:1673:6: error: dereferencing pointer to incomplete type
disk->private_data = ns;
^
drivers/nvme/host/core.c:1674:6: error: dereferencing pointer to incomplete type
disk->queue = ns->queue;
^
drivers/nvme/host/core.c:1675:6: error: dereferencing pointer to incomplete type
disk->flags = GENHD_FL_EXT_DEVT;
^
drivers/nvme/host/core.c:1675:16: error: 'GENHD_FL_EXT_DEVT' undeclared (first use in this function)
disk->flags = GENHD_FL_EXT_DEVT;
^
drivers/nvme/host/core.c:1676:14: error: dereferencing pointer to incomplete type
sprintf(disk->disk_name, "nvme%dn%d", ctrl->instance, ns->instance);
^
drivers/nvme/host/core.c:1689:2: error: implicit declaration of function 'device_add_disk' [-Werror=implicit-function-declaration]
device_add_disk(ctrl->device, ns->disk);
^
drivers/nvme/host/core.c:1690:47: error: invalid type argument of '->' (have 'int')
if (sysfs_create_group(&disk_to_dev(ns->disk)->kobj,
^
In file included from include/linux/kernel.h:13:0,
from include/linux/sched.h:17,
from include/linux/blkdev.h:4,
from drivers/nvme/host/core.c:15:
drivers/nvme/host/core.c:1693:12: error: dereferencing pointer to incomplete type
ns->disk->disk_name);
^
include/linux/printk.h:269:37: note: in definition of macro 'pr_warning'
printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
^
>> drivers/nvme/host/core.c:1692:3: note: in expansion of macro 'pr_warn'
pr_warn("%s: failed to create sysfs group for identification\n",
^
drivers/nvme/host/core.c:1698:2: error: implicit declaration of function 'blk_cleanup_queue' [-Werror=implicit-function-declaration]
blk_cleanup_queue(ns->queue);
^
drivers/nvme/host/core.c: In function 'nvme_ns_remove':
drivers/nvme/host/core.c:1710:14: error: dereferencing pointer to incomplete type
if (ns->disk->flags & GENHD_FL_UP) {
^
drivers/nvme/host/core.c:1710:24: error: 'GENHD_FL_UP' undeclared (first use in this function)
if (ns->disk->flags & GENHD_FL_UP) {
^
drivers/nvme/host/core.c:1713:44: error: invalid type argument of '->' (have 'int')
sysfs_remove_group(&disk_to_dev(ns->disk)->kobj,
^
drivers/nvme/host/core.c:1715:3: error: implicit declaration of function 'del_gendisk' [-Werror=implicit-function-declaration]
del_gendisk(ns->disk);
^
drivers/nvme/host/core.c: In function 'nvme_validate_ns':
drivers/nvme/host/core.c:1733:3: error: implicit declaration of function 'revalidate_disk' [-Werror=implicit-function-declaration]
if (revalidate_disk(ns->disk))
^
drivers/nvme/host/core.c: In function 'nvme_kill_queues':
drivers/nvme/host/core.c:2041:3: error: implicit declaration of function 'blk_set_queue_dying' [-Werror=implicit-function-declaration]
blk_set_queue_dying(ns->queue);
^
drivers/nvme/host/core.c: In function 'nvme_stop_queues':
drivers/nvme/host/core.c:2055:26: error: dereferencing pointer to incomplete type
spin_lock_irq(ns->queue->queue_lock);
^
drivers/nvme/host/core.c:2056:3: error: implicit declaration of function 'queue_flag_set' [-Werror=implicit-function-declaration]
queue_flag_set(QUEUE_FLAG_STOPPED, ns->queue);
^
drivers/nvme/host/core.c:2056:18: error: 'QUEUE_FLAG_STOPPED' undeclared (first use in this function)
queue_flag_set(QUEUE_FLAG_STOPPED, ns->queue);
^
drivers/nvme/host/core.c:2057:28: error: dereferencing pointer to incomplete type
spin_unlock_irq(ns->queue->queue_lock);
^
drivers/nvme/host/core.c: In function 'nvme_start_queues':
drivers/nvme/host/core.c:2072:3: error: implicit declaration of function 'queue_flag_clear_unlocked' [-Werror=implicit-function-declaration]
queue_flag_clear_unlocked(QUEUE_FLAG_STOPPED, ns->queue);
^
drivers/nvme/host/core.c:2072:29: error: 'QUEUE_FLAG_STOPPED' undeclared (first use in this function)
queue_flag_clear_unlocked(QUEUE_FLAG_STOPPED, ns->queue);
^
cc1: some warnings being treated as errors
..
vim +/spin_lock_irqsave +202 drivers/nvme/host/core.c
21d34711e Christoph Hellwig 2015-11-26 9 * This program is distributed in the hope it will be useful, but WITHOUT
21d34711e Christoph Hellwig 2015-11-26 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21d34711e Christoph Hellwig 2015-11-26 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
21d34711e Christoph Hellwig 2015-11-26 12 * more details.
21d34711e Christoph Hellwig 2015-11-26 13 */
21d34711e Christoph Hellwig 2015-11-26 14
21d34711e Christoph Hellwig 2015-11-26 @15 #include <linux/blkdev.h>
21d34711e Christoph Hellwig 2015-11-26 16 #include <linux/blk-mq.h>
5fd4ce1b0 Christoph Hellwig 2015-11-28 17 #include <linux/delay.h>
21d34711e Christoph Hellwig 2015-11-26 18 #include <linux/errno.h>
1673f1f08 Christoph Hellwig 2015-11-26 19 #include <linux/hdreg.h>
21d34711e Christoph Hellwig 2015-11-26 20 #include <linux/kernel.h>
5bae7f73d Christoph Hellwig 2015-11-28 21 #include <linux/module.h>
5bae7f73d Christoph Hellwig 2015-11-28 22 #include <linux/list_sort.h>
21d34711e Christoph Hellwig 2015-11-26 23 #include <linux/slab.h>
21d34711e Christoph Hellwig 2015-11-26 24 #include <linux/types.h>
1673f1f08 Christoph Hellwig 2015-11-26 25 #include <linux/pr.h>
1673f1f08 Christoph Hellwig 2015-11-26 26 #include <linux/ptrace.h>
1673f1f08 Christoph Hellwig 2015-11-26 27 #include <linux/nvme_ioctl.h>
1673f1f08 Christoph Hellwig 2015-11-26 28 #include <linux/t10-pi.h>
1673f1f08 Christoph Hellwig 2015-11-26 29 #include <scsi/sg.h>
1673f1f08 Christoph Hellwig 2015-11-26 30 #include <asm/unaligned.h>
21d34711e Christoph Hellwig 2015-11-26 31
21d34711e Christoph Hellwig 2015-11-26 32 #include "nvme.h"
038bd4cb6 Sagi Grimberg 2016-06-13 33 #include "fabrics.h"
21d34711e Christoph Hellwig 2015-11-26 34
f3ca80fc1 Christoph Hellwig 2015-11-28 35 #define NVME_MINORS (1U << MINORBITS)
f3ca80fc1 Christoph Hellwig 2015-11-28 36
ba0ba7d3e Ming Lin 2016-02-10 37 unsigned char admin_timeout = 60;
ba0ba7d3e Ming Lin 2016-02-10 38 module_param(admin_timeout, byte, 0644);
ba0ba7d3e Ming Lin 2016-02-10 39 MODULE_PARM_DESC(admin_timeout, "timeout in seconds for admin commands");
576d55d62 Ming Lin 2016-02-10 40 EXPORT_SYMBOL_GPL(admin_timeout);
ba0ba7d3e Ming Lin 2016-02-10 41
ba0ba7d3e Ming Lin 2016-02-10 42 unsigned char nvme_io_timeout = 30;
ba0ba7d3e Ming Lin 2016-02-10 43 module_param_named(io_timeout, nvme_io_timeout, byte, 0644);
ba0ba7d3e Ming Lin 2016-02-10 44 MODULE_PARM_DESC(io_timeout, "timeout in seconds for I/O");
576d55d62 Ming Lin 2016-02-10 45 EXPORT_SYMBOL_GPL(nvme_io_timeout);
ba0ba7d3e Ming Lin 2016-02-10 46
ba0ba7d3e Ming Lin 2016-02-10 47 unsigned char shutdown_timeout = 5;
ba0ba7d3e Ming Lin 2016-02-10 48 module_param(shutdown_timeout, byte, 0644);
ba0ba7d3e Ming Lin 2016-02-10 49 MODULE_PARM_DESC(shutdown_timeout, "timeout in seconds for controller shutdown");
ba0ba7d3e Ming Lin 2016-02-10 50
f80ec966c Keith Busch 2016-07-12 51 unsigned int nvme_max_retries = 5;
f80ec966c Keith Busch 2016-07-12 52 module_param_named(max_retries, nvme_max_retries, uint, 0644);
f80ec966c Keith Busch 2016-07-12 53 MODULE_PARM_DESC(max_retries, "max number of retries a command may have");
f80ec966c Keith Busch 2016-07-12 54 EXPORT_SYMBOL_GPL(nvme_max_retries);
5bae7f73d Christoph Hellwig 2015-11-28 55
f3ca80fc1 Christoph Hellwig 2015-11-28 56 static int nvme_char_major;
f3ca80fc1 Christoph Hellwig 2015-11-28 57 module_param(nvme_char_major, int, 0);
f3ca80fc1 Christoph Hellwig 2015-11-28 58
f3ca80fc1 Christoph Hellwig 2015-11-28 59 static LIST_HEAD(nvme_ctrl_list);
9f2482b91 Ming Lin 2016-02-10 60 static DEFINE_SPINLOCK(dev_list_lock);
1673f1f08 Christoph Hellwig 2015-11-26 61
f3ca80fc1 Christoph Hellwig 2015-11-28 62 static struct class *nvme_class;
f3ca80fc1 Christoph Hellwig 2015-11-28 63
c55a2fd4b Ming Lin 2016-05-18 64 void nvme_cancel_request(struct request *req, void *data, bool reserved)
c55a2fd4b Ming Lin 2016-05-18 65 {
c55a2fd4b Ming Lin 2016-05-18 66 int status;
c55a2fd4b Ming Lin 2016-05-18 67
c55a2fd4b Ming Lin 2016-05-18 68 if (!blk_mq_request_started(req))
c55a2fd4b Ming Lin 2016-05-18 69 return;
c55a2fd4b Ming Lin 2016-05-18 70
c55a2fd4b Ming Lin 2016-05-18 71 dev_dbg_ratelimited(((struct nvme_ctrl *) data)->device,
c55a2fd4b Ming Lin 2016-05-18 72 "Cancelling I/O %d", req->tag);
c55a2fd4b Ming Lin 2016-05-18 73
c55a2fd4b Ming Lin 2016-05-18 74 status = NVME_SC_ABORT_REQ;
c55a2fd4b Ming Lin 2016-05-18 75 if (blk_queue_dying(req->q))
c55a2fd4b Ming Lin 2016-05-18 76 status |= NVME_SC_DNR;
c55a2fd4b Ming Lin 2016-05-18 77 blk_mq_complete_request(req, status);
c55a2fd4b Ming Lin 2016-05-18 78 }
c55a2fd4b Ming Lin 2016-05-18 79 EXPORT_SYMBOL_GPL(nvme_cancel_request);
c55a2fd4b Ming Lin 2016-05-18 80
bb8d261e0 Christoph Hellwig 2016-04-26 81 bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl,
bb8d261e0 Christoph Hellwig 2016-04-26 82 enum nvme_ctrl_state new_state)
bb8d261e0 Christoph Hellwig 2016-04-26 83 {
bb8d261e0 Christoph Hellwig 2016-04-26 84 enum nvme_ctrl_state old_state = ctrl->state;
bb8d261e0 Christoph Hellwig 2016-04-26 85 bool changed = false;
bb8d261e0 Christoph Hellwig 2016-04-26 86
bb8d261e0 Christoph Hellwig 2016-04-26 87 spin_lock_irq(&ctrl->lock);
bb8d261e0 Christoph Hellwig 2016-04-26 88 switch (new_state) {
bb8d261e0 Christoph Hellwig 2016-04-26 89 case NVME_CTRL_LIVE:
bb8d261e0 Christoph Hellwig 2016-04-26 90 switch (old_state) {
7d2e80080 Christoph Hellwig 2016-06-13 91 case NVME_CTRL_NEW:
bb8d261e0 Christoph Hellwig 2016-04-26 92 case NVME_CTRL_RESETTING:
def61eca9 Christoph Hellwig 2016-07-06 93 case NVME_CTRL_RECONNECTING:
bb8d261e0 Christoph Hellwig 2016-04-26 94 changed = true;
bb8d261e0 Christoph Hellwig 2016-04-26 95 /* FALLTHRU */
bb8d261e0 Christoph Hellwig 2016-04-26 96 default:
bb8d261e0 Christoph Hellwig 2016-04-26 97 break;
bb8d261e0 Christoph Hellwig 2016-04-26 98 }
bb8d261e0 Christoph Hellwig 2016-04-26 99 break;
bb8d261e0 Christoph Hellwig 2016-04-26 100 case NVME_CTRL_RESETTING:
bb8d261e0 Christoph Hellwig 2016-04-26 101 switch (old_state) {
bb8d261e0 Christoph Hellwig 2016-04-26 102 case NVME_CTRL_NEW:
bb8d261e0 Christoph Hellwig 2016-04-26 103 case NVME_CTRL_LIVE:
def61eca9 Christoph Hellwig 2016-07-06 104 case NVME_CTRL_RECONNECTING:
def61eca9 Christoph Hellwig 2016-07-06 105 changed = true;
def61eca9 Christoph Hellwig 2016-07-06 106 /* FALLTHRU */
def61eca9 Christoph Hellwig 2016-07-06 107 default:
def61eca9 Christoph Hellwig 2016-07-06 108 break;
def61eca9 Christoph Hellwig 2016-07-06 109 }
def61eca9 Christoph Hellwig 2016-07-06 110 break;
def61eca9 Christoph Hellwig 2016-07-06 111 case NVME_CTRL_RECONNECTING:
def61eca9 Christoph Hellwig 2016-07-06 112 switch (old_state) {
def61eca9 Christoph Hellwig 2016-07-06 113 case NVME_CTRL_LIVE:
bb8d261e0 Christoph Hellwig 2016-04-26 114 changed = true;
bb8d261e0 Christoph Hellwig 2016-04-26 115 /* FALLTHRU */
bb8d261e0 Christoph Hellwig 2016-04-26 116 default:
bb8d261e0 Christoph Hellwig 2016-04-26 117 break;
bb8d261e0 Christoph Hellwig 2016-04-26 118 }
bb8d261e0 Christoph Hellwig 2016-04-26 119 break;
bb8d261e0 Christoph Hellwig 2016-04-26 120 case NVME_CTRL_DELETING:
bb8d261e0 Christoph Hellwig 2016-04-26 121 switch (old_state) {
bb8d261e0 Christoph Hellwig 2016-04-26 122 case NVME_CTRL_LIVE:
bb8d261e0 Christoph Hellwig 2016-04-26 123 case NVME_CTRL_RESETTING:
def61eca9 Christoph Hellwig 2016-07-06 124 case NVME_CTRL_RECONNECTING:
bb8d261e0 Christoph Hellwig 2016-04-26 125 changed = true;
bb8d261e0 Christoph Hellwig 2016-04-26 126 /* FALLTHRU */
bb8d261e0 Christoph Hellwig 2016-04-26 127 default:
bb8d261e0 Christoph Hellwig 2016-04-26 128 break;
bb8d261e0 Christoph Hellwig 2016-04-26 129 }
bb8d261e0 Christoph Hellwig 2016-04-26 130 break;
0ff9d4e1a Keith Busch 2016-05-12 131 case NVME_CTRL_DEAD:
0ff9d4e1a Keith Busch 2016-05-12 132 switch (old_state) {
0ff9d4e1a Keith Busch 2016-05-12 133 case NVME_CTRL_DELETING:
0ff9d4e1a Keith Busch 2016-05-12 134 changed = true;
0ff9d4e1a Keith Busch 2016-05-12 135 /* FALLTHRU */
0ff9d4e1a Keith Busch 2016-05-12 136 default:
0ff9d4e1a Keith Busch 2016-05-12 137 break;
0ff9d4e1a Keith Busch 2016-05-12 138 }
0ff9d4e1a Keith Busch 2016-05-12 139 break;
bb8d261e0 Christoph Hellwig 2016-04-26 140 default:
bb8d261e0 Christoph Hellwig 2016-04-26 141 break;
bb8d261e0 Christoph Hellwig 2016-04-26 142 }
bb8d261e0 Christoph Hellwig 2016-04-26 143 spin_unlock_irq(&ctrl->lock);
bb8d261e0 Christoph Hellwig 2016-04-26 144
bb8d261e0 Christoph Hellwig 2016-04-26 145 if (changed)
bb8d261e0 Christoph Hellwig 2016-04-26 146 ctrl->state = new_state;
bb8d261e0 Christoph Hellwig 2016-04-26 147
bb8d261e0 Christoph Hellwig 2016-04-26 148 return changed;
bb8d261e0 Christoph Hellwig 2016-04-26 149 }
bb8d261e0 Christoph Hellwig 2016-04-26 150 EXPORT_SYMBOL_GPL(nvme_change_ctrl_state);
bb8d261e0 Christoph Hellwig 2016-04-26 151
1673f1f08 Christoph Hellwig 2015-11-26 152 static void nvme_free_ns(struct kref *kref)
1673f1f08 Christoph Hellwig 2015-11-26 153 {
1673f1f08 Christoph Hellwig 2015-11-26 154 struct nvme_ns *ns = container_of(kref, struct nvme_ns, kref);
1673f1f08 Christoph Hellwig 2015-11-26 155
1673f1f08 Christoph Hellwig 2015-11-26 156 if (ns->type == NVME_NS_LIGHTNVM)
1673f1f08 Christoph Hellwig 2015-11-26 157 nvme_nvm_unregister(ns->queue, ns->disk->disk_name);
1673f1f08 Christoph Hellwig 2015-11-26 158
1673f1f08 Christoph Hellwig 2015-11-26 159 spin_lock(&dev_list_lock);
1673f1f08 Christoph Hellwig 2015-11-26 160 ns->disk->private_data = NULL;
1673f1f08 Christoph Hellwig 2015-11-26 161 spin_unlock(&dev_list_lock);
1673f1f08 Christoph Hellwig 2015-11-26 162
1673f1f08 Christoph Hellwig 2015-11-26 163 put_disk(ns->disk);
075790ebb Keith Busch 2016-02-24 164 ida_simple_remove(&ns->ctrl->ns_ida, ns->instance);
075790ebb Keith Busch 2016-02-24 165 nvme_put_ctrl(ns->ctrl);
1673f1f08 Christoph Hellwig 2015-11-26 166 kfree(ns);
1673f1f08 Christoph Hellwig 2015-11-26 167 }
1673f1f08 Christoph Hellwig 2015-11-26 168
5bae7f73d Christoph Hellwig 2015-11-28 169 static void nvme_put_ns(struct nvme_ns *ns)
1673f1f08 Christoph Hellwig 2015-11-26 170 {
1673f1f08 Christoph Hellwig 2015-11-26 171 kref_put(&ns->kref, nvme_free_ns);
1673f1f08 Christoph Hellwig 2015-11-26 172 }
1673f1f08 Christoph Hellwig 2015-11-26 173
1673f1f08 Christoph Hellwig 2015-11-26 174 static struct nvme_ns *nvme_get_ns_from_disk(struct gendisk *disk)
1673f1f08 Christoph Hellwig 2015-11-26 175 {
1673f1f08 Christoph Hellwig 2015-11-26 176 struct nvme_ns *ns;
1673f1f08 Christoph Hellwig 2015-11-26 177
1673f1f08 Christoph Hellwig 2015-11-26 178 spin_lock(&dev_list_lock);
1673f1f08 Christoph Hellwig 2015-11-26 179 ns = disk->private_data;
e439bb12e Sagi Grimberg 2016-02-10 180 if (ns) {
e439bb12e Sagi Grimberg 2016-02-10 181 if (!kref_get_unless_zero(&ns->kref))
e439bb12e Sagi Grimberg 2016-02-10 182 goto fail;
e439bb12e Sagi Grimberg 2016-02-10 183 if (!try_module_get(ns->ctrl->ops->module))
e439bb12e Sagi Grimberg 2016-02-10 184 goto fail_put_ns;
e439bb12e Sagi Grimberg 2016-02-10 185 }
1673f1f08 Christoph Hellwig 2015-11-26 186 spin_unlock(&dev_list_lock);
1673f1f08 Christoph Hellwig 2015-11-26 187
1673f1f08 Christoph Hellwig 2015-11-26 188 return ns;
e439bb12e Sagi Grimberg 2016-02-10 189
e439bb12e Sagi Grimberg 2016-02-10 190 fail_put_ns:
e439bb12e Sagi Grimberg 2016-02-10 191 kref_put(&ns->kref, nvme_free_ns);
e439bb12e Sagi Grimberg 2016-02-10 192 fail:
e439bb12e Sagi Grimberg 2016-02-10 193 spin_unlock(&dev_list_lock);
e439bb12e Sagi Grimberg 2016-02-10 194 return NULL;
1673f1f08 Christoph Hellwig 2015-11-26 195 }
1673f1f08 Christoph Hellwig 2015-11-26 196
7688faa6d Christoph Hellwig 2015-11-28 197 void nvme_requeue_req(struct request *req)
7688faa6d Christoph Hellwig 2015-11-28 198 {
7688faa6d Christoph Hellwig 2015-11-28 199 unsigned long flags;
7688faa6d Christoph Hellwig 2015-11-28 200
7688faa6d Christoph Hellwig 2015-11-28 201 blk_mq_requeue_request(req);
7688faa6d Christoph Hellwig 2015-11-28 @202 spin_lock_irqsave(req->q->queue_lock, flags);
7688faa6d Christoph Hellwig 2015-11-28 203 if (!blk_queue_stopped(req->q))
7688faa6d Christoph Hellwig 2015-11-28 204 blk_mq_kick_requeue_list(req->q);
7688faa6d Christoph Hellwig 2015-11-28 205 spin_unlock_irqrestore(req->q->queue_lock, flags);
:::::: The code at line 202 was first introduced by commit
:::::: 7688faa6dd2c99ce5d66571d9ad65535ec39e8cb nvme: factor out a few helpers from req_completion
:::::: TO: Christoph Hellwig <hch@....de>
:::::: CC: Jens Axboe <axboe@...com>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Download attachment ".config.gz" of type "application/octet-stream" (25284 bytes)
Powered by blists - more mailing lists