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
636fb9c8
Commit
636fb9c8
authored
May 22, 2011
by
Benny Halevy
Committed by
Boaz Harrosh
May 29, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pnfs: alloc and free layout_hdr layoutdriver methods
[gfp_flags] Signed-off-by:
Benny Halevy
<
bhalevy@panasas.com
>
parent
b6c05f16
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
3 deletions
+22
-3
fs/nfs/pnfs.c
fs/nfs/pnfs.c
+18
-3
fs/nfs/pnfs.h
fs/nfs/pnfs.h
+4
-0
No files found.
fs/nfs/pnfs.c
View file @
636fb9c8
...
...
@@ -177,13 +177,28 @@ get_layout_hdr(struct pnfs_layout_hdr *lo)
atomic_inc
(
&
lo
->
plh_refcount
);
}
static
struct
pnfs_layout_hdr
*
pnfs_alloc_layout_hdr
(
struct
inode
*
ino
,
gfp_t
gfp_flags
)
{
struct
pnfs_layoutdriver_type
*
ld
=
NFS_SERVER
(
ino
)
->
pnfs_curr_ld
;
return
ld
->
alloc_layout_hdr
?
ld
->
alloc_layout_hdr
(
ino
,
gfp_flags
)
:
kzalloc
(
sizeof
(
struct
pnfs_layout_hdr
),
gfp_flags
);
}
static
void
pnfs_free_layout_hdr
(
struct
pnfs_layout_hdr
*
lo
)
{
struct
pnfs_layoutdriver_type
*
ld
=
NFS_SERVER
(
lo
->
plh_inode
)
->
pnfs_curr_ld
;
return
ld
->
alloc_layout_hdr
?
ld
->
free_layout_hdr
(
lo
)
:
kfree
(
lo
);
}
static
void
destroy_layout_hdr
(
struct
pnfs_layout_hdr
*
lo
)
{
dprintk
(
"%s: freeing layout cache %p
\n
"
,
__func__
,
lo
);
BUG_ON
(
!
list_empty
(
&
lo
->
plh_layouts
));
NFS_I
(
lo
->
plh_inode
)
->
layout
=
NULL
;
kfree
(
lo
);
pnfs_free_layout_hdr
(
lo
);
}
static
void
...
...
@@ -744,7 +759,7 @@ alloc_init_layout_hdr(struct inode *ino, gfp_t gfp_flags)
{
struct
pnfs_layout_hdr
*
lo
;
lo
=
kzalloc
(
sizeof
(
struct
pnfs_layout_hdr
)
,
gfp_flags
);
lo
=
pnfs_alloc_layout_hdr
(
ino
,
gfp_flags
);
if
(
!
lo
)
return
NULL
;
atomic_set
(
&
lo
->
plh_refcount
,
1
);
...
...
@@ -777,7 +792,7 @@ pnfs_find_alloc_layout(struct inode *ino, gfp_t gfp_flags)
if
(
likely
(
nfsi
->
layout
==
NULL
))
/* Won the race? */
nfsi
->
layout
=
new
;
else
kfree
(
new
);
pnfs_free_layout_hdr
(
new
);
return
nfsi
->
layout
;
}
...
...
fs/nfs/pnfs.h
View file @
636fb9c8
...
...
@@ -73,6 +73,10 @@ struct pnfs_layoutdriver_type {
const
u32
id
;
const
char
*
name
;
struct
module
*
owner
;
struct
pnfs_layout_hdr
*
(
*
alloc_layout_hdr
)
(
struct
inode
*
inode
,
gfp_t
gfp_flags
);
void
(
*
free_layout_hdr
)
(
struct
pnfs_layout_hdr
*
);
struct
pnfs_layout_segment
*
(
*
alloc_lseg
)
(
struct
pnfs_layout_hdr
*
layoutid
,
struct
nfs4_layoutget_res
*
lgr
,
gfp_t
gfp_flags
);
void
(
*
free_lseg
)
(
struct
pnfs_layout_segment
*
lseg
);
...
...
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