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
08e2e5bc
Commit
08e2e5bc
authored
Sep 29, 2016
by
Trond Myklebust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pNFS/flexfiles: Clean up layoutstats
Signed-off-by:
Trond Myklebust
<
trond.myklebust@primarydata.com
>
parent
5b9b3c85
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
20 deletions
+7
-20
fs/nfs/flexfilelayout/flexfilelayout.c
fs/nfs/flexfilelayout/flexfilelayout.c
+7
-20
No files found.
fs/nfs/flexfilelayout/flexfilelayout.c
View file @
08e2e5bc
...
@@ -2227,14 +2227,13 @@ ff_layout_encode_layoutstats(struct xdr_stream *xdr,
...
@@ -2227,14 +2227,13 @@ ff_layout_encode_layoutstats(struct xdr_stream *xdr,
}
}
static
int
static
int
ff_layout_mirror_prepare_stats
(
struct
nfs42_layoutstat_args
*
args
,
ff_layout_mirror_prepare_stats
(
struct
pnfs_layout_hdr
*
lo
,
struct
pnfs_layout_hdr
*
l
o
,
struct
nfs42_layoutstat_devinfo
*
devinf
o
,
int
dev_limit
)
int
dev_limit
)
{
{
struct
nfs4_flexfile_layout
*
ff_layout
=
FF_LAYOUT_FROM_HDR
(
lo
);
struct
nfs4_flexfile_layout
*
ff_layout
=
FF_LAYOUT_FROM_HDR
(
lo
);
struct
nfs4_ff_layout_mirror
*
mirror
;
struct
nfs4_ff_layout_mirror
*
mirror
;
struct
nfs4_deviceid_node
*
dev
;
struct
nfs4_deviceid_node
*
dev
;
struct
nfs42_layoutstat_devinfo
*
devinfo
;
int
i
=
0
;
int
i
=
0
;
list_for_each_entry
(
mirror
,
&
ff_layout
->
mirrors
,
mirrors
)
{
list_for_each_entry
(
mirror
,
&
ff_layout
->
mirrors
,
mirrors
)
{
...
@@ -2248,7 +2247,6 @@ ff_layout_mirror_prepare_stats(struct nfs42_layoutstat_args *args,
...
@@ -2248,7 +2247,6 @@ ff_layout_mirror_prepare_stats(struct nfs42_layoutstat_args *args,
if
(
!
atomic_inc_not_zero
(
&
mirror
->
ref
))
if
(
!
atomic_inc_not_zero
(
&
mirror
->
ref
))
continue
;
continue
;
dev
=
&
mirror
->
mirror_ds
->
id_node
;
dev
=
&
mirror
->
mirror_ds
->
id_node
;
devinfo
=
&
args
->
devinfo
[
i
];
memcpy
(
&
devinfo
->
dev_id
,
&
dev
->
deviceid
,
NFS4_DEVICEID4_SIZE
);
memcpy
(
&
devinfo
->
dev_id
,
&
dev
->
deviceid
,
NFS4_DEVICEID4_SIZE
);
devinfo
->
offset
=
0
;
devinfo
->
offset
=
0
;
devinfo
->
length
=
NFS4_MAX_UINT64
;
devinfo
->
length
=
NFS4_MAX_UINT64
;
...
@@ -2260,6 +2258,7 @@ ff_layout_mirror_prepare_stats(struct nfs42_layoutstat_args *args,
...
@@ -2260,6 +2258,7 @@ ff_layout_mirror_prepare_stats(struct nfs42_layoutstat_args *args,
devinfo
->
layoutstats_encode
=
ff_layout_encode_layoutstats
;
devinfo
->
layoutstats_encode
=
ff_layout_encode_layoutstats
;
devinfo
->
layout_private
=
mirror
;
devinfo
->
layout_private
=
mirror
;
devinfo
++
;
i
++
;
i
++
;
}
}
return
i
;
return
i
;
...
@@ -2269,29 +2268,17 @@ static int
...
@@ -2269,29 +2268,17 @@ static int
ff_layout_prepare_layoutstats
(
struct
nfs42_layoutstat_args
*
args
)
ff_layout_prepare_layoutstats
(
struct
nfs42_layoutstat_args
*
args
)
{
{
struct
nfs4_flexfile_layout
*
ff_layout
;
struct
nfs4_flexfile_layout
*
ff_layout
;
struct
nfs4_ff_layout_mirror
*
mirror
;
const
int
dev_count
=
PNFS_LAYOUTSTATS_MAXDEV
;
int
dev_count
=
0
;
spin_lock
(
&
args
->
inode
->
i_lock
);
ff_layout
=
FF_LAYOUT_FROM_HDR
(
NFS_I
(
args
->
inode
)
->
layout
);
list_for_each_entry
(
mirror
,
&
ff_layout
->
mirrors
,
mirrors
)
{
if
(
atomic_read
(
&
mirror
->
ref
)
!=
0
)
dev_count
++
;
}
spin_unlock
(
&
args
->
inode
->
i_lock
);
/* For now, send at most PNFS_LAYOUTSTATS_MAXDEV statistics */
/* For now, send at most PNFS_LAYOUTSTATS_MAXDEV statistics */
if
(
dev_count
>
PNFS_LAYOUTSTATS_MAXDEV
)
{
dprintk
(
"%s: truncating devinfo to limit (%d:%d)
\n
"
,
__func__
,
dev_count
,
PNFS_LAYOUTSTATS_MAXDEV
);
dev_count
=
PNFS_LAYOUTSTATS_MAXDEV
;
}
args
->
devinfo
=
kmalloc_array
(
dev_count
,
sizeof
(
*
args
->
devinfo
),
GFP_NOIO
);
args
->
devinfo
=
kmalloc_array
(
dev_count
,
sizeof
(
*
args
->
devinfo
),
GFP_NOIO
);
if
(
!
args
->
devinfo
)
if
(
!
args
->
devinfo
)
return
-
ENOMEM
;
return
-
ENOMEM
;
spin_lock
(
&
args
->
inode
->
i_lock
);
spin_lock
(
&
args
->
inode
->
i_lock
);
args
->
num_dev
=
ff_layout_mirror_prepare_stats
(
args
,
ff_layout
=
FF_LAYOUT_FROM_HDR
(
NFS_I
(
args
->
inode
)
->
layout
);
&
ff_layout
->
generic_hdr
,
dev_count
);
args
->
num_dev
=
ff_layout_mirror_prepare_stats
(
&
ff_layout
->
generic_hdr
,
&
args
->
devinfo
[
0
],
dev_count
);
spin_unlock
(
&
args
->
inode
->
i_lock
);
spin_unlock
(
&
args
->
inode
->
i_lock
);
if
(
!
args
->
num_dev
)
{
if
(
!
args
->
num_dev
)
{
kfree
(
args
->
devinfo
);
kfree
(
args
->
devinfo
);
...
...
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