Whamcloud - gitweb
Simple journal abstractions for the no-journal (ext2) and ext3 cases.
authoradilger <adilger>
Wed, 27 Mar 2002 00:46:29 +0000 (00:46 +0000)
committeradilger <adilger>
Wed, 27 Mar 2002 00:46:29 +0000 (00:46 +0000)
lustre/mds/mds_ext3.c [new file with mode: 0644]
lustre/mds/mds_null.c [new file with mode: 0644]

diff --git a/lustre/mds/mds_ext3.c b/lustre/mds/mds_ext3.c
new file mode 100644 (file)
index 0000000..7f14e30
--- /dev/null
@@ -0,0 +1,51 @@
+/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
+ * vim:expandtab:shiftwidth=8:tabstop=8:
+ *
+ *  linux/mds/mds_ext3.c
+ *
+ *  Lustre Metadata Server (mds) journal abstraction routines
+ *
+ *  Copyright (C) 2002  Cluster File Systems, Inc.
+ *  author: Andreas Dilger <adilger@clusterfs.com>
+ *
+ *  This code is issued under the GNU General Public License.
+ *  See the file COPYING in this distribution
+ *
+ */
+
+#define DEBUG_SUBSYSTEM S_MDS
+
+#include <linux/fs.h>
+#include <linux/jbd.h>
+#include <linux/ext3_fs.h>
+#include <linux/ext3_jbd.h>
+#include <linux/lustre_mds.h>
+
+/*
+ * We don't currently need any additional blocks for rmdir and
+ * unlink transactions because we are storing the OST oa_id inside
+ * the inode (which we will be changing anyways as part of this
+ * transaction).  When we store the oa_id in an EA (which may be
+ * in an external block) we need to increase nblocks by 1.
+ */
+static void *mds_ext3_start(struct inode *inode, int op)
+{
+        int nblocks = 0;
+
+        switch(op) {
+        case MDS_JOP_RMDIR:
+        case MDS_JOP_UNLINK:     nblocks = EXT3_DELETE_TRANS_BLOCKS; break;
+        }
+
+        return journal_start(EXT3_JOURNAL(inode), nblocks);
+}
+
+static int mds_ext3_stop(void *handle, struct inode *inode)
+{
+        return journal_stop((handle_t *)handle);
+}
+
+struct mds_journal_operations mds_ext3_journal_ops = {
+        tr_start:       mds_ext3_start,
+        tr_commit:      mds_ext3_stop,
+};
diff --git a/lustre/mds/mds_null.c b/lustre/mds/mds_null.c
new file mode 100644 (file)
index 0000000..b65605d
--- /dev/null
@@ -0,0 +1,34 @@
+/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
+ * vim:expandtab:shiftwidth=8:tabstop=8:
+ *
+ *  linux/mds/mds_null.c
+ *
+ *  Lustre Metadata Server (mds) journal abstraction routines
+ *
+ *  Copyright (C) 2002  Cluster File Systems, Inc.
+ *  author: Andreas Dilger <adilger@clusterfs.com>
+ *
+ *  This code is issued under the GNU General Public License.
+ *  See the file COPYING in this distribution
+ *
+ */
+
+#define DEBUG_SUBSYSTEM S_MDS
+
+#include <linux/fs.h>
+#include <linux/lustre_mds.h>
+
+static void *mds_null_start(struct inode *inode, int nblocks)
+{
+        return 0;
+}
+
+static int mds_null_stop(void *handle, struct inode *inode)
+{
+        return 0;
+}
+
+struct mds_journal_operations mds_null_journal_ops = {
+        tr_start:       mds_null_start,
+        tr_commit:      mds_null_stop,
+};