* \retval 0 on success
* \retval negative negated errno on error
*/
- int (*do_object_sync)(const struct lu_env *env,
- struct dt_object *obj,
- __u64 start,
- __u64 end);
+ int (*do_object_sync)(const struct lu_env *env, struct dt_object *obj,
+ __u64 start, __u64 end);
/**
* Lock object.
size_t *max_update_size, const struct lu_fid *fid,
const struct lu_attr *attr, struct dt_allocation_hint *hint,
struct dt_object_format *dof);
-int out_object_destroy_pack(const struct lu_env *env,
- struct object_update *update,
- size_t *max_update_size,
- const struct lu_fid *fid);
+int out_destroy_pack(const struct lu_env *env, struct object_update *update,
+ size_t *max_update_size, const struct lu_fid *fid);
int out_index_delete_pack(const struct lu_env *env,
struct object_update *update, size_t *max_update_size,
const struct lu_fid *fid, const struct dt_key *key);
const struct lu_fid *fid);
size_t update_records_ref_del_size(const struct lu_env *env,
const struct lu_fid *fid);
-size_t update_records_object_destroy_size(const struct lu_env *env,
- const struct lu_fid *fid);
+size_t update_records_destroy_size(const struct lu_env *env,
+ const struct lu_fid *fid);
size_t update_records_index_insert_size(const struct lu_env *env,
const struct lu_fid *fid,
const struct dt_rec *rec,
unsigned int *param_count,
size_t *max_param_size,
const struct lu_fid *fid);
-int update_records_object_destroy_pack(const struct lu_env *env,
- struct update_ops *ops,
- unsigned int *op_count,
- size_t *max_ops_size,
- struct update_params *params,
- unsigned int *param_count,
- size_t *max_param_size,
- const struct lu_fid *fid);
+int update_records_destroy_pack(const struct lu_env *env,
+ struct update_ops *ops, unsigned int *op_count,
+ size_t *max_ops_size,
+ struct update_params *params,
+ unsigned int *param_count,
+ size_t *max_param_size,
+ const struct lu_fid *fid);
int update_records_index_insert_pack(const struct lu_env *env,
struct update_ops *ops,
unsigned int *op_count,
extern struct lu_object_operations lod_lu_obj_ops;
int lod_load_lmv_shards(const struct lu_env *env, struct lod_object *lo,
struct lu_buf *buf, bool resize);
-int lod_declare_striped_object(const struct lu_env *env, struct dt_object *dt,
+int lod_declare_striped_create(const struct lu_env *env, struct dt_object *dt,
struct lu_attr *attr,
const struct lu_buf *lovea, struct thandle *th);
-int lod_striping_create(const struct lu_env *env, struct dt_object *dt,
+int lod_striped_create(const struct lu_env *env, struct dt_object *dt,
struct lu_attr *attr, struct dt_object_format *dof,
struct thandle *th);
void lod_object_free_striping(const struct lu_env *env, struct lod_object *lo);
struct thandle *th,
const struct dt_object *sub_obj,
bool *record_update);
-int lod_sub_object_declare_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);
-int lod_sub_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);
-int lod_sub_object_declare_ref_add(const struct lu_env *env,
- struct dt_object *dt,
- struct thandle *th);
-int lod_sub_object_ref_add(const struct lu_env *env, struct dt_object *dt,
- struct thandle *th);
-int lod_sub_object_declare_ref_del(const struct lu_env *env,
- struct dt_object *dt,
- struct thandle *th);
-int lod_sub_object_ref_del(const struct lu_env *env, struct dt_object *dt,
- struct thandle *th);
-int lod_sub_object_declare_destroy(const struct lu_env *env,
- struct dt_object *dt,
- struct thandle *th);
-int lod_sub_object_destroy(const struct lu_env *env, struct dt_object *dt,
- struct thandle *th);
-int lod_sub_object_declare_insert(const struct lu_env *env,
- struct dt_object *dt,
- const struct dt_rec *rec,
- const struct dt_key *key,
- struct thandle *th);
-int lod_sub_object_index_insert(const struct lu_env *env, struct dt_object *dt,
- const struct dt_rec *rec,
- const struct dt_key *key, struct thandle *th,
- int ign);
-int lod_sub_object_declare_delete(const struct lu_env *env,
- struct dt_object *dt,
- const struct dt_key *key,
- struct thandle *th);
-int lod_sub_object_delete(const struct lu_env *env, struct dt_object *dt,
- const struct dt_key *name, struct thandle *th);
-int lod_sub_object_declare_xattr_set(const struct lu_env *env,
- struct dt_object *dt,
- const struct lu_buf *buf,
- const char *name, int fl,
- struct thandle *th);
-int lod_sub_object_xattr_set(const struct lu_env *env, struct dt_object *dt,
- const struct lu_buf *buf, const char *name, int fl,
- struct thandle *th);
-int lod_sub_object_declare_attr_set(const struct lu_env *env,
- struct dt_object *dt,
- const struct lu_attr *attr,
- struct thandle *th);
-int lod_sub_object_attr_set(const struct lu_env *env,
- struct dt_object *dt,
- const struct lu_attr *attr,
+int lod_sub_declare_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);
+int lod_sub_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);
+int lod_sub_declare_ref_add(const struct lu_env *env, struct dt_object *dt,
struct thandle *th);
-int lod_sub_object_declare_xattr_del(const struct lu_env *env,
- struct dt_object *dt,
- const char *name,
- struct thandle *th);
-int lod_sub_object_xattr_del(const struct lu_env *env,
- struct dt_object *dt,
- const char *name,
- struct thandle *th);
-int lod_sub_object_declare_write(const struct lu_env *env,
- struct dt_object *dt,
- const struct lu_buf *buf, loff_t pos,
- struct thandle *th);
-ssize_t lod_sub_object_write(const struct lu_env *env, struct dt_object *dt,
- const struct lu_buf *buf, loff_t *pos,
- struct thandle *th, int rq);
-int lod_sub_object_declare_punch(const struct lu_env *env,
- struct dt_object *dt,
- __u64 start, __u64 end,
- struct thandle *th);
-int lod_sub_object_punch(const struct lu_env *env, struct dt_object *dt,
- __u64 start, __u64 end, struct thandle *th);
+int lod_sub_ref_add(const struct lu_env *env, struct dt_object *dt,
+ struct thandle *th);
+int lod_sub_declare_ref_del(const struct lu_env *env, struct dt_object *dt,
+ struct thandle *th);
+int lod_sub_ref_del(const struct lu_env *env, struct dt_object *dt,
+ struct thandle *th);
+int lod_sub_declare_destroy(const struct lu_env *env, struct dt_object *dt,
+ struct thandle *th);
+int lod_sub_destroy(const struct lu_env *env, struct dt_object *dt,
+ struct thandle *th);
+int lod_sub_declare_insert(const struct lu_env *env, struct dt_object *dt,
+ const struct dt_rec *rec, const struct dt_key *key,
+ struct thandle *th);
+int lod_sub_insert(const struct lu_env *env, struct dt_object *dt,
+ const struct dt_rec *rec, const struct dt_key *key,
+ struct thandle *th, int ign);
+int lod_sub_declare_delete(const struct lu_env *env, struct dt_object *dt,
+ const struct dt_key *key, struct thandle *th);
+int lod_sub_delete(const struct lu_env *env, struct dt_object *dt,
+ const struct dt_key *name, struct thandle *th);
+int lod_sub_declare_xattr_set(const struct lu_env *env, struct dt_object *dt,
+ const struct lu_buf *buf, const char *name,
+ int fl, struct thandle *th);
+int lod_sub_xattr_set(const struct lu_env *env, struct dt_object *dt,
+ const struct lu_buf *buf, const char *name, int fl,
+ struct thandle *th);
+int lod_sub_declare_attr_set(const struct lu_env *env, struct dt_object *dt,
+ const struct lu_attr *attr, struct thandle *th);
+int lod_sub_attr_set(const struct lu_env *env, struct dt_object *dt,
+ const struct lu_attr *attr, struct thandle *th);
+int lod_sub_declare_xattr_del(const struct lu_env *env, struct dt_object *dt,
+ const char *name, struct thandle *th);
+int lod_sub_xattr_del(const struct lu_env *env, struct dt_object *dt,
+ const char *name, struct thandle *th);
+int lod_sub_declare_write(const struct lu_env *env, struct dt_object *dt,
+ const struct lu_buf *buf, loff_t pos,
+ struct thandle *th);
+ssize_t lod_sub_write(const struct lu_env *env, struct dt_object *dt,
+ const struct lu_buf *buf, loff_t *pos,
+ struct thandle *th, int rq);
+int lod_sub_declare_punch(const struct lu_env *env, struct dt_object *dt,
+ __u64 start, __u64 end, struct thandle *th);
+int lod_sub_punch(const struct lu_env *env, struct dt_object *dt,
+ __u64 start, __u64 end, struct thandle *th);
int lod_sub_prep_llog(const struct lu_env *env, struct lod_device *lod,
struct dt_device *dt, int index);
*
* \see dt_index_operations::dio_lookup() in the API description for details.
*/
-static int lod_index_lookup(const struct lu_env *env, struct dt_object *dt,
- struct dt_rec *rec, const struct dt_key *key)
+static int lod_lookup(const struct lu_env *env, struct dt_object *dt,
+ struct dt_rec *rec, const struct dt_key *key)
{
struct dt_object *next = dt_object_child(dt);
return next->do_index_ops->dio_lookup(env, next, rec, key);
* \see dt_index_operations::dio_declare_insert() in the API description
* for details.
*/
-static int lod_declare_index_insert(const struct lu_env *env,
- struct dt_object *dt,
- const struct dt_rec *rec,
- const struct dt_key *key,
- struct thandle *th)
+static int lod_declare_insert(const struct lu_env *env, struct dt_object *dt,
+ const struct dt_rec *rec,
+ const struct dt_key *key, struct thandle *th)
{
- return lod_sub_object_declare_insert(env, dt_object_child(dt),
- rec, key, th);
+ return lod_sub_declare_insert(env, dt_object_child(dt), rec, key, th);
}
/**
*
* \see dt_index_operations::dio_insert() in the API description for details.
*/
-static int lod_index_insert(const struct lu_env *env,
- struct dt_object *dt,
- const struct dt_rec *rec,
- const struct dt_key *key,
- struct thandle *th,
- int ign)
+static int lod_insert(const struct lu_env *env, struct dt_object *dt,
+ const struct dt_rec *rec, const struct dt_key *key,
+ struct thandle *th, int ign)
{
- return lod_sub_object_index_insert(env, dt_object_child(dt), rec, key,
- th, ign);
+ return lod_sub_insert(env, dt_object_child(dt), rec, key, th, ign);
}
/**
* \see dt_index_operations::dio_declare_delete() in the API description
* for details.
*/
-static int lod_declare_index_delete(const struct lu_env *env,
- struct dt_object *dt,
- const struct dt_key *key,
- struct thandle *th)
+static int lod_declare_delete(const struct lu_env *env, struct dt_object *dt,
+ const struct dt_key *key, struct thandle *th)
{
- return lod_sub_object_declare_delete(env, dt_object_child(dt), key,
- th);
+ return lod_sub_declare_delete(env, dt_object_child(dt), key, th);
}
/**
*
* \see dt_index_operations::dio_delete() in the API description for details.
*/
-static int lod_index_delete(const struct lu_env *env,
- struct dt_object *dt,
- const struct dt_key *key,
- struct thandle *th)
+static int lod_delete(const struct lu_env *env, struct dt_object *dt,
+ const struct dt_key *key, struct thandle *th)
{
- return lod_sub_object_delete(env, dt_object_child(dt), key, th);
+ return lod_sub_delete(env, dt_object_child(dt), key, th);
}
/**
}
static struct dt_index_operations lod_index_ops = {
- .dio_lookup = lod_index_lookup,
- .dio_declare_insert = lod_declare_index_insert,
- .dio_insert = lod_index_insert,
- .dio_declare_delete = lod_declare_index_delete,
- .dio_delete = lod_index_delete,
+ .dio_lookup = lod_lookup,
+ .dio_declare_insert = lod_declare_insert,
+ .dio_insert = lod_insert,
+ .dio_declare_delete = lod_declare_delete,
+ .dio_delete = lod_delete,
.dio_it = {
.init = lod_it_init,
.fini = lod_it_fini,
}
static struct dt_index_operations lod_striped_index_ops = {
- .dio_lookup = lod_index_lookup,
- .dio_declare_insert = lod_declare_index_insert,
- .dio_insert = lod_index_insert,
- .dio_declare_delete = lod_declare_index_delete,
- .dio_delete = lod_index_delete,
+ .dio_lookup = lod_lookup,
+ .dio_declare_insert = lod_declare_insert,
+ .dio_insert = lod_insert,
+ .dio_declare_delete = lod_declare_delete,
+ .dio_delete = lod_delete,
.dio_it = {
.init = lod_striped_it_init,
.fini = lod_striped_it_fini,
*
* \see dt_object_operations::do_read_lock() in the API description for details.
*/
-static void lod_object_read_lock(const struct lu_env *env,
- struct dt_object *dt, unsigned role)
+static void lod_read_lock(const struct lu_env *env, struct dt_object *dt,
+ unsigned role)
{
dt_read_lock(env, dt_object_child(dt), role);
}
* \see dt_object_operations::do_write_lock() in the API description for
* details.
*/
-static void lod_object_write_lock(const struct lu_env *env,
- struct dt_object *dt, unsigned role)
+static void lod_write_lock(const struct lu_env *env, struct dt_object *dt,
+ unsigned role)
{
dt_write_lock(env, dt_object_child(dt), role);
}
* \see dt_object_operations::do_read_unlock() in the API description for
* details.
*/
-static void lod_object_read_unlock(const struct lu_env *env,
- struct dt_object *dt)
+static void lod_read_unlock(const struct lu_env *env, struct dt_object *dt)
{
dt_read_unlock(env, dt_object_child(dt));
}
* \see dt_object_operations::do_write_unlock() in the API description for
* details.
*/
-static void lod_object_write_unlock(const struct lu_env *env,
- struct dt_object *dt)
+static void lod_write_unlock(const struct lu_env *env, struct dt_object *dt)
{
dt_write_unlock(env, dt_object_child(dt));
}
* \see dt_object_operations::do_write_locked() in the API description for
* details.
*/
-static int lod_object_write_locked(const struct lu_env *env,
- struct dt_object *dt)
+static int lod_write_locked(const struct lu_env *env, struct dt_object *dt)
{
return dt_write_locked(env, dt_object_child(dt));
}
int stripe_idx, struct lod_obj_stripe_cb_data *data)
{
if (data->locd_declare)
- return lod_sub_object_declare_attr_set(env, dt,
- data->locd_attr, th);
- else
- return lod_sub_object_attr_set(env, dt, data->locd_attr, th);
+ return lod_sub_declare_attr_set(env, dt, data->locd_attr, th);
+
+ return lod_sub_attr_set(env, dt, data->locd_attr, th);
}
/**
/*
* declare setattr on the local object
*/
- rc = lod_sub_object_declare_attr_set(env, next, attr, th);
+ rc = lod_sub_declare_attr_set(env, next, attr, th);
if (rc)
RETURN(rc);
for (i = 0; i < lo->ldo_dir_stripenr; i++) {
if (lo->ldo_stripe[i] == NULL)
continue;
- rc = lod_sub_object_declare_attr_set(env,
- lo->ldo_stripe[i], attr,
- th);
+ rc = lod_sub_declare_attr_set(env, lo->ldo_stripe[i],
+ attr, th);
if (rc != 0)
RETURN(rc);
}
RETURN(0);
if (OBD_FAIL_CHECK(OBD_FAIL_LFSCK_LOST_STRIPE)) {
- rc = lod_sub_object_declare_xattr_del(env, next,
- XATTR_NAME_LOV, th);
+ rc = lod_sub_declare_xattr_del(env, next, XATTR_NAME_LOV, th);
RETURN(rc);
}
buf->lb_buf = info->lti_ea_store;
buf->lb_len = info->lti_ea_store_size;
- rc = lod_sub_object_declare_xattr_set(env, next, buf,
- XATTR_NAME_LOV,
- LU_XATTR_REPLACE, th);
+ rc = lod_sub_declare_xattr_set(env, next, buf, XATTR_NAME_LOV,
+ LU_XATTR_REPLACE, th);
}
RETURN(rc);
/*
* apply changes to the local object
*/
- rc = lod_sub_object_attr_set(env, next, attr, th);
+ rc = lod_sub_attr_set(env, next, attr, th);
if (rc)
RETURN(rc);
if ((dt_object_exists(lo->ldo_stripe[i]) == 0))
continue;
- rc = lod_sub_object_attr_set(env, lo->ldo_stripe[i],
- attr, th);
+ rc = lod_sub_attr_set(env, lo->ldo_stripe[i], attr, th);
if (rc != 0)
break;
}
RETURN(0);
if (OBD_FAIL_CHECK(OBD_FAIL_LFSCK_LOST_STRIPE)) {
- rc = lod_sub_object_xattr_del(env, next, XATTR_NAME_LOV, th);
+ rc = lod_sub_xattr_del(env, next, XATTR_NAME_LOV, th);
RETURN(rc);
}
fid_to_ostid(fid, oi);
ostid_cpu_to_le(oi, &objs->l_ost_oi);
- rc = lod_sub_object_xattr_set(env, next, buf, XATTR_NAME_LOV,
- LU_XATTR_REPLACE, th);
+ rc = lod_sub_xattr_set(env, next, buf, XATTR_NAME_LOV,
+ LU_XATTR_REPLACE, th);
} else if (OBD_FAIL_CHECK(OBD_FAIL_LFSCK_BAD_PFL_RANGE)) {
struct lod_thread_info *info = lod_env_info(env);
struct lu_buf *buf = &info->lti_buf;
le64_add_cpu(&lcme->lcme_extent.e_start, 1);
le64_add_cpu(&lcme->lcme_extent.e_end, -1);
- rc = lod_sub_object_xattr_set(env, next, buf, XATTR_NAME_LOV,
- LU_XATTR_REPLACE, th);
+ rc = lod_sub_xattr_set(env, next, buf, XATTR_NAME_LOV,
+ LU_XATTR_REPLACE, th);
}
RETURN(rc);
struct linkea_data ldata = { NULL };
struct lu_buf linkea_buf;
- rc = lod_sub_object_declare_create(env, dto, attr, NULL,
- dof, th);
+ rc = lod_sub_declare_create(env, dto, attr, NULL, dof, th);
if (rc != 0)
GOTO(out, rc);
if (!dt_try_as_dir(env, dto))
GOTO(out, rc = -EINVAL);
- rc = lod_sub_object_declare_ref_add(env, dto, th);
+ rc = lod_sub_declare_ref_add(env, dto, th);
if (rc != 0)
GOTO(out, rc);
rec->rec_fid = lu_object_fid(&dto->do_lu);
- rc = lod_sub_object_declare_insert(env, dto,
- (const struct dt_rec *)rec,
- (const struct dt_key *)dot, th);
+ rc = lod_sub_declare_insert(env, dto,
+ (const struct dt_rec *)rec,
+ (const struct dt_key *)dot, th);
if (rc != 0)
GOTO(out, rc);
/* master stripe FID will be put to .. */
rec->rec_fid = lu_object_fid(&dt->do_lu);
- rc = lod_sub_object_declare_insert(env, dto,
- (const struct dt_rec *)rec,
- (const struct dt_key *)dotdot,
- th);
+ rc = lod_sub_declare_insert(env, dto,
+ (const struct dt_rec *)rec,
+ (const struct dt_key *)dotdot, th);
if (rc != 0)
GOTO(out, rc);
else
slave_lmm->lmv_master_mdt_index =
cpu_to_le32(i);
- rc = lod_sub_object_declare_xattr_set(env, dto,
- &slave_lmv_buf, XATTR_NAME_LMV, 0, th);
+ rc = lod_sub_declare_xattr_set(env, dto, &slave_lmv_buf,
+ XATTR_NAME_LMV, 0, th);
if (rc != 0)
GOTO(out, rc);
}
linkea_buf.lb_buf = ldata.ld_buf->lb_buf;
linkea_buf.lb_len = ldata.ld_leh->leh_len;
- rc = lod_sub_object_declare_xattr_set(env, dto, &linkea_buf,
- XATTR_NAME_LINK, 0, th);
+ rc = lod_sub_declare_xattr_set(env, dto, &linkea_buf,
+ XATTR_NAME_LINK, 0, th);
if (rc != 0)
GOTO(out, rc);
rec->rec_fid = lu_object_fid(&dto->do_lu);
- rc = lod_sub_object_declare_insert(env, dt_object_child(dt),
- (const struct dt_rec *)rec,
- (const struct dt_key *)stripe_name,
- th);
+ rc = lod_sub_declare_insert(env, dt_object_child(dt),
+ (const struct dt_rec *)rec,
+ (const struct dt_key *)stripe_name,
+ th);
if (rc != 0)
GOTO(out, rc);
- rc = lod_sub_object_declare_ref_add(env, dt_object_child(dt),
- th);
+ rc = lod_sub_declare_ref_add(env, dt_object_child(dt), th);
if (rc != 0)
GOTO(out, rc);
}
- rc = lod_sub_object_declare_xattr_set(env, dt_object_child(dt),
- &lmv_buf, XATTR_NAME_LMV, 0, th);
+ rc = lod_sub_declare_xattr_set(env, dt_object_child(dt),
+ &lmv_buf, XATTR_NAME_LMV, 0, th);
if (rc != 0)
GOTO(out, rc);
out:
RETURN(rc);
}
- rc = lod_sub_object_declare_xattr_set(env, next, buf, name, fl, th);
+ rc = lod_sub_declare_xattr_set(env, next, buf, name, fl, th);
if (rc != 0)
RETURN(rc);
for (i = 0; i < lo->ldo_dir_stripenr; i++) {
LASSERT(lo->ldo_stripe[i]);
- rc = lod_sub_object_declare_xattr_set(env, lo->ldo_stripe[i],
- buf, name, fl, th);
+ rc = lod_sub_declare_xattr_set(env, lo->ldo_stripe[i],
+ buf, name, fl, th);
if (rc != 0)
break;
}
ff->ff_parent.f_ver = stripe_idx;
fid_cpu_to_le(&ff->ff_parent, &ff->ff_parent);
if (data->locd_declare)
- rc = lod_sub_object_declare_xattr_set(env, dt, buf,
- XATTR_NAME_FID,
- LU_XATTR_REPLACE, th);
+ rc = lod_sub_declare_xattr_set(env, dt, buf, XATTR_NAME_FID,
+ LU_XATTR_REPLACE, th);
else
- rc = lod_sub_object_xattr_set(env, dt, buf, XATTR_NAME_FID,
- LU_XATTR_REPLACE, th);
+ rc = lod_sub_xattr_set(env, dt, buf, XATTR_NAME_FID,
+ LU_XATTR_REPLACE, th);
return rc;
}
* \retval 0 if reset succeeds
* \retval negative errno if reset fails
*/
-static int lod_object_replace_parent_fid(const struct lu_env *env,
- struct dt_object *dt,
- struct thandle *th, bool declare)
+static int lod_replace_parent_fid(const struct lu_env *env,
+ struct dt_object *dt,
+ struct thandle *th, bool declare)
{
struct lod_object *lo = lod_dt_obj(dt);
struct lod_thread_info *info = lod_env_info(env);
* later when generating component ID for the new components */
info->lti_buf.lb_len = lod_comp_md_size(lo, false);
- rc = lod_sub_object_declare_xattr_set(env, next, &info->lti_buf,
+ rc = lod_sub_declare_xattr_set(env, next, &info->lti_buf,
XATTR_NAME_LOV, 0, th);
if (rc)
GOTO(error, rc);
lod_obj_inc_layout_gen(lo);
info->lti_buf.lb_len = lod_comp_md_size(lo, false);
- rc = lod_sub_object_declare_xattr_set(env, dt, &info->lti_buf,
- XATTR_NAME_LOV, 0, th);
+ rc = lod_sub_declare_xattr_set(env, dt, &info->lti_buf,
+ XATTR_NAME_LOV, 0, th);
RETURN(rc);
}
if (obj == NULL)
continue;
- rc = lod_sub_object_declare_destroy(env, obj, th);
+ rc = lod_sub_declare_destroy(env, obj, th);
if (rc)
RETURN(rc);
}
memset(attr, 0, sizeof(*attr));
attr->la_valid = LA_SIZE;
- rc = lod_sub_object_declare_attr_set(env, next, attr, th);
+ rc = lod_sub_declare_attr_set(env, next, attr, th);
if (rc)
RETURN(rc);
if (left > 0) {
info->lti_buf.lb_len = lod_comp_md_size(lo, false);
- rc = lod_sub_object_declare_xattr_set(env, next, &info->lti_buf,
- XATTR_NAME_LOV, 0, th);
+ rc = lod_sub_declare_xattr_set(env, next, &info->lti_buf,
+ XATTR_NAME_LOV, 0, th);
} else {
- rc = lod_sub_object_declare_xattr_del(env, next, XATTR_NAME_LOV,
- th);
+ rc = lod_sub_declare_xattr_del(env, next, XATTR_NAME_LOV, th);
}
RETURN(rc);
attr->la_valid = LA_TYPE | LA_MODE;
attr->la_mode = S_IFREG;
}
- rc = lod_declare_striped_object(env, dt, attr, buf, th);
+ rc = lod_declare_striped_create(env, dt, attr, buf, th);
} else if (S_ISREG(mode) &&
strlen(name) > strlen(XATTR_LUSTRE_LOV) + 1 &&
strncmp(name, XATTR_LUSTRE_LOV,
} else if (S_ISDIR(mode)) {
rc = lod_dir_declare_xattr_set(env, dt, buf, name, fl, th);
} else if (strcmp(name, XATTR_NAME_FID) == 0) {
- rc = lod_object_replace_parent_fid(env, dt, th, true);
+ rc = lod_replace_parent_fid(env, dt, th, true);
} else {
- rc = lod_sub_object_declare_xattr_set(env, next, buf, name,
- fl, th);
+ rc = lod_sub_declare_xattr_set(env, next, buf, name, fl, th);
}
RETURN(rc);
int i;
ENTRY;
- rc = lod_sub_object_xattr_set(env, next, buf, name, fl, th);
+ rc = lod_sub_xattr_set(env, next, buf, name, fl, th);
if (rc != 0 || !S_ISDIR(dt->do_lu.lo_header->loh_attr))
RETURN(rc);
for (i = 0; i < lo->ldo_dir_stripenr; i++) {
LASSERT(lo->ldo_stripe[i]);
- rc = lod_sub_object_xattr_set(env, lo->ldo_stripe[i], buf, name,
- fl, th);
+ rc = lod_sub_xattr_set(env, lo->ldo_stripe[i], buf, name,
+ fl, th);
if (rc != 0)
break;
}
int i;
ENTRY;
- rc = lod_sub_object_xattr_del(env, next, name, th);
+ rc = lod_sub_xattr_del(env, next, name, th);
if (rc != 0 || !S_ISDIR(dt->do_lu.lo_header->loh_attr))
RETURN(rc);
for (i = 0; i < lo->ldo_dir_stripenr; i++) {
LASSERT(lo->ldo_stripe[i]);
- rc = lod_sub_object_xattr_del(env, lo->ldo_stripe[i], name,
- th);
+ rc = lod_sub_xattr_del(env, lo->ldo_stripe[i], name, th);
if (rc != 0)
break;
}
dto = lo->ldo_stripe[i];
dt_write_lock(env, dto, MOR_TGT_CHILD);
- rc = lod_sub_object_create(env, dto, attr, NULL, dof,
- th);
+ rc = lod_sub_create(env, dto, attr, NULL, dof, th);
if (rc != 0) {
dt_write_unlock(env, dto);
GOTO(out, rc);
}
- rc = lod_sub_object_ref_add(env, dto, th);
+ rc = lod_sub_ref_add(env, dto, th);
dt_write_unlock(env, dto);
if (rc != 0)
GOTO(out, rc);
rec->rec_fid = lu_object_fid(&dto->do_lu);
- rc = lod_sub_object_index_insert(env, dto,
- (const struct dt_rec *)rec,
- (const struct dt_key *)dot, th, 0);
+ rc = lod_sub_insert(env, dto, (const struct dt_rec *)rec,
+ (const struct dt_key *)dot, th, 0);
if (rc != 0)
GOTO(out, rc);
rec->rec_fid = lu_object_fid(&dt->do_lu);
- rc = lod_sub_object_index_insert(env, dto, (struct dt_rec *)rec,
- (const struct dt_key *)dotdot, th, 0);
+ rc = lod_sub_insert(env, dto, (struct dt_rec *)rec,
+ (const struct dt_key *)dotdot, th, 0);
if (rc != 0)
GOTO(out, rc);
slave_lmm->lmv_master_mdt_index =
cpu_to_le32(i);
- rc = lod_sub_object_xattr_set(env, dto, &slave_lmv_buf,
- XATTR_NAME_LMV, fl, th);
+ rc = lod_sub_xattr_set(env, dto, &slave_lmv_buf,
+ XATTR_NAME_LMV, fl, th);
if (rc != 0)
GOTO(out, rc);
}
linkea_buf.lb_buf = ldata.ld_buf->lb_buf;
linkea_buf.lb_len = ldata.ld_leh->leh_len;
- rc = lod_sub_object_xattr_set(env, dto, &linkea_buf,
- XATTR_NAME_LINK, 0, th);
+ rc = lod_sub_xattr_set(env, dto, &linkea_buf,
+ XATTR_NAME_LINK, 0, th);
if (rc != 0)
GOTO(out, rc);
rec->rec_fid = lu_object_fid(&dto->do_lu);
- rc = lod_sub_object_index_insert(env, dt_object_child(dt),
- (const struct dt_rec *)rec,
- (const struct dt_key *)stripe_name, th, 0);
+ rc = lod_sub_insert(env, dt_object_child(dt),
+ (const struct dt_rec *)rec,
+ (const struct dt_key *)stripe_name, th, 0);
if (rc != 0)
GOTO(out, rc);
- rc = lod_sub_object_ref_add(env, dt_object_child(dt), th);
+ rc = lod_sub_ref_add(env, dt_object_child(dt), th);
if (rc != 0)
GOTO(out, rc);
}
if (!OBD_FAIL_CHECK(OBD_FAIL_LFSCK_LOST_MASTER_LMV))
- rc = lod_sub_object_xattr_set(env, dt_object_child(dt),
- &lmv_buf, XATTR_NAME_LMV, fl, th);
+ rc = lod_sub_xattr_set(env, dt_object_child(dt),
+ &lmv_buf, XATTR_NAME_LMV, fl, th);
out:
if (slave_lmm != NULL)
OBD_FREE_PTR(slave_lmm);
if (lo->ldo_comp_cnt == 0) {
lod_object_free_striping(env, lo);
- rc = lod_sub_object_xattr_del(env, next, XATTR_NAME_LOV, th);
+ rc = lod_sub_xattr_del(env, next, XATTR_NAME_LOV, th);
RETURN(rc);
}
info->lti_buf.lb_buf = lmm;
info->lti_buf.lb_len = lmm_size;
- rc = lod_sub_object_xattr_set(env, next, &info->lti_buf,
- XATTR_NAME_LOV, 0, th);
+ rc = lod_sub_xattr_set(env, next, &info->lti_buf,
+ XATTR_NAME_LOV, 0, th);
RETURN(rc);
}
if (obj == NULL)
continue;
- rc = lod_sub_object_destroy(env, obj, th);
+ rc = lod_sub_destroy(env, obj, th);
if (rc)
GOTO(out, rc);
if (attr->la_size > 0) {
attr->la_size = 0;
attr->la_valid = LA_SIZE;
- rc = lod_sub_object_attr_set(env, next, attr, th);
+ rc = lod_sub_attr_set(env, next, attr, th);
if (rc)
GOTO(out, rc);
}
if (lmm != NULL && le32_to_cpu(lmm->lmv_hash_type) &
LMV_HASH_FLAG_MIGRATION)
- rc = lod_sub_object_xattr_set(env, next, buf, name, fl,
- th);
+ rc = lod_sub_xattr_set(env, next, buf, name, fl, th);
else
rc = lod_dir_striping_create(env, dt, NULL, NULL, th);
/* free stripes, then update disk */
lod_object_free_striping(env, lod_dt_obj(dt));
- rc = lod_sub_object_xattr_set(env, next, buf, name,
- fl, th);
+ rc = lod_sub_xattr_set(env, next, buf, name, fl, th);
} else if (dt_object_remote(dt)) {
/* This only happens during migration, see
* mdd_migrate_create(), in which Master MDT will
* create a remote target object, and only set
* (migrating) stripe EA on the remote object,
* and does not need creating each stripes. */
- rc = lod_sub_object_xattr_set(env, next, buf, name,
+ rc = lod_sub_xattr_set(env, next, buf, name,
fl, th);
} else if (strcmp(name, XATTR_LUSTRE_LOV".del") == 0) {
/* delete component(s) */
!strcmp(name, XATTR_NAME_LOV),
!lod_dt_obj(dt)->ldo_comp_cached));
- rc = lod_striping_create(env, dt, NULL, NULL, th);
+ rc = lod_striped_create(env, dt, NULL, NULL, th);
}
RETURN(rc);
} else if (strcmp(name, XATTR_NAME_FID) == 0) {
- rc = lod_object_replace_parent_fid(env, dt, th, false);
+ rc = lod_replace_parent_fid(env, dt, th, false);
RETURN(rc);
}
int i;
ENTRY;
- rc = lod_sub_object_declare_xattr_del(env, dt_object_child(dt),
- name, th);
+ rc = lod_sub_declare_xattr_del(env, dt_object_child(dt), name, th);
if (rc != 0)
RETURN(rc);
for (i = 0; i < lo->ldo_dir_stripenr; i++) {
LASSERT(lo->ldo_stripe[i]);
- rc = lod_sub_object_declare_xattr_del(env, lo->ldo_stripe[i],
- name, th);
+ rc = lod_sub_declare_xattr_del(env, lo->ldo_stripe[i],
+ name, th);
if (rc != 0)
break;
}
if (!strcmp(name, XATTR_NAME_LOV))
lod_object_free_striping(env, lod_dt_obj(dt));
- rc = lod_sub_object_xattr_del(env, next, name, th);
+ rc = lod_sub_xattr_del(env, next, name, th);
if (rc != 0 || !S_ISDIR(dt->do_lu.lo_header->loh_attr))
RETURN(rc);
for (i = 0; i < lo->ldo_dir_stripenr; i++) {
LASSERT(lo->ldo_stripe[i]);
- rc = lod_sub_object_xattr_del(env, lo->ldo_stripe[i], name, th);
+ rc = lod_sub_xattr_del(env, lo->ldo_stripe[i], name, th);
if (rc != 0)
break;
}
attr->la_valid = LA_SIZE;
attr->la_size = size;
- rc = lod_sub_object_declare_attr_set(env, objects[stripe], attr, th);
+ rc = lod_sub_declare_attr_set(env, objects[stripe], attr, th);
RETURN(rc);
}
* \retval 0 on success
* \retval negative if failed
*/
-int lod_declare_striped_object(const struct lu_env *env, struct dt_object *dt,
+int lod_declare_striped_create(const struct lu_env *env, struct dt_object *dt,
struct lu_attr *attr,
const struct lu_buf *lovea, struct thandle *th)
{
info->lti_buf = *lovea;
}
- rc = lod_sub_object_declare_xattr_set(env, next, &info->lti_buf,
- XATTR_NAME_LOV, 0, th);
+ rc = lod_sub_declare_xattr_set(env, next, &info->lti_buf,
+ XATTR_NAME_LOV, 0, th);
if (rc)
GOTO(out, rc);
* \see dt_object_operations::do_declare_create() in the API description
* for details.
*/
-static int lod_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)
+static int lod_declare_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 dt_object *next = dt_object_child(dt);
struct lod_object *lo = lod_dt_obj(dt);
/*
* first of all, we declare creation of local object
*/
- rc = lod_sub_object_declare_create(env, next, attr, hint, dof, th);
+ rc = lod_sub_declare_create(env, next, attr, hint, dof, th);
if (rc != 0)
GOTO(out, rc);
* to use striping, then ->declare_create() behaving differently
* should be cleaned */
if (dof->u.dof_reg.striped != 0)
- rc = lod_declare_striped_object(env, dt, attr,
+ rc = lod_declare_striped_create(env, dt, attr,
NULL, th);
} else if (dof->dof_type == DFT_DIR) {
struct seq_server_site *ss;
* \retval 0 on success
* \retval negative if failed
*/
-int lod_striping_create(const struct lu_env *env, struct dt_object *dt,
- struct lu_attr *attr, struct dt_object_format *dof,
- struct thandle *th)
+int lod_striped_create(const struct lu_env *env, struct dt_object *dt,
+ struct lu_attr *attr, struct dt_object_format *dof,
+ struct thandle *th)
{
struct lod_layout_component *lod_comp;
struct lod_object *lo = lod_dt_obj(dt);
for (j = 0; j < lod_comp->llc_stripenr; j++) {
struct dt_object *object = lod_comp->llc_stripe[j];
LASSERT(object != NULL);
- rc = lod_sub_object_create(env, object, attr, NULL,
- dof, th);
+ rc = lod_sub_create(env, object, attr, NULL, dof, th);
if (rc)
break;
}
*
* \see dt_object_operations::do_create() in the API description for details.
*/
-static int lod_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)
+static int lod_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)
{
int rc;
ENTRY;
/* create local object */
- rc = lod_sub_object_create(env, dt_object_child(dt), attr, hint, dof,
- th);
+ rc = lod_sub_create(env, dt_object_child(dt), attr, hint, dof, th);
if (rc != 0)
RETURN(rc);
if (S_ISREG(dt->do_lu.lo_header->loh_attr) &&
lod_obj_is_striped(dt) && dof->u.dof_reg.striped != 0) {
LASSERT(lod_dt_obj(dt)->ldo_comp_cached == 0);
- rc = lod_striping_create(env, dt, attr, dof, th);
+ rc = lod_striped_create(env, dt, attr, dof, th);
}
RETURN(rc);
int stripe_idx, struct lod_obj_stripe_cb_data *data)
{
if (data->locd_declare)
- return lod_sub_object_declare_destroy(env, dt, th);
+ return lod_sub_declare_destroy(env, dt, th);
else if (!OBD_FAIL_CHECK(OBD_FAIL_LFSCK_LOST_SPEOBJ) ||
stripe_idx == cfs_fail_val)
- return lod_sub_object_destroy(env, dt, th);
+ return lod_sub_destroy(env, dt, th);
else
return 0;
}
* \see dt_object_operations::do_declare_destroy() in the API description
* for details.
*/
-static int lod_declare_object_destroy(const struct lu_env *env,
- struct dt_object *dt,
- struct thandle *th)
+static int lod_declare_destroy(const struct lu_env *env, struct dt_object *dt,
+ struct thandle *th)
{
struct dt_object *next = dt_object_child(dt);
struct lod_object *lo = lod_dt_obj(dt);
RETURN(rc);
for (i = 0; i < lo->ldo_dir_stripenr; i++) {
- rc = lod_sub_object_declare_ref_del(env, next, th);
+ rc = lod_sub_declare_ref_del(env, next, th);
if (rc != 0)
RETURN(rc);
snprintf(stripe_name, sizeof(info->lti_key), DFID":%d",
PFID(lu_object_fid(&lo->ldo_stripe[i]->do_lu)),
i);
- rc = lod_sub_object_declare_delete(env, next,
+ rc = lod_sub_declare_delete(env, next,
(const struct dt_key *)stripe_name, th);
if (rc != 0)
RETURN(rc);
/*
* we declare destroy for the local object
*/
- rc = lod_sub_object_declare_destroy(env, next, th);
+ rc = lod_sub_declare_destroy(env, next, th);
if (rc)
RETURN(rc);
if (lo->ldo_stripe[i] == NULL)
continue;
- rc = lod_sub_object_declare_ref_del(env,
- lo->ldo_stripe[i], th);
+ rc = lod_sub_declare_ref_del(env, lo->ldo_stripe[i],
+ th);
- rc = lod_sub_object_declare_destroy(env,
- lo->ldo_stripe[i], th);
+ rc = lod_sub_declare_destroy(env, lo->ldo_stripe[i],
+ th);
if (rc != 0)
break;
}
*
* \see dt_object_operations::do_destroy() in the API description for details.
*/
-static int lod_object_destroy(const struct lu_env *env,
- struct dt_object *dt, struct thandle *th)
+static int lod_destroy(const struct lu_env *env, struct dt_object *dt,
+ struct thandle *th)
{
struct dt_object *next = dt_object_child(dt);
struct lod_object *lo = lod_dt_obj(dt);
RETURN(rc);
for (i = 0; i < lo->ldo_dir_stripenr; i++) {
- rc = lod_sub_object_ref_del(env, next, th);
+ rc = lod_sub_ref_del(env, next, th);
if (rc != 0)
RETURN(rc);
PFID(lu_object_fid(&dt->do_lu)), stripe_name,
PFID(lu_object_fid(&lo->ldo_stripe[i]->do_lu)));
- rc = lod_sub_object_delete(env, next,
+ rc = lod_sub_delete(env, next,
(const struct dt_key *)stripe_name, th);
if (rc != 0)
RETURN(rc);
}
}
- rc = lod_sub_object_destroy(env, next, th);
+ rc = lod_sub_destroy(env, next, th);
if (rc != 0)
RETURN(rc);
i == cfs_fail_val) {
dt_write_lock(env, lo->ldo_stripe[i],
MOR_TGT_CHILD);
- rc = lod_sub_object_ref_del(env,
- lo->ldo_stripe[i], th);
+ rc = lod_sub_ref_del(env, lo->ldo_stripe[i],
+ th);
dt_write_unlock(env, lo->ldo_stripe[i]);
if (rc != 0)
break;
- rc = lod_sub_object_destroy(env,
- lo->ldo_stripe[i], th);
+ rc = lod_sub_destroy(env, lo->ldo_stripe[i],
+ th);
if (rc != 0)
break;
}
static int lod_declare_ref_add(const struct lu_env *env,
struct dt_object *dt, struct thandle *th)
{
- return lod_sub_object_declare_ref_add(env, dt_object_child(dt), th);
+ return lod_sub_declare_ref_add(env, dt_object_child(dt), th);
}
/**
static int lod_ref_add(const struct lu_env *env,
struct dt_object *dt, struct thandle *th)
{
- return lod_sub_object_ref_add(env, dt_object_child(dt), th);
+ return lod_sub_ref_add(env, dt_object_child(dt), th);
}
/**
static int lod_declare_ref_del(const struct lu_env *env,
struct dt_object *dt, struct thandle *th)
{
- return lod_sub_object_declare_ref_del(env, dt_object_child(dt), th);
+ return lod_sub_declare_ref_del(env, dt_object_child(dt), th);
}
/**
static int lod_ref_del(const struct lu_env *env,
struct dt_object *dt, struct thandle *th)
{
- return lod_sub_object_ref_del(env, dt_object_child(dt), th);
+ return lod_sub_ref_del(env, dt_object_child(dt), th);
}
/**
if (!rc) {
info->lti_buf.lb_len = lod_comp_md_size(lo, false);
- rc = lod_sub_object_declare_xattr_set(env, next, &info->lti_buf,
- XATTR_NAME_LOV, 0, th);
+ rc = lod_sub_declare_xattr_set(env, next, &info->lti_buf,
+ XATTR_NAME_LOV, 0, th);
}
out:
if (rc)
{
struct lu_attr *attr = &lod_env_info(env)->lti_attr;
- RETURN(lod_striping_create(env, dt, attr, NULL, th));
+ RETURN(lod_striped_create(env, dt, attr, NULL, th));
}
struct dt_object_operations lod_obj_ops = {
- .do_read_lock = lod_object_read_lock,
- .do_write_lock = lod_object_write_lock,
- .do_read_unlock = lod_object_read_unlock,
- .do_write_unlock = lod_object_write_unlock,
- .do_write_locked = lod_object_write_locked,
+ .do_read_lock = lod_read_lock,
+ .do_write_lock = lod_write_lock,
+ .do_read_unlock = lod_read_unlock,
+ .do_write_unlock = lod_write_unlock,
+ .do_write_locked = lod_write_locked,
.do_attr_get = lod_attr_get,
.do_declare_attr_set = lod_declare_attr_set,
.do_attr_set = lod_attr_set,
.do_xattr_del = lod_xattr_del,
.do_xattr_list = lod_xattr_list,
.do_ah_init = lod_ah_init,
- .do_declare_create = lod_declare_object_create,
- .do_create = lod_object_create,
- .do_declare_destroy = lod_declare_object_destroy,
- .do_destroy = lod_object_destroy,
+ .do_declare_create = lod_declare_create,
+ .do_create = lod_create,
+ .do_declare_destroy = lod_declare_destroy,
+ .do_destroy = lod_destroy,
.do_index_try = lod_index_try,
.do_declare_ref_add = lod_declare_ref_add,
.do_ref_add = lod_ref_add,
const struct lu_buf *buf, loff_t pos,
struct thandle *th)
{
- return lod_sub_object_declare_write(env, dt_object_child(dt), buf, pos,
- th);
+ return lod_sub_declare_write(env, dt_object_child(dt), buf, pos, th);
}
/**
const struct lu_buf *buf, loff_t *pos,
struct thandle *th, int iq)
{
- return lod_sub_object_write(env, dt_object_child(dt), buf, pos, th, iq);
+ return lod_sub_write(env, dt_object_child(dt), buf, pos, th, iq);
}
static int lod_declare_punch(const struct lu_env *env, struct dt_object *dt,
if (dt_object_remote(dt))
return -ENOTSUPP;
- return lod_sub_object_declare_punch(env, dt_object_child(dt), start,
- end, th);
+ return lod_sub_declare_punch(env, dt_object_child(dt), start, end, th);
}
static int lod_punch(const struct lu_env *env, struct dt_object *dt,
if (dt_object_remote(dt))
return -ENOTSUPP;
- return lod_sub_object_punch(env, dt_object_child(dt), start, end, th);
+ return lod_sub_punch(env, dt_object_child(dt), start, end, th);
}
static const struct dt_body_operations lod_body_lnk_ops = {
dt = container_of(n, struct dt_object, do_lu);
- rc = lod_sub_object_declare_create(env, dt, NULL, NULL, NULL, th);
+ rc = lod_sub_declare_create(env, dt, NULL, NULL, NULL, th);
if (rc < 0) {
CDEBUG(D_OTHER, "can't declare creation on #%u: %d\n",
ost_idx, rc);
o = lod_comp->llc_stripe[i];
LASSERT(o);
- rc = lod_sub_object_declare_create(env, o, attr, NULL,
- NULL, th);
+ rc = lod_sub_declare_create(env, o, attr, NULL,
+ NULL, th);
if (rc < 0) {
CERROR("can't declare create: %d\n", rc);
break;
tth = container_of(th, struct top_thandle, tt_super);
/* local object must be mdt object, Note: during ost object
- * creation, FID is not assigned until osp_object_create(),
+ * creation, FID is not assigned until osp_create(),
* so if the FID of sub_obj is zero, it means OST object. */
if (!dt_object_remote(sub_obj) ||
fid_is_zero(lu_object_fid(&sub_obj->do_lu))) {
* \retval 0 if the declaration succeeds
* \retval negative errno if the declaration fails.
*/
-int lod_sub_object_declare_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)
+int lod_sub_declare_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 thandle *sub_th;
bool record_update;
* \retval 0 if the creation succeeds
* \retval negative errno if the creation fails.
*/
-int lod_sub_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)
+int lod_sub_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 thandle *sub_th;
bool record_update;
* \retval 0 if the declaration succeeds.
* \retval negative errno if the declaration fails.
*/
-int lod_sub_object_declare_ref_add(const struct lu_env *env,
- struct dt_object *dt,
- struct thandle *th)
+int lod_sub_declare_ref_add(const struct lu_env *env, struct dt_object *dt,
+ struct thandle *th)
{
struct thandle *sub_th;
bool record_update;
* \retval 0 if it succeeds.
* \retval negative errno if it fails.
*/
-int lod_sub_object_ref_add(const struct lu_env *env, struct dt_object *dt,
- struct thandle *th)
+int lod_sub_ref_add(const struct lu_env *env, struct dt_object *dt,
+ struct thandle *th)
{
struct thandle *sub_th;
bool record_update;
* \retval 0 if the declaration succeeds.
* \retval negative errno if the declaration fails.
*/
-int lod_sub_object_declare_ref_del(const struct lu_env *env,
- struct dt_object *dt,
- struct thandle *th)
+int lod_sub_declare_ref_del(const struct lu_env *env, struct dt_object *dt,
+ struct thandle *th)
{
struct thandle *sub_th;
bool record_update;
* \retval 0 if it succeeds.
* \retval negative errno if it fails.
*/
-int lod_sub_object_ref_del(const struct lu_env *env, struct dt_object *dt,
- struct thandle *th)
+int lod_sub_ref_del(const struct lu_env *env, struct dt_object *dt,
+ struct thandle *th)
{
struct thandle *sub_th;
bool record_update;
* \retval 0 if the declaration succeeds.
* \retval negative errno if the declaration fails.
*/
-int lod_sub_object_declare_destroy(const struct lu_env *env,
- struct dt_object *dt,
- struct thandle *th)
+int lod_sub_declare_destroy(const struct lu_env *env, struct dt_object *dt,
+ struct thandle *th)
{
struct thandle *sub_th;
bool record_update;
RETURN(PTR_ERR(sub_th));
if (record_update)
- update_record_size(env, object_destroy, th,
- lu_object_fid(&dt->do_lu));
+ update_record_size(env, destroy, th, lu_object_fid(&dt->do_lu));
rc = dt_declare_destroy(env, dt, sub_th);
* \retval 0 if the destroy succeeds.
* \retval negative errno if the destroy fails.
*/
-int lod_sub_object_destroy(const struct lu_env *env, struct dt_object *dt,
- struct thandle *th)
+int lod_sub_destroy(const struct lu_env *env, struct dt_object *dt,
+ struct thandle *th)
{
struct thandle *sub_th;
bool record_update;
RETURN(PTR_ERR(sub_th));
if (record_update) {
- rc = update_record_pack(object_destroy, th,
- lu_object_fid(&dt->do_lu));
+ rc = update_record_pack(destroy, th, lu_object_fid(&dt->do_lu));
if (rc < 0)
RETURN(rc);
}
* \retval 0 if the declaration succeeds.
* \retval negative errno if the declaration fails.
*/
-int lod_sub_object_declare_insert(const struct lu_env *env,
- struct dt_object *dt,
- const struct dt_rec *rec,
- const struct dt_key *key,
- struct thandle *th)
+int lod_sub_declare_insert(const struct lu_env *env, struct dt_object *dt,
+ const struct dt_rec *rec,
+ const struct dt_key *key, struct thandle *th)
{
struct thandle *sub_th;
bool record_update;
* \retval 0 if the insertion succeeds.
* \retval negative errno if the insertion fails.
*/
-int lod_sub_object_index_insert(const struct lu_env *env, struct dt_object *dt,
- const struct dt_rec *rec,
- const struct dt_key *key, struct thandle *th,
- int ign)
+int lod_sub_insert(const struct lu_env *env, struct dt_object *dt,
+ const struct dt_rec *rec, const struct dt_key *key,
+ struct thandle *th, int ign)
{
struct thandle *sub_th;
int rc;
* \retval 0 if the declaration succeeds.
* \retval negative errno if the declaration fails.
*/
-int lod_sub_object_declare_delete(const struct lu_env *env,
- struct dt_object *dt,
- const struct dt_key *key,
- struct thandle *th)
+int lod_sub_declare_delete(const struct lu_env *env, struct dt_object *dt,
+ const struct dt_key *key, struct thandle *th)
{
struct thandle *sub_th;
bool record_update;
* \retval 0 if the deletion succeeds.
* \retval negative errno if the deletion fails.
*/
-int lod_sub_object_delete(const struct lu_env *env, struct dt_object *dt,
- const struct dt_key *name, struct thandle *th)
+int lod_sub_delete(const struct lu_env *env, struct dt_object *dt,
+ const struct dt_key *name, struct thandle *th)
{
struct thandle *sub_th;
bool record_update;
* \retval 0 if the declaration succeeds.
* \retval negative errno if the declaration fails.
*/
-int lod_sub_object_declare_xattr_set(const struct lu_env *env,
- struct dt_object *dt,
- const struct lu_buf *buf,
- const char *name, int fl,
- struct thandle *th)
+int lod_sub_declare_xattr_set(const struct lu_env *env, struct dt_object *dt,
+ const struct lu_buf *buf, const char *name,
+ int fl, struct thandle *th)
{
struct thandle *sub_th;
bool record_update;
* \retval 0 if the xattr setting succeeds.
* \retval negative errno if xattr setting fails.
*/
-int lod_sub_object_xattr_set(const struct lu_env *env, struct dt_object *dt,
- const struct lu_buf *buf, const char *name, int fl,
- struct thandle *th)
+int lod_sub_xattr_set(const struct lu_env *env, struct dt_object *dt,
+ const struct lu_buf *buf, const char *name, int fl,
+ struct thandle *th)
{
struct thandle *sub_th;
bool record_update;
* \retval 0 if the declaration succeeds.
* \retval negative errno if the declaration fails.
*/
-int lod_sub_object_declare_attr_set(const struct lu_env *env,
- struct dt_object *dt,
- const struct lu_attr *attr,
- struct thandle *th)
+int lod_sub_declare_attr_set(const struct lu_env *env, struct dt_object *dt,
+ const struct lu_attr *attr, struct thandle *th)
{
struct thandle *sub_th;
bool record_update;
* \retval 0 if attributes setting succeeds.
* \retval negative errno if the attributes setting fails.
*/
-int lod_sub_object_attr_set(const struct lu_env *env,
- struct dt_object *dt,
- const struct lu_attr *attr,
- struct thandle *th)
+int lod_sub_attr_set(const struct lu_env *env, struct dt_object *dt,
+ const struct lu_attr *attr, struct thandle *th)
{
bool record_update;
struct thandle *sub_th;
* \retval 0 if the declaration succeeds.
* \retval negative errno if the declaration fails.
*/
-int lod_sub_object_declare_xattr_del(const struct lu_env *env,
- struct dt_object *dt,
- const char *name,
- struct thandle *th)
+int lod_sub_declare_xattr_del(const struct lu_env *env, struct dt_object *dt,
+ const char *name, struct thandle *th)
{
struct thandle *sub_th;
bool record_update;
* \retval 0 if the deletion succeeds.
* \retval negative errno if the deletion fails.
*/
-int lod_sub_object_xattr_del(const struct lu_env *env,
- struct dt_object *dt,
- const char *name,
- struct thandle *th)
+int lod_sub_xattr_del(const struct lu_env *env, struct dt_object *dt,
+ const char *name, struct thandle *th)
{
struct thandle *sub_th;
bool record_update;
* \retval 0 if the insertion succeeds.
* \retval negative errno if the insertion fails.
*/
-int lod_sub_object_declare_write(const struct lu_env *env,
- struct dt_object *dt,
- const struct lu_buf *buf, loff_t pos,
- struct thandle *th)
+int lod_sub_declare_write(const struct lu_env *env, struct dt_object *dt,
+ const struct lu_buf *buf, loff_t pos,
+ struct thandle *th)
{
struct thandle *sub_th;
bool record_update;
* \retval the buffer size in bytes if it succeeds.
* \retval negative errno if it fails.
*/
-ssize_t lod_sub_object_write(const struct lu_env *env, struct dt_object *dt,
- const struct lu_buf *buf, loff_t *pos,
- struct thandle *th, int rq)
+ssize_t lod_sub_write(const struct lu_env *env, struct dt_object *dt,
+ const struct lu_buf *buf, loff_t *pos,
+ struct thandle *th, int rq)
{
struct thandle *sub_th;
bool record_update;
* \retval 0 if the insertion succeeds.
* \retval negative errno if the insertion fails.
*/
-int lod_sub_object_declare_punch(const struct lu_env *env,
- struct dt_object *dt,
- __u64 start, __u64 end,
- struct thandle *th)
+int lod_sub_declare_punch(const struct lu_env *env, struct dt_object *dt,
+ __u64 start, __u64 end, struct thandle *th)
{
struct thandle *sub_th;
bool record_update;
* \retval the buffer size in bytes if it succeeds.
* \retval negative errno if it fails.
*/
-int lod_sub_object_punch(const struct lu_env *env, struct dt_object *dt,
- __u64 start, __u64 end, struct thandle *th)
+int lod_sub_punch(const struct lu_env *env, struct dt_object *dt,
+ __u64 start, __u64 end, struct thandle *th)
{
struct thandle *sub_th;
bool record_update;
RETURN(rc);
}
-static int mdd_declare_object_create(const struct lu_env *env,
+static int mdd_declare_create_object(const struct lu_env *env,
struct mdd_device *mdd,
struct mdd_object *p, struct mdd_object *c,
struct lu_attr *attr,
const struct lu_buf *buf;
int rc;
- rc = mdd_declare_object_create_internal(env, p, c, attr, handle, spec,
+ rc = mdd_declare_create_object_internal(env, p, c, attr, handle, spec,
hint);
- if (rc)
- GOTO(out, rc);
+ if (rc)
+ GOTO(out, rc);
#ifdef CONFIG_FS_POSIX_ACL
if (def_acl_buf->lb_len > 0 && S_ISDIR(attr->la_mode)) {
{
int rc;
- rc = mdd_declare_object_create(env, mdd, p, c, attr, handle, spec,
+ rc = mdd_declare_create_object(env, mdd, p, c, attr, handle, spec,
def_acl_buf, acl_buf, hint);
if (rc)
GOTO(out, rc);
/**
* Create a metadata object and initialize it, set acl, xattr.
**/
-static int mdd_object_create(const struct lu_env *env, struct mdd_object *pobj,
+static int mdd_create_object(const struct lu_env *env, struct mdd_object *pobj,
struct mdd_object *son, struct lu_attr *attr,
struct md_op_spec *spec, struct lu_buf *acl_buf,
struct lu_buf *def_acl_buf,
struct dt_allocation_hint *hint,
struct thandle *handle)
{
- const struct lu_buf *buf;
- int rc;
+ const struct lu_buf *buf;
+ int rc;
mdd_write_lock(env, son, MOR_TGT_CHILD);
- rc = mdd_object_create_internal(env, NULL, son, attr, handle, spec,
+ rc = mdd_create_object_internal(env, NULL, son, attr, handle, spec,
hint);
if (rc)
GOTO(unlock, rc);
struct dt_object *dt = mdd_object_child(son);
const char *target_name = spec->u.sp_symname;
int sym_len = strlen(target_name);
- const struct lu_buf *buf;
loff_t pos = 0;
buf = mdd_buf_get_const(env, target_name, sym_len);
RETURN(rc);
}
-/*
+/**
* Create object and insert it into namespace.
+ *
+ * Two operations have to be performed:
+ *
+ * - an allocation of a new object (->do_create()), and
+ * - an insertion into a parent index (->dio_insert()).
+ *
+ * Due to locking, operation order is not important, when both are
+ * successful, *but* error handling cases are quite different:
+ *
+ * - if insertion is done first, and following object creation fails,
+ * insertion has to be rolled back, but this operation might fail
+ * also leaving us with dangling index entry.
+ *
+ * - if creation is done first, is has to be undone if insertion fails,
+ * leaving us with leaked space, which is not good but not fatal.
+ *
+ * It seems that creation-first is simplest solution, but it is sub-optimal
+ * in the frequent
+ *
+ * $ mkdir foo
+ * $ mkdir foo
+ *
+ * case, because second mkdir is bound to create object, only to
+ * destroy it immediately.
+ *
+ * To avoid this follow local file systems that do double lookup:
+ *
+ * 0. lookup -> -EEXIST (mdd_create_sanity_check())
+ * 1. create (mdd_create_object_internal())
+ * 2. insert (__mdd_index_insert(), lookup again)
+ *
+ * \param[in] pobj parent object
+ * \param[in] lname name of child being created
+ * \param[in,out] child child object being created
+ * \param[in] spec additional create parameters
+ * \param[in] ma attributes for new child object
+ *
+ * \retval 0 on success
+ * \retval negative errno on failure
*/
static int mdd_create(const struct lu_env *env, struct md_object *pobj,
const struct lu_name *lname, struct md_object *child,
- struct md_op_spec *spec, struct md_attr* ma)
+ struct md_op_spec *spec, struct md_attr *ma)
{
struct mdd_thread_info *info = mdd_env_info(env);
struct lu_attr *la = &info->mti_la_for_fix;
int rc2;
ENTRY;
- /*
- * Two operations have to be performed:
- *
- * - an allocation of a new object (->do_create()), and
- *
- * - an insertion into a parent index (->dio_insert()).
- *
- * Due to locking, operation order is not important, when both are
- * successful, *but* error handling cases are quite different:
- *
- * - if insertion is done first, and following object creation fails,
- * insertion has to be rolled back, but this operation might fail
- * also leaving us with dangling index entry.
- *
- * - if creation is done first, is has to be undone if insertion
- * fails, leaving us with leaked space, which is neither good, nor
- * fatal.
- *
- * It seems that creation-first is simplest solution, but it is
- * sub-optimal in the frequent
- *
- * $ mkdir foo
- * $ mkdir foo
- *
- * case, because second mkdir is bound to create object, only to
- * destroy it immediately.
- *
- * To avoid this follow local file systems that do double lookup:
- *
- * 0. lookup -> -EEXIST (mdd_create_sanity_check())
- *
- * 1. create (mdd_object_create_internal())
- *
- * 2. insert (__mdd_index_insert(), lookup again)
- */
-
rc = mdd_la_get(env, mdd_pobj, pattr);
if (rc != 0)
RETURN(rc);
if (rc)
RETURN(rc);
- if (OBD_FAIL_CHECK(OBD_FAIL_MDS_DQACQ_NET))
+ if (OBD_FAIL_CHECK(OBD_FAIL_MDS_DQACQ_NET))
GOTO(out_free, rc = -EINPROGRESS);
handle = mdd_trans_create(env, mdd);
rc = mdd_declare_create(env, mdd, mdd_pobj, son, lname, attr,
handle, spec, ldata, &def_acl_buf, &acl_buf,
hint);
- if (rc)
- GOTO(out_stop, rc);
+ if (rc)
+ GOTO(out_stop, rc);
- rc = mdd_trans_start(env, mdd, handle);
- if (rc)
- GOTO(out_stop, rc);
+ rc = mdd_trans_start(env, mdd, handle);
+ if (rc)
+ GOTO(out_stop, rc);
- rc = mdd_object_create(env, mdd_pobj, son, attr, spec, &acl_buf,
+ rc = mdd_create_object(env, mdd_pobj, son, attr, spec, &acl_buf,
&def_acl_buf, hint, handle);
if (rc != 0)
GOTO(out_stop, rc);
int rc;
int mgr_easize;
- rc = mdd_declare_object_create_internal(env, mdd_pobj, mdd_tobj, la,
+ rc = mdd_declare_create_object_internal(env, mdd_pobj, mdd_tobj, la,
handle, spec, NULL);
if (rc != 0)
return rc;
la->la_valid &= ~LA_NLINK;
/* create the target object */
- rc = mdd_object_create(env, mdd_pobj, mdd_tobj, la, spec, NULL, NULL,
+ rc = mdd_create_object(env, mdd_pobj, mdd_tobj, la, spec, NULL, NULL,
hint, handle);
if (rc != 0)
GOTO(stop_trans, rc);
int mdd_update_time(const struct lu_env *env, struct mdd_object *obj,
const struct lu_attr *oattr, struct lu_attr *attr,
struct thandle *handle);
-int mdd_object_create_internal(const struct lu_env *env, struct mdd_object *p,
+int mdd_create_object_internal(const struct lu_env *env, struct mdd_object *p,
struct mdd_object *c, struct lu_attr *attr,
struct thandle *handle,
const struct md_op_spec *spec,
const struct lu_name *sname,
struct thandle *handle);
int mdd_invalidate(const struct lu_env *env, struct md_object *obj);
-int mdd_declare_object_create_internal(const struct lu_env *env,
+int mdd_declare_create_object_internal(const struct lu_env *env,
struct mdd_object *p,
struct mdd_object *c,
struct lu_attr *attr,
}
static inline int
-mdo_declare_create_obj(const struct lu_env *env, struct mdd_object *o,
- struct lu_attr *attr,
- struct dt_allocation_hint *hint,
- struct dt_object_format *dof,
- struct thandle *handle)
+mdo_declare_create_object(const struct lu_env *env, struct mdd_object *obj,
+ struct lu_attr *attr, struct dt_allocation_hint *hint,
+ struct dt_object_format *dof, struct thandle *handle)
{
- struct dt_object *next = mdd_object_child(o);
+ struct dt_object *next = mdd_object_child(obj);
return dt_declare_create(env, next, attr, hint, dof, handle);
}
static inline int
-mdo_create_obj(const struct lu_env *env, struct mdd_object *o,
- struct lu_attr *attr,
- struct dt_allocation_hint *hint,
- struct dt_object_format *dof,
- struct thandle *handle)
+mdo_create_object(const struct lu_env *env, struct mdd_object *obj,
+ struct lu_attr *attr, struct dt_allocation_hint *hint,
+ struct dt_object_format *dof, struct thandle *handle)
{
- struct dt_object *next = mdd_object_child(o);
+ struct dt_object *next = mdd_object_child(obj);
return dt_create(env, next, attr, hint, dof, handle);
}
return mdo_invalidate(env, md2mdd_obj(obj));
}
-int mdd_declare_object_create_internal(const struct lu_env *env,
+int mdd_declare_create_object_internal(const struct lu_env *env,
struct mdd_object *p,
struct mdd_object *c,
struct lu_attr *attr,
const struct md_op_spec *spec,
struct dt_allocation_hint *hint)
{
- struct dt_object_format *dof = &mdd_env_info(env)->mti_dof;
- const struct dt_index_features *feat = spec->sp_feat;
- int rc;
- ENTRY;
+ struct dt_object_format *dof = &mdd_env_info(env)->mti_dof;
+ const struct dt_index_features *feat = spec->sp_feat;
+ int rc;
+ ENTRY;
if (feat != &dt_directory_features && feat != NULL) {
- dof->dof_type = DFT_INDEX;
+ dof->dof_type = DFT_INDEX;
dof->u.dof_idx.di_feat = feat;
-
} else {
dof->dof_type = dt_mode_to_dft(attr->la_mode);
if (dof->dof_type == DFT_REGULAR) {
}
}
- rc = mdo_declare_create_obj(env, c, attr, hint, dof, handle);
+ rc = mdo_declare_create_object(env, c, attr, hint, dof, handle);
- RETURN(rc);
+ RETURN(rc);
}
-int mdd_object_create_internal(const struct lu_env *env, struct mdd_object *p,
+int mdd_create_object_internal(const struct lu_env *env, struct mdd_object *p,
struct mdd_object *c, struct lu_attr *attr,
struct thandle *handle,
const struct md_op_spec *spec,
struct dt_allocation_hint *hint)
{
- struct dt_object_format *dof = &mdd_env_info(env)->mti_dof;
- int rc;
- ENTRY;
+ struct dt_object_format *dof = &mdd_env_info(env)->mti_dof;
+ int rc;
+ ENTRY;
LASSERT(!mdd_object_exists(c));
- rc = mdo_create_obj(env, c, attr, hint, dof, handle);
+ rc = mdo_create_object(env, c, attr, hint, dof, handle);
RETURN(rc);
}
const struct lu_attr *attr, struct thandle *handle,
int needacl)
{
- int rc;
- ENTRY;
+ int rc;
+ ENTRY;
rc = mdo_attr_set(env, obj, attr, handle);
#ifdef CONFIG_FS_POSIX_ACL
- if (!rc && (attr->la_valid & LA_MODE) && needacl)
- rc = mdd_acl_chmod(env, obj, attr->la_mode, handle);
+ if (!rc && (attr->la_valid & LA_MODE) && needacl)
+ rc = mdd_acl_chmod(env, obj, attr->la_mode, handle);
#endif
- RETURN(rc);
+ RETURN(rc);
}
int mdd_update_time(const struct lu_env *env, struct mdd_object *obj,
}
-static int orphan_object_destroy(const struct lu_env *env,
- struct mdd_object *obj,
- struct dt_key *key)
+static int orphan_destroy(const struct lu_env *env, struct mdd_object *obj,
+ struct dt_key *key)
{
struct thandle *th = NULL;
struct mdd_device *mdd = mdo2mdd(&obj->mod_obj);
* \retval -ve error
*/
static int orph_key_test_and_del(const struct lu_env *env,
- struct mdd_device *mdd,
- struct lu_fid *lf,
- struct dt_key *key)
+ struct mdd_device *mdd, struct lu_fid *lf,
+ struct dt_key *key)
{
- struct mdd_object *mdo;
- int rc;
+ struct mdd_object *mdo;
+ int rc;
- mdo = mdd_object_find(env, mdd, lf);
+ mdo = mdd_object_find(env, mdd, lf);
- if (IS_ERR(mdo))
- return PTR_ERR(mdo);
+ if (IS_ERR(mdo))
+ return PTR_ERR(mdo);
- rc = -EBUSY;
- if (mdo->mod_count == 0) {
- CDEBUG(D_HA, "Found orphan "DFID", delete it\n", PFID(lf));
- rc = orphan_object_destroy(env, mdo, key);
- if (rc) /* so replay-single.sh test_37 works */
- CERROR("%s: error unlinking orphan "DFID" from "
- "PENDING: rc = %d\n",
+ rc = -EBUSY;
+ if (mdo->mod_count == 0) {
+ CDEBUG(D_HA, "Found orphan "DFID", delete it\n", PFID(lf));
+ rc = orphan_destroy(env, mdo, key);
+ if (rc) /* so replay-single.sh test_37 works */
+ CERROR("%s: error unlinking orphan "DFID" from "
+ "PENDING: rc = %d\n",
mdd2obd_dev(mdd)->obd_name, PFID(lf), rc);
} else {
mdd_write_lock(env, mdo, MOR_TGT_CHILD);
/* version of child will be changed */
tgt_vbr_obj_set(info->mti_env, mdt_obj2dt(child));
- /* Not found and with MDS_OPEN_CREAT: let's create it. */
- mdt_set_disposition(info, ldlm_rep, DISP_OPEN_CREATE);
+ /* Not found and with MDS_OPEN_CREAT: let's create it. */
+ mdt_set_disposition(info, ldlm_rep, DISP_OPEN_CREATE);
- /* Let lower layers know what is lock mode on directory. */
- info->mti_spec.sp_cr_mode =
- mdt_dlm_mode2mdl_mode(lh->mlh_pdo_mode);
+ /* Let lower layers know what is lock mode on directory. */
+ info->mti_spec.sp_cr_mode =
+ mdt_dlm_mode2mdl_mode(lh->mlh_pdo_mode);
- /*
- * Do not perform lookup sanity check. We know that name does
- * not exist.
- */
- info->mti_spec.sp_cr_lookup = 0;
- info->mti_spec.sp_feat = &dt_directory_features;
-
- result = mdo_create(info->mti_env,
- mdt_object_child(parent),
- &rr->rr_name,
- mdt_object_child(child),
- &info->mti_spec,
- &info->mti_attr);
- if (result == -ERESTART) {
- mdt_clear_disposition(info, ldlm_rep, DISP_OPEN_CREATE);
- GOTO(out_child, result);
- } else {
+ /* Don't do lookup sanity check. We know name doesn't exist. */
+ info->mti_spec.sp_cr_lookup = 0;
+ info->mti_spec.sp_feat = &dt_directory_features;
+
+ result = mdo_create(info->mti_env, mdt_object_child(parent),
+ &rr->rr_name, mdt_object_child(child),
+ &info->mti_spec, &info->mti_attr);
+ if (result == -ERESTART) {
+ mdt_clear_disposition(info, ldlm_rep, DISP_OPEN_CREATE);
+ GOTO(out_child, result);
+ } else {
mdt_prep_ma_buf_from_rep(info, child, ma);
/* XXX: we should call this once, see few lines below */
if (result == 0)
* 2 - child. Version of child by FID. Must be ENOENT. It is mostly sanity
* check.
*/
-static int mdt_md_create(struct mdt_thread_info *info)
+static int mdt_create(struct mdt_thread_info *info)
{
struct mdt_device *mdt = info->mti_mdt;
struct mdt_object *parent;
RETURN(err_serious(-EOPNOTSUPP));
}
- rc = mdt_md_create(info);
+ rc = mdt_create(info);
RETURN(rc);
}
* Drop FMD list reference so it will disappear when last reference is dropped
* to zero.
*
- * This function is called from ofd_object_destroy() and may only affect
+ * This function is called from ofd_destroy() and may only affect
* the one client that is doing the unlink and at worst we have an stale entry
* referencing an object that should never be used again.
*
int ofd_object_punch(const struct lu_env *env, struct ofd_object *fo,
__u64 start, __u64 end, struct lu_attr *la,
struct filter_fid *ff, struct obdo *oa);
-int ofd_object_destroy(const struct lu_env *, struct ofd_object *, int);
+int ofd_destroy(const struct lu_env *, struct ofd_object *, int);
int ofd_attr_get(const struct lu_env *env, struct ofd_object *fo,
struct lu_attr *la);
int ofd_attr_handle_id(const struct lu_env *env, struct ofd_object *fo,
*
* Supplemental function to destroy object by FID, it is used by request
* handler and by ofd_echo_destroy() below to find object by FID, lock it
- * and call ofd_object_destroy() finally.
+ * and call ofd_destroy() finally.
*
* \param[in] env execution environment
* \param[in] ofd OFD device
LASSERT(fo != NULL);
- rc = ofd_object_destroy(env, fo, orphan);
+ rc = ofd_destroy(env, fo, orphan);
EXIT;
ofd_object_put(env, fo);
* \retval 0 if successful
* \retval negative value on error
*/
-int ofd_object_destroy(const struct lu_env *env, struct ofd_object *fo,
+int ofd_destroy(const struct lu_env *env, struct ofd_object *fo,
int orphan)
{
struct ofd_device *ofd = ofd_obj2dev(fo);
static const char dot[] = ".";
static const char dotdot[] = "..";
-static const char remote_obj_dir[] = "REM_OBJ_DIR";
static const struct lu_object_operations osd_lu_obj_ops;
static const struct dt_object_operations osd_obj_ops;
-static const struct dt_object_operations osd_obj_ea_ops;
static const struct dt_object_operations osd_obj_otable_it_ops;
static const struct dt_index_operations osd_index_iam_ops;
static const struct dt_index_operations osd_index_ea_ops;
/*
* Concurrency: doesn't matter
*/
-
-/*
- * Concurrency: doesn't matter
- */
-static int osd_write_locked(const struct lu_env *env, struct osd_object *o)
+static int osd_is_write_locked(const struct lu_env *env, struct osd_object *o)
{
struct osd_thread_info *oti = osd_oti_get(env);
return oti->oti_w_locks > 0 && o->oo_owner == env;
l = &mo->oo_dt.do_lu;
dt_object_init(&mo->oo_dt, NULL, d);
- mo->oo_dt.do_ops = &osd_obj_ea_ops;
+ mo->oo_dt.do_ops = &osd_obj_ops;
l->lo_ops = &osd_lu_obj_ops;
init_rwsem(&mo->oo_sem);
init_rwsem(&mo->oo_ext_idx_sem);
{
int rc;
- CDEBUG(D_CACHE, "syncing OSD %s\n", LUSTRE_OSD_LDISKFS_NAME);
+ CDEBUG(D_CACHE, "%s: syncing OSD\n", osd_dt_dev(d)->od_svname);
rc = ldiskfs_force_commit(osd_sb(osd_dt_dev(d)));
- CDEBUG(D_CACHE, "synced OSD %s: rc = %d\n",
- LUSTRE_OSD_LDISKFS_NAME, rc);
+ CDEBUG(D_CACHE, "%s: synced OSD: rc = %d\n", osd_dt_dev(d)->od_svname,
+ rc);
return rc;
}
struct super_block *s = osd_sb(osd_dt_dev(d));
ENTRY;
- CDEBUG(D_HA, "async commit OSD %s\n", LUSTRE_OSD_LDISKFS_NAME);
+ CDEBUG(D_HA, "%s: async commit OSD\n", osd_dt_dev(d)->od_svname);
RETURN(s->s_op->sync_fs(s, 0));
}
.dt_commit_async = osd_commit_async,
};
-static void osd_object_read_lock(const struct lu_env *env,
- struct dt_object *dt, unsigned role)
+static void osd_read_lock(const struct lu_env *env, struct dt_object *dt,
+ unsigned role)
{
- struct osd_object *obj = osd_dt_obj(dt);
- struct osd_thread_info *oti = osd_oti_get(env);
+ struct osd_object *obj = osd_dt_obj(dt);
+ struct osd_thread_info *oti = osd_oti_get(env);
- LINVRNT(osd_invariant(obj));
+ LINVRNT(osd_invariant(obj));
- LASSERT(obj->oo_owner != env);
+ LASSERT(obj->oo_owner != env);
down_read_nested(&obj->oo_sem, role);
- LASSERT(obj->oo_owner == NULL);
- oti->oti_r_locks++;
+ LASSERT(obj->oo_owner == NULL);
+ oti->oti_r_locks++;
}
-static void osd_object_write_lock(const struct lu_env *env,
- struct dt_object *dt, unsigned role)
+static void osd_write_lock(const struct lu_env *env, struct dt_object *dt,
+ unsigned role)
{
- struct osd_object *obj = osd_dt_obj(dt);
- struct osd_thread_info *oti = osd_oti_get(env);
+ struct osd_object *obj = osd_dt_obj(dt);
+ struct osd_thread_info *oti = osd_oti_get(env);
- LINVRNT(osd_invariant(obj));
+ LINVRNT(osd_invariant(obj));
- LASSERT(obj->oo_owner != env);
+ LASSERT(obj->oo_owner != env);
down_write_nested(&obj->oo_sem, role);
- LASSERT(obj->oo_owner == NULL);
- obj->oo_owner = env;
- oti->oti_w_locks++;
+ LASSERT(obj->oo_owner == NULL);
+ obj->oo_owner = env;
+ oti->oti_w_locks++;
}
-static void osd_object_read_unlock(const struct lu_env *env,
- struct dt_object *dt)
+static void osd_read_unlock(const struct lu_env *env, struct dt_object *dt)
{
- struct osd_object *obj = osd_dt_obj(dt);
- struct osd_thread_info *oti = osd_oti_get(env);
+ struct osd_object *obj = osd_dt_obj(dt);
+ struct osd_thread_info *oti = osd_oti_get(env);
- LINVRNT(osd_invariant(obj));
+ LINVRNT(osd_invariant(obj));
- LASSERT(oti->oti_r_locks > 0);
- oti->oti_r_locks--;
+ LASSERT(oti->oti_r_locks > 0);
+ oti->oti_r_locks--;
up_read(&obj->oo_sem);
}
-static void osd_object_write_unlock(const struct lu_env *env,
- struct dt_object *dt)
+static void osd_write_unlock(const struct lu_env *env, struct dt_object *dt)
{
- struct osd_object *obj = osd_dt_obj(dt);
- struct osd_thread_info *oti = osd_oti_get(env);
+ struct osd_object *obj = osd_dt_obj(dt);
+ struct osd_thread_info *oti = osd_oti_get(env);
- LINVRNT(osd_invariant(obj));
+ LINVRNT(osd_invariant(obj));
- LASSERT(obj->oo_owner == env);
- LASSERT(oti->oti_w_locks > 0);
- oti->oti_w_locks--;
- obj->oo_owner = NULL;
+ LASSERT(obj->oo_owner == env);
+ LASSERT(oti->oti_w_locks > 0);
+ oti->oti_w_locks--;
+ obj->oo_owner = NULL;
up_write(&obj->oo_sem);
}
-static int osd_object_write_locked(const struct lu_env *env,
- struct dt_object *dt)
+static int osd_write_locked(const struct lu_env *env, struct dt_object *dt)
{
- struct osd_object *obj = osd_dt_obj(dt);
+ struct osd_object *obj = osd_dt_obj(dt);
- LINVRNT(osd_invariant(obj));
+ LINVRNT(osd_invariant(obj));
- return obj->oo_owner == env;
+ return obj->oo_owner == env;
}
static struct timespec *osd_inode_time(const struct lu_env *env,
}
/**
- * Helper function for osd_object_create()
+ * Helper function for osd_create()
*
* \retval 0, on success
*/
-static int __osd_object_create(struct osd_thread_info *info,
- struct osd_object *obj, struct lu_attr *attr,
- struct dt_allocation_hint *hint,
- struct dt_object_format *dof,
- struct thandle *th)
+static int __osd_create(struct osd_thread_info *info, struct osd_object *obj,
+ struct lu_attr *attr, struct dt_allocation_hint *hint,
+ struct dt_object_format *dof, struct thandle *th)
{
int result;
__u32 umask;
}
/**
- * Helper function for osd_object_create()
+ * Helper function for osd_create()
*
* \retval 0, on success
*/
return fld_local_lookup(env, ss->ss_server_fld, seq, range);
}
-/*
- * Concurrency: no external locking is necessary.
- */
-static int osd_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 *handle)
+static int osd_declare_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 *handle)
{
- struct osd_thandle *oh;
- int rc;
+ struct osd_thandle *oh;
+ int rc;
ENTRY;
LASSERT(handle != NULL);
RETURN(rc);
}
-static int osd_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)
-{
- const struct lu_fid *fid = lu_object_fid(&dt->do_lu);
- struct osd_object *obj = osd_dt_obj(dt);
- struct osd_thread_info *info = osd_oti_get(env);
- int result;
- ENTRY;
-
- if (dt_object_exists(dt))
- return -EEXIST;
-
- LINVRNT(osd_invariant(obj));
- LASSERT(!dt_object_remote(dt));
- LASSERT(osd_write_locked(env, obj));
- LASSERT(th != NULL);
-
- if (unlikely(fid_is_acct(fid)))
- /* Quota files can't be created from the kernel any more,
- * 'tune2fs -O quota' will take care of creating them */
- RETURN(-EPERM);
-
- result = __osd_object_create(info, obj, attr, hint, dof, th);
- if (result == 0) {
- result = __osd_oi_insert(env, obj, fid, th);
- if (obj->oo_dt.do_body_ops == &osd_body_ops_new)
- obj->oo_dt.do_body_ops = &osd_body_ops;
- }
- LASSERT(ergo(result == 0,
- dt_object_exists(dt) && !dt_object_remote(dt)));
-
- LASSERT(osd_invariant(obj));
- RETURN(result);
-}
-
/**
* Called to destroy on-disk representation of the object
*
* Concurrency: must be locked
*/
-static int osd_declare_object_destroy(const struct lu_env *env,
- struct dt_object *dt,
- struct thandle *th)
+static int osd_declare_destroy(const struct lu_env *env, struct dt_object *dt,
+ struct thandle *th)
{
struct osd_object *obj = osd_dt_obj(dt);
struct inode *inode = obj->oo_inode;
RETURN(rc);
}
-static int osd_object_destroy(const struct lu_env *env,
- struct dt_object *dt,
- struct thandle *th)
+static int osd_destroy(const struct lu_env *env, struct dt_object *dt,
+ struct thandle *th)
{
- const struct lu_fid *fid = lu_object_fid(&dt->do_lu);
- struct osd_object *obj = osd_dt_obj(dt);
- struct inode *inode = obj->oo_inode;
- struct osd_device *osd = osd_obj2dev(obj);
- struct osd_thandle *oh;
- int result;
- ENTRY;
+ const struct lu_fid *fid = lu_object_fid(&dt->do_lu);
+ struct osd_object *obj = osd_dt_obj(dt);
+ struct inode *inode = obj->oo_inode;
+ struct osd_device *osd = osd_obj2dev(obj);
+ struct osd_thandle *oh;
+ int result;
+ ENTRY;
- oh = container_of0(th, struct osd_thandle, ot_super);
- LASSERT(oh->ot_handle);
- LASSERT(inode);
- LASSERT(!lu_object_is_dying(dt->do_lu.lo_header));
+ oh = container_of0(th, struct osd_thandle, ot_super);
+ LASSERT(oh->ot_handle);
+ LASSERT(inode);
+ LASSERT(!lu_object_is_dying(dt->do_lu.lo_header));
if (unlikely(fid_is_acct(fid)))
RETURN(-EPERM);
}
/**
- * OSD layer object create function for interoperability mode (b11826).
- * This is mostly similar to osd_object_create(). Only difference being, fid is
- * inserted into inode ea here.
+ * OSD layer object create function for OST objects (b=11826).
+ *
+ * The FID is inserted into inode xattr here.
*
* \retval 0, on success
* \retval -ve, on error
*/
-static int osd_object_ea_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)
+static int osd_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)
{
const struct lu_fid *fid = lu_object_fid(&dt->do_lu);
struct osd_object *obj = osd_dt_obj(dt);
if (dt_object_exists(dt))
RETURN(-EEXIST);
- LASSERT(osd_invariant(obj));
+ LINVRNT(osd_invariant(obj));
LASSERT(!dt_object_remote(dt));
- LASSERT(osd_write_locked(env, obj));
+ LASSERT(osd_is_write_locked(env, obj));
LASSERT(th != NULL);
if (unlikely(fid_is_acct(fid)))
* 'tune2fs -O quota' will take care of creating them */
RETURN(-EPERM);
- result = __osd_object_create(info, obj, attr, hint, dof, th);
+ result = __osd_create(info, obj, attr, hint, dof, th);
if (result == 0) {
if (fid_is_idif(fid) &&
!osd_dev(dt->do_lu.lo_dev)->od_index_in_idif) {
LASSERT(ergo(result == 0,
dt_object_exists(dt) && !dt_object_remote(dt)));
- LINVRNT(osd_invariant(obj));
- RETURN(result);
+ LINVRNT(osd_invariant(obj));
+ RETURN(result);
}
-static int osd_declare_object_ref_add(const struct lu_env *env,
- struct dt_object *dt,
- struct thandle *handle)
+static int osd_declare_ref_add(const struct lu_env *env, struct dt_object *dt,
+ struct thandle *handle)
{
- struct osd_thandle *oh;
+ struct osd_thandle *oh;
- /* it's possible that object doesn't exist yet */
- LASSERT(handle != NULL);
+ /* it's possible that object doesn't exist yet */
+ LASSERT(handle != NULL);
- oh = container_of0(handle, struct osd_thandle, ot_super);
- LASSERT(oh->ot_handle == NULL);
+ oh = container_of0(handle, struct osd_thandle, ot_super);
+ LASSERT(oh->ot_handle == NULL);
osd_trans_declare_op(env, oh, OSD_OT_REF_ADD,
osd_dto_credits_noquota[DTO_ATTR_SET_BASE]);
/*
* Concurrency: @dt is write locked.
*/
-static int osd_object_ref_add(const struct lu_env *env,
- struct dt_object *dt, struct thandle *th)
+static int osd_ref_add(const struct lu_env *env, struct dt_object *dt,
+ struct thandle *th)
{
struct osd_object *obj = osd_dt_obj(dt);
struct inode *inode = obj->oo_inode;
LINVRNT(osd_invariant(obj));
LASSERT(!dt_object_remote(dt));
- LASSERT(osd_write_locked(env, obj));
+ LASSERT(osd_is_write_locked(env, obj));
LASSERT(th != NULL);
oh = container_of0(th, struct osd_thandle, ot_super);
return rc;
}
-static int osd_declare_object_ref_del(const struct lu_env *env,
- struct dt_object *dt,
- struct thandle *handle)
+static int osd_declare_ref_del(const struct lu_env *env, struct dt_object *dt,
+ struct thandle *handle)
{
struct osd_thandle *oh;
/*
* Concurrency: @dt is write locked.
*/
-static int osd_object_ref_del(const struct lu_env *env, struct dt_object *dt,
- struct thandle *th)
+static int osd_ref_del(const struct lu_env *env, struct dt_object *dt,
+ struct thandle *th)
{
struct osd_object *obj = osd_dt_obj(dt);
struct inode *inode = obj->oo_inode;
LINVRNT(osd_invariant(obj));
LASSERT(!dt_object_remote(dt));
- LASSERT(osd_write_locked(env, obj));
+ LASSERT(osd_is_write_locked(env, obj));
LASSERT(th != NULL);
oh = container_of0(th, struct osd_thandle, ot_super);
}
static const struct dt_object_operations osd_obj_ops = {
- .do_read_lock = osd_object_read_lock,
- .do_write_lock = osd_object_write_lock,
- .do_read_unlock = osd_object_read_unlock,
- .do_write_unlock = osd_object_write_unlock,
- .do_write_locked = osd_object_write_locked,
- .do_attr_get = osd_attr_get,
- .do_declare_attr_set = osd_declare_attr_set,
- .do_attr_set = osd_attr_set,
- .do_ah_init = osd_ah_init,
- .do_declare_create = osd_declare_object_create,
- .do_create = osd_object_create,
- .do_declare_destroy = osd_declare_object_destroy,
- .do_destroy = osd_object_destroy,
- .do_index_try = osd_index_try,
- .do_declare_ref_add = osd_declare_object_ref_add,
- .do_ref_add = osd_object_ref_add,
- .do_declare_ref_del = osd_declare_object_ref_del,
- .do_ref_del = osd_object_ref_del,
- .do_xattr_get = osd_xattr_get,
- .do_declare_xattr_set = osd_declare_xattr_set,
- .do_xattr_set = osd_xattr_set,
- .do_declare_xattr_del = osd_declare_xattr_del,
- .do_xattr_del = osd_xattr_del,
- .do_xattr_list = osd_xattr_list,
- .do_object_sync = osd_object_sync,
- .do_invalidate = osd_invalidate,
-};
-
-/**
- * dt_object_operations for interoperability mode
- * (i.e. to run 2.0 mds on 1.8 disk) (b11826)
- */
-static const struct dt_object_operations osd_obj_ea_ops = {
- .do_read_lock = osd_object_read_lock,
- .do_write_lock = osd_object_write_lock,
- .do_read_unlock = osd_object_read_unlock,
- .do_write_unlock = osd_object_write_unlock,
- .do_write_locked = osd_object_write_locked,
- .do_attr_get = osd_attr_get,
- .do_declare_attr_set = osd_declare_attr_set,
- .do_attr_set = osd_attr_set,
- .do_ah_init = osd_ah_init,
- .do_declare_create = osd_declare_object_create,
- .do_create = osd_object_ea_create,
- .do_declare_destroy = osd_declare_object_destroy,
- .do_destroy = osd_object_destroy,
- .do_index_try = osd_index_try,
- .do_declare_ref_add = osd_declare_object_ref_add,
- .do_ref_add = osd_object_ref_add,
- .do_declare_ref_del = osd_declare_object_ref_del,
- .do_ref_del = osd_object_ref_del,
- .do_xattr_get = osd_xattr_get,
- .do_declare_xattr_set = osd_declare_xattr_set,
- .do_xattr_set = osd_xattr_set,
- .do_declare_xattr_del = osd_declare_xattr_del,
- .do_xattr_del = osd_xattr_del,
- .do_xattr_list = osd_xattr_list,
- .do_object_sync = osd_object_sync,
- .do_invalidate = osd_invalidate,
+ .do_read_lock = osd_read_lock,
+ .do_write_lock = osd_write_lock,
+ .do_read_unlock = osd_read_unlock,
+ .do_write_unlock = osd_write_unlock,
+ .do_write_locked = osd_write_locked,
+ .do_attr_get = osd_attr_get,
+ .do_declare_attr_set = osd_declare_attr_set,
+ .do_attr_set = osd_attr_set,
+ .do_ah_init = osd_ah_init,
+ .do_declare_create = osd_declare_create,
+ .do_create = osd_create,
+ .do_declare_destroy = osd_declare_destroy,
+ .do_destroy = osd_destroy,
+ .do_index_try = osd_index_try,
+ .do_declare_ref_add = osd_declare_ref_add,
+ .do_ref_add = osd_ref_add,
+ .do_declare_ref_del = osd_declare_ref_del,
+ .do_ref_del = osd_ref_del,
+ .do_xattr_get = osd_xattr_get,
+ .do_declare_xattr_set = osd_declare_xattr_set,
+ .do_xattr_set = osd_xattr_set,
+ .do_declare_xattr_del = osd_declare_xattr_del,
+ .do_xattr_del = osd_xattr_del,
+ .do_xattr_list = osd_xattr_list,
+ .do_object_sync = osd_object_sync,
+ .do_invalidate = osd_invalidate,
};
static const struct dt_object_operations osd_obj_otable_it_ops = {
extern const int osd_dto_credits_noquota[];
struct osd_object {
- struct dt_object oo_dt;
- /**
- * Inode for file system object represented by this osd_object. This
- * inode is pinned for the whole duration of lu_object life.
- *
- * Not modified concurrently (either setup early during object
- * creation, or assigned by osd_object_create() under write lock).
- */
- struct inode *oo_inode;
- /**
- * to protect index ops.
- */
- struct htree_lock_head *oo_hl_head;
+ struct dt_object oo_dt;
+ /**
+ * Inode for file system object represented by this osd_object. This
+ * inode is pinned for the whole duration of lu_object life.
+ *
+ * Not modified concurrently (either setup early during object
+ * creation, or assigned by osd_create() under write lock).
+ */
+ struct inode *oo_inode;
+ /**
+ * to protect index ops.
+ */
+ struct htree_lock_head *oo_hl_head;
struct rw_semaphore oo_ext_idx_sem;
struct rw_semaphore oo_sem;
struct osd_directory *oo_dir;
* inode is pinned for the whole duration of lu_object life.
*
* Not modified concurrently (either setup early during object
- * creation, or assigned by osd_object_create() under write lock).
+ * creation, or assigned by osd_create() under write lock).
*/
dnode_t *oo_dn;
sa_handle_t *oo_sa_hdl;
LASSERT(obj->oo_destroy == OSD_DESTROY_ASYNC);
/* the object is supposed to be exclusively locked by
- * the caller (osd_object_destroy()), while the transaction
+ * the caller (osd_destroy()), while the transaction
* (oh) is per-thread and not shared */
if (likely(list_empty(&obj->oo_unlinked_linkage))) {
list_add(&obj->oo_unlinked_linkage, &oh->ot_unlinked_list);
up_write(&obj->oo_guard);
}
-static int osd_declare_object_destroy(const struct lu_env *env,
- struct dt_object *dt,
- struct thandle *th)
+static int osd_declare_destroy(const struct lu_env *env, struct dt_object *dt,
+ struct thandle *th)
{
const struct lu_fid *fid = lu_object_fid(&dt->do_lu);
struct osd_object *obj = osd_dt_obj(dt);
RETURN(0);
}
-static int osd_object_destroy(const struct lu_env *env,
- struct dt_object *dt, struct thandle *th)
+static int osd_destroy(const struct lu_env *env, struct dt_object *dt,
+ struct thandle *th)
{
struct osd_thread_info *info = osd_oti_get(env);
char *buf = info->oti_str;
return (*p)(env, cookie, LUSTRE_OSD_ZFS_NAME"-object@%p", o);
}
-static void osd_object_read_lock(const struct lu_env *env,
- struct dt_object *dt, unsigned role)
+static void osd_read_lock(const struct lu_env *env, struct dt_object *dt,
+ unsigned role)
{
struct osd_object *obj = osd_dt_obj(dt);
down_read_nested(&obj->oo_sem, role);
}
-static void osd_object_write_lock(const struct lu_env *env,
- struct dt_object *dt, unsigned role)
+static void osd_write_lock(const struct lu_env *env, struct dt_object *dt,
+ unsigned role)
{
struct osd_object *obj = osd_dt_obj(dt);
down_write_nested(&obj->oo_sem, role);
}
-static void osd_object_read_unlock(const struct lu_env *env,
- struct dt_object *dt)
+static void osd_read_unlock(const struct lu_env *env, struct dt_object *dt)
{
struct osd_object *obj = osd_dt_obj(dt);
up_read(&obj->oo_sem);
}
-static void osd_object_write_unlock(const struct lu_env *env,
- struct dt_object *dt)
+static void osd_write_unlock(const struct lu_env *env, struct dt_object *dt)
{
- struct osd_object *obj = osd_dt_obj(dt);
+ struct osd_object *obj = osd_dt_obj(dt);
- LASSERT(osd_invariant(obj));
+ LASSERT(osd_invariant(obj));
up_write(&obj->oo_sem);
}
-static int osd_object_write_locked(const struct lu_env *env,
- struct dt_object *dt)
+static int osd_write_locked(const struct lu_env *env, struct dt_object *dt)
{
struct osd_object *obj = osd_dt_obj(dt);
int rc = 1;
}
}
-static int osd_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 *handle)
+static int osd_declare_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 *handle)
{
const struct lu_fid *fid = lu_object_fid(&dt->do_lu);
struct osd_object *obj = osd_dt_obj(dt);
/*
* Concurrency: @dt is write locked.
*/
-static int osd_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)
+static int osd_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 osd_thread_info *info = osd_oti_get(env);
struct lustre_mdt_attrs *lma = &info->oti_mdt_attrs;
RETURN(rc);
}
-static int osd_declare_object_ref_add(const struct lu_env *env,
- struct dt_object *dt,
- struct thandle *th)
+static int osd_declare_ref_add(const struct lu_env *env, struct dt_object *dt,
+ struct thandle *th)
{
return osd_declare_attr_set(env, dt, NULL, th);
}
/*
* Concurrency: @dt is write locked.
*/
-static int osd_object_ref_add(const struct lu_env *env,
- struct dt_object *dt,
- struct thandle *handle)
+static int osd_ref_add(const struct lu_env *env, struct dt_object *dt,
+ struct thandle *handle)
{
struct osd_object *obj = osd_dt_obj(dt);
struct osd_thandle *oh;
RETURN(rc);
}
-static int osd_declare_object_ref_del(const struct lu_env *env,
- struct dt_object *dt,
- struct thandle *handle)
+static int osd_declare_ref_del(const struct lu_env *env, struct dt_object *dt,
+ struct thandle *handle)
{
return osd_declare_attr_set(env, dt, NULL, handle);
}
/*
* Concurrency: @dt is write locked.
*/
-static int osd_object_ref_del(const struct lu_env *env,
- struct dt_object *dt,
- struct thandle *handle)
+static int osd_ref_del(const struct lu_env *env, struct dt_object *dt,
+ struct thandle *handle)
{
struct osd_object *obj = osd_dt_obj(dt);
struct osd_thandle *oh;
}
static struct dt_object_operations osd_obj_ops = {
- .do_read_lock = osd_object_read_lock,
- .do_write_lock = osd_object_write_lock,
- .do_read_unlock = osd_object_read_unlock,
- .do_write_unlock = osd_object_write_unlock,
- .do_write_locked = osd_object_write_locked,
+ .do_read_lock = osd_read_lock,
+ .do_write_lock = osd_write_lock,
+ .do_read_unlock = osd_read_unlock,
+ .do_write_unlock = osd_write_unlock,
+ .do_write_locked = osd_write_locked,
.do_attr_get = osd_attr_get,
.do_declare_attr_set = osd_declare_attr_set,
.do_attr_set = osd_attr_set,
.do_ah_init = osd_ah_init,
- .do_declare_create = osd_declare_object_create,
- .do_create = osd_object_create,
- .do_declare_destroy = osd_declare_object_destroy,
- .do_destroy = osd_object_destroy,
+ .do_declare_create = osd_declare_create,
+ .do_create = osd_create,
+ .do_declare_destroy = osd_declare_destroy,
+ .do_destroy = osd_destroy,
.do_index_try = osd_index_try,
- .do_declare_ref_add = osd_declare_object_ref_add,
- .do_ref_add = osd_object_ref_add,
- .do_declare_ref_del = osd_declare_object_ref_del,
- .do_ref_del = osd_object_ref_del,
+ .do_declare_ref_add = osd_declare_ref_add,
+ .do_ref_add = osd_ref_add,
+ .do_declare_ref_del = osd_declare_ref_del,
+ .do_ref_del = osd_ref_del,
.do_xattr_get = osd_xattr_get,
.do_declare_xattr_set = osd_declare_xattr_set,
.do_xattr_set = osd_xattr_set,
}
static struct dt_object_operations osd_obj_otable_it_ops = {
- .do_attr_get = osd_otable_it_attr_get,
- .do_index_try = osd_index_try,
+ .do_attr_get = osd_otable_it_attr_get,
+ .do_index_try = osd_index_try,
};
void *key_rec);
int osp_it_next_page(const struct lu_env *env, struct dt_it *di);
/* osp_md_object.c */
-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);
-int osp_md_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);
+int osp_md_declare_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);
+int osp_md_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);
int osp_md_declare_attr_set(const struct lu_env *env, struct dt_object *dt,
const struct lu_attr *attr, struct thandle *th);
int osp_md_attr_set(const struct lu_env *env, struct dt_object *dt,
*
* \retval only return 0 for now
*/
-static int osp_object_create_interpreter(const struct lu_env *env,
- struct object_update_reply *reply,
- struct ptlrpc_request *req,
- struct osp_object *obj,
- void *data, int index, int rc)
+static int osp_create_interpreter(const struct lu_env *env,
+ struct object_update_reply *reply,
+ struct ptlrpc_request *req,
+ struct osp_object *obj,
+ void *data, int index, int rc)
{
if (rc != 0 && rc != -EEXIST) {
obj->opo_obj.do_lu.lo_header->loh_attr &= ~LOHA_EXISTS;
* \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)
+int osp_md_declare_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)
{
return osp_trans_update_request_create(th);
}
* \retval 0 if packing creation succeeds.
* \retval negative errno if packing creation fails.
*/
-int osp_md_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)
+int osp_md_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_update_request *update;
struct osp_object *obj = dt2osp_obj(dt);
GOTO(out, rc);
rc = osp_insert_update_callback(env, update, dt2osp_obj(dt), NULL,
- osp_object_create_interpreter);
+ osp_create_interpreter);
if (rc < 0)
GOTO(out, rc);
/**
* Implementation of dt_object_operations::do_read_lock
*
- * osp_md_object_{read,write}_lock() will only lock the remote object in the
+ * osp_md_{read,write}_lock() will only lock the remote object in the
* local cache, which uses the semaphore (opo_sem) inside the osp_object to
* lock the object. Note: it will not lock the object in the whole cluster,
* which relies on the LDLM lock.
* \param[in] dt object to be locked
* \param[in] role lock role from MDD layer, see mdd_object_role().
*/
-static void osp_md_object_read_lock(const struct lu_env *env,
- struct dt_object *dt, unsigned role)
+static void osp_md_read_lock(const struct lu_env *env, struct dt_object *dt,
+ unsigned role)
{
struct osp_object *obj = dt2osp_obj(dt);
* \param[in] dt object to be locked
* \param[in] role lock role from MDD layer, see mdd_object_role().
*/
-static void osp_md_object_write_lock(const struct lu_env *env,
- struct dt_object *dt, unsigned role)
+static void osp_md_write_lock(const struct lu_env *env, struct dt_object *dt,
+ unsigned role)
{
struct osp_object *obj = dt2osp_obj(dt);
* \param[in] env execution environment
* \param[in] dt object to be unlocked
*/
-static void osp_md_object_read_unlock(const struct lu_env *env,
- struct dt_object *dt)
+static void osp_md_read_unlock(const struct lu_env *env, struct dt_object *dt)
{
struct osp_object *obj = dt2osp_obj(dt);
* \param[in] env execution environment
* \param[in] dt object to be unlocked
*/
-static void osp_md_object_write_unlock(const struct lu_env *env,
- struct dt_object *dt)
+static void osp_md_write_unlock(const struct lu_env *env, struct dt_object *dt)
{
struct osp_object *obj = dt2osp_obj(dt);
* \param[in] env execution environment
* \param[in] dt object to be tested
*/
-static int osp_md_object_write_locked(const struct lu_env *env,
- struct dt_object *dt)
+static int osp_md_write_locked(const struct lu_env *env, struct dt_object *dt)
{
struct osp_object *obj = dt2osp_obj(dt);
* \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)
+int osp_md_declare_destroy(const struct lu_env *env, struct dt_object *dt,
+ struct thandle *th)
{
return osp_trans_update_request_create(th);
}
* \retval 0 for success
* \retval negative error number on failure
*/
-int osp_md_object_destroy(const struct lu_env *env, struct dt_object *dt,
- struct thandle *th)
+int osp_md_destroy(const struct lu_env *env, struct dt_object *dt,
+ struct thandle *th)
{
struct osp_object *o = dt2osp_obj(dt);
struct osp_device *osp = lu2osp_dev(dt->do_lu.lo_dev);
update = thandle_to_osp_update_request(th);
LASSERT(update != NULL);
- rc = osp_update_rpc_pack(env, object_destroy, update, OUT_DESTROY,
+ rc = osp_update_rpc_pack(env, destroy, update, OUT_DESTROY,
lu_object_fid(&dt->do_lu));
if (rc != 0)
RETURN(rc);
}
struct dt_object_operations osp_md_obj_ops = {
- .do_read_lock = osp_md_object_read_lock,
- .do_write_lock = osp_md_object_write_lock,
- .do_read_unlock = osp_md_object_read_unlock,
- .do_write_unlock = osp_md_object_write_unlock,
- .do_write_locked = osp_md_object_write_locked,
- .do_declare_create = osp_md_declare_object_create,
- .do_create = osp_md_object_create,
+ .do_read_lock = osp_md_read_lock,
+ .do_write_lock = osp_md_write_lock,
+ .do_read_unlock = osp_md_read_unlock,
+ .do_write_unlock = osp_md_write_unlock,
+ .do_write_locked = osp_md_write_locked,
+ .do_declare_create = osp_md_declare_create,
+ .do_create = osp_md_create,
.do_declare_ref_add = osp_md_declare_ref_add,
.do_ref_add = osp_md_ref_add,
.do_declare_ref_del = osp_md_declare_ref_del,
.do_ref_del = osp_md_ref_del,
- .do_declare_destroy = osp_md_declare_object_destroy,
- .do_destroy = osp_md_object_destroy,
+ .do_declare_destroy = osp_md_declare_destroy,
+ .do_destroy = osp_md_destroy,
.do_ah_init = osp_md_ah_init,
.do_attr_get = osp_attr_get,
.do_declare_attr_set = osp_md_declare_attr_set,
*
* If the transaction is a remote transaction and the FID for the OST-object
* has been assigned already, then handle it as creating (remote) MDT object
- * via osp_md_declare_object_create(). This function is usually used for LFSCK
+ * via osp_md_declare_create(). This function is usually used for LFSCK
* to re-create the lost OST object. Otherwise, if it is not replay case, the
* OSP will reserve pre-created object for the subsequent create operation;
* if the MDT side cached pre-created objects are less than some threshold,
* \retval 0 for success
* \retval negative error number on failure
*/
-static int osp_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)
+static int osp_declare_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_thread_info *osi = osp_env_info(env);
struct osp_device *d = lu2osp_dev(dt->do_lu.lo_dev);
if (is_only_remote_trans(th) && !fid_is_zero(fid)) {
LASSERT(fid_is_sane(fid));
- rc = osp_md_declare_object_create(env, dt, attr, hint, dof, th);
+ rc = osp_md_declare_create(env, dt, attr, hint, dof, th);
RETURN(rc);
}
*
* If the transaction is a remote transaction and the FID for the OST-object
* has been assigned already, then handle it as handling MDT object via the
- * osp_md_object_create(). For other cases, the OSP will assign FID to the
+ * osp_md_create(). For other cases, the OSP will assign FID to the
* object to be created, and update last_used Object ID (OID) file.
*
* \param[in] env pointer to the thread context
* \retval 0 for success
* \retval negative error number on failure
*/
-static int osp_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)
+static int osp_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_thread_info *osi = osp_env_info(env);
struct osp_device *d = lu2osp_dev(dt->do_lu.lo_dev);
!fid_is_zero(lu_object_fid(&dt->do_lu))) {
LASSERT(fid_is_sane(lu_object_fid(&dt->do_lu)));
- rc = osp_md_object_create(env, dt, attr, hint, dof, th);
+ rc = osp_md_create(env, dt, attr, hint, dof, th);
if (rc == 0)
o->opo_non_exist = 0;
* \retval 0 for success
* \retval negative error number on failure
*/
-int osp_declare_object_destroy(const struct lu_env *env,
- struct dt_object *dt, struct thandle *th)
+int osp_declare_destroy(const struct lu_env *env, struct dt_object *dt,
+ struct thandle *th)
{
struct osp_object *o = dt2osp_obj(dt);
struct osp_device *osp = lu2osp_dev(dt->do_lu.lo_dev);
* \retval 0 for success
* \retval negative error number on failure
*/
-static int osp_object_destroy(const struct lu_env *env, struct dt_object *dt,
- struct thandle *th)
+static int osp_destroy(const struct lu_env *env, struct dt_object *dt,
+ struct thandle *th)
{
struct osp_object *o = dt2osp_obj(dt);
struct osp_device *osp = lu2osp_dev(dt->do_lu.lo_dev);
.do_xattr_get = osp_xattr_get,
.do_declare_xattr_set = osp_declare_xattr_set,
.do_xattr_set = osp_xattr_set,
- .do_declare_create = osp_declare_object_create,
- .do_create = osp_object_create,
- .do_declare_destroy = osp_declare_object_destroy,
- .do_destroy = osp_object_destroy,
+ .do_declare_create = osp_declare_create,
+ .do_create = osp_create,
+ .do_declare_destroy = osp_declare_destroy,
+ .do_destroy = osp_destroy,
.do_index_try = osp_index_try,
};
* = import is disconnected =
*
* = import is inactive =
- * in this case osp_declare_object_create() returns an error
+ * in this case osp_declare_create() returns an error
*
*/
* Get local thandle for osp_thandle
*
* Get the local OSD thandle from the OSP thandle. Currently, there
- * are a few OSP API (osp_object_create() and osp_sync_add()) needs
+ * are a few OSP API (osp_create() and osp_sync_add()) needs
* to update the object on local OSD device.
*
* If the osp_thandle comes from normal stack (MDD->LOD->OSP), then
}
EXPORT_SYMBOL(out_index_delete_pack);
-int out_object_destroy_pack(const struct lu_env *env,
- struct object_update *update,
- size_t *max_update_size, const struct lu_fid *fid)
+int out_destroy_pack(const struct lu_env *env, struct object_update *update,
+ size_t *max_update_size, const struct lu_fid *fid)
{
return out_update_pack(env, update, max_update_size, OUT_DESTROY, fid,
0, NULL, NULL, 0);
}
-EXPORT_SYMBOL(out_object_destroy_pack);
+EXPORT_SYMBOL(out_destroy_pack);
int out_write_pack(const struct lu_env *env, struct object_update *update,
size_t *max_update_size, const struct lu_fid *fid,
*
* \retval size of object destroy update.
*/
-size_t update_records_object_destroy_size(const struct lu_env *env,
+size_t update_records_destroy_size(const struct lu_env *env,
const struct lu_fid *fid)
{
return update_records_update_size(0, NULL);
}
-EXPORT_SYMBOL(update_records_object_destroy_size);
+EXPORT_SYMBOL(update_records_destroy_size);
/**
* Pack object destroy update
* \retval 0 if packing succeeds.
* \retval negative errno if packing fails.
*/
-int update_records_object_destroy_pack(const struct lu_env *env,
+int update_records_destroy_pack(const struct lu_env *env,
struct update_ops *ops,
unsigned int *op_count,
size_t *max_ops_size,
max_ops_size, params, param_count,
max_param_size, 0, NULL, NULL);
}
-EXPORT_SYMBOL(update_records_object_destroy_pack);
+EXPORT_SYMBOL(update_records_destroy_pack);
/**
* Calculate index insert update size