Ejemplo n.º 1
0
/**
 * Implementation of dt_index_operations::dio_declare_delete
 *
 * Create the osp_update_request to track the update for this OSP
 * in the transaction.
 *
 * \param[in] env	execution environment
 * \param[in] dt	object for which to delete index
 * \param[in] key	key of the index
 * \param[in] th	the transaction handle
 *
 * \retval		0 if preparation succeeds.
 * \retval		negative errno if preparation fails.
 */
static int osp_md_declare_index_delete(const struct lu_env *env,
				       struct dt_object *dt,
				       const struct dt_key *key,
				       struct thandle *th)
{
	return osp_trans_update_request_create(th);
}
Ejemplo n.º 2
0
/**
 * Implementation of dt_body_operations::dbo_declare_write
 *
 * Create the osp_update_request to track the update for this OSP
 * in the transaction.
  *
 * \param[in] env	execution environment
 * \param[in] dt	object to be written
 * \param[in] buf	buffer to write which includes an embedded size field
 * \param[in] pos	offet in the object to start writing at
 * \param[in] th	transaction handle
 *
 * \retval		0 if preparation succeeds.
 * \retval		negative errno if preparation fails.
 */
static ssize_t osp_md_declare_write(const struct lu_env *env,
				    struct dt_object *dt,
				    const struct lu_buf *buf,
				    loff_t pos, struct thandle *th)
{
	return osp_trans_update_request_create(th);
}
Ejemplo n.º 3
0
/**
 * Implementation of dt_object_operations::do_declare_create
 *
 * Create the osp_update_request to track the update for this OSP
 * in the transaction.
 *
 * \param[in] env	execution environment
 * \param[in] dt	remote object to be created
 * \param[in] attr	attribute of the created object
 * \param[in] hint	creation hint
 * \param[in] dof	creation format information
 * \param[in] th	the transaction handle
 *
 * \retval		0 if preparation succeeds.
 * \retval		negative errno if preparation fails.
 */
int osp_md_declare_object_create(const struct lu_env *env,
				 struct dt_object *dt,
				 struct lu_attr *attr,
				 struct dt_allocation_hint *hint,
				 struct dt_object_format *dof,
				 struct thandle *th)
{
	struct osp_object *obj = dt2osp_obj(dt);
	int		  rc;

	if (obj->opo_ooa == NULL) {
		rc = osp_oac_init(obj);
		if (rc != 0)
			return rc;
	}

	return osp_trans_update_request_create(th);
}
Ejemplo n.º 4
0
/**
 * Implementation of dt_body_operations::dbo_declare_write
 *
 * Create the osp_update_request to track the update for this OSP
 * in the transaction.
  *
 * \param[in] env	execution environment
 * \param[in] dt	object to be written
 * \param[in] buf	buffer to write which includes an embedded size field
 * \param[in] pos	offet in the object to start writing at
 * \param[in] th	transaction handle
 *
 * \retval		0 if preparation succeeds.
 * \retval		negative errno if preparation fails.
 */
static ssize_t osp_md_declare_write(const struct lu_env *env,
				    struct dt_object *dt,
				    const struct lu_buf *buf,
				    loff_t pos, struct thandle *th)
{
	struct osp_device *osp = dt2osp_dev(th->th_dev);
	int rc;

	rc = osp_trans_update_request_create(th);
	if (rc != 0)
		return rc;

	if (osp->opd_update == NULL)
		return 0;

	if (dt2osp_obj(dt)->opo_stale)
		return -ESTALE;

	return 0;
}
Ejemplo n.º 5
0
/**
 * Implement OSP layer dt_object_operations::do_declare_destroy() interface.
 *
 * Create the dt_update_request to track the update for this OSP
 * in the transaction.
 *
 * \param[in] env	pointer to the thread context
 * \param[in] dt	pointer to the OSP layer dt_object to be destroyed
 * \param[in] th	pointer to the transaction handler
 *
 * \retval		0 for success
 * \retval		negative error number on failure
 */
int osp_md_declare_object_destroy(const struct lu_env *env,
			       struct dt_object *dt, struct thandle *th)
{
	return osp_trans_update_request_create(th);
}
Ejemplo n.º 6
0
/**
 * Implementation of dt_object_operations::do_declare_attr_get
 *
 * Create the osp_update_request to track the update for this OSP
 * in the transaction.
 *
 * \param[in] env	execution environment
 * \param[in] dt	object on which to set attributes
 * \param[in] attr	attributes to be set
 * \param[in] th	the transaction handle
 *
 * \retval		0 if preparation succeeds.
 * \retval		negative errno if preparation fails.
 */
int osp_md_declare_attr_set(const struct lu_env *env, struct dt_object *dt,
			    const struct lu_attr *attr, struct thandle *th)
{
	return osp_trans_update_request_create(th);
}