示例#1
0
/**
 * Implementation of obd_ops::o_get_info.
 *
 * This function is not called from request handler, it is only used by
 * direct call from nrs_orr_range_fill_physical() in ptlrpc, see LU-3239.
 *
 * \see  ofd_get_info_hdl() for request handler function.
 *
 * \param[in]  env	execution environment
 * \param[in]  exp	OBD export of OFD device
 * \param[in]  keylen	length of \a key
 * \param[in]  key	key name
 * \param[out] vallen	length of key value
 * \param[out] val	the key value to return
 * \param[in]  lsm	not used in OFD
 *
 * \retval		0 if successful
 * \retval		negative value on error
 */
static int ofd_get_info(const struct lu_env *env, struct obd_export *exp,
			__u32 keylen, void *key, __u32 *vallen, void *val,
			struct lov_stripe_md *lsm)
{
	struct ofd_thread_info		*info;
	struct ofd_device		*ofd;
	struct ll_fiemap_info_key	*fm_key = key;
	struct ll_user_fiemap		*fiemap = val;
	int				 rc = 0;

	ENTRY;

	if (exp->exp_obd == NULL) {
		CDEBUG(D_IOCTL, "invalid client export %p\n", exp);
		RETURN(-EINVAL);
	}

	ofd = ofd_exp(exp);

	if (KEY_IS(KEY_FIEMAP)) {
		info = ofd_info_init(env, exp);

		rc = ostid_to_fid(&info->fti_fid, &fm_key->oa.o_oi,
				  ofd->ofd_lut.lut_lsd.lsd_osd_index);
		if (rc != 0)
			RETURN(rc);

		rc = ofd_fiemap_get(env, ofd, &info->fti_fid, fiemap);
	} else {
		CERROR("%s: not supported key %s\n", ofd_name(ofd), (char*)key);
		rc = -EOPNOTSUPP;
	}

	RETURN(rc);
}
示例#2
0
/* Setinfo coming from Server (eg MDT) to Client (eg MDC)! */
static int ldlm_handle_setinfo(struct ptlrpc_request *req)
{
	struct obd_device *obd = req->rq_export->exp_obd;
	char *key;
	void *val;
	int keylen, vallen;
	int rc = -ENOSYS;

	DEBUG_REQ(D_HSM, req, "%s: handle setinfo\n", obd->obd_name);

	req_capsule_set(&req->rq_pill, &RQF_OBD_SET_INFO);

	key = req_capsule_client_get(&req->rq_pill, &RMF_SETINFO_KEY);
	if (key == NULL) {
		DEBUG_REQ(D_IOCTL, req, "no set_info key");
		return -EFAULT;
	}
	keylen = req_capsule_get_size(&req->rq_pill, &RMF_SETINFO_KEY,
				      RCL_CLIENT);
	val = req_capsule_client_get(&req->rq_pill, &RMF_SETINFO_VAL);
	if (val == NULL) {
		DEBUG_REQ(D_IOCTL, req, "no set_info val");
		return -EFAULT;
	}
	vallen = req_capsule_get_size(&req->rq_pill, &RMF_SETINFO_VAL,
				      RCL_CLIENT);

	/* We are responsible for swabbing contents of val */

	if (KEY_IS(KEY_HSM_COPYTOOL_SEND))
		/* Pass it on to mdc (the "export" in this case) */
		rc = obd_set_info_async(req->rq_svc_thread->t_env,
					req->rq_export,
					sizeof(KEY_HSM_COPYTOOL_SEND),
					KEY_HSM_COPYTOOL_SEND,
					vallen, val, NULL);
	else
		DEBUG_REQ(D_WARNING, req, "ignoring unknown key %s", key);

	return rc;
}
示例#3
0
/**
 * Implementation of obd_ops::o_set_info_async.
 *
 * This function is not called from request handler, it is only used by
 * class_notify_sptlrpc_conf() locally by direct obd_set_info_async() call.
 * \see  ofd_set_info_hdl() for request handler function.
 *
 * \param[in] env	execution environment
 * \param[in] exp	OBD export of OFD device
 * \param[in] keylen	length of \a key
 * \param[in] key	key name
 * \param[in] vallen	length of \a val
 * \param[in] val	the \a key value
 * \param[in] set	not used in OFD
 *
 * \retval		0 if successful
 * \retval		negative value on error
 */
static int ofd_set_info_async(const struct lu_env *env, struct obd_export *exp,
			      __u32 keylen, void *key, __u32 vallen, void *val,
			      struct ptlrpc_request_set *set)
{
	int rc = 0;

	ENTRY;

	if (exp->exp_obd == NULL) {
		CDEBUG(D_IOCTL, "invalid export %p\n", exp);
		RETURN(-EINVAL);
	}

	if (KEY_IS(KEY_SPTLRPC_CONF)) {
		rc = tgt_adapt_sptlrpc_conf(class_exp2tgt(exp), 0);
	} else {
		CERROR("%s: Unsupported key %s\n",
		       exp->exp_obd->obd_name, (char*)key);
		rc = -EOPNOTSUPP;
	}
	RETURN(rc);
}
示例#4
0
static int mdd_obd_get_info(const struct lu_env *env, struct obd_export *exp,
			    __u32 keylen, void *key, __u32 *vallen, void *val,
			    struct lov_stripe_md *lsm)
{
	int rc = -EINVAL;

	if (KEY_IS(KEY_OSP_CONNECTED)) {
		struct obd_device	*obd = exp->exp_obd;
		struct mdd_device	*mdd;

		if (!obd->obd_set_up || obd->obd_stopping)
			RETURN(-EAGAIN);

		mdd = lu2mdd_dev(obd->obd_lu_dev);
		LASSERT(mdd);
		rc = obd_get_info(env, mdd->mdd_child_exp, keylen, key, vallen,
				  val, lsm);
		RETURN(rc);
	}

	RETURN(rc);
}