static ssize_t ldiskfs_osd_full_scrub_threshold_rate_seq_write(struct file *file, const char __user *buffer, size_t count, loff_t *off) { struct seq_file *m = file->private_data; struct dt_device *dt = m->private; struct osd_device *dev = osd_dt_dev(dt); int rc; __s64 val; LASSERT(dev != NULL); if (unlikely(dev->od_mnt == NULL)) return -EINPROGRESS; rc = lprocfs_str_to_s64(buffer, count, &val); if (rc != 0) return rc; if (val < 0) return -EINVAL; dev->od_full_scrub_threshold_rate = val; return count; }
/** * Set QoS free space priority parameter. * * Set the relative priority of free OST space compared to OST load when OSTs * are space imbalanced. See lod_qos_priofree_seq_show() for description of * this parameter. See lod_qos_thresholdrr_seq_write() and lq_threshold_rr to * determine what constitutes "space imbalanced" OSTs. * * \param[in] file proc file * \param[in] buffer string which contains the free space priority (0-100) * \param[in] count @buffer length * \param[in] off unused for single entry * * \retval @count on success * \retval negative error code if failed */ static ssize_t lod_qos_priofree_seq_write(struct file *file, const char __user *buffer, size_t count, loff_t *off) { struct seq_file *m = file->private_data; struct obd_device *dev = m->private; struct lod_device *lod; int rc; __s64 val; LASSERT(dev != NULL); lod = lu2lod_dev(dev->obd_lu_dev); rc = lprocfs_str_to_s64(buffer, count, &val); if (rc) return rc; if (val < 0 || val > 100) return -EINVAL; lod->lod_qos.lq_prio_free = (val << 8) / 100; lod->lod_qos.lq_dirty = 1; lod->lod_qos.lq_reset = 1; return count; }
/** * Set default number of stripes. * * \param[in] file proc file * \param[in] buffer string containing the default number of stripes * for new files * \param[in] count @buffer length * \param[in] off unused for single entry * * \retval @count on success * \retval negative error code otherwise */ static ssize_t lod_stripecount_seq_write(struct file *file, const char __user *buffer, size_t count, loff_t *off) { struct seq_file *m = file->private_data; struct obd_device *dev = m->private; struct lod_device *lod; int rc; __s64 val; __u32 stripe_count; LASSERT(dev != NULL); lod = lu2lod_dev(dev->obd_lu_dev); rc = lprocfs_str_to_s64(buffer, count, &val); if (rc) return rc; if (val < 0) return -ERANGE; stripe_count = val; lod_fix_desc_stripe_count(&stripe_count); lod->lod_desc.ld_default_stripe_count = stripe_count; return count; }
static ssize_t ldiskfs_osd_index_in_idif_seq_write(struct file *file, const char __user *buffer, size_t count, loff_t *off) { struct lu_env env; struct seq_file *m = file->private_data; struct dt_device *dt = m->private; struct osd_device *dev = osd_dt_dev(dt); struct lu_target *tgt; __s64 val; int rc; LASSERT(dev != NULL); if (unlikely(dev->od_mnt == NULL)) return -EINPROGRESS; rc = lprocfs_str_to_s64(buffer, count, &val); if (rc != 0) return rc; if (dev->od_index_in_idif) { if (val != 0) return count; LCONSOLE_WARN("%s: OST-index in IDIF has been enabled, " "it cannot be reverted back.\n", osd_name(dev)); return -EPERM; } if (val == 0) return count; rc = lu_env_init(&env, LCT_DT_THREAD); if (rc != 0) return rc; tgt = dev->od_dt_dev.dd_lu_dev.ld_site->ls_tgt; tgt->lut_lsd.lsd_feature_rocompat |= OBD_ROCOMPAT_IDX_IN_IDIF; rc = tgt_server_data_update(&env, tgt, 1); lu_env_fini(&env); if (rc < 0) return rc; LCONSOLE_INFO("%s: enable OST-index in IDIF successfully, " "it cannot be reverted back.\n", osd_name(dev)); dev->od_index_in_idif = 1; return count; }
static ssize_t ldiskfs_osd_pdo_seq_write(struct file *file, const char __user *buffer, size_t count, loff_t *off) { int rc; __s64 pdo; rc = lprocfs_str_to_s64(buffer, count, &pdo); if (rc != 0) return rc; ldiskfs_pdo = !!pdo; return count; }
static ssize_t ldiskfs_osd_track_declares_assert_seq_write(struct file *file, const char __user *buffer, size_t count, loff_t *off) { __s64 track_declares_assert; int rc; rc = lprocfs_str_to_s64(buffer, count, &track_declares_assert); if (rc != 0) return rc; ldiskfs_track_declares_assert = !!track_declares_assert; return count; }
static ssize_t gss_lk_proc_dl_seq_write(struct file *file, const char __user *buffer, size_t count, loff_t *off) { int rc; __s64 val; rc = lprocfs_str_to_s64(buffer, count, &val); if (rc < 0) return rc; if (val < 0 || val > 4) return -ERANGE; gss_lk_debug_level = val; return count; }
static ssize_t mdd_sync_perm_seq_write(struct file *file, const char __user *buffer, size_t count, loff_t *off) { struct seq_file *m = file->private_data; struct mdd_device *mdd = m->private; int rc; __s64 val; LASSERT(mdd != NULL); rc = lprocfs_str_to_s64(buffer, count, &val); if (rc) return rc; mdd->mdd_sync_permission = !!val; return count; }
static ssize_t mdd_lfsck_speed_limit_seq_write(struct file *file, const char __user *buffer, size_t count, loff_t *off) { struct seq_file *m = file->private_data; struct mdd_device *mdd = m->private; __s64 val; int rc; LASSERT(mdd != NULL); rc = lprocfs_str_to_s64(buffer, count, &val); if (rc != 0) return rc; if (val < 0 || val > INT_MAX) return -ERANGE; rc = lfsck_set_speed(mdd->mdd_bottom, val); return rc != 0 ? rc : count; }
/** * Set expiration period used to refresh cached statfs data. * * \param[in] file proc file * \param[in] buffer string contains maximum age of statfs data in seconds * \param[in] count @buffer length * \param[in] off unused for single entry * * \retval @count on success * \retval negative error code if failed */ static ssize_t lod_qos_maxage_seq_write(struct file *file, const char __user *buffer, size_t count, loff_t *off) { struct seq_file *m = file->private_data; struct obd_device *dev = m->private; struct lustre_cfg_bufs bufs; struct lod_device *lod; struct lu_device *next; struct lustre_cfg *lcfg; char str[32]; unsigned int i; int rc; __s64 val; LASSERT(dev != NULL); lod = lu2lod_dev(dev->obd_lu_dev); rc = lprocfs_str_to_s64(buffer, count, &val); if (rc) return rc; if (val <= 0) return -EINVAL; lod->lod_desc.ld_qos_maxage = val; /* * propogate the value down to OSPs */ lustre_cfg_bufs_reset(&bufs, NULL); snprintf(str, 32, "%smaxage=%u", PARAM_OSP, (__u32)val); lustre_cfg_bufs_set_string(&bufs, 1, str); lcfg = lustre_cfg_new(LCFG_PARAM, &bufs); if (lcfg == NULL) return -ENOMEM; lod_getref(&lod->lod_ost_descs); lod_foreach_ost(lod, i) { next = &OST_TGT(lod,i)->ltd_ost->dd_lu_dev; rc = next->ld_ops->ldo_process_config(NULL, next, lcfg); if (rc) CERROR("can't set maxage on #%d: %d\n", i, rc); }
static ssize_t ldiskfs_osd_wcache_seq_write(struct file *file, const char __user *buffer, size_t count, loff_t *off) { struct seq_file *m = file->private_data; struct dt_device *dt = m->private; struct osd_device *osd = osd_dt_dev(dt); int rc; __s64 val; LASSERT(osd != NULL); if (unlikely(osd->od_mnt == NULL)) return -EINPROGRESS; rc = lprocfs_str_to_s64(buffer, count, &val); if (rc) return rc; osd->od_writethrough_cache = !!val; return count; }