Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
0ce4eb3c
Commit
0ce4eb3c
authored
Feb 11, 2002
by
Jens Axboe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace awful schedule_timeout polling code with
completions. Applies to 2.5.4-pre3 -- steve.cameron@compaq.com
parent
e5853732
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
11 deletions
+14
-11
drivers/block/cciss.c
drivers/block/cciss.c
+9
-7
drivers/block/cciss_cmd.h
drivers/block/cciss_cmd.h
+1
-1
drivers/block/cciss_scsi.c
drivers/block/cciss_scsi.c
+4
-3
No files found.
drivers/block/cciss.c
View file @
0ce4eb3c
...
...
@@ -647,6 +647,7 @@ static int cciss_ioctl(struct inode *inode, struct file *filep,
char
*
buff
=
NULL
;
u64bit
temp64
;
unsigned
long
flags
;
DECLARE_COMPLETION
(
wait
);
if
(
!
arg
)
return
-
EINVAL
;
...
...
@@ -712,6 +713,8 @@ static int cciss_ioctl(struct inode *inode, struct file *filep,
c
->
SG
[
0
].
Len
=
iocommand
.
buf_size
;
c
->
SG
[
0
].
Ext
=
0
;
// we are not chaining
}
c
->
waiting
=
&
wait
;
/* Put the request on the tail of the request queue */
spin_lock_irqsave
(
CCISS_LOCK
(
ctlr
),
flags
);
addQ
(
&
h
->
reqQ
,
c
);
...
...
@@ -719,9 +722,7 @@ static int cciss_ioctl(struct inode *inode, struct file *filep,
start_io
(
h
);
spin_unlock_irqrestore
(
CCISS_LOCK
(
ctlr
),
flags
);
/* Wait for completion */
while
(
c
->
cmd_type
!=
CMD_IOCTL_DONE
)
schedule_timeout
(
1
);
wait_for_completion
(
&
wait
);
/* unlock the buffers from DMA */
temp64
.
val32
.
lower
=
c
->
SG
[
0
].
Addr
.
lower
;
...
...
@@ -933,6 +934,7 @@ static int sendcmd_withirq(__u8 cmd,
u64bit
buff_dma_handle
;
unsigned
long
flags
;
int
return_status
=
IO_OK
;
DECLARE_COMPLETION
(
wait
);
if
((
c
=
cmd_alloc
(
h
,
0
))
==
NULL
)
{
...
...
@@ -1026,6 +1028,7 @@ static int sendcmd_withirq(__u8 cmd,
c
->
SG
[
0
].
Len
=
size
;
c
->
SG
[
0
].
Ext
=
0
;
// we are not chaining
}
c
->
waiting
=
&
wait
;
/* Put the request on the tail of the queue and send it */
spin_lock_irqsave
(
CCISS_LOCK
(
ctlr
),
flags
);
...
...
@@ -1034,9 +1037,8 @@ static int sendcmd_withirq(__u8 cmd,
start_io
(
h
);
spin_unlock_irqrestore
(
CCISS_LOCK
(
ctlr
),
flags
);
/* wait for completion */
while
(
c
->
cmd_type
!=
CMD_IOCTL_DONE
)
schedule_timeout
(
1
);
wait_for_completion
(
&
wait
);
/* unlock the buffers from DMA */
pci_unmap_single
(
h
->
pdev
,
(
dma_addr_t
)
buff_dma_handle
.
val
,
size
,
PCI_DMA_BIDIRECTIONAL
);
...
...
@@ -1959,7 +1961,7 @@ static void do_cciss_intr(int irq, void *dev_id, struct pt_regs *regs)
complete_command
(
c
,
0
);
cmd_free
(
h
,
c
,
1
);
}
else
if
(
c
->
cmd_type
==
CMD_IOCTL_PEND
)
{
c
->
cmd_type
=
CMD_IOCTL_DONE
;
c
omplete
(
c
->
waiting
)
;
}
# ifdef CONFIG_CISS_SCSI_TAPE
else
if
(
c
->
cmd_type
==
CMD_SCSI
)
...
...
drivers/block/cciss_cmd.h
View file @
0ce4eb3c
...
...
@@ -222,7 +222,6 @@ typedef struct _ErrorInfo_struct {
/* Command types */
#define CMD_RWREQ 0x00
#define CMD_IOCTL_PEND 0x01
#define CMD_IOCTL_DONE 0x02
#define CMD_SCSI 0x03
#define CMD_MSG_DONE 0x04
#define CMD_MSG_TIMEOUT 0x05
...
...
@@ -240,6 +239,7 @@ typedef struct _CommandList_struct {
struct
_CommandList_struct
*
prev
;
struct
_CommandList_struct
*
next
;
struct
request
*
rq
;
struct
completion
*
waiting
;
#ifdef CONFIG_CISS_SCSI_TAPE
void
*
scsi_cmd
;
#endif
...
...
drivers/block/cciss_scsi.c
View file @
0ce4eb3c
...
...
@@ -897,6 +897,7 @@ cciss_scsi_do_simple_cmd(ctlr_info_t *c,
int
direction
)
{
unsigned
long
flags
;
DECLARE_COMPLETION
(
wait
);
cp
->
cmd_type
=
CMD_IOCTL_PEND
;
// treat this like an ioctl
cp
->
scsi_cmd
=
NULL
;
...
...
@@ -922,6 +923,8 @@ cciss_scsi_do_simple_cmd(ctlr_info_t *c,
(
unsigned
char
*
)
buf
,
bufsize
,
scsi_to_pci_dma_dir
(
SCSI_DATA_READ
));
cp
->
waiting
=
&
wait
;
/* Put the request on the tail of the request queue */
spin_lock_irqsave
(
CCISS_LOCK
(
c
->
ctlr
),
flags
);
addQ
(
&
c
->
reqQ
,
cp
);
...
...
@@ -929,9 +932,7 @@ cciss_scsi_do_simple_cmd(ctlr_info_t *c,
start_io
(
c
);
spin_unlock_irqrestore
(
CCISS_LOCK
(
c
->
ctlr
),
flags
);
/* Wait for the request to complete */
while
(
cp
->
cmd_type
!=
CMD_IOCTL_DONE
)
schedule_timeout
(
1
);
wait_for_completion
(
&
wait
);
/* undo the dma mapping */
cciss_unmap_one
(
c
->
pdev
,
cp
,
bufsize
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment