struct thandle *lod_sub_get_thandle(const struct lu_env *env,
struct thandle *th,
- const struct dt_object *sub_obj)
+ const struct dt_object *sub_obj,
+ bool *record_update)
{
struct lod_device *lod = dt2lod_dev(th->th_dev);
struct top_thandle *tth;
int rc;
ENTRY;
+ if (record_update != NULL)
+ *record_update = false;
+
if (th->th_top == NULL)
RETURN(th);
* creation, FID is not assigned until osp_object_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)))
+ fid_is_zero(lu_object_fid(&sub_obj->do_lu))) {
+ /* local MDT object */
+ if (fid_is_sane(lu_object_fid(&sub_obj->do_lu)) &&
+ tth->tt_update_records != NULL &&
+ record_update != NULL)
+ *record_update = true;
+
RETURN(tth->tt_master_sub_thandle);
+ }
rc = lod_fld_lookup(env, lod, lu_object_fid(&sub_obj->do_lu),
&mdt_index, &type);
if (type == LU_SEQ_RANGE_OST)
RETURN(tth->tt_master_sub_thandle);
+ if (tth->tt_update_records != NULL && record_update != NULL)
+ *record_update = true;
+
sub_th = thandle_get_sub(env, th, sub_obj);
RETURN(sub_th);
{
struct thandle *sub_th;
- sub_th = lod_sub_get_thandle(env, th, dt);
+ sub_th = lod_sub_get_thandle(env, th, dt, NULL);
if (IS_ERR(sub_th))
return PTR_ERR(sub_th);
struct thandle *th)
{
struct thandle *sub_th;
+ bool record_update;
int rc;
ENTRY;
- sub_th = lod_sub_get_thandle(env, th, dt);
+ sub_th = lod_sub_get_thandle(env, th, dt, &record_update);
if (IS_ERR(sub_th))
RETURN(PTR_ERR(sub_th));
+ if (record_update) {
+ rc = update_record_pack(create, th,
+ lu_object_fid(&dt->do_lu),
+ attr, hint, dof);
+ if (rc < 0)
+ RETURN(rc);
+ }
+
rc = dt_create(env, dt, attr, hint, dof, sub_th);
RETURN(rc);
int rc;
ENTRY;
- sub_th = lod_sub_get_thandle(env, th, dt);
+ sub_th = lod_sub_get_thandle(env, th, dt, NULL);
if (IS_ERR(sub_th))
RETURN(PTR_ERR(sub_th));
struct thandle *th)
{
struct thandle *sub_th;
+ bool record_update;
int rc;
ENTRY;
- sub_th = lod_sub_get_thandle(env, th, dt);
+ sub_th = lod_sub_get_thandle(env, th, dt, &record_update);
if (IS_ERR(sub_th))
RETURN(PTR_ERR(sub_th));
+ if (record_update) {
+ rc = update_record_pack(ref_add, th,
+ lu_object_fid(&dt->do_lu));
+ if (rc < 0)
+ RETURN(rc);
+ }
+
rc = dt_ref_add(env, dt, sub_th);
RETURN(rc);
int rc;
ENTRY;
- sub_th = lod_sub_get_thandle(env, th, dt);
+ sub_th = lod_sub_get_thandle(env, th, dt, NULL);
if (IS_ERR(sub_th))
RETURN(PTR_ERR(sub_th));
struct thandle *th)
{
struct thandle *sub_th;
+ bool record_update;
int rc;
ENTRY;
- sub_th = lod_sub_get_thandle(env, th, dt);
+ sub_th = lod_sub_get_thandle(env, th, dt, &record_update);
if (IS_ERR(sub_th))
RETURN(PTR_ERR(sub_th));
+ if (record_update) {
+ rc = update_record_pack(ref_del, th,
+ lu_object_fid(&dt->do_lu));
+ if (rc < 0)
+ RETURN(rc);
+ }
+
rc = dt_ref_del(env, dt, sub_th);
RETURN(rc);
int rc;
ENTRY;
- sub_th = lod_sub_get_thandle(env, th, dt);
+ sub_th = lod_sub_get_thandle(env, th, dt, NULL);
if (IS_ERR(sub_th))
RETURN(PTR_ERR(sub_th));
struct thandle *th)
{
struct thandle *sub_th;
+ bool record_update;
int rc;
ENTRY;
- sub_th = lod_sub_get_thandle(env, th, dt);
+ sub_th = lod_sub_get_thandle(env, th, dt, &record_update);
if (IS_ERR(sub_th))
RETURN(PTR_ERR(sub_th));
+ if (record_update) {
+ rc = update_record_pack(object_destroy, th,
+ lu_object_fid(&dt->do_lu));
+ if (rc < 0)
+ RETURN(rc);
+ }
+
rc = dt_destroy(env, dt, sub_th);
RETURN(rc);
{
struct thandle *sub_th;
- sub_th = lod_sub_get_thandle(env, th, dt);
+ sub_th = lod_sub_get_thandle(env, th, dt, NULL);
if (IS_ERR(sub_th))
return PTR_ERR(sub_th);
int ign)
{
struct thandle *sub_th;
+ int rc;
+ bool record_update;
- sub_th = lod_sub_get_thandle(env, th, dt);
+ sub_th = lod_sub_get_thandle(env, th, dt, &record_update);
if (IS_ERR(sub_th))
return PTR_ERR(sub_th);
+ if (record_update) {
+ rc = update_record_pack(index_insert, th,
+ lu_object_fid(&dt->do_lu), rec, key);
+ if (rc < 0)
+ return rc;
+ }
+
return dt_insert(env, dt, rec, key, sub_th, ign);
}
{
struct thandle *sub_th;
- sub_th = lod_sub_get_thandle(env, th, dt);
+ sub_th = lod_sub_get_thandle(env, th, dt, NULL);
if (IS_ERR(sub_th))
return PTR_ERR(sub_th);
const struct dt_key *name, struct thandle *th)
{
struct thandle *sub_th;
+ bool record_update;
int rc;
ENTRY;
- sub_th = lod_sub_get_thandle(env, th, dt);
+ sub_th = lod_sub_get_thandle(env, th, dt, &record_update);
if (IS_ERR(sub_th))
RETURN(PTR_ERR(sub_th));
+ if (record_update) {
+ rc = update_record_pack(index_delete, th,
+ lu_object_fid(&dt->do_lu), name);
+ if (rc < 0)
+ RETURN(rc);
+ }
+
rc = dt_delete(env, dt, name, sub_th);
RETURN(rc);
}
int rc;
ENTRY;
- sub_th = lod_sub_get_thandle(env, th, dt);
+ sub_th = lod_sub_get_thandle(env, th, dt, NULL);
if (IS_ERR(sub_th))
RETURN(PTR_ERR(sub_th));
struct thandle *th)
{
struct thandle *sub_th;
+ bool record_update;
int rc;
ENTRY;
- sub_th = lod_sub_get_thandle(env, th, dt);
+ sub_th = lod_sub_get_thandle(env, th, dt, &record_update);
if (IS_ERR(sub_th))
RETURN(PTR_ERR(sub_th));
+ if (record_update) {
+ rc = update_record_pack(xattr_set, th,
+ lu_object_fid(&dt->do_lu),
+ buf, name, fl);
+ if (rc < 0)
+ RETURN(rc);
+ }
+
rc = dt_xattr_set(env, dt, buf, name, fl, sub_th);
RETURN(rc);
int rc;
ENTRY;
- sub_th = lod_sub_get_thandle(env, th, dt);
+ sub_th = lod_sub_get_thandle(env, th, dt, NULL);
if (IS_ERR(sub_th))
RETURN(PTR_ERR(sub_th));
const struct lu_attr *attr,
struct thandle *th)
{
+ bool record_update;
struct thandle *sub_th;
int rc;
ENTRY;
- sub_th = lod_sub_get_thandle(env, th, dt);
+ sub_th = lod_sub_get_thandle(env, th, dt, &record_update);
if (IS_ERR(sub_th))
RETURN(PTR_ERR(sub_th));
+ if (record_update) {
+ rc = update_record_pack(attr_set, th, lu_object_fid(&dt->do_lu),
+ attr);
+ if (rc < 0)
+ RETURN(rc);
+ }
+
rc = dt_attr_set(env, dt, attr, sub_th);
RETURN(rc);
int rc;
ENTRY;
- sub_th = lod_sub_get_thandle(env, th, dt);
+ sub_th = lod_sub_get_thandle(env, th, dt, NULL);
if (IS_ERR(sub_th))
RETURN(PTR_ERR(sub_th));
struct thandle *th)
{
struct thandle *sub_th;
+ bool record_update;
int rc;
ENTRY;
- sub_th = lod_sub_get_thandle(env, th, dt);
+ sub_th = lod_sub_get_thandle(env, th, dt, &record_update);
if (IS_ERR(sub_th))
RETURN(PTR_ERR(sub_th));
+ if (record_update) {
+ rc = update_record_pack(xattr_del, th,
+ lu_object_fid(&dt->do_lu), name);
+ if (rc < 0)
+ RETURN(rc);
+ }
+
rc = dt_xattr_del(env, dt, name, sub_th);
RETURN(rc);
int rc;
ENTRY;
- sub_th = lod_sub_get_thandle(env, th, dt);
+ sub_th = lod_sub_get_thandle(env, th, dt, NULL);
if (IS_ERR(sub_th))
RETURN(PTR_ERR(sub_th));
struct thandle *th, int rq)
{
struct thandle *sub_th;
+ bool record_update;
ssize_t rc;
ENTRY;
- sub_th = lod_sub_get_thandle(env, th, dt);
+ sub_th = lod_sub_get_thandle(env, th, dt, &record_update);
if (IS_ERR(sub_th))
RETURN(PTR_ERR(sub_th));
+ if (record_update) {
+ rc = update_record_pack(write, th, lu_object_fid(&dt->do_lu),
+ buf, *pos);
+ if (rc < 0)
+ RETURN(rc);
+ }
+
rc = dt_write(env, dt, buf, pos, sub_th, rq);
RETURN(rc);
}