Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
kernel_linux
提交
cbf3a959
K
kernel_linux
项目概览
OpenHarmony
/
kernel_linux
上一次同步 4 年多
通知
15
Star
8
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
kernel_linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
cbf3a959
编写于
1月 05, 2018
作者:
J
Jens Axboe
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'nvme-4.15' of
git://git.infradead.org/nvme
into for-linus
Pull a handful of NVMe fixes from Christoph that should go into 4.15.
上级
454be724
254beb84
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
52 addition
and
25 deletion
+52
-25
drivers/nvme/host/core.c
drivers/nvme/host/core.c
+6
-1
drivers/nvme/host/nvme.h
drivers/nvme/host/nvme.h
+12
-0
drivers/nvme/host/pci.c
drivers/nvme/host/pci.c
+20
-22
drivers/nvme/host/rdma.c
drivers/nvme/host/rdma.c
+13
-1
drivers/nvme/target/fcloop.c
drivers/nvme/target/fcloop.c
+1
-1
未找到文件。
drivers/nvme/host/core.c
浏览文件 @
cbf3a959
...
@@ -1335,6 +1335,7 @@ static void nvme_update_disk_info(struct gendisk *disk,
...
@@ -1335,6 +1335,7 @@ static void nvme_update_disk_info(struct gendisk *disk,
struct
nvme_ns
*
ns
,
struct
nvme_id_ns
*
id
)
struct
nvme_ns
*
ns
,
struct
nvme_id_ns
*
id
)
{
{
sector_t
capacity
=
le64_to_cpup
(
&
id
->
nsze
)
<<
(
ns
->
lba_shift
-
9
);
sector_t
capacity
=
le64_to_cpup
(
&
id
->
nsze
)
<<
(
ns
->
lba_shift
-
9
);
unsigned
short
bs
=
1
<<
ns
->
lba_shift
;
unsigned
stream_alignment
=
0
;
unsigned
stream_alignment
=
0
;
if
(
ns
->
ctrl
->
nr_streams
&&
ns
->
sws
&&
ns
->
sgs
)
if
(
ns
->
ctrl
->
nr_streams
&&
ns
->
sws
&&
ns
->
sgs
)
...
@@ -1343,7 +1344,10 @@ static void nvme_update_disk_info(struct gendisk *disk,
...
@@ -1343,7 +1344,10 @@ static void nvme_update_disk_info(struct gendisk *disk,
blk_mq_freeze_queue
(
disk
->
queue
);
blk_mq_freeze_queue
(
disk
->
queue
);
blk_integrity_unregister
(
disk
);
blk_integrity_unregister
(
disk
);
blk_queue_logical_block_size
(
disk
->
queue
,
1
<<
ns
->
lba_shift
);
blk_queue_logical_block_size
(
disk
->
queue
,
bs
);
blk_queue_physical_block_size
(
disk
->
queue
,
bs
);
blk_queue_io_min
(
disk
->
queue
,
bs
);
if
(
ns
->
ms
&&
!
ns
->
ext
&&
if
(
ns
->
ms
&&
!
ns
->
ext
&&
(
ns
->
ctrl
->
ops
->
flags
&
NVME_F_METADATA_SUPPORTED
))
(
ns
->
ctrl
->
ops
->
flags
&
NVME_F_METADATA_SUPPORTED
))
nvme_init_integrity
(
disk
,
ns
->
ms
,
ns
->
pi_type
);
nvme_init_integrity
(
disk
,
ns
->
ms
,
ns
->
pi_type
);
...
@@ -2987,6 +2991,7 @@ static void nvme_ns_remove(struct nvme_ns *ns)
...
@@ -2987,6 +2991,7 @@ static void nvme_ns_remove(struct nvme_ns *ns)
mutex_unlock
(
&
ns
->
ctrl
->
namespaces_mutex
);
mutex_unlock
(
&
ns
->
ctrl
->
namespaces_mutex
);
synchronize_srcu
(
&
ns
->
head
->
srcu
);
synchronize_srcu
(
&
ns
->
head
->
srcu
);
nvme_mpath_check_last_path
(
ns
);
nvme_put_ns
(
ns
);
nvme_put_ns
(
ns
);
}
}
...
...
drivers/nvme/host/nvme.h
浏览文件 @
cbf3a959
...
@@ -417,6 +417,15 @@ static inline void nvme_mpath_clear_current_path(struct nvme_ns *ns)
...
@@ -417,6 +417,15 @@ static inline void nvme_mpath_clear_current_path(struct nvme_ns *ns)
rcu_assign_pointer
(
head
->
current_path
,
NULL
);
rcu_assign_pointer
(
head
->
current_path
,
NULL
);
}
}
struct
nvme_ns
*
nvme_find_path
(
struct
nvme_ns_head
*
head
);
struct
nvme_ns
*
nvme_find_path
(
struct
nvme_ns_head
*
head
);
static
inline
void
nvme_mpath_check_last_path
(
struct
nvme_ns
*
ns
)
{
struct
nvme_ns_head
*
head
=
ns
->
head
;
if
(
head
->
disk
&&
list_empty
(
&
head
->
list
))
kblockd_schedule_work
(
&
head
->
requeue_work
);
}
#else
#else
static
inline
void
nvme_failover_req
(
struct
request
*
req
)
static
inline
void
nvme_failover_req
(
struct
request
*
req
)
{
{
...
@@ -448,6 +457,9 @@ static inline void nvme_mpath_remove_disk_links(struct nvme_ns *ns)
...
@@ -448,6 +457,9 @@ static inline void nvme_mpath_remove_disk_links(struct nvme_ns *ns)
static
inline
void
nvme_mpath_clear_current_path
(
struct
nvme_ns
*
ns
)
static
inline
void
nvme_mpath_clear_current_path
(
struct
nvme_ns
*
ns
)
{
{
}
}
static
inline
void
nvme_mpath_check_last_path
(
struct
nvme_ns
*
ns
)
{
}
#endif
/* CONFIG_NVME_MULTIPATH */
#endif
/* CONFIG_NVME_MULTIPATH */
#ifdef CONFIG_NVM
#ifdef CONFIG_NVM
...
...
drivers/nvme/host/pci.c
浏览文件 @
cbf3a959
...
@@ -448,12 +448,31 @@ static void **nvme_pci_iod_list(struct request *req)
...
@@ -448,12 +448,31 @@ static void **nvme_pci_iod_list(struct request *req)
return
(
void
**
)(
iod
->
sg
+
blk_rq_nr_phys_segments
(
req
));
return
(
void
**
)(
iod
->
sg
+
blk_rq_nr_phys_segments
(
req
));
}
}
static
inline
bool
nvme_pci_use_sgls
(
struct
nvme_dev
*
dev
,
struct
request
*
req
)
{
struct
nvme_iod
*
iod
=
blk_mq_rq_to_pdu
(
req
);
unsigned
int
avg_seg_size
;
avg_seg_size
=
DIV_ROUND_UP
(
blk_rq_payload_bytes
(
req
),
blk_rq_nr_phys_segments
(
req
));
if
(
!
(
dev
->
ctrl
.
sgls
&
((
1
<<
0
)
|
(
1
<<
1
))))
return
false
;
if
(
!
iod
->
nvmeq
->
qid
)
return
false
;
if
(
!
sgl_threshold
||
avg_seg_size
<
sgl_threshold
)
return
false
;
return
true
;
}
static
blk_status_t
nvme_init_iod
(
struct
request
*
rq
,
struct
nvme_dev
*
dev
)
static
blk_status_t
nvme_init_iod
(
struct
request
*
rq
,
struct
nvme_dev
*
dev
)
{
{
struct
nvme_iod
*
iod
=
blk_mq_rq_to_pdu
(
rq
);
struct
nvme_iod
*
iod
=
blk_mq_rq_to_pdu
(
rq
);
int
nseg
=
blk_rq_nr_phys_segments
(
rq
);
int
nseg
=
blk_rq_nr_phys_segments
(
rq
);
unsigned
int
size
=
blk_rq_payload_bytes
(
rq
);
unsigned
int
size
=
blk_rq_payload_bytes
(
rq
);
iod
->
use_sgl
=
nvme_pci_use_sgls
(
dev
,
rq
);
if
(
nseg
>
NVME_INT_PAGES
||
size
>
NVME_INT_BYTES
(
dev
))
{
if
(
nseg
>
NVME_INT_PAGES
||
size
>
NVME_INT_BYTES
(
dev
))
{
size_t
alloc_size
=
nvme_pci_iod_alloc_size
(
dev
,
size
,
nseg
,
size_t
alloc_size
=
nvme_pci_iod_alloc_size
(
dev
,
size
,
nseg
,
iod
->
use_sgl
);
iod
->
use_sgl
);
...
@@ -604,8 +623,6 @@ static blk_status_t nvme_pci_setup_prps(struct nvme_dev *dev,
...
@@ -604,8 +623,6 @@ static blk_status_t nvme_pci_setup_prps(struct nvme_dev *dev,
dma_addr_t
prp_dma
;
dma_addr_t
prp_dma
;
int
nprps
,
i
;
int
nprps
,
i
;
iod
->
use_sgl
=
false
;
length
-=
(
page_size
-
offset
);
length
-=
(
page_size
-
offset
);
if
(
length
<=
0
)
{
if
(
length
<=
0
)
{
iod
->
first_dma
=
0
;
iod
->
first_dma
=
0
;
...
@@ -715,8 +732,6 @@ static blk_status_t nvme_pci_setup_sgls(struct nvme_dev *dev,
...
@@ -715,8 +732,6 @@ static blk_status_t nvme_pci_setup_sgls(struct nvme_dev *dev,
int
entries
=
iod
->
nents
,
i
=
0
;
int
entries
=
iod
->
nents
,
i
=
0
;
dma_addr_t
sgl_dma
;
dma_addr_t
sgl_dma
;
iod
->
use_sgl
=
true
;
/* setting the transfer type as SGL */
/* setting the transfer type as SGL */
cmd
->
flags
=
NVME_CMD_SGL_METABUF
;
cmd
->
flags
=
NVME_CMD_SGL_METABUF
;
...
@@ -770,23 +785,6 @@ static blk_status_t nvme_pci_setup_sgls(struct nvme_dev *dev,
...
@@ -770,23 +785,6 @@ static blk_status_t nvme_pci_setup_sgls(struct nvme_dev *dev,
return
BLK_STS_OK
;
return
BLK_STS_OK
;
}
}
static
inline
bool
nvme_pci_use_sgls
(
struct
nvme_dev
*
dev
,
struct
request
*
req
)
{
struct
nvme_iod
*
iod
=
blk_mq_rq_to_pdu
(
req
);
unsigned
int
avg_seg_size
;
avg_seg_size
=
DIV_ROUND_UP
(
blk_rq_payload_bytes
(
req
),
blk_rq_nr_phys_segments
(
req
));
if
(
!
(
dev
->
ctrl
.
sgls
&
((
1
<<
0
)
|
(
1
<<
1
))))
return
false
;
if
(
!
iod
->
nvmeq
->
qid
)
return
false
;
if
(
!
sgl_threshold
||
avg_seg_size
<
sgl_threshold
)
return
false
;
return
true
;
}
static
blk_status_t
nvme_map_data
(
struct
nvme_dev
*
dev
,
struct
request
*
req
,
static
blk_status_t
nvme_map_data
(
struct
nvme_dev
*
dev
,
struct
request
*
req
,
struct
nvme_command
*
cmnd
)
struct
nvme_command
*
cmnd
)
{
{
...
@@ -806,7 +804,7 @@ static blk_status_t nvme_map_data(struct nvme_dev *dev, struct request *req,
...
@@ -806,7 +804,7 @@ static blk_status_t nvme_map_data(struct nvme_dev *dev, struct request *req,
DMA_ATTR_NO_WARN
))
DMA_ATTR_NO_WARN
))
goto
out
;
goto
out
;
if
(
nvme_pci_use_sgls
(
dev
,
req
)
)
if
(
iod
->
use_sgl
)
ret
=
nvme_pci_setup_sgls
(
dev
,
req
,
&
cmnd
->
rw
);
ret
=
nvme_pci_setup_sgls
(
dev
,
req
,
&
cmnd
->
rw
);
else
else
ret
=
nvme_pci_setup_prps
(
dev
,
req
,
&
cmnd
->
rw
);
ret
=
nvme_pci_setup_prps
(
dev
,
req
,
&
cmnd
->
rw
);
...
...
drivers/nvme/host/rdma.c
浏览文件 @
cbf3a959
...
@@ -974,12 +974,18 @@ static void nvme_rdma_error_recovery_work(struct work_struct *work)
...
@@ -974,12 +974,18 @@ static void nvme_rdma_error_recovery_work(struct work_struct *work)
blk_mq_unquiesce_queue
(
ctrl
->
ctrl
.
admin_q
);
blk_mq_unquiesce_queue
(
ctrl
->
ctrl
.
admin_q
);
nvme_start_queues
(
&
ctrl
->
ctrl
);
nvme_start_queues
(
&
ctrl
->
ctrl
);
if
(
!
nvme_change_ctrl_state
(
&
ctrl
->
ctrl
,
NVME_CTRL_RECONNECTING
))
{
/* state change failure should never happen */
WARN_ON_ONCE
(
1
);
return
;
}
nvme_rdma_reconnect_or_remove
(
ctrl
);
nvme_rdma_reconnect_or_remove
(
ctrl
);
}
}
static
void
nvme_rdma_error_recovery
(
struct
nvme_rdma_ctrl
*
ctrl
)
static
void
nvme_rdma_error_recovery
(
struct
nvme_rdma_ctrl
*
ctrl
)
{
{
if
(
!
nvme_change_ctrl_state
(
&
ctrl
->
ctrl
,
NVME_CTRL_RE
CONNEC
TING
))
if
(
!
nvme_change_ctrl_state
(
&
ctrl
->
ctrl
,
NVME_CTRL_RE
SET
TING
))
return
;
return
;
queue_work
(
nvme_wq
,
&
ctrl
->
err_work
);
queue_work
(
nvme_wq
,
&
ctrl
->
err_work
);
...
@@ -1753,6 +1759,12 @@ static void nvme_rdma_reset_ctrl_work(struct work_struct *work)
...
@@ -1753,6 +1759,12 @@ static void nvme_rdma_reset_ctrl_work(struct work_struct *work)
nvme_stop_ctrl
(
&
ctrl
->
ctrl
);
nvme_stop_ctrl
(
&
ctrl
->
ctrl
);
nvme_rdma_shutdown_ctrl
(
ctrl
,
false
);
nvme_rdma_shutdown_ctrl
(
ctrl
,
false
);
if
(
!
nvme_change_ctrl_state
(
&
ctrl
->
ctrl
,
NVME_CTRL_RECONNECTING
))
{
/* state change failure should never happen */
WARN_ON_ONCE
(
1
);
return
;
}
ret
=
nvme_rdma_configure_admin_queue
(
ctrl
,
false
);
ret
=
nvme_rdma_configure_admin_queue
(
ctrl
,
false
);
if
(
ret
)
if
(
ret
)
goto
out_fail
;
goto
out_fail
;
...
...
drivers/nvme/target/fcloop.c
浏览文件 @
cbf3a959
...
@@ -1085,7 +1085,7 @@ fcloop_delete_target_port(struct device *dev, struct device_attribute *attr,
...
@@ -1085,7 +1085,7 @@ fcloop_delete_target_port(struct device *dev, struct device_attribute *attr,
const
char
*
buf
,
size_t
count
)
const
char
*
buf
,
size_t
count
)
{
{
struct
fcloop_nport
*
nport
=
NULL
,
*
tmpport
;
struct
fcloop_nport
*
nport
=
NULL
,
*
tmpport
;
struct
fcloop_tport
*
tport
;
struct
fcloop_tport
*
tport
=
NULL
;
u64
nodename
,
portname
;
u64
nodename
,
portname
;
unsigned
long
flags
;
unsigned
long
flags
;
int
ret
;
int
ret
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录