Whamcloud - gitweb
merge b_devel into HEAD, which will become 0.7.3
[fs/lustre-release.git] / lustre / include / linux / lustre_log.h
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  *  Copyright (C) 2001 Cluster File Systems, Inc. <info@clusterfs.com>
5  *
6  *   This file is part of Lustre, http://www.lustre.org.
7  *
8  *   Lustre is free software; you can redistribute it and/or
9  *   modify it under the terms of version 2 of the GNU General Public
10  *   License as published by the Free Software Foundation.
11  *
12  *   Lustre is distributed in the hope that it will be useful,
13  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *   GNU General Public License for more details.
16  *
17  *   You should have received a copy of the GNU General Public License
18  *   along with Lustre; if not, write to the Free Software
19  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20  *
21  * Generic infrastructure for managing a collection of logs.
22  *
23  * These logs are used for:
24  *
25  * - orphan recovery: OST adds record on create
26  * - mtime/size consistency: the OST adds a record on first write
27  * - open/unlinked objects: OST adds a record on destroy
28  *
29  * - mds unlink log: the MDS adds an entry upon delete
30  *
31  * - raid1 replication log between OST's
32  * - MDS replication logs
33  */
34
35 #ifndef _LUSTRE_LOG_H
36 #define _LUSTRE_LOG_H
37
38 #include <linux/lustre_idl.h>
39
40 struct obd_trans_info;
41 struct obd_device;
42 struct lov_stripe_md;
43
44 /* In-memory descriptor for a log object or log catalog */
45 struct llog_handle {
46         struct list_head        lgh_list;
47         struct llog_cookie      lgh_cookie;
48         struct semaphore        lgh_lock;
49         struct obd_device      *lgh_obd;
50         void                   *lgh_hdr;
51         struct file            *lgh_file;
52         struct obd_uuid        *lgh_tgtuuid;
53         struct llog_handle     *lgh_current;
54         struct llog_handle     *(*lgh_log_create)(struct obd_device *obd);
55         struct llog_handle     *(*lgh_log_open)(struct obd_device *obd,
56                                                 struct llog_cookie *logcookie);
57         int                     (*lgh_log_close)(struct llog_handle *cathandle,
58                                                  struct llog_handle *loghandle);
59         int                     lgh_index;
60 };
61
62 extern int llog_add_record(struct llog_handle *cathandle,
63                            struct llog_trans_hdr *rec,
64                            struct llog_cookie *logcookies);
65
66 extern int llog_cancel_records(struct llog_handle *cathandle, int count,
67                                struct llog_cookie *cookies);
68
69 extern struct llog_handle *llog_alloc_handle(void);
70 extern void llog_free_handle(struct llog_handle *handle);
71 extern int llog_init_catalog(struct llog_handle *cathandle,
72                              struct obd_uuid *tgtuuid);
73 extern int llog_delete_log(struct llog_handle *cathandle,
74                            struct llog_handle *loghandle);
75 extern int llog_close_log(struct llog_handle *cathandle,
76                           struct llog_handle *loghandle);
77 extern struct llog_handle *llog_new_log(struct llog_handle *cathandle,
78                                         struct obd_uuid *tgtuuid);
79
80 #endif
81