NFSv4.2/pnfs: Make the layoutstats timer configurable
authorTrond Myklebust <trond.myklebust@primarydata.com>
Tue, 25 Aug 2015 00:39:18 +0000 (20:39 -0400)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Tue, 25 Aug 2015 18:40:08 +0000 (14:40 -0400)
Allow advanced users to set the layoutstats timer in order to lengthen
or shorten the period between layoutstat transmissions to the server.

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Documentation/kernel-parameters.txt
fs/nfs/flexfilelayout/flexfilelayout.c
fs/nfs/pnfs.c
fs/nfs/pnfs.h

index 1d6f0459cd7bbe531b7acc2d85722ff62185729e..30d78b561574216796eb5e7c0ce9a9a5d017882e 100644 (file)
@@ -2279,6 +2279,15 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
                        The default parameter value of '0' causes the kernel
                        not to attempt recovery of lost locks.
 
+       nfs4.layoutstats_timer =
+                       [NFSv4.2] Change the rate at which the kernel sends
+                       layoutstats to the pNFS metadata server.
+
+                       Setting this to value to 0 causes the kernel to use
+                       whatever value is the default set by the layout
+                       driver. A non-zero value sets the minimum interval
+                       in seconds between layoutstats transmissions.
+
        nfsd.nfs4_disable_idmapping=
                        [NFSv4] When set to the default of '1', the NFSv4
                        server will return only numeric uids and gids to
index 0fbf37de2a410096ffddb56a2dad52cff6db66a2..9f6fb8876b3fa308bd8ea77f9939abb728b8f849 100644 (file)
@@ -533,14 +533,17 @@ nfs4_ff_layoutstat_start_io(struct nfs4_ff_layout_mirror *mirror,
                            ktime_t now)
 {
        static const ktime_t notime = {0};
+       s64 report_interval = FF_LAYOUTSTATS_REPORT_INTERVAL;
 
        nfs4_ff_start_busy_timer(&layoutstat->busy_timer, now);
        if (ktime_equal(mirror->start_time, notime))
                mirror->start_time = now;
        if (ktime_equal(mirror->last_report_time, notime))
                mirror->last_report_time = now;
+       if (layoutstats_timer != 0)
+               report_interval = (s64)layoutstats_timer * 1000LL;
        if (ktime_to_ms(ktime_sub(now, mirror->last_report_time)) >=
-                       FF_LAYOUTSTATS_REPORT_INTERVAL) {
+                       report_interval) {
                mirror->last_report_time = now;
                return true;
        }
index 247c5a5d2d6b86fbf8d95076444c4a0a14fc805e..3530bb703214f27add6a7e657a568f72864c2e9a 100644 (file)
@@ -2285,3 +2285,7 @@ out_put:
 }
 EXPORT_SYMBOL_GPL(pnfs_report_layoutstat);
 #endif
+
+unsigned int layoutstats_timer;
+module_param(layoutstats_timer, uint, 0644);
+EXPORT_SYMBOL_GPL(layoutstats_timer);
index 02c27f93caf112646a1ff3fa93104f447f24ca35..d3979dd1037a631e5309bc2bf7862d3521594a8a 100644 (file)
@@ -528,12 +528,15 @@ pnfs_use_threshold(struct nfs4_threshold **dst, struct nfs4_threshold *src,
                                        nfss->pnfs_curr_ld->id == src->l_type);
 }
 
+extern unsigned int layoutstats_timer;
+
 #ifdef NFS_DEBUG
 void nfs4_print_deviceid(const struct nfs4_deviceid *dev_id);
 #else
 static inline void nfs4_print_deviceid(const struct nfs4_deviceid *dev_id)
 {
 }
+
 #endif /* NFS_DEBUG */
 #else  /* CONFIG_NFS_V4_1 */