Whamcloud - gitweb
LU-1146 build: batch update copyright messages
[fs/lustre-release.git] / lustre / mdd / mdd_trans.c
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  * GPL HEADER START
5  *
6  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License version 2 only,
10  * as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License version 2 for more details (a copy is included
16  * in the LICENSE file that accompanied this code).
17  *
18  * You should have received a copy of the GNU General Public License
19  * version 2 along with this program; If not, see
20  * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
21  *
22  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
23  * CA 95054 USA or visit www.sun.com if you need additional information or
24  * have any questions.
25  *
26  * GPL HEADER END
27  */
28 /*
29  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
30  * Use is subject to license terms.
31  *
32  * Copyright (c) 2011, 2012, Whamcloud, Inc.
33  */
34 /*
35  * This file is part of Lustre, http://www.lustre.org/
36  * Lustre is a trademark of Sun Microsystems, Inc.
37  *
38  * lustre/mdd/mdd_trans.c
39  *
40  * Lustre Metadata Server (mdd) routines
41  *
42  * Author: Wang Di <wangdi@clusterfs.com>
43  */
44
45 #ifndef EXPORT_SYMTAB
46 # define EXPORT_SYMTAB
47 #endif
48 #define DEBUG_SUBSYSTEM S_MDS
49
50 #include <linux/module.h>
51 #ifdef HAVE_EXT4_LDISKFS
52 #include <ldiskfs/ldiskfs_jbd2.h>
53 #else
54 #include <linux/jbd.h>
55 #endif
56 #include <obd.h>
57 #include <obd_class.h>
58 #include <lustre_ver.h>
59 #include <obd_support.h>
60 #include <lprocfs_status.h>
61
62 #ifdef HAVE_EXT4_LDISKFS
63 #include <ldiskfs/ldiskfs.h>
64 #else
65 #include <linux/ldiskfs_fs.h>
66 #endif
67 #include <lustre_mds.h>
68 #include <lustre/lustre_idl.h>
69
70 #include "mdd_internal.h"
71
72 int mdd_txn_stop_cb(const struct lu_env *env, struct thandle *txn,
73                     void *cookie)
74 {
75         struct mdd_device *mdd = cookie;
76         struct obd_device *obd = mdd2obd_dev(mdd);
77
78         LASSERT(obd);
79         return mds_lov_write_objids(obd);
80 }
81
82 struct thandle *mdd_trans_create(const struct lu_env *env,
83                                  struct mdd_device *mdd)
84 {
85         return mdd_child_ops(mdd)->dt_trans_create(env, mdd->mdd_child);
86 }
87
88 int mdd_trans_start(const struct lu_env *env, struct mdd_device *mdd,
89                     struct thandle *th)
90 {
91         return mdd_child_ops(mdd)->dt_trans_start(env, mdd->mdd_child, th);
92 }
93
94 void mdd_trans_stop(const struct lu_env *env, struct mdd_device *mdd,
95                     int result, struct thandle *handle)
96 {
97         handle->th_result = result;
98         mdd_child_ops(mdd)->dt_trans_stop(env, handle);
99 }