Whamcloud - gitweb
- make HEAD from b_post_cmd3
[fs/lustre-release.git] / lustre / osd / osd_oi.h
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  *  lustre/osd/osd_oi.h
5  *  OSD Object Index
6  *
7  *  Copyright (c) 2006 Cluster File Systems, Inc.
8  *   Author: Nikita Danilov <nikita@clusterfs.com>
9  *
10  *   This file is part of the Lustre file system, http://www.lustre.org
11  *   Lustre is a trademark of Cluster File Systems, Inc.
12  *
13  *   You may have signed or agreed to another license before downloading
14  *   this software.  If so, you are bound by the terms and conditions
15  *   of that agreement, and the following does not apply to you.  See the
16  *   LICENSE file included with this distribution for more information.
17  *
18  *   If you did not agree to a different license, then this copy of Lustre
19  *   is open source software; you can redistribute it and/or modify it
20  *   under the terms of version 2 of the GNU General Public License as
21  *   published by the Free Software Foundation.
22  *
23  *   In either case, Lustre is distributed in the hope that it will be
24  *   useful, but WITHOUT ANY WARRANTY; without even the implied warranty
25  *   of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26  *   license text for more details.
27  */
28 /*
29  * Object Index (oi) service runs in the bottom layer of server stack. In
30  * translates fid local to this service to the storage cookie that uniquely
31  * and efficiently identifies object (inode) of the underlying file system.
32  */
33
34 #ifndef _OSD_OI_H
35 #define _OSD_OI_H
36
37 #if defined(__KERNEL__)
38
39 /* struct rw_semaphore */
40 #include <linux/rwsem.h>
41 #include <lu_object.h>
42
43 struct lu_fid;
44 struct osd_thread_info;
45 struct lu_site;
46 struct thandle;
47
48 struct dt_device;
49
50 enum {
51         OSD_OI_FID_SMALL,
52         OSD_OI_FID_OTHER,
53         OSD_OI_FID_NR
54 };
55
56 /*
57  * Object Index (oi) instance.
58  */
59 struct osd_oi {
60         /*
61          * underlying index object, where fid->id mapping in stored.
62          */
63         struct dt_object *oi_dir[OSD_OI_FID_NR];
64 };
65
66 /*
67  * Storage cookie. Datum uniquely identifying inode on the underlying file
68  * system.
69  *
70  * XXX Currently this is ext2/ext3/ldiskfs specific thing. In the future this
71  * should be generalized to work with other local file systems.
72  */
73 struct osd_inode_id {
74         __u32 oii_ino; /* inode number */
75         __u32 oii_gen; /* inode generation */
76 };
77
78 int  osd_oi_init(struct osd_thread_info *info,
79                  struct osd_oi *oi, struct dt_device *dev);
80 void osd_oi_fini(struct osd_thread_info *info, struct osd_oi *oi);
81
82 int  osd_oi_lookup(struct osd_thread_info *info, struct osd_oi *oi,
83                    const struct lu_fid *fid, struct osd_inode_id *id);
84 int  osd_oi_insert(struct osd_thread_info *info, struct osd_oi *oi,
85                    const struct lu_fid *fid, const struct osd_inode_id *id,
86                    struct thandle *th);
87 int  osd_oi_delete(struct osd_thread_info *info,
88                    struct osd_oi *oi, const struct lu_fid *fid,
89                    struct thandle *th);
90
91 #endif /* __KERNEL__ */
92 #endif /* _OSD_OI_H */