Whamcloud - gitweb
LU-1337 vfs: kernel 3.3 hides vfsmount guts
[fs/lustre-release.git] / lustre / mgs / lproc_mgs.c
index 1801c04..fad189e 100644 (file)
@@ -1,6 +1,4 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
+/*
  * GPL HEADER START
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  * GPL HEADER END
  */
 /*
- * Copyright  2008 Sun Microsystems, Inc. All rights reserved
+ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
+ *
+ * Copyright (c) 2011, Whamcloud, Inc.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
 static int lprocfs_mgs_rd_mntdev(char *page, char **start, off_t off, int count,
                                  int *eof, void *data)
 {
-        struct obd_device* obd = (struct obd_device *)data;
+       struct obd_device *obd = (struct obd_device *)data;
 
-        LASSERT(obd != NULL);
-        LASSERT(obd->u.mgs.mgs_vfsmnt->mnt_devname);
-        *eof = 1;
+       LASSERT(obd != NULL);
+       LASSERT(mnt_get_devname(obd->u.mgs.mgs_vfsmnt));
+       *eof = 1;
 
-        return snprintf(page, count, "%s\n",obd->u.mgs.mgs_vfsmnt->mnt_devname);
+       return snprintf(page, count, "%s\n",
+                       mnt_get_devname(obd->u.mgs.mgs_vfsmnt));
 }
 
 static int mgs_fs_seq_show(struct seq_file *seq, void *v)
@@ -128,9 +129,9 @@ static int mgsself_srpc_seq_show(struct seq_file *seq, void *v)
         if (rc)
                 return rc;
 
-        cfs_down(&fsdb->fsdb_sem);
+        cfs_mutex_lock(&fsdb->fsdb_mutex);
         seq_show_srpc_rules(seq, fsdb->fsdb_name, &fsdb->fsdb_srpc_gen);
-        cfs_up(&fsdb->fsdb_sem);
+        cfs_mutex_unlock(&fsdb->fsdb_mutex);
         return 0;
 }
 
@@ -193,7 +194,7 @@ static int mgs_live_seq_show(struct seq_file *seq, void *v)
         struct mgs_tgt_srpc_conf *srpc_tgt;
         int i;
 
-        cfs_down(&fsdb->fsdb_sem);
+        cfs_mutex_lock(&fsdb->fsdb_mutex);
 
         seq_printf(seq, "fsname: %s\n", fsdb->fsdb_name);
         seq_printf(seq, "flags: %#lx     gen: %d\n",
@@ -217,11 +218,25 @@ static int mgs_live_seq_show(struct seq_file *seq, void *v)
         }
         seq_show_srpc_rules(seq, fsdb->fsdb_name, &fsdb->fsdb_srpc_gen);
 
-        cfs_up(&fsdb->fsdb_sem);
+        lprocfs_rd_ir_state(seq, fsdb);
+
+        cfs_mutex_unlock(&fsdb->fsdb_mutex);
         return 0;
 }
 
-LPROC_SEQ_FOPS_RO(mgs_live);
+static ssize_t mgs_live_seq_write(struct file *file, const char *buf,
+                                  size_t len, loff_t *off)
+{
+        struct seq_file *seq  = file->private_data;
+        struct fs_db    *fsdb = seq->private;
+        ssize_t rc;
+
+        rc = lprocfs_wr_ir_state(file, buf, len, fsdb);
+        if (rc >= 0)
+                rc = len;
+        return rc;
+}
+LPROC_SEQ_FOPS(mgs_live);
 
 int lproc_mgs_add_live(struct obd_device *obd, struct fs_db *fsdb)
 {
@@ -254,6 +269,7 @@ struct lprocfs_vars lprocfs_mgs_obd_vars[] = {
         { "num_exports",     lprocfs_rd_num_exports, 0, 0 },
         { "hash_stats",      lprocfs_obd_rd_hash,    0, 0 },
         { "evict_client",    0, lprocfs_wr_evict_client, 0 },
+        { "ir_timeout",      lprocfs_rd_ir_timeout, lprocfs_wr_ir_timeout, 0 },
         { 0 }
 };