Whamcloud - gitweb
LU-9325 obd: replace lprocfs_str_to_s64
[fs/lustre-release.git] / lustre / mgs / mgs_nids.c
index 1e24fe8..7f73d86 100644 (file)
@@ -23,7 +23,7 @@
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2011, 2015, Intel Corporation.
+ * Copyright (c) 2011, 2017, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -48,7 +48,7 @@
 
 #include "mgs_internal.h"
 
-static unsigned int ir_timeout;
+static time64_t ir_timeout;
 
 static int nidtbl_is_sane(struct mgs_nidtbl *tbl)
 {
@@ -421,7 +421,7 @@ static int mgs_ir_notify(void *arg)
        struct ldlm_res_id resid;
        char name[sizeof(fsdb->fsdb_name) + 16];
 
-       LASSERTF(sizeof(name) < 40, "name is too large to be in stack.\n");
+       CLASSERT(sizeof(name) < 40); /* name is too large to be on stack */
 
        snprintf(name, sizeof(name) - 1, "mgs_%s_notify", fsdb->fsdb_name);
        complete(&fsdb->fsdb_notify_comp);
@@ -454,11 +454,10 @@ int mgs_ir_init_fs(const struct lu_env *env, struct mgs_device *mgs,
        struct task_struct *task;
 
        if (!ir_timeout)
-               ir_timeout = OBD_IR_MGS_TIMEOUT;
+               ir_timeout = (time64_t)OBD_IR_MGS_TIMEOUT;
 
        fsdb->fsdb_ir_state = IR_FULL;
-       if (cfs_time_before(cfs_time_current_sec(),
-                           mgs->mgs_start_time + ir_timeout))
+       if (mgs->mgs_start_time + ir_timeout > ktime_get_real_seconds())
                fsdb->fsdb_ir_state = IR_STARTUP;
        fsdb->fsdb_nonir_clients = 0;
        /* start notify thread */
@@ -494,8 +493,8 @@ void mgs_ir_fini_fs(struct mgs_device *mgs, struct fs_db *fsdb)
 static inline void ir_state_graduate(struct fs_db *fsdb)
 {
         if (fsdb->fsdb_ir_state == IR_STARTUP) {
-               if (cfs_time_before(fsdb->fsdb_mgs->mgs_start_time + ir_timeout,
-                                    cfs_time_current_sec())) {
+               if (ktime_get_real_seconds() >
+                   fsdb->fsdb_mgs->mgs_start_time + ir_timeout) {
                         fsdb->fsdb_ir_state = IR_FULL;
                         if (fsdb->fsdb_nonir_clients)
                                 fsdb->fsdb_ir_state = IR_PARTIAL;
@@ -832,14 +831,15 @@ int lprocfs_rd_ir_state(struct seq_file *seq, void *data)
 
 int lprocfs_ir_timeout_seq_show(struct seq_file *m, void *data)
 {
-       return lprocfs_uint_seq_show(m, &ir_timeout);
+       seq_printf(m, "%lld\n", ir_timeout);
+       return 0;
 }
 
 ssize_t lprocfs_ir_timeout_seq_write(struct file *file,
                                     const char __user *buffer,
                                     size_t count, loff_t *off)
 {
-        return lprocfs_wr_uint(file, buffer, count, &ir_timeout);
+       return kstrtoll_from_user(buffer, count, 0, &ir_timeout);
 }
 
 /* --------------- Handle non IR support clients --------------- */