+static int ll_rd_max_cached_mb(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);
+ long pages_number;
+ int mult;
+
+ spin_lock(&sbi->ll_lock);
+ pages_number = sbi->ll_async_page_max;
+ spin_unlock(&sbi->ll_lock);
+
+ mult = 1 << (20 - CFS_PAGE_SHIFT);
+ return lprocfs_read_frac_helper(page, count, pages_number, mult);;
+}
+
+static int ll_wr_max_cached_mb(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 mult, rc, pages_number;
+
+ mult = 1 << (20 - CFS_PAGE_SHIFT);
+ rc = lprocfs_write_frac_helper(buffer, count, &pages_number, mult);
+ if (rc)
+ return rc;
+
+ if (pages_number < 0 || pages_number > num_physpages) {
+ CERROR("can't set max cache more than %lu MB\n",
+ num_physpages >> (20 - CFS_PAGE_SHIFT));
+ return -ERANGE;
+ }
+
+ spin_lock(&sbi->ll_lock);
+ sbi->ll_async_page_max = pages_number ;
+ spin_unlock(&sbi->ll_lock);
+
+ if (!sbi->ll_dt_exp)
+ /* Not set up yet, don't call llap_shrink_cache */
+ return count;
+
+ return count;
+}
+
+static int ll_rd_checksum(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_CHECKSUM) ? 1 : 0);
+}
+
+static int ll_wr_checksum(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;
+
+ if (!sbi->ll_dt_exp)
+ /* Not set up yet */
+ return -EAGAIN;
+
+ rc = lprocfs_write_helper(buffer, count, &val);
+ if (rc)
+ return rc;
+ if (val)
+ sbi->ll_flags |= LL_SBI_CHECKSUM;
+ else
+ sbi->ll_flags &= ~LL_SBI_CHECKSUM;
+
+ rc = obd_set_info_async(sbi->ll_dt_exp, sizeof(KEY_CHECKSUM),
+ KEY_CHECKSUM, sizeof(val), &val, NULL);
+ if (rc)
+ CWARN("Failed to set OSC checksum flags: %d\n", rc);
+
+ return count;
+}
+
+static int ll_rd_max_rw_chunk(char *page, char **start, off_t off,
+ int count, int *eof, void *data)
+{
+ struct super_block *sb = data;
+
+ return snprintf(page, count, "%lu\n", ll_s2sbi(sb)->ll_max_rw_chunk);
+}
+
+static int ll_wr_max_rw_chunk(struct file *file, const char *buffer,
+ unsigned long count, void *data)
+{
+ struct super_block *sb = data;
+ int rc, val;
+
+ rc = lprocfs_write_helper(buffer, count, &val);
+ if (rc)
+ return rc;
+ ll_s2sbi(sb)->ll_max_rw_chunk = val;
+ return count;
+}
+
+static int ll_rd_track_id(char *page, int count, void *data,
+ enum stats_track_type type)
+{
+ struct super_block *sb = data;
+
+ if (ll_s2sbi(sb)->ll_stats_track_type == type) {
+ return snprintf(page, count, "%d\n",
+ ll_s2sbi(sb)->ll_stats_track_id);
+
+ } else if (ll_s2sbi(sb)->ll_stats_track_type == STATS_TRACK_ALL) {
+ return snprintf(page, count, "0 (all)\n");
+ } else {
+ return snprintf(page, count, "untracked\n");
+ }
+}
+
+static int ll_wr_track_id(const char *buffer, unsigned long count, void *data,
+ enum stats_track_type type)
+{
+ struct super_block *sb = data;
+ int rc, pid;
+
+ rc = lprocfs_write_helper(buffer, count, &pid);
+ if (rc)
+ return rc;
+ ll_s2sbi(sb)->ll_stats_track_id = pid;
+ if (pid == 0)
+ ll_s2sbi(sb)->ll_stats_track_type = STATS_TRACK_ALL;
+ else
+ ll_s2sbi(sb)->ll_stats_track_type = type;
+ lprocfs_clear_stats(ll_s2sbi(sb)->ll_stats);
+ return count;
+}
+
+static int ll_rd_track_pid(char *page, char **start, off_t off,
+ int count, int *eof, void *data)
+{
+ return (ll_rd_track_id(page, count, data, STATS_TRACK_PID));
+}
+
+static int ll_wr_track_pid(struct file *file, const char *buffer,
+ unsigned long count, void *data)
+{
+ return (ll_wr_track_id(buffer, count, data, STATS_TRACK_PID));
+}
+
+static int ll_rd_track_ppid(char *page, char **start, off_t off,
+ int count, int *eof, void *data)
+{
+ return (ll_rd_track_id(page, count, data, STATS_TRACK_PPID));
+}
+
+static int ll_wr_track_ppid(struct file *file, const char *buffer,
+ unsigned long count, void *data)
+{
+ return (ll_wr_track_id(buffer, count, data, STATS_TRACK_PPID));
+}
+
+static int ll_rd_track_gid(char *page, char **start, off_t off,
+ int count, int *eof, void *data)
+{
+ return (ll_rd_track_id(page, count, data, STATS_TRACK_GID));
+}
+
+static int ll_wr_track_gid(struct file *file, const char *buffer,
+ unsigned long count, void *data)
+{
+ return (ll_wr_track_id(buffer, count, data, STATS_TRACK_GID));
+}
+
+static int ll_rd_statahead_max(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_sa_max);
+}
+
+static int ll_wr_statahead_max(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 >= 0 && val <= LL_SA_RPC_MAX)
+ sbi->ll_sa_max = val;
+ else
+ CERROR("Bad statahead_max value %d. Valid values are in the "
+ "range [0, %d]\n", val, LL_SA_RPC_MAX);
+
+ return count;
+}
+
+static int ll_rd_statahead_stats(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,
+ "statahead wrong: %u\n"
+ "statahead total: %u\n"
+ "ls blocked: %llu\n"
+ "ls cached: %llu\n"
+ "hit count: %llu\n"
+ "miss count: %llu\n",
+ sbi->ll_sa_wrong,
+ sbi->ll_sa_total,
+ sbi->ll_sa_blocked,
+ sbi->ll_sa_cached,
+ sbi->ll_sa_hit,
+ sbi->ll_sa_miss);
+}
+
+static int ll_rd_lazystatfs(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_LAZYSTATFS) ? 1 : 0);
+}
+
+static int ll_wr_lazystatfs(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_LAZYSTATFS;
+ else
+ sbi->ll_flags &= ~LL_SBI_LAZYSTATFS;
+
+ return count;
+}
+
+static struct lprocfs_vars lprocfs_llite_obd_vars[] = {