Example #1
0
static ssize_t
lprocfs_fid_width_seq_write(struct file *file, const char *buffer,
			    size_t count, loff_t *off)
{
	struct lu_client_seq *seq = ((struct seq_file *)file->private_data)->private;
	__u64  max;
	int rc, val;
	ENTRY;

	LASSERT(seq != NULL);

	rc = lprocfs_write_helper(buffer, count, &val);
	if (rc)
		RETURN(rc);

	mutex_lock(&seq->lcs_mutex);
	if (seq->lcs_type == LUSTRE_SEQ_DATA)
		max = LUSTRE_DATA_SEQ_MAX_WIDTH;
	else
		max = LUSTRE_METADATA_SEQ_MAX_WIDTH;

	if (val <= max && val > 0) {
		seq->lcs_width = val;

		if (rc == 0) {
			CDEBUG(D_INFO, "%s: Sequence size: "LPU64"\n",
			       seq->lcs_name, seq->lcs_width);
		}
	}

	mutex_unlock(&seq->lcs_mutex);

	RETURN(count);
}
Example #2
0
static int
seq_server_proc_write_width(struct file *file, const char *buffer,
                            unsigned long count, void *data)
{
        struct lu_server_seq *seq = (struct lu_server_seq *)data;
	int rc, val;
	ENTRY;

        LASSERT(seq != NULL);

        cfs_down(&seq->lss_sem);

        rc = lprocfs_write_helper(buffer, count, &val);
        if (rc)
                RETURN(rc);

        seq->lss_width = val;

	if (rc == 0) {
		CDEBUG(D_INFO, "%s: Width: "LPU64"\n",
                       seq->lss_name, seq->lss_width);
	}

        cfs_up(&seq->lss_sem);

        RETURN(count);
}
Example #3
0
/**
 * Set OSC creator's osc_creator::oscc_max_grow_count
 *
 * \param file   proc file
 * \param buffer buffer containing the value
 * \param count  buffer size
 * \param data   obd device
 *
 * \retval \a count
 */
