Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
c5478def
R
raspberrypi-kernel
项目概览
openeuler
/
raspberrypi-kernel
通知
13
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
raspberrypi-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
c5478def
编写于
9月 06, 2005
作者:
C
Christoph Hellwig
提交者:
James Bottomley
9月 06, 2005
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[SCSI] switch EH thread startup to the kthread API
Signed-off-by:
N
James Bottomley
<
James.Bottomley@SteelEye.com
>
上级
32993523
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
10 addition
and
44 deletion
+10
-44
drivers/scsi/hosts.c
drivers/scsi/hosts.c
+8
-15
drivers/scsi/scsi_error.c
drivers/scsi/scsi_error.c
+2
-27
include/scsi/scsi_host.h
include/scsi/scsi_host.h
+0
-2
未找到文件。
drivers/scsi/hosts.c
浏览文件 @
c5478def
...
...
@@ -24,6 +24,7 @@
#include <linux/module.h>
#include <linux/blkdev.h>
#include <linux/kernel.h>
#include <linux/kthread.h>
#include <linux/string.h>
#include <linux/mm.h>
#include <linux/init.h>
...
...
@@ -225,15 +226,8 @@ static void scsi_host_dev_release(struct device *dev)
struct
Scsi_Host
*
shost
=
dev_to_shost
(
dev
);
struct
device
*
parent
=
dev
->
parent
;
if
(
shost
->
ehandler
)
{
DECLARE_COMPLETION
(
sem
);
shost
->
eh_notify
=
&
sem
;
shost
->
eh_kill
=
1
;
up
(
shost
->
eh_wait
);
wait_for_completion
(
&
sem
);
shost
->
eh_notify
=
NULL
;
}
if
(
shost
->
ehandler
)
kthread_stop
(
shost
->
ehandler
);
if
(
shost
->
work_q
)
destroy_workqueue
(
shost
->
work_q
);
...
...
@@ -263,7 +257,6 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
{
struct
Scsi_Host
*
shost
;
int
gfp_mask
=
GFP_KERNEL
,
rval
;
DECLARE_COMPLETION
(
complete
);
if
(
sht
->
unchecked_isa_dma
&&
privsize
)
gfp_mask
|=
__GFP_DMA
;
...
...
@@ -369,12 +362,12 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
snprintf
(
shost
->
shost_classdev
.
class_id
,
BUS_ID_SIZE
,
"host%d"
,
shost
->
host_no
);
shost
->
eh_notify
=
&
complete
;
rval
=
kernel_thread
(
scsi_error_handler
,
shost
,
0
);
if
(
rval
<
0
)
shost
->
ehandler
=
kthread_run
(
scsi_error_handler
,
shost
,
"scsi_eh_%d"
,
shost
->
host_no
);
if
(
IS_ERR
(
shost
->
ehandler
))
{
rval
=
PTR_ERR
(
shost
->
ehandler
);
goto
fail_destroy_freelist
;
wait_for_completion
(
&
complete
);
shost
->
eh_notify
=
NULL
;
}
scsi_proc_hostdir_add
(
shost
->
hostt
);
return
shost
;
...
...
drivers/scsi/scsi_error.c
浏览文件 @
c5478def
...
...
@@ -20,6 +20,7 @@
#include <linux/string.h>
#include <linux/slab.h>
#include <linux/kernel.h>
#include <linux/kthread.h>
#include <linux/interrupt.h>
#include <linux/blkdev.h>
#include <linux/delay.h>
...
...
@@ -1585,16 +1586,8 @@ int scsi_error_handler(void *data)
int
rtn
;
DECLARE_MUTEX_LOCKED
(
sem
);
/*
* Flush resources
*/
daemonize
(
"scsi_eh_%d"
,
shost
->
host_no
);
current
->
flags
|=
PF_NOFREEZE
;
shost
->
eh_wait
=
&
sem
;
shost
->
ehandler
=
current
;
/*
* Wake up the thread that created us.
...
...
@@ -1602,8 +1595,6 @@ int scsi_error_handler(void *data)
SCSI_LOG_ERROR_RECOVERY
(
3
,
printk
(
"Wake up parent of"
" scsi_eh_%d
\n
"
,
shost
->
host_no
));
complete
(
shost
->
eh_notify
);
while
(
1
)
{
/*
* If we get a signal, it means we are supposed to go
...
...
@@ -1624,7 +1615,7 @@ int scsi_error_handler(void *data)
* semaphores isn't unreasonable.
*/
down_interruptible
(
&
sem
);
if
(
shost
->
eh_kill
)
if
(
kthread_should_stop
()
)
break
;
SCSI_LOG_ERROR_RECOVERY
(
1
,
printk
(
"Error handler"
...
...
@@ -1663,22 +1654,6 @@ int scsi_error_handler(void *data)
* Make sure that nobody tries to wake us up again.
*/
shost
->
eh_wait
=
NULL
;
/*
* Knock this down too. From this point on, the host is flying
* without a pilot. If this is because the module is being unloaded,
* that's fine. If the user sent a signal to this thing, we are
* potentially in real danger.
*/
shost
->
eh_active
=
0
;
shost
->
ehandler
=
NULL
;
/*
* If anyone is waiting for us to exit (i.e. someone trying to unload
* a driver), then wake up that process to let them know we are on
* the way out the door.
*/
complete_and_exit
(
shost
->
eh_notify
,
0
);
return
0
;
}
...
...
include/scsi/scsi_host.h
浏览文件 @
c5478def
...
...
@@ -467,12 +467,10 @@ struct Scsi_Host {
struct
task_struct
*
ehandler
;
/* Error recovery thread. */
struct
semaphore
*
eh_wait
;
/* The error recovery thread waits
on this. */
struct
completion
*
eh_notify
;
/* wait for eh to begin or end */
struct
semaphore
*
eh_action
;
/* Wait for specific actions on the
host. */
unsigned
int
eh_active
:
1
;
/* Indicates the eh thread is awake and active if
this is true. */
unsigned
int
eh_kill
:
1
;
/* set when killing the eh thread */
wait_queue_head_t
host_wait
;
struct
scsi_host_template
*
hostt
;
struct
scsi_transport_template
*
transportt
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录