Whamcloud - gitweb
Simple journal abstractions for the no-journal (ext2) and ext3 cases.
[fs/lustre-release.git] / lustre / mds / mds_ext3.c
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  *  linux/mds/mds_ext3.c
5  *
6  *  Lustre Metadata Server (mds) journal abstraction routines
7  *
8  *  Copyright (C) 2002  Cluster File Systems, Inc.
9  *  author: Andreas Dilger <adilger@clusterfs.com>
10  *
11  *  This code is issued under the GNU General Public License.
12  *  See the file COPYING in this distribution
13  *
14  */
15
16 #define DEBUG_SUBSYSTEM S_MDS
17
18 #include <linux/fs.h>
19 #include <linux/jbd.h>
20 #include <linux/ext3_fs.h>
21 #include <linux/ext3_jbd.h>
22 #include <linux/lustre_mds.h>
23
24 /*
25  * We don't currently need any additional blocks for rmdir and
26  * unlink transactions because we are storing the OST oa_id inside
27  * the inode (which we will be changing anyways as part of this
28  * transaction).  When we store the oa_id in an EA (which may be
29  * in an external block) we need to increase nblocks by 1.
30  */
31 static void *mds_ext3_start(struct inode *inode, int op)
32 {
33         int nblocks = 0;
34
35         switch(op) {
36         case MDS_JOP_RMDIR:
37         case MDS_JOP_UNLINK:     nblocks = EXT3_DELETE_TRANS_BLOCKS; break;
38         }
39
40         return journal_start(EXT3_JOURNAL(inode), nblocks);
41 }
42
43 static int mds_ext3_stop(void *handle, struct inode *inode)
44 {
45         return journal_stop((handle_t *)handle);
46 }
47
48 struct mds_journal_operations mds_ext3_journal_ops = {
49         tr_start:       mds_ext3_start,
50         tr_commit:      mds_ext3_stop,
51 };