static int osc_wr_max_create_count(struct file *file, const char *buffer,
                                   unsigned long count, void *data)
{
        struct obd_device *obd = data;
        int val, rc;

        if (obd == NULL)
                return 0;

        rc = lprocfs_write_helper(buffer, count, &val);
        if (rc)
                return rc;

        if (val < 0)
                return -ERANGE;
        if (val > OST_MAX_PRECREATE)
                return -ERANGE;

        if (obd->u.cli.cl_oscc.oscc_grow_count > val)
                obd->u.cli.cl_oscc.oscc_grow_count = val;

        obd->u.cli.cl_oscc.oscc_max_grow_count = val;

        return count;
}
Example #4
0
static int osp_wr_max_create_count(struct file *file, const char *buffer,
				   unsigned long count, void *data)
{
	struct obd_device	*obd = data;
	struct osp_device	*osp = lu2osp_dev(obd->obd_lu_dev);
	int			 val, rc;

	if (osp == NULL)
		return 0;

	rc = lprocfs_write_helper(buffer, count, &val);
	if (rc)
		return rc;

	if (val < 0)
		return -ERANGE;
	if (val > OST_MAX_PRECREATE)
		return -ERANGE;

	if (osp->opd_pre_grow_count > val)
		osp->opd_pre_grow_count = val;

	osp->opd_pre_max_grow_count = val;

	return count;
}
Example #5
0
static int osp_wr_create_count(struct file *file, const char *buffer,
			       unsigned long count, void *data)
{
	struct obd_device	*obd = data;
	struct osp_device	*osp = lu2osp_dev(obd->obd_lu_dev);
	int			 val, rc, i;

	if (osp == NULL)
		return 0;

	rc = lprocfs_write_helper(buffer, count, &val);
	if (rc)
		return rc;

	/* The MDT ALWAYS needs to limit the precreate count to
	 * OST_MAX_PRECREATE, and the constant cannot be changed
	 * because it is a value shared between the OSP and OST
	 * that is the maximum possible number of objects that will
	 * ever be handled by MDT->OST recovery processing.
	 *
	 * If the OST ever gets a request to delete more orphans,
	 * this implies that something has gone badly on the MDT
	 * and the OST will refuse to delete so much data from the
	 * filesystem as a safety measure. */
	if (val < OST_MIN_PRECREATE || val > OST_MAX_PRECREATE)
		return -ERANGE;
	if (val > osp->opd_pre_max_grow_count)
		return -ERANGE;

	for (i = 1; (i << 1) <= val; i <<= 1)
		;
	osp->opd_pre_grow_count = i;

	return count;
}
Example #6
0
static int lprocfs_wr_lfsck_speed_limit(struct file *file, const char *buffer,
					unsigned long count, void *data)
{
	struct mdd_device *mdd = data;
	struct md_lfsck *lfsck;
	__u32 val;
	int rc;

	LASSERT(mdd != NULL);
	rc = lprocfs_write_helper(buffer, count, &val);
	if (rc != 0)
		return rc;

	lfsck = &mdd->mdd_lfsck;
	if (val != lfsck->ml_bookmark_ram.lb_speed_limit) {
		struct lu_env env;

		rc = lu_env_init(&env, LCT_MD_THREAD | LCT_DT_THREAD);
		if (rc != 0)
			return rc;

		rc = mdd_lfsck_set_speed(&env, lfsck, val);
		lu_env_fini(&env);
	}
	return rc != 0 ? rc : count;
}
Example #7
0
static int
seq_client_proc_write_width(struct file *file, const char *buffer,
                            unsigned long count, void *data)
{
        struct lu_client_seq *seq = (struct lu_client_seq *)data;
	int rc, val;
	ENTRY;

        LASSERT(seq != NULL);

        cfs_down(&seq->lcs_sem);

        rc = lprocfs_write_helper(buffer, count, &val);
        if (rc) {
                cfs_up(&seq->lcs_sem);
                RETURN(rc);
        }

        if (val <= LUSTRE_SEQ_MAX_WIDTH && val > 0) {
                seq->lcs_width = val;

                if (rc == 0) {
                        CDEBUG(D_INFO, "%s: Sequence size: "LPU64"\n",
                               seq->lcs_name, seq->lcs_width);
                }
        }

        cfs_up(&seq->lcs_sem);

        RETURN(count);
}
Example #8
0
static int osc_wr_max_rpcs_in_flight(struct file *file, const char *buffer,
                                     unsigned long count, void *data)
{
        struct obd_device *dev = data;
        struct client_obd *cli = &dev->u.cli;
        struct ptlrpc_request_pool *pool = cli->cl_import->imp_rq_pool;
        int val, rc;

        rc = lprocfs_write_helper(buffer, count, &val);
        if (rc)
                return rc;

        if (val < 1 || val > OSC_MAX_RIF_MAX)
                return -ERANGE;

        LPROCFS_CLIMP_CHECK(dev);
        if (pool && val > cli->cl_max_rpcs_in_flight)
                pool->prp_populate(pool, val-cli->cl_max_rpcs_in_flight);

        client_obd_list_lock(&cli->cl_loi_list_lock);
        cli->cl_max_rpcs_in_flight = val;
        client_obd_list_unlock(&cli->cl_loi_list_lock);

        LPROCFS_CLIMP_EXIT(dev);
        return count;
}
Example #9
0
/* temporary for testing */
static int mdc_wr_kuc(struct file *file, const char *buffer,
		      unsigned long count, void *data)
{
	struct obd_device	*obd = data;
	struct kuc_hdr		*lh;
	struct hsm_action_list	*hal;
	struct hsm_action_item	*hai;
	int			 len;
	int			 fd, rc;
	ENTRY;

	rc = lprocfs_write_helper(buffer, count, &fd);
	if (rc)
		RETURN(rc);

	if (fd < 0)
		RETURN(-ERANGE);
	CWARN("message to fd %d\n", fd);

	len = sizeof(*lh) + sizeof(*hal) + MTI_NAME_MAXLEN +
		/* for mockup below */ 2 * cfs_size_round(sizeof(*hai));

	OBD_ALLOC(lh, len);

	lh->kuc_magic = KUC_MAGIC;
	lh->kuc_transport = KUC_TRANSPORT_HSM;
	lh->kuc_msgtype = HMT_ACTION_LIST;
	lh->kuc_msglen = len;

	hal = (struct hsm_action_list *)(lh + 1);
	hal->hal_version = HAL_VERSION;
	hal->hal_archive_id = 1;
	hal->hal_flags = 0;
	obd_uuid2fsname(hal->hal_fsname, obd->obd_name, MTI_NAME_MAXLEN);

	/* mock up an action list */
	hal->hal_count = 2;
	hai = hai_zero(hal);
	hai->hai_action = HSMA_ARCHIVE;
	hai->hai_fid.f_oid = 5;
	hai->hai_len = sizeof(*hai);
	hai = hai_next(hai);
	hai->hai_action = HSMA_RESTORE;
	hai->hai_fid.f_oid = 10;
	hai->hai_len = sizeof(*hai);

	/* This works for either broadcast or unicast to a single fd */
	if (fd == 0) {
		rc = libcfs_kkuc_group_put(KUC_GRP_HSM, lh);
	} else {
		cfs_file_t *fp = cfs_get_fd(fd);
		rc = libcfs_kkuc_msg_put(fp, lh);
		cfs_put_file(fp);
	}
	OBD_FREE(lh, len);
	if (rc < 0)
		RETURN(rc);
	RETURN(count);
}
Example #10
0
static int lprocfs_wr_lfsck_async_windows(struct file *file, const char *buffer,
					  unsigned long count, void *data)
{
	struct mdd_device *mdd = data;
	__u32		   val;
	int		   rc;

	LASSERT(mdd != NULL);
	rc = lprocfs_write_helper(buffer, count, &val);
	if (rc == 0)
		rc = lfsck_set_windows(mdd->mdd_bottom, val);

	return rc != 0 ? rc : count;
}
Example #11
0
static int lprocfs_wr_sync_perm(struct file *file, const char *buffer,
                                unsigned long count, void *data)
{
        struct mdd_device *mdd = data;
        int val, rc;

        LASSERT(mdd != NULL);
        rc = lprocfs_write_helper(buffer, count, &val);
        if (rc)
                return rc;

        mdd->mdd_sync_permission = !!val;
        return count;
}
Example #12
0
static int lprocfs_osd_wr_pdo(struct file *file, const char *buffer,
                              unsigned long count, void *data)
{
        int     pdo;
        int     rc;

        rc = lprocfs_write_helper(buffer, count, &pdo);
        if (rc != 0)
                return rc;

        ldiskfs_pdo = !!pdo;

        return count;
}
Example #13
0
static ssize_t
ldiskfs_osd_pdo_seq_write(struct file *file, const char *buffer,
				size_t count, loff_t *off)
{
	int pdo, rc;

        rc = lprocfs_write_helper(buffer, count, &pdo);
        if (rc != 0)
                return rc;

        ldiskfs_pdo = !!pdo;

        return count;
}
Example #14
0
static ssize_t
ldiskfs_osd_index_in_idif_seq_write(struct file *file, const char *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;
	int			 val;
	int			 rc;

	LASSERT(dev != NULL);
	if (unlikely(dev->od_mnt == NULL))
		return -EINPROGRESS;

	rc = lprocfs_write_helper(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;
}
Example #15
0
static int gss_lk_proc_dl_seq_write(struct file *file, const char *buffer,
				    size_t count, off_t *off)
{
	int     val, rc;

	rc = lprocfs_write_helper(buffer, count, &val);
	if (rc < 0)
		return rc;

	if (val < 0 || val > 4)
		return -ERANGE;

	gss_lk_debug_level = val;
	return count;
}
Example #16
0
static int gss_lk_proc_write_dl(struct file *file, const char *buffer,
                                unsigned long count, void *data)
{
        int     val, rc;

        rc = lprocfs_write_helper(buffer, count, &val);
        if (rc < 0)
                return rc;

        if (val < 0 || val > 4)
                return -ERANGE;

        gss_lk_debug_level = val;
        return count;
}
ssize_t
lprocfs_recovery_time_hard_seq_write(struct file *file, const char *buffer,
				     size_t count, loff_t *off)
{
	struct seq_file *m = file->private_data;
	struct obd_device *obd = m->private;
	int val, rc;

	LASSERT(obd != NULL);
	rc = lprocfs_write_helper(buffer, count, &val);
	if (rc)
		return rc;

	obd->obd_recovery_time_hard = val;
	return count;
}
Example #18
0
static ssize_t
mdd_sync_perm_seq_write(struct file *file, const char *buffer,
			size_t count, loff_t *off)
{
	struct seq_file *m = file->private_data;
	struct mdd_device *mdd = m->private;
        int val, rc;

        LASSERT(mdd != NULL);
        rc = lprocfs_write_helper(buffer, count, &val);
        if (rc)
                return rc;

        mdd->mdd_sync_permission = !!val;
        return count;
}
Example #19
0
static ssize_t
ldiskfs_osd_track_declares_assert_seq_write(struct file *file,
						const char *buffer,
						size_t count, loff_t *off)
{
	int     track_declares_assert;
	int     rc;

	rc = lprocfs_write_helper(buffer, count, &track_declares_assert);
	if (rc != 0)
		return rc;

	ldiskfs_track_declares_assert = !!track_declares_assert;

	return count;
}
Example #20
0
static ssize_t
mdd_lfsck_async_windows_seq_write(struct file *file, const char *buffer,
				  size_t count, loff_t *off)
{
	struct seq_file   *m = file->private_data;
	struct mdd_device *mdd = m->private;
	__u32		   val;
	int		   rc;

	LASSERT(mdd != NULL);
	rc = lprocfs_write_helper(buffer, count, &val);
	if (rc == 0)
		rc = lfsck_set_windows(mdd->mdd_bottom, val);

	return rc != 0 ? rc : count;
}
Example #21
0
static int lprocfs_osd_wr_iused_est(struct file *file, const char *buffer,
					unsigned long count, void *data)
{
	struct osd_device *osd = osd_dt_dev((struct dt_device *)data);
	int                rc, val;

	LASSERT(osd != NULL);

	rc = lprocfs_write_helper(buffer, count, &val);
	if (rc)
		return rc;

	osd->od_quota_iused_est = !!val;

	return count;
}
Example #22
0
static ssize_t
qsd_timeout_seq_write(struct file *file, const char *buffer,
			size_t count, loff_t *off)
{
	struct qsd_instance *qsd = ((struct seq_file *)file->private_data)->private;
	int		     timeout, rc;
	LASSERT(qsd != NULL);

	rc = lprocfs_write_helper(buffer, count, &timeout);
	if (rc)
		return rc;
	if (timeout < 0)
		return -EINVAL;

	qsd->qsd_timeout = timeout;
	return count;
}
Example #23
0
static int lprocfs_osd_wr_wcache(struct file *file, const char *buffer,
				 unsigned long count, void *data)
{
	struct osd_device	*osd = osd_dt_dev(data);
	int			 val, rc;

	LASSERT(osd != NULL);
	if (unlikely(osd->od_mnt == NULL))
		return -EINPROGRESS;

	rc = lprocfs_write_helper(buffer, count, &val);
	if (rc)
		return rc;

	osd->od_writethrough_cache = !!val;
	return count;
}
Example #24
0
static int lprocfs_osd_wr_auto_scrub(struct file *file, const char *buffer,
				     unsigned long count, void *data)
{
	struct osd_device *dev = osd_dt_dev(data);
	int val, rc;

	LASSERT(dev != NULL);
	if (unlikely(dev->od_mnt == NULL))
		return -EINPROGRESS;

	rc = lprocfs_write_helper(buffer, count, &val);
	if (rc)
		return rc;

	dev->od_noscrub = !val;
	return count;
}
Example #25
0
int lprocfs_quota_wr_qs_factor(struct file *file, const char *buffer,
                               unsigned long count, void *data)
{
        struct obd_device *obd = (struct obd_device *)data;
        int val, rc;
        LASSERT(obd != NULL);

        rc = lprocfs_write_helper(buffer, count, &val);
        if (rc)
                return rc;

        if (val < 2)
                return -EINVAL;

        obd->u.obt.obt_qctxt.lqc_cqs_qs_factor = val;
        return count;
}
Example #26
0
static int osc_wr_resend_count(struct file *file, const char *buffer,
                               unsigned long count, void *data)
{
        struct obd_device *obd = data;
        int val, rc;

        rc = lprocfs_write_helper(buffer, count, &val);
        if (rc)
                return rc;

        if (val < 0)
               return -EINVAL;

        cfs_atomic_set(&obd->u.cli.cl_resends, val);

        return count;
}
Example #27
0
static int osc_wr_checksum(struct file *file, const char *buffer,
                           unsigned long count, void *data)
{
        struct obd_device *obd = data;
        int val, rc;

        if (obd == NULL)
                return 0;

        rc = lprocfs_write_helper(buffer, count, &val);
        if (rc)
                return rc;

        obd->u.cli.cl_checksum = (val ? 1 : 0);

        return count;
}
Example #28
0
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;
}
Example #29
0
static ssize_t mdc_max_rpcs_in_flight_seq_write(struct file *file,
						const char __user *buffer,
						size_t count,
						loff_t *off)
{
	struct obd_device *dev = ((struct seq_file *)file->private_data)->private;
	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;
}
Example #30
0
int lprocfs_quota_wr_btune(struct file *file, const char *buffer,
                           unsigned long count, void *data)
{
        struct obd_device *obd = (struct obd_device *)data;
        int val, rc;
        LASSERT(obd != NULL);

        rc = lprocfs_write_helper(buffer, count, &val);
        if (rc)
                return rc;

        if (val <= QUOTABLOCK_SIZE * MIN_QLIMIT || val % QUOTABLOCK_SIZE ||
            val >= obd->u.obt.obt_qctxt.lqc_bunit_sz)
                return -EINVAL;

        obd->u.obt.obt_qctxt.lqc_btune_sz = val;
        return count;
}