1 #ifndef __OBD_SNAP_SUPP_H
2 #define __OBD_SNAP_SUPP_H
4 * Copyright (C) 2001 Cluster File Systems, Inc.
6 * This code is issued under the GNU General Public License.
7 * See the file COPYING in this distribution
10 /* What we use to point to IDs in the obdmd data for snapshots. If we use
11 * obd_id (8 bytes) instead of ino_t (4 bytes), we halve the number of
12 * available snapshot slots (14 in 56 bytes vs. 7 in 56 bytes until we
13 * increase the size of OBD_OBDMDSZ).
15 typedef obd_id snap_id;
17 /* maximum number of snapshot tables we maintain in the kernel */
18 #define SNAP_MAX_TABLES 8
20 /* maximum number of snapshots per device
21 must fit in "o_obdmd" area of struct obdo */
22 #define SNAP_MAX ((OBD_OBDMDSZ - sizeof(uint32_t))/sizeof(snap_id))
26 snap_id m_ids[SNAP_MAX]; /* id of snaps; slot 0 has current id */
30 /* if time is 0 this designates the "current" snapshot, i.e.
38 /* snap ioctl data for attach: current always in first slot of this array */
39 struct snap_obd_data {
40 int snap_dev; /* which device contains the data */
41 unsigned int snap_index;/* which snapshot is ours */
42 unsigned int snap_table;/* which table do we use */
46 /* snap ioctl data for table fiddling */
47 struct snap_table_data {
48 int tblcmd_no; /* which table */
49 unsigned int tblcmd_count; /* how many snaps */
50 struct snap tblcmd_snaps[SNAP_MAX]; /* sorted times! */
56 unsigned int tbl_count; /* how many snapshots exist in this table*/
57 int tbl_used; /* bitmap of snaps in use by a device */
58 time_t tbl_times[SNAP_MAX];
59 int tbl_index[SNAP_MAX];
62 struct snap_iterdata {
63 struct lustre_handle *conn;
64 struct lustre_handle *ch_conn;
72 inline struct lustre_handle *child_conn(struct lustre_handle *conn);
73 int snap_deleteobj(obd_id id, obd_gr group, void *data);
74 int snap_restoreobj(obd_id id, obd_gr group, void *data);
75 int snap_printobj(obd_id id, obd_gr group, void *data);
76 int snap_iocontrol(unsigned int cmd, struct lustre_handle *conn, int len, void *karg, void *uarg);
78 /* In the future, this function may have to deal with offsets into the obdmd.
79 * Currently, we assume we have the whole obdmd struct.
81 static __inline__ struct snap_md *snap_obdmd(struct obdo *oa)
83 return ((struct snap_md *)(&oa->o_obdmd));