Skip to content

Commit

Permalink
pNFS/flexfiles: Support server-supplied layoutstats sampling period
Browse files Browse the repository at this point in the history
Some servers want to be able to control the frequency with which clients
report layoutstats, for instance, in order to monitor QoS for a particular
file or set of file. In order to support this, the flexfiles layout allows
the server to pass this info as a hint in the layout payload.

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
  • Loading branch information
Trond Myklebust committed Dec 28, 2015
1 parent f484830 commit d0379a5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
16 changes: 13 additions & 3 deletions fs/nfs/flexfilelayout/flexfilelayout.c
Original file line number Diff line number Diff line change
Expand Up @@ -505,9 +505,17 @@ ff_layout_alloc_lseg(struct pnfs_layout_hdr *lh,
}

p = xdr_inline_decode(&stream, 4);
if (p)
fls->flags = be32_to_cpup(p);
if (!p)
goto out_sort_mirrors;
fls->flags = be32_to_cpup(p);

p = xdr_inline_decode(&stream, 4);
if (!p)
goto out_sort_mirrors;
for (i=0; i < fls->mirror_array_cnt; i++)
fls->mirror_array[i]->report_interval = be32_to_cpup(p);

out_sort_mirrors:
ff_layout_sort_mirrors(fls);
rc = ff_layout_check_layout(lgr);
if (rc)
Expand Down Expand Up @@ -603,7 +611,9 @@ nfs4_ff_layoutstat_start_io(struct nfs4_ff_layout_mirror *mirror,
mirror->start_time = now;
if (ktime_equal(mirror->last_report_time, notime))
mirror->last_report_time = now;
if (layoutstats_timer != 0)
if (mirror->report_interval != 0)
report_interval = (s64)mirror->report_interval * 1000LL;
else if (layoutstats_timer != 0)
report_interval = (s64)layoutstats_timer * 1000LL;
if (ktime_to_ms(ktime_sub(now, mirror->last_report_time)) >=
report_interval) {
Expand Down
1 change: 1 addition & 0 deletions fs/nfs/flexfilelayout/flexfilelayout.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ struct nfs4_ff_layout_mirror {
struct nfs4_ff_layoutstat write_stat;
ktime_t start_time;
ktime_t last_report_time;
u32 report_interval;
};

struct nfs4_ff_layout_segment {
Expand Down

0 comments on commit d0379a5

Please sign in to comment.