X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Finclude%2Flustre_update.h;h=404da0f5148279b18913785d6f17456d5f7d039d;hb=1736c1befd27e3dacb424269ad987fe5dd480827;hp=f9fd97e71268a503972508d9f290718b7804a3b6;hpb=fb80ae7c7601a03c1181de381f067f553e7b8c6f;p=fs%2Flustre-release.git diff --git a/lustre/include/lustre_update.h b/lustre/include/lustre_update.h index f9fd97e..404da0f 100644 --- a/lustre/include/lustre_update.h +++ b/lustre/include/lustre_update.h @@ -20,7 +20,7 @@ * GPL HEADER END */ /* - * Copyright (c) 2013, 2014, Intel Corporation. + * Copyright (c) 2013, 2016, Intel Corporation. */ /* * lustre/include/lustre_update.h @@ -30,12 +30,13 @@ #ifndef _LUSTRE_UPDATE_H #define _LUSTRE_UPDATE_H -#include #include +#include +#include #define OUT_UPDATE_INIT_BUFFER_SIZE 4096 -/* 16KB, the current biggest size is llog header(8KB) */ -#define OUT_UPDATE_REPLY_SIZE 16384 +#define OUT_UPDATE_REPLY_SIZE 4096 +#define OUT_BULK_BUFFER_SIZE 4096 struct dt_key; struct dt_rec; @@ -130,6 +131,21 @@ update_records_get_params(const struct update_records *record) 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) { @@ -146,18 +162,23 @@ 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) @@ -194,7 +215,7 @@ static inline void *size = param->oup_len; if (param->oup_len == 0) - return NULL; + return ERR_PTR(-ENODATA); return (void *)¶m->oup_buf[0]; } @@ -227,7 +248,7 @@ object_update_result_insert(struct object_update_reply *reply, LASSERT(update_result != NULL); update_result->our_rc = ptlrpc_status_hton(rc); - if (data_len > 0) { + if (data != NULL && data_len > 0) { LASSERT(data != NULL); ptr = (char *)update_result + cfs_size_round(sizeof(struct object_update_reply)); @@ -261,7 +282,7 @@ object_update_result_data_get(const struct object_update_reply *reply, lbuf->lb_buf = update_result->our_data; lbuf->lb_len = update_result->our_datalen; - return 0; + return result; } /** @@ -269,11 +290,11 @@ object_update_result_data_get(const struct object_update_reply *reply, * distribution. */ struct thandle_update_records { - /* All of updates for the cross-MDT operation. */ + /* All of updates for the cross-MDT operation, vmalloc'd. */ struct llog_update_record *tur_update_records; size_t tur_update_records_buf_size; - /* All of parameters for the cross-MDT operation */ + /* All of parameters for the cross-MDT operation, vmalloc'd */ struct update_params *tur_update_params; unsigned int tur_update_param_count; size_t tur_update_params_buf_size; @@ -285,6 +306,7 @@ struct top_multiple_thandle { atomic_t tmt_refcount; /* Other sub transactions will be listed here. */ struct list_head tmt_sub_thandle_list; + spinlock_t tmt_sub_lock; struct list_head tmt_commit_list; /* All of update records will packed here */ @@ -329,7 +351,8 @@ struct sub_thandle { /* If this sub thandle is committed */ bool st_committed:1, - st_stopped:1; + st_stopped:1, + st_started:1; }; struct tx_arg; @@ -389,7 +412,8 @@ struct thandle_exec_args { int out_update_pack(const struct lu_env *env, struct object_update *update, size_t *max_update_size, enum update_type op, const struct lu_fid *fid, unsigned int params_count, - __u16 *param_sizes, const void **param_bufs); + __u16 *param_sizes, const void **param_bufs, + __u32 reply_size); int out_create_pack(const struct lu_env *env, struct object_update *update, size_t *max_update_size, const struct lu_fid *fid, const struct lu_attr *attr, struct dt_allocation_hint *hint, @@ -434,7 +458,8 @@ int out_index_lookup_pack(const struct lu_env *env, const struct dt_key *key); int out_xattr_get_pack(const struct lu_env *env, struct object_update *update, size_t *max_update_size, - const struct lu_fid *fid, const char *name); + const struct lu_fid *fid, const char *name, + const int bufsize); int out_read_pack(const struct lu_env *env, struct object_update *update, size_t *max_update_length, const struct lu_fid *fid, size_t size, loff_t pos);