Whamcloud - gitweb
LU-14669 tests: reduce time spent in sanity-sec
[fs/lustre-release.git] / lustre / obdclass / lu_ref.c
index e0a7579..43f37e9 100644 (file)
@@ -27,7 +27,6 @@
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
  *
  * lustre/obdclass/lu_ref.c
  *
@@ -309,15 +308,15 @@ static void *lu_ref_seq_next(struct seq_file *seq, void *p, loff_t *pos)
        LASSERT(seq->private == p);
        LASSERT(!list_empty(&ref->lf_linkage));
 
+       (*pos)++;
        spin_lock(&lu_ref_refs_guard);
        next = list_entry(ref->lf_linkage.next, struct lu_ref, lf_linkage);
-       if (&next->lf_linkage == &lu_ref_refs) {
+       if (&next->lf_linkage == &lu_ref_refs)
                p = NULL;
-       } else {
-               (*pos)++;
+       else
                list_move(&ref->lf_linkage, &next->lf_linkage);
-       }
        spin_unlock(&lu_ref_refs_guard);
+
        return p;
 }
 
@@ -360,7 +359,7 @@ static int lu_ref_seq_show(struct seq_file *seq, void *p)
        return 0;
 }
 
-static struct seq_operations lu_ref_seq_ops = {
+static const struct seq_operations lu_ref_seq_ops = {
        .start = lu_ref_seq_start,
        .stop  = lu_ref_seq_stop,
        .next  = lu_ref_seq_next,
@@ -395,7 +394,8 @@ static int lu_ref_seq_open(struct inode *inode, struct file *file)
 
 static int lu_ref_seq_release(struct inode *inode, struct file *file)
 {
-       struct lu_ref *ref = ((struct seq_file *)file->private_data)->private;
+       struct seq_file *m = file->private_data;
+       struct lu_ref *ref = m->private;
 
        spin_lock(&lu_ref_refs_guard);
        list_del_init(&ref->lf_linkage);
@@ -404,12 +404,12 @@ static int lu_ref_seq_release(struct inode *inode, struct file *file)
        return seq_release(inode, file);
 }
 
-static struct file_operations lu_ref_dump_fops = {
-       .owner   = THIS_MODULE,
-       .open    = lu_ref_seq_open,
-       .read    = seq_read,
-       .llseek  = seq_lseek,
-       .release = lu_ref_seq_release
+static const struct file_operations lu_ref_dump_fops = {
+       .owner          = THIS_MODULE,
+       .open           = lu_ref_seq_open,
+       .read           = seq_read,
+       .llseek         = seq_lseek,
+       .release        = lu_ref_seq_release
 };
 
 #endif /* CONFIG_PROC_FS */