Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-davinci-2.6.23
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linux
linux-davinci-2.6.23
Commits
3bec63db
Commit
3bec63db
authored
Jun 17, 2007
by
Trond Myklebust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
NFS: Convert struct nfs_open_context to use a kref
Signed-off-by:
Trond Myklebust
<
Trond.Myklebust@netapp.com
>
parent
edc05fc1
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
18 deletions
+25
-18
fs/nfs/inode.c
fs/nfs/inode.c
+23
-17
include/linux/nfs_fs.h
include/linux/nfs_fs.h
+2
-1
No files found.
fs/nfs/inode.c
View file @
3bec63db
...
...
@@ -461,7 +461,6 @@ static struct nfs_open_context *alloc_nfs_open_context(struct vfsmount *mnt, str
ctx
=
kmalloc
(
sizeof
(
*
ctx
),
GFP_KERNEL
);
if
(
ctx
!=
NULL
)
{
atomic_set
(
&
ctx
->
count
,
1
);
ctx
->
path
.
dentry
=
dget
(
dentry
);
ctx
->
path
.
mnt
=
mntget
(
mnt
);
ctx
->
cred
=
get_rpccred
(
cred
);
...
...
@@ -469,6 +468,7 @@ static struct nfs_open_context *alloc_nfs_open_context(struct vfsmount *mnt, str
ctx
->
lockowner
=
current
->
files
;
ctx
->
error
=
0
;
ctx
->
dir_cookie
=
0
;
kref_init
(
&
ctx
->
kref
);
}
return
ctx
;
}
...
...
@@ -476,13 +476,15 @@ static struct nfs_open_context *alloc_nfs_open_context(struct vfsmount *mnt, str
struct
nfs_open_context
*
get_nfs_open_context
(
struct
nfs_open_context
*
ctx
)
{
if
(
ctx
!=
NULL
)
atomic_inc
(
&
ctx
->
count
);
kref_get
(
&
ctx
->
kref
);
return
ctx
;
}
void
put_nfs_open_context
(
struct
nfs_open_context
*
ctx
)
static
void
nfs_free_open_context
(
struct
kref
*
kref
)
{
if
(
atomic_dec_and_test
(
&
ctx
->
count
))
{
struct
nfs_open_context
*
ctx
=
container_of
(
kref
,
struct
nfs_open_context
,
kref
);
if
(
!
list_empty
(
&
ctx
->
list
))
{
struct
inode
*
inode
=
ctx
->
path
.
dentry
->
d_inode
;
spin_lock
(
&
inode
->
i_lock
);
...
...
@@ -496,7 +498,11 @@ void put_nfs_open_context(struct nfs_open_context *ctx)
dput
(
ctx
->
path
.
dentry
);
mntput
(
ctx
->
path
.
mnt
);
kfree
(
ctx
);
}
}
void
put_nfs_open_context
(
struct
nfs_open_context
*
ctx
)
{
kref_put
(
&
ctx
->
kref
,
nfs_free_open_context
);
}
/*
...
...
include/linux/nfs_fs.h
View file @
3bec63db
...
...
@@ -30,6 +30,7 @@
#ifdef __KERNEL__
#include <linux/in.h>
#include <linux/kref.h>
#include <linux/mm.h>
#include <linux/namei.h>
#include <linux/pagemap.h>
...
...
@@ -70,7 +71,7 @@ struct nfs_access_entry {
struct
nfs4_state
;
struct
nfs_open_context
{
atomic_t
count
;
struct
kref
kref
;
struct
path
path
;
struct
rpc_cred
*
cred
;
struct
nfs4_state
*
state
;
...
...
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