* GPL HEADER END
*/
/*
- * Copyright (c) 2013, 2015, Intel Corporation.
+ * Copyright (c) 2013, 2016, Intel Corporation.
*/
/*
* lustre/include/lustre_update.h
#ifndef _LUSTRE_UPDATE_H
#define _LUSTRE_UPDATE_H
-#include <lustre_net.h>
#include <dt_object.h>
+#include <lustre_net.h>
+#include <obj_update.h>
#define OUT_UPDATE_INIT_BUFFER_SIZE 4096
#define OUT_UPDATE_REPLY_SIZE 4096
update_ops_size(&record->ur_ops, record->ur_update_count));
}
+static inline struct update_param *
+update_param_next_param(const struct update_param *param)
+{
+ return (struct update_param *)((char *)param +
+ object_update_param_size(
+ (struct object_update_param *)param));
+}
+
+static inline size_t
+__update_records_size(size_t raw_size)
+{
+ return cfs_size_round(offsetof(struct update_records, ur_ops) +
+ raw_size);
+}
+
static inline size_t
update_records_size(const struct update_records *record)
{
param_size = update_params_size(params, record->ur_param_count);
}
- return cfs_size_round(offsetof(struct update_records, ur_ops) +
- op_size + param_size);
+ return __update_records_size(op_size + param_size);
}
static inline size_t
-llog_update_record_size(const struct llog_update_record *lur)
+__llog_update_record_size(size_t records_size)
{
- return cfs_size_round(sizeof(lur->lur_hdr) +
- update_records_size(&lur->lur_update_rec) +
+ return cfs_size_round(sizeof(struct llog_rec_hdr) + records_size +
sizeof(struct llog_rec_tail));
}
+static inline size_t
+llog_update_record_size(const struct llog_update_record *lur)
+{
+ return __llog_update_record_size(
+ update_records_size(&lur->lur_update_rec));
+}
+
static inline struct update_op *
update_ops_get_op(const struct update_ops *ops, unsigned int index,
unsigned int update_count)
char *ptr;
update_result = object_update_result_get(reply, index, NULL);
- LASSERT(update_result != NULL);
+ LASSERT(update_result);
update_result->our_rc = ptlrpc_status_hton(rc);
- if (data != NULL && data_len > 0) {
- LASSERT(data != NULL);
- ptr = (char *)update_result +
+ if (rc >= 0) {
+ if (data_len > 0) {
+ LASSERT(data);
+
+ ptr = (char *)update_result +
cfs_size_round(sizeof(struct object_update_reply));
+ memcpy(ptr, data, data_len);
+ }
update_result->our_datalen = data_len;
- memcpy(ptr, data, data_len);
}
reply->ourp_lens[index] = cfs_size_round(data_len +
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,