Whamcloud - gitweb
LU-925 agl: trigger async glimpse lock when statahead
[fs/lustre-release.git] / lustre / llite / lproc_llite.c
index 0845ba7..3bfe608 100644 (file)
@@ -30,6 +30,9 @@
  * Use is subject to license terms.
  */
 /*
+ * Copyright (c) 2011 Whamcloud, Inc.
+ */
+/*
  * This file is part of Lustre, http://www.lustre.org/
  * Lustre is a trademark of Sun Microsystems, Inc.
  */
@@ -562,6 +565,35 @@ static int ll_wr_statahead_max(struct file *file, const char *buffer,
         return count;
 }
 
+static int ll_rd_statahead_agl(char *page, char **start, off_t off,
+                               int count, int *eof, void *data)
+{
+        struct super_block *sb = data;
+        struct ll_sb_info *sbi = ll_s2sbi(sb);
+
+        return snprintf(page, count, "%u\n",
+                        sbi->ll_flags & LL_SBI_AGL_ENABLED ? 1 : 0);
+}
+
+static int ll_wr_statahead_agl(struct file *file, const char *buffer,
+                               unsigned long count, void *data)
+{
+        struct super_block *sb = data;
+        struct ll_sb_info *sbi = ll_s2sbi(sb);
+        int val, rc;
+
+        rc = lprocfs_write_helper(buffer, count, &val);
+        if (rc)
+                return rc;
+
+        if (val)
+                sbi->ll_flags |= LL_SBI_AGL_ENABLED;
+        else
+                sbi->ll_flags &= ~LL_SBI_AGL_ENABLED;
+
+        return count;
+}
+
 static int ll_rd_statahead_stats(char *page, char **start, off_t off,
                                  int count, int *eof, void *data)
 {
@@ -570,9 +602,11 @@ static int ll_rd_statahead_stats(char *page, char **start, off_t off,
 
         return snprintf(page, count,
                         "statahead total: %u\n"
-                        "statahead wrong: %u\n",
+                        "statahead wrong: %u\n"
+                        "agl total: %u\n",
                         atomic_read(&sbi->ll_sa_total),
-                        atomic_read(&sbi->ll_sa_wrong));
+                        atomic_read(&sbi->ll_sa_wrong),
+                        atomic_read(&sbi->ll_agl_total));
 }
 
 static int ll_rd_lazystatfs(char *page, char **start, off_t off,
@@ -630,6 +664,7 @@ static struct lprocfs_vars lprocfs_llite_obd_vars[] = {
         { "stats_track_ppid", ll_rd_track_ppid, ll_wr_track_ppid, 0 },
         { "stats_track_gid",  ll_rd_track_gid, ll_wr_track_gid, 0 },
         { "statahead_max",    ll_rd_statahead_max, ll_wr_statahead_max, 0 },
+        { "statahead_agl",    ll_rd_statahead_agl, ll_wr_statahead_agl, 0 },
         { "statahead_stats",  ll_rd_statahead_stats, 0, 0 },
         { "lazystatfs",         ll_rd_lazystatfs, ll_wr_lazystatfs, 0 },
         { 0 }