X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Ftarget%2Ftgt_internal.h;h=ebe3a1ab99f85a2caa0db68a7bbcce7a67550649;hb=386818f0c56e438779e17d0ca12b481f17c53682;hp=3623bde9a4f44b2c70f894fe680a7193f84351b1;hpb=08aa217ce49aba1ded52e0f7adb8a607035123fd;p=fs%2Flustre-release.git diff --git a/lustre/target/tgt_internal.h b/lustre/target/tgt_internal.h index 3623bde..ebe3a1a 100644 --- a/lustre/target/tgt_internal.h +++ b/lustre/target/tgt_internal.h @@ -43,7 +43,60 @@ #include #include -extern struct lu_context_key tgt_thread_key; +extern int (*tgt_lfsck_in_notify)(const struct lu_env *env, + struct dt_device *key, + struct lfsck_request *lr); + +struct tx_arg; +typedef int (*tx_exec_func_t)(const struct lu_env *env, struct thandle *th, + struct tx_arg *ta); + +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; +}; + +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; +}; /** * Common data shared by tg-level handlers. This is allocated per-thread to @@ -55,8 +108,39 @@ struct tgt_thread_info { struct lsd_client_data tti_lcd; struct lu_buf tti_buf; loff_t tti_off; + + struct lu_attr tti_attr; + struct lu_fid tti_fid1; + + /* transno storage during last_rcvd update */ + __u64 tti_transno; + __u32 tti_has_trans:1, + tti_mult_trans:1; + + /* Updates data for OUT target */ + struct thandle_exec_args tti_tea; + union { + struct { + /* for tgt_readpage() */ + struct lu_rdpg tti_rdpg; + /* for tgt_sendpage() */ + struct l_wait_info tti_wait_info; + } rdpg; + struct { + struct dt_object_format tti_update_dof; + struct object_update_reply *tti_update_reply; + struct object_update *tti_update; + int tti_update_reply_index; + struct obdo tti_obdo; + struct dt_object *tti_dt_object; + } update; + } tti_u; + struct lfsck_request tti_lr; + struct dt_insert_rec tti_rec; }; +extern struct lu_context_key tgt_thread_key; + static inline struct tgt_thread_info *tgt_th_info(const struct lu_env *env) { struct tgt_thread_info *tti; @@ -66,4 +150,74 @@ static inline struct tgt_thread_info *tgt_th_info(const struct lu_env *env) return tti; } +#define MGS_SERVICE_WATCHDOG_FACTOR (2) + +int tgt_request_handle(struct ptlrpc_request *req); + +/* check if request's xid is equal to last one or not*/ +static inline int req_xid_is_last(struct ptlrpc_request *req) +{ + struct lsd_client_data *lcd = req->rq_export->exp_target_data.ted_lcd; + + LASSERT(lcd != NULL); + return (req->rq_xid == lcd->lcd_last_xid || + req->rq_xid == lcd->lcd_last_close_xid); +} + +static inline char *dt_obd_name(struct dt_device *dt) +{ + return dt->dd_lu_dev.ld_obd->obd_name; +} + +/* Update handlers */ +int out_handle(struct tgt_session_info *tsi); + +#define out_tx_create(info, obj, attr, fid, dof, th, reply, idx) \ + __out_tx_create(info, obj, attr, fid, dof, th, reply, idx, \ + __FILE__, __LINE__) + +#define out_tx_attr_set(info, obj, attr, th, reply, idx) \ + __out_tx_attr_set(info, obj, attr, th, reply, idx, \ + __FILE__, __LINE__) + +#define out_tx_xattr_set(info, obj, buf, name, fl, th, reply, idx) \ + __out_tx_xattr_set(info, obj, buf, name, fl, th, reply, idx, \ + __FILE__, __LINE__) + +#define out_tx_xattr_del(info, obj, name, th, reply, idx) \ + __out_tx_xattr_del(info, obj, name, th, reply, idx, \ + __FILE__, __LINE__) + +#define out_tx_ref_add(info, obj, th, reply, idx) \ + __out_tx_ref_add(info, obj, th, reply, idx, __FILE__, __LINE__) + +#define out_tx_ref_del(info, obj, th, reply, idx) \ + __out_tx_ref_del(info, obj, th, reply, idx, __FILE__, __LINE__) + +#define out_tx_index_insert(info, obj, rec, key, th, reply, idx) \ + __out_tx_index_insert(info, obj, rec, key, th, reply, idx, \ + __FILE__, __LINE__) + +#define out_tx_index_delete(info, obj, key, th, reply, idx) \ + __out_tx_index_delete(info, obj, key, th, reply, idx, \ + __FILE__, __LINE__) + +#define out_tx_destroy(info, obj, th, reply, idx) \ + __out_tx_destroy(info, obj, th, reply, idx, __FILE__, __LINE__) + +#define out_tx_write(info, obj, buf, pos, th, reply, idx) \ + __out_tx_write(info, obj, buf, pos, th, reply, idx, __FILE__, __LINE__) + +extern struct page *tgt_page_to_corrupt; + +struct tgt_thread_big_cache { + struct niobuf_local local[PTLRPC_MAX_BRW_PAGES]; +}; + +int tgt_server_data_init(const struct lu_env *env, struct lu_target *tgt); +int tgt_txn_start_cb(const struct lu_env *env, struct thandle *th, + void *cookie); +int tgt_txn_stop_cb(const struct lu_env *env, struct thandle *th, + void *cookie); + #endif /* _TG_INTERNAL_H */