Whamcloud - gitweb
LU-1346 libcfs: tcpip/time/type related cleanup
[fs/lustre-release.git] / lustre / include / lustre_log.h
index 2419161..708d7c8 100644 (file)
@@ -27,7 +27,7 @@
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2012, Intel Corporation.
+ * Copyright (c) 2012, 2013, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -98,21 +98,31 @@ static inline void logid_to_fid(struct llog_logid *id, struct lu_fid *fid)
         * logid's by non-zero ogen (inode generation) and convert them
         * into IGIF */
        if (id->lgl_ogen == 0) {
-               fid->f_seq = id->lgl_oseq;
-               fid->f_oid = id->lgl_oid;
+               fid->f_seq = id->lgl_oi.oi.oi_seq;
+               fid->f_oid = id->lgl_oi.oi.oi_id;
                fid->f_ver = 0;
        } else {
-               lu_igif_build(fid, id->lgl_oid, id->lgl_ogen);
+               lu_igif_build(fid, id->lgl_oi.oi.oi_id, id->lgl_ogen);
        }
 }
 
 static inline void fid_to_logid(struct lu_fid *fid, struct llog_logid *id)
 {
-       id->lgl_oseq = fid->f_seq;
-       id->lgl_oid = fid->f_oid;
+       id->lgl_oi.oi.oi_seq = fid->f_seq;
+       id->lgl_oi.oi.oi_id = fid->f_oid;
        id->lgl_ogen = 0;
 }
 
+static inline void logid_set_id(struct llog_logid *log_id, __u64 id)
+{
+       log_id->lgl_oi.oi.oi_id = id;
+}
+
+static inline __u64 logid_id(struct llog_logid *log_id)
+{
+       return log_id->lgl_oi.oi.oi_id;
+}
+
 struct llog_handle;
 
 /* llog.c  -  general API */
@@ -134,7 +144,11 @@ int llog_open(const struct lu_env *env, struct llog_ctxt *ctxt,
              struct llog_handle **lgh, struct llog_logid *logid,
              char *name, enum llog_open_param open_param);
 int llog_close(const struct lu_env *env, struct llog_handle *cathandle);
-int llog_get_size(struct llog_handle *loghandle);
+int llog_is_empty(const struct lu_env *env, struct llog_ctxt *ctxt,
+                 char *name);
+int llog_backup(const struct lu_env *env, struct obd_device *obd,
+               struct llog_ctxt *ctxt, struct llog_ctxt *bak_ctxt,
+               char *name, char *backup);
 
 /* llog_process flags */
 #define LLOG_FLAG_NODEAMON 0x0001
@@ -380,6 +394,13 @@ static inline int llog_data_len(int len)
         return cfs_size_round(len);
 }
 
+static inline int llog_get_size(struct llog_handle *loghandle)
+{
+       if (loghandle && loghandle->lgh_hdr)
+               return loghandle->lgh_hdr->llh_count;
+       return 0;
+}
+
 static inline struct llog_ctxt *llog_ctxt_get(struct llog_ctxt *ctxt)
 {
         cfs_atomic_inc(&ctxt->loc_refcount);