Whamcloud - gitweb
LU-9485 test: revert a change from LU-5361
[fs/lustre-release.git] / lustre / osd-ldiskfs / osd_lproc.c
index 7eb806d..8b018cf 100644 (file)
  *
  * You should have received a copy of the GNU General Public License
  * version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * http://www.gnu.org/licenses/gpl-2.0.html
  *
  * GPL HEADER END
  */
@@ -63,7 +59,7 @@ void osd_brw_stats_update(struct osd_device *osd, struct osd_iobuf *iobuf)
         if (unlikely(nr_pages == 0))
                 return;
 
-       blocks_per_page = PAGE_CACHE_SIZE >> osd_sb(osd)->s_blocksize_bits;
+       blocks_per_page = PAGE_SIZE >> osd_sb(osd)->s_blocksize_bits;
 
         lprocfs_oh_tally_log2(&s->hist[BRW_R_PAGES+rw], nr_pages);
 
@@ -125,12 +121,13 @@ static void display_brw_stats(struct seq_file *seq, char *name, char *units,
 
 static void brw_stats_show(struct seq_file *seq, struct brw_stats *brw_stats)
 {
-       struct timeval now;
+       struct timespec64 now;
 
        /* this sampling races with updates */
-       do_gettimeofday(&now);
-       seq_printf(seq, "snapshot_time:         %lu.%lu (secs.usecs)\n",
-                  now.tv_sec, now.tv_usec);
+       ktime_get_real_ts64(&now);
+
+       seq_printf(seq, "snapshot_time:         %lld.%09ld (secs.nsecs)\n",
+                  (s64)now.tv_sec, now.tv_nsec);
 
         display_brw_stats(seq, "pages per bulk r/w", "rpcs",
                           &brw_stats->hist[BRW_R_PAGES],
@@ -173,10 +170,11 @@ static int osd_brw_stats_seq_show(struct seq_file *seq, void *v)
         return 0;
 }
 
-static ssize_t osd_brw_stats_seq_write(struct file *file, const char *buf,
-                                       size_t len, loff_t *off)
+static ssize_t osd_brw_stats_seq_write(struct file *file,
+                                      const char __user *buf,
+                                      size_t len, loff_t *off)
 {
-        struct seq_file *seq = file->private_data;
+       struct seq_file *seq = file->private_data;
         struct osd_device *osd = seq->private;
         int i;
 
@@ -274,7 +272,7 @@ static int ldiskfs_osd_cache_seq_show(struct seq_file *m, void *data)
 }
 
 static ssize_t
-ldiskfs_osd_cache_seq_write(struct file *file, const char *buffer,
+ldiskfs_osd_cache_seq_write(struct file *file, const char __user *buffer,
                            size_t count, loff_t *off)
 {
        struct seq_file *m = file->private_data;
@@ -309,7 +307,7 @@ static int ldiskfs_osd_wcache_seq_show(struct seq_file *m, void *data)
 }
 
 static ssize_t
-ldiskfs_osd_wcache_seq_write(struct file *file, const char *buffer,
+ldiskfs_osd_wcache_seq_write(struct file *file, const char __user *buffer,
                                size_t count, loff_t *off)
 {
        struct seq_file *m = file->private_data;
@@ -332,7 +330,7 @@ ldiskfs_osd_wcache_seq_write(struct file *file, const char *buffer,
 LPROC_SEQ_FOPS(ldiskfs_osd_wcache);
 
 static ssize_t
-lprocfs_osd_force_sync_seq_write(struct file *file, const char *buffer,
+lprocfs_osd_force_sync_seq_write(struct file *file, const char __user *buffer,
                                        size_t count, loff_t *off)
 {
        struct seq_file   *m = file->private_data;
@@ -362,7 +360,7 @@ static int ldiskfs_osd_pdo_seq_show(struct seq_file *m, void *data)
 }
 
 static ssize_t
-ldiskfs_osd_pdo_seq_write(struct file *file, const char *buffer,
+ldiskfs_osd_pdo_seq_write(struct file *file, const char __user *buffer,
                                size_t count, loff_t *off)
 {
        int rc;
@@ -391,7 +389,7 @@ static int ldiskfs_osd_auto_scrub_seq_show(struct seq_file *m, void *data)
 }
 
 static ssize_t
-ldiskfs_osd_auto_scrub_seq_write(struct file *file, const char *buffer,
+ldiskfs_osd_auto_scrub_seq_write(struct file *file, const char __user *buffer,
                                        size_t count, loff_t *off)
 {
        struct seq_file *m = file->private_data;
@@ -421,12 +419,13 @@ static int ldiskfs_osd_full_scrub_ratio_seq_show(struct seq_file *m, void *data)
        if (unlikely(dev->od_mnt == NULL))
                return -EINPROGRESS;
 
-       seq_printf(m, LPU64"\n", dev->od_full_scrub_ratio);
+       seq_printf(m, "%llu\n", dev->od_full_scrub_ratio);
        return 0;
 }
 
 static ssize_t
-ldiskfs_osd_full_scrub_ratio_seq_write(struct file *file, const char *buffer,
+ldiskfs_osd_full_scrub_ratio_seq_write(struct file *file,
+                                      const char __user *buffer,
                                       size_t count, loff_t *off)
 {
        struct seq_file *m = file->private_data;
@@ -460,14 +459,14 @@ static int ldiskfs_osd_full_scrub_threshold_rate_seq_show(struct seq_file *m,
        if (unlikely(dev->od_mnt == NULL))
                return -EINPROGRESS;
 
-       seq_printf(m, LPU64" (bad OI mappings/minute)\n",
+       seq_printf(m, "%llu (bad OI mappings/minute)\n",
                   dev->od_full_scrub_threshold_rate);
        return 0;
 }
 
 static ssize_t
 ldiskfs_osd_full_scrub_threshold_rate_seq_write(struct file *file,
-                                               const char *buffer,
+                                               const char __user *buffer,
                                                size_t count, loff_t *off)
 {
        struct seq_file *m = file->private_data;
@@ -501,7 +500,7 @@ ldiskfs_osd_track_declares_assert_seq_show(struct seq_file *m, void *data)
 
 static ssize_t
 ldiskfs_osd_track_declares_assert_seq_write(struct file *file,
-                                               const char *buffer,
+                                               const char __user *buffer,
                                                size_t count, loff_t *off)
 {
        __s64 track_declares_assert;
@@ -537,12 +536,12 @@ static int ldiskfs_osd_readcache_seq_show(struct seq_file *m, void *data)
        if (unlikely(osd->od_mnt == NULL))
                return -EINPROGRESS;
 
-       seq_printf(m, LPU64"\n", osd->od_readcache_max_filesize);
+       seq_printf(m, "%llu\n", osd->od_readcache_max_filesize);
        return 0;
 }
 
 static ssize_t
-ldiskfs_osd_readcache_seq_write(struct file *file, const char *buffer,
+ldiskfs_osd_readcache_seq_write(struct file *file, const char __user *buffer,
                                size_t count, loff_t *off)
 {
        struct seq_file *m = file->private_data;
@@ -555,7 +554,7 @@ ldiskfs_osd_readcache_seq_write(struct file *file, const char *buffer,
        if (unlikely(osd->od_mnt == NULL))
                return -EINPROGRESS;
 
-       rc = lprocfs_str_to_s64(buffer, count, &val);
+       rc = lprocfs_str_with_units_to_s64(buffer, count, &val, '1');
        if (rc)
                return rc;
        if (val < 0)
@@ -581,7 +580,8 @@ static int ldiskfs_osd_index_in_idif_seq_show(struct seq_file *m, void *data)
 }
 
 static ssize_t
-ldiskfs_osd_index_in_idif_seq_write(struct file *file, const char *buffer,
+ldiskfs_osd_index_in_idif_seq_write(struct file *file,
+                                   const char __user *buffer,
                                    size_t count, loff_t *off)
 {
        struct lu_env env;