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
70f8e839
Commit
70f8e839
authored
Oct 22, 2020
by
Chuck Lever
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
NFSD: Update the NFSv3 wccstat result encoder to use struct xdr_stream
Signed-off-by:
Chuck Lever
<
chuck.lever@oracle.com
>
parent
5cf35335
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
3 deletions
+65
-3
fs/nfsd/nfs3xdr.c
fs/nfsd/nfs3xdr.c
+65
-3
No files found.
fs/nfsd/nfs3xdr.c
View file @
70f8e839
...
...
@@ -400,6 +400,35 @@ encode_saved_post_attr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp)
return
encode_fattr3
(
rqstp
,
p
,
fhp
,
&
fhp
->
fh_post_attr
);
}
static
bool
svcxdr_encode_wcc_attr
(
struct
xdr_stream
*
xdr
,
const
struct
svc_fh
*
fhp
)
{
__be32
*
p
;
p
=
xdr_reserve_space
(
xdr
,
XDR_UNIT
*
6
);
if
(
!
p
)
return
false
;
p
=
xdr_encode_hyper
(
p
,
(
u64
)
fhp
->
fh_pre_size
);
p
=
encode_nfstime3
(
p
,
&
fhp
->
fh_pre_mtime
);
encode_nfstime3
(
p
,
&
fhp
->
fh_pre_ctime
);
return
true
;
}
static
bool
svcxdr_encode_pre_op_attr
(
struct
xdr_stream
*
xdr
,
const
struct
svc_fh
*
fhp
)
{
if
(
!
fhp
->
fh_pre_saved
)
{
if
(
xdr_stream_encode_item_absent
(
xdr
)
<
0
)
return
false
;
return
true
;
}
if
(
xdr_stream_encode_item_present
(
xdr
)
<
0
)
return
false
;
return
svcxdr_encode_wcc_attr
(
xdr
,
fhp
);
}
static
bool
svcxdr_encode_post_op_attr
(
struct
svc_rqst
*
rqstp
,
struct
xdr_stream
*
xdr
,
const
struct
svc_fh
*
fhp
)
...
...
@@ -460,6 +489,39 @@ nfs3svc_encode_post_op_attr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fh
return
encode_post_op_attr
(
rqstp
,
p
,
fhp
);
}
/*
* Encode weak cache consistency data
*/
static
bool
svcxdr_encode_wcc_data
(
struct
svc_rqst
*
rqstp
,
struct
xdr_stream
*
xdr
,
const
struct
svc_fh
*
fhp
)
{
struct
dentry
*
dentry
=
fhp
->
fh_dentry
;
if
(
!
dentry
||
!
d_really_is_positive
(
dentry
)
||
!
fhp
->
fh_post_saved
)
goto
neither
;
/* before */
if
(
!
svcxdr_encode_pre_op_attr
(
xdr
,
fhp
))
return
false
;
/* after */
if
(
xdr_stream_encode_item_present
(
xdr
)
<
0
)
return
false
;
if
(
!
svcxdr_encode_fattr3
(
rqstp
,
xdr
,
fhp
,
&
fhp
->
fh_post_attr
))
return
false
;
return
true
;
neither:
if
(
xdr_stream_encode_item_absent
(
xdr
)
<
0
)
return
false
;
if
(
!
svcxdr_encode_post_op_attr
(
rqstp
,
xdr
,
fhp
))
return
false
;
return
true
;
}
/*
* Enocde weak cache consistency data
*/
...
...
@@ -855,11 +917,11 @@ nfs3svc_encode_getattrres(struct svc_rqst *rqstp, __be32 *p)
int
nfs3svc_encode_wccstat
(
struct
svc_rqst
*
rqstp
,
__be32
*
p
)
{
struct
xdr_stream
*
xdr
=
&
rqstp
->
rq_res_stream
;
struct
nfsd3_attrstat
*
resp
=
rqstp
->
rq_resp
;
*
p
++
=
resp
->
status
;
p
=
encode_wcc_data
(
rqstp
,
p
,
&
resp
->
fh
);
return
xdr_ressize_check
(
rqstp
,
p
);
return
svcxdr_encode_nfsstat3
(
xdr
,
resp
->
status
)
&&
svcxdr_encode_wcc_data
(
rqstp
,
xdr
,
&
resp
->
fh
);
}
/* LOOKUP */
...
...
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