diff options
Diffstat (limited to 'fs/nfs')
| -rw-r--r-- | fs/nfs/flexfilelayout/flexfilelayout.c | 27 | ||||
| -rw-r--r-- | fs/nfs/flexfilelayout/flexfilelayout.h | 6 |
2 files changed, 28 insertions, 5 deletions
diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c index 6bcb6d6c9dc3..d3b3b6236711 100644 --- a/fs/nfs/flexfilelayout/flexfilelayout.c +++ b/fs/nfs/flexfilelayout/flexfilelayout.c | |||
| @@ -452,14 +452,23 @@ nfs4_ff_layout_calc_completion_time(struct rpc_task *task) | |||
| 452 | return ktime_sub(ktime_get(), task->tk_start); | 452 | return ktime_sub(ktime_get(), task->tk_start); |
| 453 | } | 453 | } |
| 454 | 454 | ||
| 455 | static void | 455 | static bool |
| 456 | nfs4_ff_layoutstat_start_io(struct nfs4_ff_layout_mirror *mirror, | 456 | nfs4_ff_layoutstat_start_io(struct nfs4_ff_layout_mirror *mirror, |
| 457 | struct nfs4_ff_layoutstat *layoutstat) | 457 | struct nfs4_ff_layoutstat *layoutstat) |
| 458 | { | 458 | { |
| 459 | static const ktime_t notime = {0}; | 459 | static const ktime_t notime = {0}; |
| 460 | ktime_t now = ktime_get(); | ||
| 460 | 461 | ||
| 461 | nfs4_ff_start_busy_timer(&layoutstat->busy_timer); | 462 | nfs4_ff_start_busy_timer(&layoutstat->busy_timer); |
| 462 | cmpxchg(&mirror->start_time, notime, ktime_get()); | 463 | cmpxchg(&mirror->start_time.tv64, notime.tv64, now.tv64); |
| 464 | cmpxchg(&mirror->last_report_time.tv64, notime.tv64, now.tv64); | ||
| 465 | if (ktime_to_ms(ktime_sub(now, mirror->last_report_time)) >= | ||
| 466 | FF_LAYOUTSTATS_REPORT_INTERVAL) { | ||
| 467 | mirror->last_report_time = now; | ||
| 468 | return true; | ||
| 469 | } | ||
| 470 | |||
| 471 | return false; | ||
| 463 | } | 472 | } |
| 464 | 473 | ||
| 465 | static void | 474 | static void |
| @@ -496,10 +505,15 @@ static void | |||
| 496 | nfs4_ff_layout_stat_io_start_read(struct nfs4_ff_layout_mirror *mirror, | 505 | nfs4_ff_layout_stat_io_start_read(struct nfs4_ff_layout_mirror *mirror, |
| 497 | __u64 requested) | 506 | __u64 requested) |
| 498 | { | 507 | { |
| 508 | bool report; | ||
| 509 | |||
| 499 | spin_lock(&mirror->lock); | 510 | spin_lock(&mirror->lock); |
| 500 | nfs4_ff_layoutstat_start_io(mirror, &mirror->read_stat); | 511 | report = nfs4_ff_layoutstat_start_io(mirror, &mirror->read_stat); |
| 501 | nfs4_ff_layout_stat_io_update_requested(&mirror->read_stat, requested); | 512 | nfs4_ff_layout_stat_io_update_requested(&mirror->read_stat, requested); |
| 502 | spin_unlock(&mirror->lock); | 513 | spin_unlock(&mirror->lock); |
| 514 | |||
| 515 | if (report) | ||
| 516 | pnfs_report_layoutstat(mirror->lseg->pls_layout->plh_inode); | ||
| 503 | } | 517 | } |
| 504 | 518 | ||
| 505 | static void | 519 | static void |
| @@ -519,10 +533,15 @@ static void | |||
| 519 | nfs4_ff_layout_stat_io_start_write(struct nfs4_ff_layout_mirror *mirror, | 533 | nfs4_ff_layout_stat_io_start_write(struct nfs4_ff_layout_mirror *mirror, |
| 520 | __u64 requested) | 534 | __u64 requested) |
| 521 | { | 535 | { |
| 536 | bool report; | ||
| 537 | |||
| 522 | spin_lock(&mirror->lock); | 538 | spin_lock(&mirror->lock); |
| 523 | nfs4_ff_layoutstat_start_io(mirror, &mirror->write_stat); | 539 | report = nfs4_ff_layoutstat_start_io(mirror , &mirror->write_stat); |
| 524 | nfs4_ff_layout_stat_io_update_requested(&mirror->write_stat, requested); | 540 | nfs4_ff_layout_stat_io_update_requested(&mirror->write_stat, requested); |
| 525 | spin_unlock(&mirror->lock); | 541 | spin_unlock(&mirror->lock); |
| 542 | |||
| 543 | if (report) | ||
| 544 | pnfs_report_layoutstat(mirror->lseg->pls_layout->plh_inode); | ||
| 526 | } | 545 | } |
| 527 | 546 | ||
| 528 | static void | 547 | static void |
diff --git a/fs/nfs/flexfilelayout/flexfilelayout.h b/fs/nfs/flexfilelayout/flexfilelayout.h index 7e248874f46d..6fcd8d5e8e3d 100644 --- a/fs/nfs/flexfilelayout/flexfilelayout.h +++ b/fs/nfs/flexfilelayout/flexfilelayout.h | |||
| @@ -15,6 +15,9 @@ | |||
| 15 | * due to network error etc. */ | 15 | * due to network error etc. */ |
| 16 | #define NFS4_FLEXFILE_LAYOUT_MAX_MIRROR_CNT 4096 | 16 | #define NFS4_FLEXFILE_LAYOUT_MAX_MIRROR_CNT 4096 |
| 17 | 17 | ||
| 18 | /* LAYOUTSTATS report interval in ms */ | ||
| 19 | #define FF_LAYOUTSTATS_REPORT_INTERVAL (60000L) | ||
| 20 | |||
| 18 | struct nfs4_ff_ds_version { | 21 | struct nfs4_ff_ds_version { |
| 19 | u32 version; | 22 | u32 version; |
| 20 | u32 minor_version; | 23 | u32 minor_version; |
| @@ -62,6 +65,7 @@ struct nfs4_ff_layoutstat { | |||
| 62 | }; | 65 | }; |
| 63 | 66 | ||
| 64 | struct nfs4_ff_layout_mirror { | 67 | struct nfs4_ff_layout_mirror { |
| 68 | struct pnfs_layout_segment *lseg; /* back pointer */ | ||
| 65 | u32 ds_count; | 69 | u32 ds_count; |
| 66 | u32 efficiency; | 70 | u32 efficiency; |
| 67 | struct nfs4_ff_layout_ds *mirror_ds; | 71 | struct nfs4_ff_layout_ds *mirror_ds; |
| @@ -75,7 +79,7 @@ struct nfs4_ff_layout_mirror { | |||
| 75 | struct nfs4_ff_layoutstat read_stat; | 79 | struct nfs4_ff_layoutstat read_stat; |
| 76 | struct nfs4_ff_layoutstat write_stat; | 80 | struct nfs4_ff_layoutstat write_stat; |
| 77 | ktime_t start_time; | 81 | ktime_t start_time; |
| 78 | struct pnfs_layout_segment *lseg; /* back pointer */ | 82 | ktime_t last_report_time; |
| 79 | }; | 83 | }; |
| 80 | 84 | ||
| 81 | struct nfs4_ff_layout_segment { | 85 | struct nfs4_ff_layout_segment { |
