Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
1b23484b
cloud-kernel
项目概览
openanolis
/
cloud-kernel
1 年多 前同步成功
通知
160
Star
36
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
1b23484b
编写于
1月 20, 2011
作者:
M
Matthew Wilcox
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
NVMe: Implement per-CPU queues
Signed-off-by:
N
Matthew Wilcox
<
matthew.r.wilcox@intel.com
>
上级
b3b06812
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
50 addition
and
11 deletion
+50
-11
drivers/block/nvme.c
drivers/block/nvme.c
+50
-11
未找到文件。
drivers/block/nvme.c
浏览文件 @
1b23484b
...
@@ -172,11 +172,17 @@ static unsigned long free_cmdid(struct nvme_queue *nvmeq, int cmdid)
...
@@ -172,11 +172,17 @@ static unsigned long free_cmdid(struct nvme_queue *nvmeq, int cmdid)
static
struct
nvme_queue
*
get_nvmeq
(
struct
nvme_ns
*
ns
)
static
struct
nvme_queue
*
get_nvmeq
(
struct
nvme_ns
*
ns
)
{
{
return
ns
->
dev
->
queues
[
1
];
int
qid
,
cpu
=
get_cpu
();
if
(
cpu
<
ns
->
dev
->
queue_count
)
qid
=
cpu
+
1
;
else
qid
=
(
cpu
%
rounddown_pow_of_two
(
ns
->
dev
->
queue_count
))
+
1
;
return
ns
->
dev
->
queues
[
qid
];
}
}
static
void
put_nvmeq
(
struct
nvme_queue
*
nvmeq
)
static
void
put_nvmeq
(
struct
nvme_queue
*
nvmeq
)
{
{
put_cpu
();
}
}
/**
/**
...
@@ -795,19 +801,51 @@ static int set_queue_count(struct nvme_dev *dev, int count)
...
@@ -795,19 +801,51 @@ static int set_queue_count(struct nvme_dev *dev, int count)
return
min
(
result
&
0xffff
,
result
>>
16
)
+
1
;
return
min
(
result
&
0xffff
,
result
>>
16
)
+
1
;
}
}
/* XXX: Create per-CPU queues */
static
int
__devinit
nvme_setup_io_queues
(
struct
nvme_dev
*
dev
)
static
int
__devinit
nvme_setup_io_queues
(
struct
nvme_dev
*
dev
)
{
{
int
this_cpu
;
int
result
,
cpu
,
i
,
nr_queues
;
set_queue_count
(
dev
,
1
);
nr_queues
=
num_online_cpus
();
result
=
set_queue_count
(
dev
,
nr_queues
);
if
(
result
<
0
)
return
result
;
if
(
result
<
nr_queues
)
nr_queues
=
result
;
this_cpu
=
get_cpu
();
/* Deregister the admin queue's interrupt */
dev
->
queues
[
1
]
=
nvme_create_queue
(
dev
,
1
,
NVME_Q_DEPTH
,
this_cpu
);
free_irq
(
dev
->
entry
[
0
].
vector
,
dev
->
queues
[
0
]);
put_cpu
();
if
(
!
dev
->
queues
[
1
])
for
(
i
=
0
;
i
<
nr_queues
;
i
++
)
return
-
ENOMEM
;
dev
->
entry
[
i
].
entry
=
i
;
dev
->
queue_count
++
;
for
(;;)
{
result
=
pci_enable_msix
(
dev
->
pci_dev
,
dev
->
entry
,
nr_queues
);
if
(
result
==
0
)
{
break
;
}
else
if
(
result
>
0
)
{
nr_queues
=
result
;
continue
;
}
else
{
nr_queues
=
1
;
break
;
}
}
result
=
queue_request_irq
(
dev
,
dev
->
queues
[
0
],
"nvme admin"
);
/* XXX: handle failure here */
cpu
=
cpumask_first
(
cpu_online_mask
);
for
(
i
=
0
;
i
<
nr_queues
;
i
++
)
{
irq_set_affinity_hint
(
dev
->
entry
[
i
].
vector
,
get_cpu_mask
(
cpu
));
cpu
=
cpumask_next
(
cpu
,
cpu_online_mask
);
}
for
(
i
=
0
;
i
<
nr_queues
;
i
++
)
{
dev
->
queues
[
i
+
1
]
=
nvme_create_queue
(
dev
,
i
+
1
,
NVME_Q_DEPTH
,
i
);
if
(
!
dev
->
queues
[
i
+
1
])
return
-
ENOMEM
;
dev
->
queue_count
++
;
}
return
0
;
return
0
;
}
}
...
@@ -931,7 +969,8 @@ static int __devinit nvme_probe(struct pci_dev *pdev,
...
@@ -931,7 +969,8 @@ static int __devinit nvme_probe(struct pci_dev *pdev,
GFP_KERNEL
);
GFP_KERNEL
);
if
(
!
dev
->
entry
)
if
(
!
dev
->
entry
)
goto
free
;
goto
free
;
dev
->
queues
=
kcalloc
(
2
,
sizeof
(
void
*
),
GFP_KERNEL
);
dev
->
queues
=
kcalloc
(
num_possible_cpus
()
+
1
,
sizeof
(
void
*
),
GFP_KERNEL
);
if
(
!
dev
->
queues
)
if
(
!
dev
->
queues
)
goto
free
;
goto
free
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录