X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Finclude%2Flustre_update.h;h=1417804f68f316dc183b7b8b597f46557fee08d5;hp=8a42fb8647cad8c4b8b54abbf22434f2887e275e;hb=4f53536d002c13886210b672b657795baa067144;hpb=b1f01a709ffe66d82f13ad421d319432d235c05b diff --git a/lustre/include/lustre_update.h b/lustre/include/lustre_update.h index 8a42fb8..1417804 100644 --- a/lustre/include/lustre_update.h +++ b/lustre/include/lustre_update.h @@ -102,6 +102,23 @@ update_params_get_param(const struct update_params *params, return param; } +static inline void* +update_params_get_param_buf(const struct update_params *params, __u16 index, + unsigned int param_count, __u16 *size) +{ + struct object_update_param *param; + + param = update_params_get_param(params, (unsigned int)index, + param_count); + if (param == NULL) + return NULL; + + if (size != NULL) + *size = param->oup_len; + + return ¶m->oup_buf[0]; +} + struct update_op { struct lu_fid uop_fid; __u16 uop_type; @@ -377,6 +394,59 @@ struct sub_thandle { bool st_committed:1; }; +struct tx_arg; +typedef int (*tx_exec_func_t)(const struct lu_env *env, struct thandle *th, + struct tx_arg *ta); + +/* Structure for holding one update executation */ +struct tx_arg { + tx_exec_func_t exec_fn; + tx_exec_func_t undo_fn; + struct dt_object *object; + const char *file; + struct object_update_reply *reply; + int line; + int index; + union { + struct { + struct dt_insert_rec rec; + const struct dt_key *key; + } insert; + struct { + } ref; + struct { + struct lu_attr attr; + } attr_set; + struct { + struct lu_buf buf; + const char *name; + int flags; + __u32 csum; + } xattr_set; + struct { + struct lu_attr attr; + struct dt_allocation_hint hint; + struct dt_object_format dof; + struct lu_fid fid; + } create; + struct { + struct lu_buf buf; + loff_t pos; + } write; + struct { + struct ost_body *body; + } destroy; + } u; +}; + +/* Structure for holding all update executations of one transaction */ +struct thandle_exec_args { + struct thandle *ta_handle; + int ta_argno; /* used args */ + int ta_alloc_args; /* allocated args count */ + struct tx_arg **ta_args; +}; + /* target/out_lib.c */ int out_update_pack(const struct lu_env *env, struct object_update *update, size_t max_update_size, enum update_type op, @@ -466,6 +536,9 @@ static inline void top_multiple_thandle_put(struct top_multiple_thandle *tmt) struct sub_thandle *lookup_sub_thandle(struct top_multiple_thandle *tmt, struct dt_device *dt_dev); +int sub_thandle_trans_create(const struct lu_env *env, + struct top_thandle *top_th, + struct sub_thandle *st); /* update_records.c */ int update_records_create_pack(const struct lu_env *env,