diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /fs/afs/volume.h |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'fs/afs/volume.h')
-rw-r--r-- | fs/afs/volume.h | 142 |
1 files changed, 142 insertions, 0 deletions
diff --git a/fs/afs/volume.h b/fs/afs/volume.h new file mode 100644 index 000000000000..1e691889c4c9 --- /dev/null +++ b/fs/afs/volume.h | |||
@@ -0,0 +1,142 @@ | |||
1 | /* volume.h: AFS volume management | ||
2 | * | ||
3 | * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. | ||
4 | * Written by David Howells (dhowells@redhat.com) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the License, or (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #ifndef _LINUX_AFS_VOLUME_H | ||
13 | #define _LINUX_AFS_VOLUME_H | ||
14 | |||
15 | #include "types.h" | ||
16 | #include "fsclient.h" | ||
17 | #include "kafstimod.h" | ||
18 | #include "kafsasyncd.h" | ||
19 | #include "cache.h" | ||
20 | |||
21 | #define __packed __attribute__((packed)) | ||
22 | |||
23 | typedef enum { | ||
24 | AFS_VLUPD_SLEEP, /* sleeping waiting for update timer to fire */ | ||
25 | AFS_VLUPD_PENDING, /* on pending queue */ | ||
26 | AFS_VLUPD_INPROGRESS, /* op in progress */ | ||
27 | AFS_VLUPD_BUSYSLEEP, /* sleeping because server returned EBUSY */ | ||
28 | |||
29 | } __attribute__((packed)) afs_vlocation_upd_t; | ||
30 | |||
31 | /*****************************************************************************/ | ||
32 | /* | ||
33 | * entry in the cached volume location catalogue | ||
34 | */ | ||
35 | struct afs_cache_vlocation | ||
36 | { | ||
37 | uint8_t name[64]; /* volume name (lowercase, padded with NULs) */ | ||
38 | uint8_t nservers; /* number of entries used in servers[] */ | ||
39 | uint8_t vidmask; /* voltype mask for vid[] */ | ||
40 | uint8_t srvtmask[8]; /* voltype masks for servers[] */ | ||
41 | #define AFS_VOL_VTM_RW 0x01 /* R/W version of the volume is available (on this server) */ | ||
42 | #define AFS_VOL_VTM_RO 0x02 /* R/O version of the volume is available (on this server) */ | ||
43 | #define AFS_VOL_VTM_BAK 0x04 /* backup version of the volume is available (on this server) */ | ||
44 | |||
45 | afs_volid_t vid[3]; /* volume IDs for R/W, R/O and Bak volumes */ | ||
46 | struct in_addr servers[8]; /* fileserver addresses */ | ||
47 | time_t rtime; /* last retrieval time */ | ||
48 | }; | ||
49 | |||
50 | #ifdef AFS_CACHING_SUPPORT | ||
51 | extern struct cachefs_index_def afs_vlocation_cache_index_def; | ||
52 | #endif | ||
53 | |||
54 | /*****************************************************************************/ | ||
55 | /* | ||
56 | * volume -> vnode hash table entry | ||
57 | */ | ||
58 | struct afs_cache_vhash | ||
59 | { | ||
60 | afs_voltype_t vtype; /* which volume variation */ | ||
61 | uint8_t hash_bucket; /* which hash bucket this represents */ | ||
62 | } __attribute__((packed)); | ||
63 | |||
64 | #ifdef AFS_CACHING_SUPPORT | ||
65 | extern struct cachefs_index_def afs_volume_cache_index_def; | ||
66 | #endif | ||
67 | |||
68 | /*****************************************************************************/ | ||
69 | /* | ||
70 | * AFS volume location record | ||
71 | */ | ||
72 | struct afs_vlocation | ||
73 | { | ||
74 | atomic_t usage; | ||
75 | struct list_head link; /* link in cell volume location list */ | ||
76 | struct afs_timer timeout; /* decaching timer */ | ||
77 | struct afs_cell *cell; /* cell to which volume belongs */ | ||
78 | #ifdef AFS_CACHING_SUPPORT | ||
79 | struct cachefs_cookie *cache; /* caching cookie */ | ||
80 | #endif | ||
81 | struct afs_cache_vlocation vldb; /* volume information DB record */ | ||
82 | struct afs_volume *vols[3]; /* volume access record pointer (index by type) */ | ||
83 | rwlock_t lock; /* access lock */ | ||
84 | unsigned long read_jif; /* time at which last read from vlserver */ | ||
85 | struct afs_timer upd_timer; /* update timer */ | ||
86 | struct afs_async_op upd_op; /* update operation */ | ||
87 | afs_vlocation_upd_t upd_state; /* update state */ | ||
88 | unsigned short upd_first_svix; /* first server index during update */ | ||
89 | unsigned short upd_curr_svix; /* current server index during update */ | ||
90 | unsigned short upd_rej_cnt; /* ENOMEDIUM count during update */ | ||
91 | unsigned short upd_busy_cnt; /* EBUSY count during update */ | ||
92 | unsigned short valid; /* T if valid */ | ||
93 | }; | ||
94 | |||
95 | extern int afs_vlocation_lookup(struct afs_cell *cell, | ||
96 | const char *name, | ||
97 | unsigned namesz, | ||
98 | struct afs_vlocation **_vlocation); | ||
99 | |||
100 | #define afs_get_vlocation(V) do { atomic_inc(&(V)->usage); } while(0) | ||
101 | |||
102 | extern void afs_put_vlocation(struct afs_vlocation *vlocation); | ||
103 | extern void afs_vlocation_do_timeout(struct afs_vlocation *vlocation); | ||
104 | |||
105 | /*****************************************************************************/ | ||
106 | /* | ||
107 | * AFS volume access record | ||
108 | */ | ||
109 | struct afs_volume | ||
110 | { | ||
111 | atomic_t usage; | ||
112 | struct afs_cell *cell; /* cell to which belongs (unrefd ptr) */ | ||
113 | struct afs_vlocation *vlocation; /* volume location */ | ||
114 | #ifdef AFS_CACHING_SUPPORT | ||
115 | struct cachefs_cookie *cache; /* caching cookie */ | ||
116 | #endif | ||
117 | afs_volid_t vid; /* volume ID */ | ||
118 | afs_voltype_t __packed type; /* type of volume */ | ||
119 | char type_force; /* force volume type (suppress R/O -> R/W) */ | ||
120 | unsigned short nservers; /* number of server slots filled */ | ||
121 | unsigned short rjservers; /* number of servers discarded due to -ENOMEDIUM */ | ||
122 | struct afs_server *servers[8]; /* servers on which volume resides (ordered) */ | ||
123 | struct rw_semaphore server_sem; /* lock for accessing current server */ | ||
124 | }; | ||
125 | |||
126 | extern int afs_volume_lookup(const char *name, | ||
127 | struct afs_cell *cell, | ||
128 | int rwpath, | ||
129 | struct afs_volume **_volume); | ||
130 | |||
131 | #define afs_get_volume(V) do { atomic_inc(&(V)->usage); } while(0) | ||
132 | |||
133 | extern void afs_put_volume(struct afs_volume *volume); | ||
134 | |||
135 | extern int afs_volume_pick_fileserver(struct afs_volume *volume, | ||
136 | struct afs_server **_server); | ||
137 | |||
138 | extern int afs_volume_release_fileserver(struct afs_volume *volume, | ||
139 | struct afs_server *server, | ||
140 | int result); | ||
141 | |||
142 | #endif /* _LINUX_AFS_VOLUME_H */ | ||