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
nexedi
linux
Commits
84115e1c
Commit
84115e1c
authored
Jul 14, 2007
by
Trond Myklebust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SUNRPC: Cleanup of rpc_task initialisation
Signed-off-by:
Trond Myklebust
<
Trond.Myklebust@netapp.com
>
parent
e8914c65
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
117 additions
and
58 deletions
+117
-58
fs/nfs/direct.c
fs/nfs/direct.c
+28
-8
fs/nfs/read.c
fs/nfs/read.c
+10
-5
fs/nfs/write.c
fs/nfs/write.c
+19
-11
include/linux/sunrpc/clnt.h
include/linux/sunrpc/clnt.h
+1
-1
include/linux/sunrpc/sched.h
include/linux/sunrpc/sched.h
+9
-5
net/sunrpc/clnt.c
net/sunrpc/clnt.c
+37
-14
net/sunrpc/sched.c
net/sunrpc/sched.c
+13
-14
No files found.
fs/nfs/direct.c
View file @
84115e1c
...
@@ -272,6 +272,11 @@ static ssize_t nfs_direct_read_schedule_segment(struct nfs_direct_req *dreq,
...
@@ -272,6 +272,11 @@ static ssize_t nfs_direct_read_schedule_segment(struct nfs_direct_req *dreq,
unsigned
long
user_addr
=
(
unsigned
long
)
iov
->
iov_base
;
unsigned
long
user_addr
=
(
unsigned
long
)
iov
->
iov_base
;
size_t
count
=
iov
->
iov_len
;
size_t
count
=
iov
->
iov_len
;
size_t
rsize
=
NFS_SERVER
(
inode
)
->
rsize
;
size_t
rsize
=
NFS_SERVER
(
inode
)
->
rsize
;
struct
rpc_task_setup
task_setup_data
=
{
.
rpc_client
=
NFS_CLIENT
(
inode
),
.
callback_ops
=
&
nfs_read_direct_ops
,
.
flags
=
RPC_TASK_ASYNC
,
};
unsigned
int
pgbase
;
unsigned
int
pgbase
;
int
result
;
int
result
;
ssize_t
started
=
0
;
ssize_t
started
=
0
;
...
@@ -322,8 +327,8 @@ static ssize_t nfs_direct_read_schedule_segment(struct nfs_direct_req *dreq,
...
@@ -322,8 +327,8 @@ static ssize_t nfs_direct_read_schedule_segment(struct nfs_direct_req *dreq,
data
->
res
.
eof
=
0
;
data
->
res
.
eof
=
0
;
data
->
res
.
count
=
bytes
;
data
->
res
.
count
=
bytes
;
rpc_init_task
(
&
data
->
task
,
NFS_CLIENT
(
inode
),
RPC_TASK_ASYNC
,
task_setup_data
.
callback_data
=
data
;
&
nfs_read_direct_ops
,
data
);
rpc_init_task
(
&
data
->
task
,
&
task_setup_
data
);
NFS_PROTO
(
inode
)
->
read_setup
(
data
);
NFS_PROTO
(
inode
)
->
read_setup
(
data
);
data
->
task
.
tk_cookie
=
(
unsigned
long
)
inode
;
data
->
task
.
tk_cookie
=
(
unsigned
long
)
inode
;
...
@@ -431,6 +436,11 @@ static void nfs_direct_write_reschedule(struct nfs_direct_req *dreq)
...
@@ -431,6 +436,11 @@ static void nfs_direct_write_reschedule(struct nfs_direct_req *dreq)
struct
inode
*
inode
=
dreq
->
inode
;
struct
inode
*
inode
=
dreq
->
inode
;
struct
list_head
*
p
;
struct
list_head
*
p
;
struct
nfs_write_data
*
data
;
struct
nfs_write_data
*
data
;
struct
rpc_task_setup
task_setup_data
=
{
.
rpc_client
=
NFS_CLIENT
(
inode
),
.
callback_ops
=
&
nfs_write_direct_ops
,
.
flags
=
RPC_TASK_ASYNC
,
};
dreq
->
count
=
0
;
dreq
->
count
=
0
;
get_dreq
(
dreq
);
get_dreq
(
dreq
);
...
@@ -451,8 +461,8 @@ static void nfs_direct_write_reschedule(struct nfs_direct_req *dreq)
...
@@ -451,8 +461,8 @@ static void nfs_direct_write_reschedule(struct nfs_direct_req *dreq)
* Reuse data->task; data->args should not have changed
* Reuse data->task; data->args should not have changed
* since the original request was sent.
* since the original request was sent.
*/
*/
rpc_init_task
(
&
data
->
task
,
NFS_CLIENT
(
inode
),
RPC_TASK_ASYNC
,
task_setup_data
.
callback_data
=
data
;
&
nfs_write_direct_ops
,
data
);
rpc_init_task
(
&
data
->
task
,
&
task_setup_
data
);
NFS_PROTO
(
inode
)
->
write_setup
(
data
,
FLUSH_STABLE
);
NFS_PROTO
(
inode
)
->
write_setup
(
data
,
FLUSH_STABLE
);
data
->
task
.
tk_priority
=
RPC_PRIORITY_NORMAL
;
data
->
task
.
tk_priority
=
RPC_PRIORITY_NORMAL
;
...
@@ -504,6 +514,12 @@ static const struct rpc_call_ops nfs_commit_direct_ops = {
...
@@ -504,6 +514,12 @@ static const struct rpc_call_ops nfs_commit_direct_ops = {
static
void
nfs_direct_commit_schedule
(
struct
nfs_direct_req
*
dreq
)
static
void
nfs_direct_commit_schedule
(
struct
nfs_direct_req
*
dreq
)
{
{
struct
nfs_write_data
*
data
=
dreq
->
commit_data
;
struct
nfs_write_data
*
data
=
dreq
->
commit_data
;
struct
rpc_task_setup
task_setup_data
=
{
.
rpc_client
=
NFS_CLIENT
(
dreq
->
inode
),
.
callback_ops
=
&
nfs_commit_direct_ops
,
.
callback_data
=
data
,
.
flags
=
RPC_TASK_ASYNC
,
};
data
->
inode
=
dreq
->
inode
;
data
->
inode
=
dreq
->
inode
;
data
->
cred
=
dreq
->
ctx
->
cred
;
data
->
cred
=
dreq
->
ctx
->
cred
;
...
@@ -515,8 +531,7 @@ static void nfs_direct_commit_schedule(struct nfs_direct_req *dreq)
...
@@ -515,8 +531,7 @@ static void nfs_direct_commit_schedule(struct nfs_direct_req *dreq)
data
->
res
.
fattr
=
&
data
->
fattr
;
data
->
res
.
fattr
=
&
data
->
fattr
;
data
->
res
.
verf
=
&
data
->
verf
;
data
->
res
.
verf
=
&
data
->
verf
;
rpc_init_task
(
&
data
->
task
,
NFS_CLIENT
(
dreq
->
inode
),
RPC_TASK_ASYNC
,
rpc_init_task
(
&
data
->
task
,
&
task_setup_data
);
&
nfs_commit_direct_ops
,
data
);
NFS_PROTO
(
data
->
inode
)
->
commit_setup
(
data
,
0
);
NFS_PROTO
(
data
->
inode
)
->
commit_setup
(
data
,
0
);
data
->
task
.
tk_priority
=
RPC_PRIORITY_NORMAL
;
data
->
task
.
tk_priority
=
RPC_PRIORITY_NORMAL
;
...
@@ -641,6 +656,11 @@ static ssize_t nfs_direct_write_schedule_segment(struct nfs_direct_req *dreq,
...
@@ -641,6 +656,11 @@ static ssize_t nfs_direct_write_schedule_segment(struct nfs_direct_req *dreq,
struct
inode
*
inode
=
ctx
->
path
.
dentry
->
d_inode
;
struct
inode
*
inode
=
ctx
->
path
.
dentry
->
d_inode
;
unsigned
long
user_addr
=
(
unsigned
long
)
iov
->
iov_base
;
unsigned
long
user_addr
=
(
unsigned
long
)
iov
->
iov_base
;
size_t
count
=
iov
->
iov_len
;
size_t
count
=
iov
->
iov_len
;
struct
rpc_task_setup
task_setup_data
=
{
.
rpc_client
=
NFS_CLIENT
(
inode
),
.
callback_ops
=
&
nfs_write_direct_ops
,
.
flags
=
RPC_TASK_ASYNC
,
};
size_t
wsize
=
NFS_SERVER
(
inode
)
->
wsize
;
size_t
wsize
=
NFS_SERVER
(
inode
)
->
wsize
;
unsigned
int
pgbase
;
unsigned
int
pgbase
;
int
result
;
int
result
;
...
@@ -694,8 +714,8 @@ static ssize_t nfs_direct_write_schedule_segment(struct nfs_direct_req *dreq,
...
@@ -694,8 +714,8 @@ static ssize_t nfs_direct_write_schedule_segment(struct nfs_direct_req *dreq,
data
->
res
.
count
=
bytes
;
data
->
res
.
count
=
bytes
;
data
->
res
.
verf
=
&
data
->
verf
;
data
->
res
.
verf
=
&
data
->
verf
;
rpc_init_task
(
&
data
->
task
,
NFS_CLIENT
(
inode
),
RPC_TASK_ASYNC
,
task_setup_data
.
callback_data
=
data
;
&
nfs_write_direct_ops
,
data
);
rpc_init_task
(
&
data
->
task
,
&
task_setup_
data
);
NFS_PROTO
(
inode
)
->
write_setup
(
data
,
sync
);
NFS_PROTO
(
inode
)
->
write_setup
(
data
,
sync
);
data
->
task
.
tk_priority
=
RPC_PRIORITY_NORMAL
;
data
->
task
.
tk_priority
=
RPC_PRIORITY_NORMAL
;
...
...
fs/nfs/read.c
View file @
84115e1c
...
@@ -160,11 +160,17 @@ static void nfs_read_rpcsetup(struct nfs_page *req, struct nfs_read_data *data,
...
@@ -160,11 +160,17 @@ static void nfs_read_rpcsetup(struct nfs_page *req, struct nfs_read_data *data,
const
struct
rpc_call_ops
*
call_ops
,
const
struct
rpc_call_ops
*
call_ops
,
unsigned
int
count
,
unsigned
int
offset
)
unsigned
int
count
,
unsigned
int
offset
)
{
{
struct
inode
*
inode
;
struct
inode
*
inode
=
req
->
wb_context
->
path
.
dentry
->
d_inode
;
int
flags
;
int
swap_flags
=
IS_SWAPFILE
(
inode
)
?
NFS_RPC_SWAPFLAGS
:
0
;
struct
rpc_task_setup
task_setup_data
=
{
.
rpc_client
=
NFS_CLIENT
(
inode
),
.
callback_ops
=
call_ops
,
.
callback_data
=
data
,
.
flags
=
RPC_TASK_ASYNC
|
swap_flags
,
};
data
->
req
=
req
;
data
->
req
=
req
;
data
->
inode
=
inode
=
req
->
wb_context
->
path
.
dentry
->
d_inode
;
data
->
inode
=
inode
;
data
->
cred
=
req
->
wb_context
->
cred
;
data
->
cred
=
req
->
wb_context
->
cred
;
data
->
args
.
fh
=
NFS_FH
(
inode
);
data
->
args
.
fh
=
NFS_FH
(
inode
);
...
@@ -180,8 +186,7 @@ static void nfs_read_rpcsetup(struct nfs_page *req, struct nfs_read_data *data,
...
@@ -180,8 +186,7 @@ static void nfs_read_rpcsetup(struct nfs_page *req, struct nfs_read_data *data,
nfs_fattr_init
(
&
data
->
fattr
);
nfs_fattr_init
(
&
data
->
fattr
);
/* Set up the initial task struct. */
/* Set up the initial task struct. */
flags
=
RPC_TASK_ASYNC
|
(
IS_SWAPFILE
(
inode
)
?
NFS_RPC_SWAPFLAGS
:
0
);
rpc_init_task
(
&
data
->
task
,
&
task_setup_data
);
rpc_init_task
(
&
data
->
task
,
NFS_CLIENT
(
inode
),
flags
,
call_ops
,
data
);
NFS_PROTO
(
inode
)
->
read_setup
(
data
);
NFS_PROTO
(
inode
)
->
read_setup
(
data
);
data
->
task
.
tk_cookie
=
(
unsigned
long
)
inode
;
data
->
task
.
tk_cookie
=
(
unsigned
long
)
inode
;
...
...
fs/nfs/write.c
View file @
84115e1c
...
@@ -773,8 +773,14 @@ static void nfs_write_rpcsetup(struct nfs_page *req,
...
@@ -773,8 +773,14 @@ static void nfs_write_rpcsetup(struct nfs_page *req,
unsigned
int
count
,
unsigned
int
offset
,
unsigned
int
count
,
unsigned
int
offset
,
int
how
)
int
how
)
{
{
struct
inode
*
inode
;
struct
inode
*
inode
=
req
->
wb_context
->
path
.
dentry
->
d_inode
;
int
flags
;
int
flags
=
(
how
&
FLUSH_SYNC
)
?
0
:
RPC_TASK_ASYNC
;
struct
rpc_task_setup
task_setup_data
=
{
.
rpc_client
=
NFS_CLIENT
(
inode
),
.
callback_ops
=
call_ops
,
.
callback_data
=
data
,
.
flags
=
flags
,
};
/* Set up the RPC argument and reply structs
/* Set up the RPC argument and reply structs
* NB: take care not to mess about with data->commit et al. */
* NB: take care not to mess about with data->commit et al. */
...
@@ -796,8 +802,7 @@ static void nfs_write_rpcsetup(struct nfs_page *req,
...
@@ -796,8 +802,7 @@ static void nfs_write_rpcsetup(struct nfs_page *req,
nfs_fattr_init
(
&
data
->
fattr
);
nfs_fattr_init
(
&
data
->
fattr
);
/* Set up the initial task struct. */
/* Set up the initial task struct. */
flags
=
(
how
&
FLUSH_SYNC
)
?
0
:
RPC_TASK_ASYNC
;
rpc_init_task
(
&
data
->
task
,
&
task_setup_data
);
rpc_init_task
(
&
data
->
task
,
NFS_CLIENT
(
inode
),
flags
,
call_ops
,
data
);
NFS_PROTO
(
inode
)
->
write_setup
(
data
,
how
);
NFS_PROTO
(
inode
)
->
write_setup
(
data
,
how
);
data
->
task
.
tk_priority
=
flush_task_priority
(
how
);
data
->
task
.
tk_priority
=
flush_task_priority
(
how
);
...
@@ -1144,16 +1149,20 @@ static void nfs_commit_rpcsetup(struct list_head *head,
...
@@ -1144,16 +1149,20 @@ static void nfs_commit_rpcsetup(struct list_head *head,
struct
nfs_write_data
*
data
,
struct
nfs_write_data
*
data
,
int
how
)
int
how
)
{
{
struct
nfs_page
*
first
;
struct
nfs_page
*
first
=
nfs_list_entry
(
head
->
next
);
struct
inode
*
inode
;
struct
inode
*
inode
=
first
->
wb_context
->
path
.
dentry
->
d_inode
;
int
flags
;
int
flags
=
(
how
&
FLUSH_SYNC
)
?
0
:
RPC_TASK_ASYNC
;
struct
rpc_task_setup
task_setup_data
=
{
.
rpc_client
=
NFS_CLIENT
(
inode
),
.
callback_ops
=
&
nfs_commit_ops
,
.
callback_data
=
data
,
.
flags
=
flags
,
};
/* Set up the RPC argument and reply structs
/* Set up the RPC argument and reply structs
* NB: take care not to mess about with data->commit et al. */
* NB: take care not to mess about with data->commit et al. */
list_splice_init
(
head
,
&
data
->
pages
);
list_splice_init
(
head
,
&
data
->
pages
);
first
=
nfs_list_entry
(
data
->
pages
.
next
);
inode
=
first
->
wb_context
->
path
.
dentry
->
d_inode
;
data
->
inode
=
inode
;
data
->
inode
=
inode
;
data
->
cred
=
first
->
wb_context
->
cred
;
data
->
cred
=
first
->
wb_context
->
cred
;
...
@@ -1168,8 +1177,7 @@ static void nfs_commit_rpcsetup(struct list_head *head,
...
@@ -1168,8 +1177,7 @@ static void nfs_commit_rpcsetup(struct list_head *head,
nfs_fattr_init
(
&
data
->
fattr
);
nfs_fattr_init
(
&
data
->
fattr
);
/* Set up the initial task struct. */
/* Set up the initial task struct. */
flags
=
(
how
&
FLUSH_SYNC
)
?
0
:
RPC_TASK_ASYNC
;
rpc_init_task
(
&
data
->
task
,
&
task_setup_data
);
rpc_init_task
(
&
data
->
task
,
NFS_CLIENT
(
inode
),
flags
,
&
nfs_commit_ops
,
data
);
NFS_PROTO
(
inode
)
->
commit_setup
(
data
,
how
);
NFS_PROTO
(
inode
)
->
commit_setup
(
data
,
how
);
data
->
task
.
tk_priority
=
flush_task_priority
(
how
);
data
->
task
.
tk_priority
=
flush_task_priority
(
how
);
...
...
include/linux/sunrpc/clnt.h
View file @
84115e1c
...
@@ -126,7 +126,7 @@ int rpcb_register(u32, u32, int, unsigned short, int *);
...
@@ -126,7 +126,7 @@ int rpcb_register(u32, u32, int, unsigned short, int *);
int
rpcb_getport_sync
(
struct
sockaddr_in
*
,
__u32
,
__u32
,
int
);
int
rpcb_getport_sync
(
struct
sockaddr_in
*
,
__u32
,
__u32
,
int
);
void
rpcb_getport_async
(
struct
rpc_task
*
);
void
rpcb_getport_async
(
struct
rpc_task
*
);
void
rpc_call_setup
(
struct
rpc_task
*
,
struct
rpc_message
*
,
int
);
void
rpc_call_setup
(
struct
rpc_task
*
,
const
struct
rpc_message
*
,
int
);
int
rpc_call_async
(
struct
rpc_clnt
*
clnt
,
struct
rpc_message
*
msg
,
int
rpc_call_async
(
struct
rpc_clnt
*
clnt
,
struct
rpc_message
*
msg
,
int
flags
,
const
struct
rpc_call_ops
*
tk_ops
,
int
flags
,
const
struct
rpc_call_ops
*
tk_ops
,
...
...
include/linux/sunrpc/sched.h
View file @
84115e1c
...
@@ -117,6 +117,13 @@ struct rpc_call_ops {
...
@@ -117,6 +117,13 @@ struct rpc_call_ops {
void
(
*
rpc_release
)(
void
*
);
void
(
*
rpc_release
)(
void
*
);
};
};
struct
rpc_task_setup
{
struct
rpc_clnt
*
rpc_client
;
const
struct
rpc_message
*
rpc_message
;
const
struct
rpc_call_ops
*
callback_ops
;
void
*
callback_data
;
unsigned
short
flags
;
};
/*
/*
* RPC task flags
* RPC task flags
...
@@ -236,13 +243,10 @@ struct rpc_wait_queue {
...
@@ -236,13 +243,10 @@ struct rpc_wait_queue {
/*
/*
* Function prototypes
* Function prototypes
*/
*/
struct
rpc_task
*
rpc_new_task
(
struct
rpc_clnt
*
,
int
flags
,
struct
rpc_task
*
rpc_new_task
(
const
struct
rpc_task_setup
*
);
const
struct
rpc_call_ops
*
ops
,
void
*
data
);
struct
rpc_task
*
rpc_run_task
(
struct
rpc_clnt
*
clnt
,
int
flags
,
struct
rpc_task
*
rpc_run_task
(
struct
rpc_clnt
*
clnt
,
int
flags
,
const
struct
rpc_call_ops
*
ops
,
void
*
data
);
const
struct
rpc_call_ops
*
ops
,
void
*
data
);
void
rpc_init_task
(
struct
rpc_task
*
task
,
struct
rpc_clnt
*
clnt
,
void
rpc_init_task
(
struct
rpc_task
*
task
,
const
struct
rpc_task_setup
*
);
int
flags
,
const
struct
rpc_call_ops
*
ops
,
void
*
data
);
void
rpc_put_task
(
struct
rpc_task
*
);
void
rpc_put_task
(
struct
rpc_task
*
);
void
rpc_exit_task
(
struct
rpc_task
*
);
void
rpc_exit_task
(
struct
rpc_task
*
);
void
rpc_release_calldata
(
const
struct
rpc_call_ops
*
,
void
*
);
void
rpc_release_calldata
(
const
struct
rpc_call_ops
*
,
void
*
);
...
...
net/sunrpc/clnt.c
View file @
84115e1c
...
@@ -524,25 +524,22 @@ void rpc_clnt_sigunmask(struct rpc_clnt *clnt, sigset_t *oldset)
...
@@ -524,25 +524,22 @@ void rpc_clnt_sigunmask(struct rpc_clnt *clnt, sigset_t *oldset)
EXPORT_SYMBOL_GPL
(
rpc_clnt_sigunmask
);
EXPORT_SYMBOL_GPL
(
rpc_clnt_sigunmask
);
static
static
struct
rpc_task
*
rpc_do_run_task
(
struct
rpc_clnt
*
clnt
,
struct
rpc_task
*
rpc_do_run_task
(
const
struct
rpc_task_setup
*
task_setup_data
)
struct
rpc_message
*
msg
,
int
flags
,
const
struct
rpc_call_ops
*
ops
,
void
*
data
)
{
{
struct
rpc_task
*
task
,
*
ret
;
struct
rpc_task
*
task
,
*
ret
;
sigset_t
oldset
;
sigset_t
oldset
;
task
=
rpc_new_task
(
clnt
,
flags
,
ops
,
data
);
task
=
rpc_new_task
(
task_setup_
data
);
if
(
task
==
NULL
)
{
if
(
task
==
NULL
)
{
rpc_release_calldata
(
ops
,
data
);
rpc_release_calldata
(
task_setup_data
->
callback_ops
,
task_setup_data
->
callback_data
);
return
ERR_PTR
(
-
ENOMEM
);
return
ERR_PTR
(
-
ENOMEM
);
}
}
/* Mask signals on synchronous RPC calls and RPCSEC_GSS upcalls */
/* Mask signals on synchronous RPC calls and RPCSEC_GSS upcalls */
rpc_task_sigmask
(
task
,
&
oldset
);
rpc_task_sigmask
(
task
,
&
oldset
);
if
(
msg
!=
NULL
)
{
if
(
task_setup_data
->
rpc_message
!=
NULL
)
{
rpc_call_setup
(
task
,
msg
,
0
);
rpc_call_setup
(
task
,
task_setup_data
->
rpc_message
,
0
);
if
(
task
->
tk_status
!=
0
)
{
if
(
task
->
tk_status
!=
0
)
{
ret
=
ERR_PTR
(
task
->
tk_status
);
ret
=
ERR_PTR
(
task
->
tk_status
);
rpc_put_task
(
task
);
rpc_put_task
(
task
);
...
@@ -566,11 +563,17 @@ struct rpc_task *rpc_do_run_task(struct rpc_clnt *clnt,
...
@@ -566,11 +563,17 @@ struct rpc_task *rpc_do_run_task(struct rpc_clnt *clnt,
int
rpc_call_sync
(
struct
rpc_clnt
*
clnt
,
struct
rpc_message
*
msg
,
int
flags
)
int
rpc_call_sync
(
struct
rpc_clnt
*
clnt
,
struct
rpc_message
*
msg
,
int
flags
)
{
{
struct
rpc_task
*
task
;
struct
rpc_task
*
task
;
struct
rpc_task_setup
task_setup_data
=
{
.
rpc_client
=
clnt
,
.
rpc_message
=
msg
,
.
callback_ops
=
&
rpc_default_ops
,
.
flags
=
flags
,
};
int
status
;
int
status
;
BUG_ON
(
flags
&
RPC_TASK_ASYNC
);
BUG_ON
(
flags
&
RPC_TASK_ASYNC
);
task
=
rpc_do_run_task
(
clnt
,
msg
,
flags
,
&
rpc_default_ops
,
NULL
);
task
=
rpc_do_run_task
(
&
task_setup_data
);
if
(
IS_ERR
(
task
))
if
(
IS_ERR
(
task
))
return
PTR_ERR
(
task
);
return
PTR_ERR
(
task
);
status
=
task
->
tk_status
;
status
=
task
->
tk_status
;
...
@@ -592,8 +595,15 @@ rpc_call_async(struct rpc_clnt *clnt, struct rpc_message *msg, int flags,
...
@@ -592,8 +595,15 @@ rpc_call_async(struct rpc_clnt *clnt, struct rpc_message *msg, int flags,
const
struct
rpc_call_ops
*
tk_ops
,
void
*
data
)
const
struct
rpc_call_ops
*
tk_ops
,
void
*
data
)
{
{
struct
rpc_task
*
task
;
struct
rpc_task
*
task
;
struct
rpc_task_setup
task_setup_data
=
{
.
rpc_client
=
clnt
,
.
rpc_message
=
msg
,
.
callback_ops
=
tk_ops
,
.
callback_data
=
data
,
.
flags
=
flags
|
RPC_TASK_ASYNC
,
};
task
=
rpc_do_run_task
(
clnt
,
msg
,
flags
|
RPC_TASK_ASYNC
,
tk_ops
,
data
);
task
=
rpc_do_run_task
(
&
task_setup_
data
);
if
(
IS_ERR
(
task
))
if
(
IS_ERR
(
task
))
return
PTR_ERR
(
task
);
return
PTR_ERR
(
task
);
rpc_put_task
(
task
);
rpc_put_task
(
task
);
...
@@ -612,12 +622,19 @@ struct rpc_task *rpc_run_task(struct rpc_clnt *clnt, int flags,
...
@@ -612,12 +622,19 @@ struct rpc_task *rpc_run_task(struct rpc_clnt *clnt, int flags,
const
struct
rpc_call_ops
*
tk_ops
,
const
struct
rpc_call_ops
*
tk_ops
,
void
*
data
)
void
*
data
)
{
{
return
rpc_do_run_task
(
clnt
,
NULL
,
flags
,
tk_ops
,
data
);
struct
rpc_task_setup
task_setup_data
=
{
.
rpc_client
=
clnt
,
.
callback_ops
=
tk_ops
,
.
callback_data
=
data
,
.
flags
=
flags
,
};
return
rpc_do_run_task
(
&
task_setup_data
);
}
}
EXPORT_SYMBOL_GPL
(
rpc_run_task
);
EXPORT_SYMBOL_GPL
(
rpc_run_task
);
void
void
rpc_call_setup
(
struct
rpc_task
*
task
,
struct
rpc_message
*
msg
,
int
flags
)
rpc_call_setup
(
struct
rpc_task
*
task
,
const
struct
rpc_message
*
msg
,
int
flags
)
{
{
task
->
tk_msg
=
*
msg
;
task
->
tk_msg
=
*
msg
;
task
->
tk_flags
|=
flags
;
task
->
tk_flags
|=
flags
;
...
@@ -1527,7 +1544,13 @@ struct rpc_task *rpc_call_null(struct rpc_clnt *clnt, struct rpc_cred *cred, int
...
@@ -1527,7 +1544,13 @@ struct rpc_task *rpc_call_null(struct rpc_clnt *clnt, struct rpc_cred *cred, int
.
rpc_proc
=
&
rpcproc_null
,
.
rpc_proc
=
&
rpcproc_null
,
.
rpc_cred
=
cred
,
.
rpc_cred
=
cred
,
};
};
return
rpc_do_run_task
(
clnt
,
&
msg
,
flags
,
&
rpc_default_ops
,
NULL
);
struct
rpc_task_setup
task_setup_data
=
{
.
rpc_client
=
clnt
,
.
rpc_message
=
&
msg
,
.
callback_ops
=
&
rpc_default_ops
,
.
flags
=
flags
,
};
return
rpc_do_run_task
(
&
task_setup_data
);
}
}
EXPORT_SYMBOL_GPL
(
rpc_call_null
);
EXPORT_SYMBOL_GPL
(
rpc_call_null
);
...
...
net/sunrpc/sched.c
View file @
84115e1c
...
@@ -815,18 +815,15 @@ EXPORT_SYMBOL_GPL(rpc_free);
...
@@ -815,18 +815,15 @@ EXPORT_SYMBOL_GPL(rpc_free);
/*
/*
* Creation and deletion of RPC task structures
* Creation and deletion of RPC task structures
*/
*/
void
rpc_init_task
(
struct
rpc_task
*
task
,
struct
rpc_clnt
*
clnt
,
int
flags
,
const
struct
rpc_call_ops
*
tk_ops
,
void
*
call
data
)
void
rpc_init_task
(
struct
rpc_task
*
task
,
const
struct
rpc_task_setup
*
task_setup_
data
)
{
{
memset
(
task
,
0
,
sizeof
(
*
task
));
memset
(
task
,
0
,
sizeof
(
*
task
));
setup_timer
(
&
task
->
tk_timer
,
(
void
(
*
)(
unsigned
long
))
rpc_run_timer
,
setup_timer
(
&
task
->
tk_timer
,
(
void
(
*
)(
unsigned
long
))
rpc_run_timer
,
(
unsigned
long
)
task
);
(
unsigned
long
)
task
);
atomic_set
(
&
task
->
tk_count
,
1
);
atomic_set
(
&
task
->
tk_count
,
1
);
task
->
tk_client
=
clnt
;
task
->
tk_flags
=
task_setup_data
->
flags
;
task
->
tk_flags
=
flags
;
task
->
tk_ops
=
task_setup_data
->
callback_ops
;
task
->
tk_ops
=
tk_ops
;
task
->
tk_calldata
=
task_setup_data
->
callback_data
;
if
(
tk_ops
->
rpc_call_prepare
!=
NULL
)
task
->
tk_action
=
rpc_prepare_task
;
task
->
tk_calldata
=
calldata
;
INIT_LIST_HEAD
(
&
task
->
tk_task
);
INIT_LIST_HEAD
(
&
task
->
tk_task
);
/* Initialize retry counters */
/* Initialize retry counters */
...
@@ -839,15 +836,17 @@ void rpc_init_task(struct rpc_task *task, struct rpc_clnt *clnt, int flags, cons
...
@@ -839,15 +836,17 @@ void rpc_init_task(struct rpc_task *task, struct rpc_clnt *clnt, int flags, cons
/* Initialize workqueue for async tasks */
/* Initialize workqueue for async tasks */
task
->
tk_workqueue
=
rpciod_workqueue
;
task
->
tk_workqueue
=
rpciod_workqueue
;
if
(
clnt
)
{
task
->
tk_client
=
task_setup_data
->
rpc_client
;
kref_get
(
&
clnt
->
cl_kref
);
if
(
task
->
tk_client
!=
NULL
)
{
if
(
clnt
->
cl_softrtry
)
kref_get
(
&
task
->
tk_client
->
cl_kref
);
if
(
task
->
tk_client
->
cl_softrtry
)
task
->
tk_flags
|=
RPC_TASK_SOFT
;
task
->
tk_flags
|=
RPC_TASK_SOFT
;
if
(
!
cl
nt
->
cl_intr
)
if
(
!
task
->
tk_clie
nt
->
cl_intr
)
task
->
tk_flags
|=
RPC_TASK_NOINTR
;
task
->
tk_flags
|=
RPC_TASK_NOINTR
;
}
}
BUG_ON
(
task
->
tk_ops
==
NULL
);
if
(
task
->
tk_ops
->
rpc_call_prepare
!=
NULL
)
task
->
tk_action
=
rpc_prepare_task
;
/* starting timestamp */
/* starting timestamp */
task
->
tk_start
=
jiffies
;
task
->
tk_start
=
jiffies
;
...
@@ -873,7 +872,7 @@ static void rpc_free_task(struct rcu_head *rcu)
...
@@ -873,7 +872,7 @@ static void rpc_free_task(struct rcu_head *rcu)
/*
/*
* Create a new task for the specified client.
* Create a new task for the specified client.
*/
*/
struct
rpc_task
*
rpc_new_task
(
struct
rpc_clnt
*
clnt
,
int
flags
,
const
struct
rpc_call_ops
*
tk_ops
,
void
*
call
data
)
struct
rpc_task
*
rpc_new_task
(
const
struct
rpc_task_setup
*
setup_
data
)
{
{
struct
rpc_task
*
task
;
struct
rpc_task
*
task
;
...
@@ -881,7 +880,7 @@ struct rpc_task *rpc_new_task(struct rpc_clnt *clnt, int flags, const struct rpc
...
@@ -881,7 +880,7 @@ struct rpc_task *rpc_new_task(struct rpc_clnt *clnt, int flags, const struct rpc
if
(
!
task
)
if
(
!
task
)
goto
out
;
goto
out
;
rpc_init_task
(
task
,
clnt
,
flags
,
tk_ops
,
call
data
);
rpc_init_task
(
task
,
setup_
data
);
dprintk
(
"RPC: allocated task %p
\n
"
,
task
);
dprintk
(
"RPC: allocated task %p
\n
"
,
task
);
task
->
tk_flags
|=
RPC_TASK_DYNAMIC
;
task
->
tk_flags
|=
RPC_TASK_DYNAMIC
;
...
...
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