Ejemplo n.º 1
0
static int osd_oi_iam_delete(struct osd_thread_info *oti, struct osd_oi *oi,
			     const struct dt_key *key, handle_t *th)
{
	struct iam_container	*bag;
	struct iam_path_descr	*ipd;
	int			 rc;
	ENTRY;

	LASSERT(oi);
	LASSERT(oi->oi_inode);
	ll_vfs_dq_init(oi->oi_inode);

	bag = &oi->oi_dir.od_container;
	ipd = osd_idx_ipd_get(oti->oti_env, bag);
	if (unlikely(ipd == NULL))
		RETURN(-ENOMEM);

	LASSERT(th != NULL);
	LASSERT(th->h_transaction != NULL);

	rc = iam_delete(th, bag, (const struct iam_key *)key, ipd);
	osd_ipd_put(oti->oti_env, bag, ipd);
	LINVRNT(osd_invariant(obj));
	RETURN(rc);
}
Ejemplo n.º 2
0
static int osd_oi_iam_refresh(struct osd_thread_info *oti, struct osd_oi *oi,
			     const struct dt_rec *rec, const struct dt_key *key,
			     struct thandle *th, bool insert)
{
	struct iam_container	*bag;
	struct iam_path_descr	*ipd;
	struct osd_thandle	*oh;
	int			rc;
	ENTRY;

	LASSERT(oi);
	LASSERT(oi->oi_inode);
	ll_vfs_dq_init(oi->oi_inode);

	bag = &oi->oi_dir.od_container;
	ipd = osd_idx_ipd_get(oti->oti_env, bag);
	if (unlikely(ipd == NULL))
		RETURN(-ENOMEM);

	oh = container_of0(th, struct osd_thandle, ot_super);
	LASSERT(oh->ot_handle != NULL);
	LASSERT(oh->ot_handle->h_transaction != NULL);
	if (insert)
		rc = iam_insert(oh->ot_handle, bag, (const struct iam_key *)key,
				(const struct iam_rec *)rec, ipd);
	else
		rc = iam_update(oh->ot_handle, bag, (const struct iam_key *)key,
				(const struct iam_rec *)rec, ipd);
	osd_ipd_put(oti->oti_env, bag, ipd);
	LINVRNT(osd_invariant(obj));
	RETURN(rc);
}