Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
Linux
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
E-EXK4 - Operating System Group
projects
Linux
Commits
636fb9c8
Commit
636fb9c8
authored
13 years ago
by
Benny Halevy
Committed by
Boaz Harrosh
13 years ago
Browse files
Options
Downloads
Patches
Plain Diff
pnfs: alloc and free layout_hdr layoutdriver methods
[gfp_flags] Signed-off-by:
Benny Halevy
<
bhalevy@panasas.com
>
parent
b6c05f16
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
fs/nfs/pnfs.c
+18
-3
18 additions, 3 deletions
fs/nfs/pnfs.c
fs/nfs/pnfs.h
+4
-0
4 additions, 0 deletions
fs/nfs/pnfs.h
with
22 additions
and
3 deletions
fs/nfs/pnfs.c
+
18
−
3
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
;
}
...
...
This diff is collapsed.
Click to expand it.
fs/nfs/pnfs.h
+
4
−
0
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
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment