Whamcloud - gitweb
b=19860
[fs/lustre-release.git] / lustre / include / lustre_log.h
index 167b366..05d85ab 100644 (file)
@@ -61,7 +61,7 @@
 #error Unsupported operating system.
 #endif
 
-#include <obd.h>
+#include <obd_class.h>
 #include <obd_ost.h>
 #include <lustre/lustre_idl.h>
 
@@ -193,11 +193,8 @@ int llog_obd_origin_add(struct llog_ctxt *ctxt,
                         struct llog_rec_hdr *rec, struct lov_stripe_md *lsm,
                         struct llog_cookie *logcookies, int numcookies);
 
-int llog_cat_initialize(struct obd_device *obd, struct obd_llog_group *olg,
-                        int idx, struct obd_uuid *uuid);
 int obd_llog_init(struct obd_device *obd, struct obd_llog_group *olg,
-                  struct obd_device *disk_obd, int count,
-                  struct llog_catid *logid, struct obd_uuid *uuid);
+                  struct obd_device *disk_obd, int *idx);
 
 int obd_llog_finish(struct obd_device *obd, int count);
 
@@ -256,13 +253,15 @@ struct llog_operations {
 
 /* llog_lvfs.c */
 extern struct llog_operations llog_lvfs_ops;
-int llog_get_cat_list(struct obd_device *obd, struct obd_device *disk_obd,
+int llog_get_cat_list(struct obd_device *disk_obd,
                       char *name, int idx, int count,
                       struct llog_catid *idarray);
 
-int llog_put_cat_list(struct obd_device *obd, struct obd_device *disk_obd,
+int llog_put_cat_list(struct obd_device *disk_obd,
                       char *name, int idx, int count, struct llog_catid *idarray);
 
+#define LLOG_CTXT_FLAG_UNINITIALIZED     0x00000001
+
 struct llog_ctxt {
         int                      loc_idx; /* my index the obd array of ctxt's */
         struct llog_gen          loc_gen;
@@ -278,6 +277,7 @@ struct llog_ctxt {
         struct semaphore         loc_sem; /* protects loc_llcd and loc_imp */
         atomic_t                 loc_refcount;
         void                    *llog_proc_cb;
+        long                     loc_flags; /* flags, see above defines */
 };
 
 #define LCM_NAME_SIZE 64
@@ -292,6 +292,10 @@ struct llog_commit_master {
          */
         atomic_t                   lcm_count;
         /**
+         * The refcount for lcm
+         */
+         atomic_t                  lcm_refcount;
+        /**
          * Thread control structure. Used for control commit thread.
          */
         struct ptlrpcd_ctl         lcm_pc;
@@ -309,6 +313,23 @@ struct llog_commit_master {
         char                       lcm_name[LCM_NAME_SIZE];
 };
 
+static inline struct llog_commit_master
+*lcm_get(struct llog_commit_master *lcm)
+{
+        LASSERT(atomic_read(&lcm->lcm_refcount) > 0);
+        atomic_inc(&lcm->lcm_refcount);
+        return lcm;
+}
+
+static inline void
+lcm_put(struct llog_commit_master *lcm)
+{
+        if (!atomic_dec_and_test(&lcm->lcm_refcount)) {
+                return ;
+        }
+        OBD_FREE_PTR(lcm);
+}
+
 struct llog_canceld_ctxt {
         /**
          * Llog context this llcd is attached to. Used for accessing
@@ -361,6 +382,7 @@ static inline void llog_gen_init(struct llog_ctxt *ctxt)
                 ctxt->loc_gen.mnt_cnt = obd->u.filter.fo_mount_count;
         else
                 ctxt->loc_gen.mnt_cnt = 0;
+        ctxt->loc_gen.conn_cnt++;
 }
 
 static inline int llog_gen_lt(struct llog_gen a, struct llog_gen b)
@@ -372,7 +394,6 @@ static inline int llog_gen_lt(struct llog_gen a, struct llog_gen b)
         return(a.conn_cnt < b.conn_cnt ? 1 : 0);
 }
 
-#define LLOG_GEN_INC(gen)  ((gen).conn_cnt ++)
 #define LLOG_PROC_BREAK 0x0001
 #define LLOG_DEL_RECORD 0x0002
 
@@ -509,6 +530,7 @@ static inline int llog_write_rec(struct llog_handle *handle,
         if (lop->lop_write_rec == NULL)
                 RETURN(-EOPNOTSUPP);
 
+        /* FIXME:  Why doesn't caller just set the right lrh_len itself? */
         if (buf)
                 buflen = rec->lrh_len + sizeof(struct llog_rec_hdr)
                                 + sizeof(struct llog_rec_tail);
@@ -653,4 +675,9 @@ static inline int llog_connect(struct llog_ctxt *ctxt,
         RETURN(rc);
 }
 
+int lustre_process_log(struct super_block *sb, char *logname,
+                       struct config_llog_instance *cfg);
+int lustre_end_log(struct super_block *sb, char *logname,
+                   struct config_llog_instance *cfg);
+
 #endif