Whamcloud - gitweb
Change obdfilter/fsfilt code so that preprw/commitrw can be called from
authoradilger <adilger>
Fri, 18 Apr 2003 21:13:42 +0000 (21:13 +0000)
committeradilger <adilger>
Fri, 18 Apr 2003 21:13:42 +0000 (21:13 +0000)
within a nested journal transaction.  This will allow us to log from the
MDS to a local obdfilter transactionally.

lustre/include/linux/lustre_log.h

index 99a61dd..68cf296 100644 (file)
@@ -1,3 +1,37 @@
+/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
+ * vim:expandtab:shiftwidth=8:tabstop=8:
+ *
+ *  Copyright (C) 2001 Cluster File Systems, Inc. <info@clusterfs.com>
+ *
+ *   This file is part of Lustre, http://www.lustre.org.
+ *
+ *   Lustre is free software; you can redistribute it and/or
+ *   modify it under the terms of version 2 of the GNU General Public
+ *   License as published by the Free Software Foundation.
+ *
+ *   Lustre is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with Lustre; if not, write to the Free Software
+ *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Generic infrastructure for managing a collection of logs.
+ *
+ * These logs are used for:
+ *
+ * - orphan recovery: OST adds record on create
+ * - mtime/size consistency: the OST adds a record on first write
+ * - open/unlinked objects: OST adds a record on destroy
+ *
+ * - mds unlink log: the MDS adds an entry upon delete
+ *
+ * - raid1 replication log between OST's
+ * - MDS replication logs
+ */
+
 #ifndef _LUSTRE_LOG_H
 #define _LUSTRE_LOG_H
 
 #include <linux/lustre_idl.h>
 #include <linux/obd.h>
 
-/* generic infrastructure for managing a collection of logs. 
-   These logs are used for: 
-
-   - orphan recovery: OST adds record on create
-   - mtime/size consistency: the OST adds a record on first write
-   - open/unlinked objects: OST adds a record on destroy
-
-   - mds unlink log: the MDS adds an entry upon delete
-
-   - raid1 replication log between OST's
-   - MDS replication logs
-*/
-
 /* catalog of log objects */
 
-/* WARNING: adjust size records! */ 
-#define LLOG_SIZE     (64 << 10)  
-#define LLOG_REC_SIZE (1 << 5)
-#define LLOG_ENTRY_COUNT 
+/* WARNING: adjust size records! */
+#define LLOG_LOG_SIZE            (64 << 10) /* == PTL_MD_MAX_IOV */
+#define LLOG_REC_SIZE            64
+#define LLOG_NUM_REC             (LLOG_LOG_SIZE / LLOG_REC_SIZE)
 
-struct llog_logid { 
-        __u64           llh_oid;
-        __u64           llh_bootcount;
+struct llog_logid {
+        __u64           lgl_oid;
+        __u64           lgl_bootcount;
 };
 
-struct llog_loglist_header { 
-        struct llog_logid  llh_current;
+struct llog_loglist_header {
         char               llh_bitmap[8192];
+        struct llog_logid  llh_current;
         struct llog_logid  llh_logs[0];
 };
 
+/* OST records for
+   - orphans
+   - size adjustments
+   - open unlinked files
+*/
+
+struct llog_trans_rec {
+        __u64             ltr_op;
+        struct ll_fid     ltr_fid;
+        obd_id            ltr_oid;
+} __attribute__((packed));
 
 /* header structure of each log */
 
@@ -43,37 +75,24 @@ struct llog_loglist_header {
    bytes with a log file size of 64K that is 16K entries, ie. 16K bits
    in the bitmap or a 2kb bitmap */
 
-struct llog_header {
-        __u32                 llh_bitmap[1024];
-        __u64                 llh_lastrec; 
-        struct llog_trans_rec llh_records[0];
+struct llog_index {
+        __u32                 lgi_bitmap[LLOG_NUM_REC / sizeof(__u32)];
+        __u32                 lgi_numrec;
+        struct llog_trans_rec lgi_records[0];
 };
 
-struct llog_handle { 
-        struct file *llh_file;
-        struct llog_header *llh_hdr;
-        struct llog_logid llh_id; 
+struct llog_handle {
+        struct file *lgh_file;
+        struct llog_index *lgh_hdr;
+        struct llog_logid lgh_lid;
 };
 
 /* cookie to find a log entry back */
-struct llog_cookie { 
-        struct llog_logid llc_id; 
-        __u64             llc_recno;
-};
-
-/* OST records for 
-   - orphans
-   - size adjustments
-   - open unlinked files
-*/
-
-struct llog_trans_rec { 
-        __u64             tr_op;
-        struct ll_fid     tr_fid;
-        obd_id            tr_oid;
+struct llog_cookie {
+        struct llog_logid lgc_lid;
+        __u64             lgc_recno;
 };
 
-
 /* exported api prototypes */
 int llog_add_record(struct llog_handle **, void *recbuf, int reclen,
                     struct llog_cookie *cookie);
@@ -82,7 +101,7 @@ int llog_clear_record(struct llog_handle *handle, __u32 recno);
 int llog_delete(struct llog_logid *id);
 
 /* internal api */
-int llog_id2handle(struct 
+int llog_id2handle(struct llog_logid *logid);
 
 #endif