X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fosp%2Flproc_osp.c;h=118c4df6e0f1aa46db33e20b6b572d6a67db6c4a;hb=17797975b27e1b5222fb75cac49d90066091486d;hp=22e33725e7c5f75d774a1ea79862efa146155ef6;hpb=a926e593b0c769d20aef191e2b0b6b1d881b6637;p=fs%2Flustre-release.git diff --git a/lustre/osp/lproc_osp.c b/lustre/osp/lproc_osp.c index 22e3372..118c4df 100644 --- a/lustre/osp/lproc_osp.c +++ b/lustre/osp/lproc_osp.c @@ -201,7 +201,7 @@ static int osp_rd_create_count(char *page, char **start, off_t off, int count, struct obd_device *obd = data; struct osp_device *osp = lu2osp_dev(obd->obd_lu_dev); - if (osp == NULL) + if (osp == NULL || osp->opd_pre == NULL) return 0; return snprintf(page, count, "%d\n", osp->opd_pre_grow_count); @@ -214,7 +214,7 @@ static int osp_wr_create_count(struct file *file, const char *buffer, struct osp_device *osp = lu2osp_dev(obd->obd_lu_dev); int val, rc, i; - if (osp == NULL) + if (osp == NULL || osp->opd_pre == NULL) return 0; rc = lprocfs_write_helper(buffer, count, &val); @@ -249,7 +249,7 @@ static int osp_rd_max_create_count(char *page, char **start, off_t off, struct obd_device *obd = data; struct osp_device *osp = lu2osp_dev(obd->obd_lu_dev); - if (osp == NULL) + if (osp == NULL || osp->opd_pre == NULL) return 0; return snprintf(page, count, "%d\n", osp->opd_pre_max_grow_count); @@ -262,7 +262,7 @@ static int osp_wr_max_create_count(struct file *file, const char *buffer, struct osp_device *osp = lu2osp_dev(obd->obd_lu_dev); int val, rc; - if (osp == NULL) + if (osp == NULL || osp->opd_pre == NULL) return 0; rc = lprocfs_write_helper(buffer, count, &val); @@ -288,7 +288,7 @@ static int osp_rd_prealloc_next_id(char *page, char **start, off_t off, struct obd_device *obd = data; struct osp_device *osp = lu2osp_dev(obd->obd_lu_dev); - if (osp == NULL) + if (osp == NULL || osp->opd_pre == NULL) return 0; return snprintf(page, count, "%u\n", @@ -301,7 +301,7 @@ static int osp_rd_prealloc_last_id(char *page, char **start, off_t off, struct obd_device *obd = data; struct osp_device *osp = lu2osp_dev(obd->obd_lu_dev); - if (osp == NULL) + if (osp == NULL || osp->opd_pre == NULL) return 0; return snprintf(page, count, "%u\n", @@ -314,7 +314,7 @@ static int osp_rd_prealloc_next_seq(char *page, char **start, off_t off, struct obd_device *obd = data; struct osp_device *osp = lu2osp_dev(obd->obd_lu_dev); - if (osp == NULL) + if (osp == NULL || osp->opd_pre == NULL) return 0; return snprintf(page, count, LPX64"\n", @@ -327,7 +327,7 @@ static int osp_rd_prealloc_last_seq(char *page, char **start, off_t off, struct obd_device *obd = data; struct osp_device *osp = lu2osp_dev(obd->obd_lu_dev); - if (osp == NULL) + if (osp == NULL || osp->opd_pre == NULL) return 0; return snprintf(page, count, LPX64"\n", @@ -340,7 +340,7 @@ static int osp_rd_prealloc_reserved(char *page, char **start, off_t off, struct obd_device *obd = data; struct osp_device *osp = lu2osp_dev(obd->obd_lu_dev); - if (osp == NULL) + if (osp == NULL || osp->opd_pre == NULL) return 0; return snprintf(page, count, LPU64"\n", osp->opd_pre_reserved); @@ -389,7 +389,7 @@ static int osp_rd_pre_status(char *page, char **start, off_t off, struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev); int rc; - if (osp == NULL) + if (osp == NULL || osp->opd_pre == NULL) return -EINVAL; rc = snprintf(page, count, "%d\n", osp->opd_pre_status); @@ -429,6 +429,38 @@ static int osp_rd_old_sync_processed(char *page, char **start, off_t off, return rc; } +static int osp_rd_lfsck_max_rpcs_in_flight(char *page, char **start, off_t off, + int count, int *eof, void *data) +{ + struct obd_device *dev = data; + __u32 max; + int rc; + + *eof = 1; + max = obd_get_max_rpcs_in_flight(&dev->u.cli); + rc = snprintf(page, count, "%u\n", max); + + return rc; +} + +static int osp_wr_lfsck_max_rpcs_in_flight(struct file *file, + const char *buffer, + unsigned long count, void *data) +{ + struct obd_device *dev = data; + int val; + int rc; + + rc = lprocfs_write_helper(buffer, count, &val); + if (rc == 0) + rc = obd_set_max_rpcs_in_flight(&dev->u.cli, val); + + if (rc != 0) + count = rc; + + return count; +} + static struct lprocfs_vars lprocfs_osp_obd_vars[] = { { "uuid", lprocfs_rd_uuid, 0, 0 }, { "ping", 0, lprocfs_wr_ping, 0, 0, 0222 }, @@ -461,6 +493,8 @@ static struct lprocfs_vars lprocfs_osp_obd_vars[] = { /* for compatibility reasons */ { "destroys_in_flight", osp_rd_destroys_in_flight, 0, 0 }, + { "lfsck_max_rpcs_in_flight", osp_rd_lfsck_max_rpcs_in_flight, + osp_wr_lfsck_max_rpcs_in_flight, 0 }, { 0 } };