Whamcloud - gitweb
get rid of some unused structure for smfs
[fs/lustre-release.git] / lustre / include / linux / lustre_log.h
index 36ec2d6..ce42b65 100644 (file)
@@ -42,6 +42,8 @@
         snprintf(logname, sizeof(logname), "LOGS/%s", name)
 #define LLOG_EEMPTY 4711
 
+struct obd_llogs;
+
 struct plain_handle_data {
         struct list_head    phd_entry;
         struct llog_handle *phd_cat_handle;
@@ -104,13 +106,14 @@ int llog_cat_process(struct llog_handle *cat_llh, llog_cb_t cb, void *data);
 int llog_cat_reverse_process(struct llog_handle *cat_llh, llog_cb_t cb, void *data);
 int llog_cat_set_first_idx(struct llog_handle *cathandle, int index);
 
+/* llog_obd.c */
 int llog_catalog_add(struct llog_ctxt *ctxt, struct llog_rec_hdr *rec,
                      void *buf, struct llog_cookie *reccookie, int, void *data);
 int llog_catalog_cancel(struct llog_ctxt *ctxt, int count, struct llog_cookie *,
                         int flags, void *data);
-int llog_catalog_setup(struct llog_ctxt **res, char *name, struct lvfs_run_ctxt *,
-                       struct fsfilt_operations *fsops, struct dentry *logs_de,
-                       struct dentry *objects_de);
+int llog_catalog_setup(struct llog_ctxt **res, char *name, struct obd_export *exp,
+                       struct lvfs_run_ctxt *, struct fsfilt_operations *fsops, 
+                       struct dentry *logs_de, struct dentry *objects_de);
 int llog_catalog_cleanup(struct llog_ctxt *ctxt);
 int llog_cat_half_bottom(struct llog_cookie *, struct llog_handle *);
 
@@ -121,18 +124,24 @@ int llog_put_cat_list(struct lvfs_run_ctxt *, struct fsfilt_operations *,
                       char *name, int count, struct llog_catid *idarray);
 extern struct llog_operations llog_lvfs_ops;
 
+int llog_obd_origin_setup(struct obd_device *, struct obd_llogs *, int,
+                          struct obd_device *, int, struct llog_logid *);
+int llog_obd_origin_cleanup(struct llog_ctxt *ctxt);
+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 obd_llog_cat_initialize(struct obd_device *, struct obd_llogs *, int, char *);
+
 /* llog_obd.c - obd llog api */
-int obd_llog_setup(struct obd_device *obd, int index, struct obd_device *disk_obd,
-                   int count,  struct llog_logid *logid,struct llog_operations *op);
+int obd_llog_setup(struct obd_device *obd, struct obd_llogs *, int index, 
+                   struct obd_device *disk_obd, int count, struct llog_logid *logid,
+                   struct llog_operations *op);
+int obd_llog_init(struct obd_device *, struct obd_llogs *, struct obd_device *,
+                  int, struct llog_catid *);
 int obd_llog_cleanup(struct llog_ctxt *);
-int llog_obd_origin_setup(struct obd_device *obd, int index,
-                          struct obd_device *disk_obd, int count,
-                          struct llog_logid *logid);
-int obd_llog_cat_initialize(struct obd_device *obd, int count, char *name);
-int obd_llog_init(struct obd_device *obd, struct obd_device *disk_obd,
-                  int count, struct llog_catid *logid);
 
-int obd_llog_finish(struct obd_device *obd, int count);
+int obd_llog_finish(struct obd_device *, struct obd_llogs *, int);
 
 /* llog_ioctl.c */
 int llog_ioctl(struct llog_ctxt *ctxt, int cmd, struct obd_ioctl_data *data);
@@ -157,12 +166,12 @@ int llog_repl_connect(struct llog_ctxt *ctxt, int count,
                       struct obd_uuid *uuid);
 
 struct llog_operations {
-        int (*lop_setup)(struct obd_device *obd, int ctxt_idx,
-                         struct obd_device *disk_obd, int count,
-                         struct llog_logid *logid);
+        int (*lop_setup)(struct obd_device *, struct obd_llogs *, int,
+                         struct obd_device *, int, struct llog_logid *);
+
         int (*lop_cleanup)(struct llog_ctxt *ctxt);
-        int (*lop_create)(struct llog_ctxt *ctxt, struct llog_handle **,
-                          struct llog_logid *logid, char *name);
+        int (*lop_open)(struct llog_ctxt *ctxt, struct llog_handle **,
+                        struct llog_logid *logid, char *name, int flags);
         int (*lop_destroy)(struct llog_handle *handle);
         int (*lop_close)(struct llog_handle *handle);
 
@@ -181,7 +190,6 @@ struct llog_operations {
         int (*lop_prev_block)(struct llog_handle *h,
                               int prev_idx, void *buf, int len);
 
-        /* XXX add 2 more: commit callbacks and llog recovery functions */
         int (*lop_sync)(struct llog_ctxt *ctxt, struct obd_export *exp);
         int (*lop_connect)(struct llog_ctxt *ctxt, int count,
                            struct llog_logid *logid, struct llog_gen *gen,
@@ -197,16 +205,18 @@ struct llog_ctxt {
         struct dentry           *loc_objects_dir;
         struct lvfs_run_ctxt    *loc_lvfs_ctxt;
 
-        struct obd_device       *loc_obd; /* points back to the containing obd*/
+        struct obd_device       *loc_obd;   /* points back to the containing obd */
         struct llog_gen          loc_gen;
-        int                      loc_idx; /* my index the obd array of ctxt's */
+        int                      loc_idx;   /* my index the obd array of ctxt's */
+        int                      loc_alone; /* is this llog ctxt has an obd? */
 
         struct obd_export       *loc_exp;
-        struct obd_import       *loc_imp; /* to use in RPC's: can be backward
-                                             pointing import */
+        struct obd_import       *loc_imp;   /* to use in RPC's: can be backward
+                                               pointing import */
         struct llog_canceld_ctxt *loc_llcd;
-        struct semaphore         loc_sem; /* protects loc_llcd */
-        void                    *loc_proc_cb; /* cb for recovery */
+        struct semaphore         loc_sem;   /* protects loc_llcd */
+        void                    *llog_proc_cb;
+        struct obd_llogs        *loc_llogs;
 };
 
 static inline void llog_gen_init(struct llog_ctxt *ctxt)
@@ -232,6 +242,7 @@ static inline int llog_gen_lt(struct llog_gen a, struct llog_gen b)
 
 #define LLOG_GEN_INC(gen)  ((gen).conn_cnt) ++
 #define LLOG_PROC_BREAK 0x0001
+#define LLOG_DEL_RECORD 0x0002
 
 static inline int llog_ctxt2ops(struct llog_ctxt *ctxt,
                                struct llog_operations **lop)
@@ -260,17 +271,17 @@ static inline int llog_data_len(int len)
         return size_round(len);
 }
 
-static inline struct llog_ctxt *llog_get_context(struct obd_device *obd,
+static inline struct llog_ctxt *llog_get_context(struct obd_llogs *llogs,
                                                  int index)
 {
         if (index < 0 || index >= LLOG_MAX_CTXTS)
                 return NULL;
 
-        return obd->obd_llog_ctxt[index];
+        return llogs->llog_ctxt[index];
 }
 
-static inline int llog_create(struct llog_ctxt *ctxt, struct llog_handle **res,
-                              struct llog_logid *logid, char *name)
+static inline int llog_open(struct llog_ctxt *ctxt, struct llog_handle **res,
+                            struct llog_logid *logid, char *name, int flags)
 {
         struct llog_operations *lop;
         int rc;
@@ -279,10 +290,10 @@ static inline int llog_create(struct llog_ctxt *ctxt, struct llog_handle **res,
         rc = llog_ctxt2ops(ctxt, &lop);
         if (rc)
                 RETURN(rc);
-        if (lop->lop_create == NULL)
+        if (lop->lop_open == NULL)
                 RETURN(-EOPNOTSUPP);
 
-        rc = lop->lop_create(ctxt, res, logid, name);
+        rc = lop->lop_open(ctxt, res, logid, name, flags);
         RETURN(rc);
 }