Whamcloud - gitweb
LU-7988 hsm: run HSM coordinator once per second at most
[fs/lustre-release.git] / lustre / mdt / mdt_lproc.c
index 4b288ed..f10e910 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
  */
@@ -27,7 +23,7 @@
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2011, 2014, Intel Corporation.
+ * Copyright (c) 2011, 2016, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -116,13 +112,13 @@ static void display_rename_stats(struct seq_file *seq, char *name,
 static void rename_stats_show(struct seq_file *seq,
                               struct rename_stats *rename_stats)
 {
-        struct timeval now;
+       struct timespec64 now;
 
-        /* this sampling races with updates */
-        do_gettimeofday(&now);
-        seq_printf(seq, "rename_stats:\n");
-        seq_printf(seq, "- %-15s %lu.%lu\n", "snapshot_time:",
-                   now.tv_sec, now.tv_usec);
+       /* this sampling races with updates */
+       ktime_get_real_ts64(&now);
+       seq_printf(seq, "rename_stats:\n");
+       seq_printf(seq, "- %-15s %llu.%9lu\n", "snapshot_time:",
+                  (s64)now.tv_sec, now.tv_nsec);
 
         display_rename_stats(seq, "same_dir",
                              &rename_stats->hist[RENAME_SAMEDIR_SIZE]);
@@ -281,9 +277,9 @@ static int mdt_identity_upcall_seq_show(struct seq_file *m, void *data)
        struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
        struct upcall_cache *hash = mdt->mdt_identity_cache;
 
-       read_lock(&hash->uc_upcall_rwlock);
+       down_read(&hash->uc_upcall_rwsem);
        seq_printf(m, "%s\n", hash->uc_upcall);
-       read_unlock(&hash->uc_upcall_rwlock);
+       up_read(&hash->uc_upcall_rwsem);
        return 0;
 }
 
@@ -309,9 +305,9 @@ mdt_identity_upcall_seq_write(struct file *file, const char __user *buffer,
                GOTO(failed, rc = -EFAULT);
 
        /* Remove any extraneous bits from the upcall (e.g. linefeeds) */
-       write_lock(&hash->uc_upcall_rwlock);
+       down_write(&hash->uc_upcall_rwsem);
        sscanf(kernbuf, "%s", hash->uc_upcall);
-       write_unlock(&hash->uc_upcall_rwlock);
+       up_write(&hash->uc_upcall_rwsem);
 
        if (strcmp(hash->uc_name, mdt_obd_name(mdt)) != 0)
                CWARN("%s: write to upcall name %s\n",
@@ -514,45 +510,6 @@ mdt_evict_tgt_nids_seq_write(struct file *file, const char __user *buffer,
 }
 LPROC_SEQ_FOPS(mdt_evict_tgt_nids);
 
-
-static int mdt_sec_level_seq_show(struct seq_file *m, void *data)
-{
-       struct obd_device *obd = m->private;
-       struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
-
-       seq_printf(m, "%d\n", mdt->mdt_lut.lut_sec_level);
-       return 0;
-}
-
-static ssize_t
-mdt_sec_level_seq_write(struct file *file, const char __user *buffer,
-                       size_t count, loff_t *off)
-{
-       struct seq_file   *m = file->private_data;
-       struct obd_device *obd = m->private;
-       struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
-       int rc;
-       __s64 val;
-
-       rc = lprocfs_str_to_s64(buffer, count, &val);
-       if (rc)
-               return rc;
-
-       if (val > LUSTRE_SEC_ALL || val < LUSTRE_SEC_NONE)
-               return -EINVAL;
-
-       if (val == LUSTRE_SEC_SPECIFY) {
-               CWARN("security level %d will be supported in future.\n",
-                     LUSTRE_SEC_SPECIFY);
-               return -EINVAL;
-       }
-
-       mdt->mdt_lut.lut_sec_level = val;
-
-       return count;
-}
-LPROC_SEQ_FOPS(mdt_sec_level);
-
 static int mdt_cos_seq_show(struct seq_file *m, void *data)
 {
        struct obd_device *obd = m->private;
@@ -805,8 +762,6 @@ mdt_sync_count_seq_write(struct file *file, const char __user *buffer,
 }
 LPROC_SEQ_FOPS(mdt_sync_count);
 
-
-LPROC_SEQ_FOPS_RO_TYPE(mdt, uuid);
 LPROC_SEQ_FOPS_RO_TYPE(mdt, recovery_status);
 LPROC_SEQ_FOPS_RO_TYPE(mdt, num_exports);
 LPROC_SEQ_FOPS_RO_TYPE(mdt, target_instance);
@@ -821,8 +776,6 @@ LPROC_SEQ_FOPS_RW_TYPE(mdt, recovery_time_hard);
 LPROC_SEQ_FOPS_RW_TYPE(mdt, recovery_time_soft);
 
 static struct lprocfs_vars lprocfs_mdt_obd_vars[] = {
-       { .name =       "uuid",
-         .fops =       &mdt_uuid_fops                          },
        { .name =       "recovery_status",
          .fops =       &mdt_recovery_status_fops               },
        { .name =       "num_exports",
@@ -845,8 +798,6 @@ static struct lprocfs_vars lprocfs_mdt_obd_vars[] = {
          .fops =       &mdt_evict_tgt_nids_fops                },
        { .name =       "hash_stats",
          .fops =       &mdt_hash_fops                          },
-       { .name =       "sec_level",
-         .fops =       &mdt_sec_level_fops                     },
        { .name =       "commit_on_sharing",
          .fops =       &mdt_cos_fops                           },
        { .name =       "root_squash",
@@ -972,7 +923,7 @@ int mdt_procfs_init(struct mdt_device *mdt, const char *name)
        LASSERT(name != NULL);
 
        obd->obd_vars = lprocfs_mdt_obd_vars;
-       rc = lprocfs_obd_setup(obd);
+       rc = lprocfs_obd_setup(obd, true);
        if (rc) {
                CERROR("%s: cannot create proc entries: rc = %d\n",
                       mdt_obd_name(mdt), rc);