-#define LCM_NAME_SIZE 64
-
-struct llog_commit_master {
- /**
- * Thread control flags (start, stop, etc.)
- */
- long lcm_flags;
- /**
- * Number of llcds onthis lcm.
- */
- cfs_atomic_t lcm_count;
- /**
- * The refcount for lcm
- */
- cfs_atomic_t lcm_refcount;
- /**
- * Thread control structure. Used for control commit thread.
- */
- struct ptlrpcd_ctl lcm_pc;
- /**
- * Lock protecting list of llcds.
- */
- cfs_spinlock_t lcm_lock;
- /**
- * Llcds in flight for debugging purposes.
- */
- cfs_list_t lcm_llcds;
- /**
- * Commit thread name buffer. Only used for thread start.
- */
- char lcm_name[LCM_NAME_SIZE];
-};
-
-static inline struct llog_commit_master
-*lcm_get(struct llog_commit_master *lcm)
-{
- cfs_atomic_inc(&lcm->lcm_refcount);
- return lcm;
-}
-
-static inline void
-lcm_put(struct llog_commit_master *lcm)
-{
- LASSERT_ATOMIC_POS(&lcm->lcm_refcount);
- if (cfs_atomic_dec_and_test(&lcm->lcm_refcount))
- OBD_FREE_PTR(lcm);
-}
-
-struct llog_canceld_ctxt {
- /**
- * Llog context this llcd is attached to. Used for accessing
- * ->loc_import and others in process of canceling cookies
- * gathered in this llcd.
- */
- struct llog_ctxt *llcd_ctxt;
- /**
- * Cancel thread control stucture pointer. Used for accessing
- * it to see if should stop processing and other needs.
- */
- struct llog_commit_master *llcd_lcm;
- /**
- * Maximal llcd size. Used in calculations on how much of room
- * left in llcd to cookie comming cookies.
- */
- int llcd_size;
- /**
- * Link to lcm llcds list.
- */
- cfs_list_t llcd_list;
- /**
- * Current llcd size while gathering cookies. This should not be
- * more than ->llcd_size. Used for determining if we need to
- * send this llcd (if full) and allocate new one. This is also
- * used for copying new cookie at the end of buffer.
- */
- int llcd_cookiebytes;
- /**
- * Pointer to the start of cookies buffer.
- */
- struct llog_cookie llcd_cookies[0];
-};
-
-/* ptlrpc/recov_thread.c */
-extern struct llog_commit_master *llog_recov_thread_init(char *name);
-extern void llog_recov_thread_fini(struct llog_commit_master *lcm,
- int force);
-extern int llog_recov_thread_start(struct llog_commit_master *lcm);
-extern void llog_recov_thread_stop(struct llog_commit_master *lcm,
- int force);
-
-static inline void llog_gen_init(struct llog_ctxt *ctxt)
-{
- struct obd_device *obd = ctxt->loc_exp->exp_obd;
-
- LASSERTF(obd->u.obt.obt_magic == OBT_MAGIC,
- "%s: wrong obt magic %#x\n",
- obd->obd_name, obd->u.obt.obt_magic);
- ctxt->loc_gen.mnt_cnt = obd->u.obt.obt_mount_count;
- ctxt->loc_gen.conn_cnt++;
-}
-
-static inline int llog_gen_lt(struct llog_gen a, struct llog_gen b)
-{
- if (a.mnt_cnt < b.mnt_cnt)
- return 1;
- if (a.mnt_cnt > b.mnt_cnt)
- return 0;
- return(a.conn_cnt < b.conn_cnt ? 1 : 0);
-}
-