X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Fofd%2Flproc_ofd.c;h=28f5ab461bf60ad5d9a1ddc4b4cdabd8331adb05;hp=74dba8a0da5e6036311f0fb935aceafdd67a1184;hb=71d68757c76cb01ba4d9afa09c766fe48dce369c;hpb=87d06d8213b9bdb3dfa5d145e992ae24a3d1c5e4 diff --git a/lustre/ofd/lproc_ofd.c b/lustre/ofd/lproc_ofd.c index 74dba8a..28f5ab4 100644 --- a/lustre/ofd/lproc_ofd.c +++ b/lustre/ofd/lproc_ofd.c @@ -56,6 +56,90 @@ static int lprocfs_ofd_rd_groups(char *page, char **start, off_t off, return snprintf(page, count, "%u\n", ofd->ofd_max_group); } +static int lprocfs_ofd_rd_tot_dirty(char *page, char **start, off_t off, + int count, int *eof, void *data) +{ + struct obd_device *obd = (struct obd_device *)data; + struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev); + + LASSERT(obd != NULL); + *eof = 1; + return snprintf(page, count, LPU64"\n", ofd->ofd_tot_dirty); +} + +static int lprocfs_ofd_rd_tot_granted(char *page, char **start, off_t off, + int count, int *eof, void *data) +{ + struct obd_device *obd = (struct obd_device *)data; + struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev); + + LASSERT(obd != NULL); + *eof = 1; + return snprintf(page, count, LPU64"\n", ofd->ofd_tot_granted); +} + +static int lprocfs_ofd_rd_tot_pending(char *page, char **start, off_t off, + int count, int *eof, void *data) +{ + struct obd_device *obd = (struct obd_device *)data; + struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev); + + LASSERT(obd != NULL); + *eof = 1; + return snprintf(page, count, LPU64"\n", ofd->ofd_tot_pending); +} + +static int lprocfs_ofd_rd_grant_precreate(char *page, char **start, off_t off, + int count, int *eof, void *data) +{ + struct obd_device *obd = (struct obd_device *)data; + + LASSERT(obd != NULL); + *eof = 1; + return snprintf(page, count, "%ld\n", + obd->obd_self_export->exp_filter_data.fed_grant); +} + +static int lprocfs_ofd_rd_grant_ratio(char *page, char **start, off_t off, + int count, int *eof, void *data) +{ + struct obd_device *obd = (struct obd_device *)data; + struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev); + + LASSERT(obd != NULL); + *eof = 1; + return snprintf(page, count, "%d%%\n", + (int) ofd_grant_reserved(ofd, 100)); +} + +static int lprocfs_ofd_wr_grant_ratio(struct file *file, const char *buffer, + unsigned long count, void *data) +{ + struct obd_device *obd = (struct obd_device *)data; + struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev); + int val; + int rc; + + rc = lprocfs_write_helper(buffer, count, &val); + if (rc) + return rc; + + if (val > 100 || val < 0) + return -EINVAL; + + if (val == 0) + CWARN("%s: disabling grant error margin\n", obd->obd_name); + if (val > 50) + CWARN("%s: setting grant error margin >50%%, be warned that " + "a huge part of the free space is now reserved for " + "grants\n", obd->obd_name); + + cfs_spin_lock(&ofd->ofd_grant_lock); + ofd->ofd_grant_ratio = ofd_grant_ratio_conv(val); + cfs_spin_unlock(&ofd->ofd_grant_lock); + return count; +} + static int lprocfs_ofd_rd_last_id(char *page, char **start, off_t off, int count, int *eof, void *data) { @@ -303,6 +387,39 @@ int lprocfs_ofd_wr_sync_lock_cancel(struct file *file, const char *buffer, return count; } +int lprocfs_ofd_rd_grant_compat_disable(char *page, char **start, off_t off, + int count, int *eof, void *data) +{ + struct obd_device *obd = data; + struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev); + int rc; + + rc = snprintf(page, count, "%u\n", ofd->ofd_grant_compat_disable); + return rc; +} + +int lprocfs_ofd_wr_grant_compat_disable(struct file *file, const char *buffer, + unsigned long count, void *data) +{ + struct obd_device *obd = data; + struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev); + int val; + int rc; + + rc = lprocfs_write_helper(buffer, count, &val); + if (rc) + return rc; + + if (val < 0) + return -EINVAL; + + cfs_spin_lock(&ofd->ofd_flags_lock); + ofd->ofd_grant_compat_disable = !!val; + cfs_spin_unlock(&ofd->ofd_flags_lock); + + return count; +} + static struct lprocfs_vars lprocfs_ofd_obd_vars[] = { { "uuid", lprocfs_rd_uuid, 0, 0 }, { "blocksize", lprocfs_rd_blksize, 0, 0 }, @@ -314,6 +431,12 @@ static struct lprocfs_vars lprocfs_ofd_obd_vars[] = { { "filegroups", lprocfs_ofd_rd_groups, 0, 0 }, { "fstype", lprocfs_ofd_rd_fstype, 0, 0 }, { "last_id", lprocfs_ofd_rd_last_id, 0, 0 }, + { "tot_dirty", lprocfs_ofd_rd_tot_dirty, 0, 0 }, + { "tot_pending", lprocfs_ofd_rd_tot_pending, 0, 0 }, + { "tot_granted", lprocfs_ofd_rd_tot_granted, 0, 0 }, + { "grant_precreate", lprocfs_ofd_rd_grant_precreate, 0, 0 }, + { "grant_ratio", lprocfs_ofd_rd_grant_ratio, + lprocfs_ofd_wr_grant_ratio, 0, 0 }, { "recovery_status", lprocfs_obd_rd_recovery_status, 0, 0 }, { "recovery_time_soft", lprocfs_obd_rd_recovery_time_soft, lprocfs_obd_wr_recovery_time_soft, 0}, @@ -331,6 +454,8 @@ static struct lprocfs_vars lprocfs_ofd_obd_vars[] = { { "instance", lprocfs_target_rd_instance, 0 }, { "ir_factor", lprocfs_obd_rd_ir_factor, lprocfs_obd_wr_ir_factor, 0}, + { "grant_compat_disable", lprocfs_ofd_rd_grant_compat_disable, + lprocfs_ofd_wr_grant_compat_disable, 0 }, { "client_cache_count", lprocfs_ofd_rd_fmd_max_num, lprocfs_ofd_wr_fmd_max_num, 0 }, { "client_cache_seconds", lprocfs_ofd_rd_fmd_max_age,