diff options
Diffstat (limited to 'fs/afs/internal.h')
-rw-r--r-- | fs/afs/internal.h | 60 |
1 files changed, 45 insertions, 15 deletions
diff --git a/fs/afs/internal.h b/fs/afs/internal.h index 7c318666e436..51e3825b5ffb 100644 --- a/fs/afs/internal.h +++ b/fs/afs/internal.h | |||
@@ -207,13 +207,14 @@ struct afs_net { | |||
207 | atomic_t nr_superblocks; | 207 | atomic_t nr_superblocks; |
208 | 208 | ||
209 | /* Cell database */ | 209 | /* Cell database */ |
210 | struct list_head cells; | 210 | struct rb_root cells; |
211 | struct afs_cell *ws_cell; | 211 | struct afs_cell *ws_cell; |
212 | rwlock_t cells_lock; | 212 | struct work_struct cells_manager; |
213 | struct rw_semaphore cells_sem; | 213 | struct timer_list cells_timer; |
214 | wait_queue_head_t cells_freeable_wq; | 214 | atomic_t cells_outstanding; |
215 | seqlock_t cells_lock; | ||
215 | 216 | ||
216 | struct rw_semaphore proc_cells_sem; | 217 | spinlock_t proc_cells_lock; |
217 | struct list_head proc_cells; | 218 | struct list_head proc_cells; |
218 | 219 | ||
219 | /* Volume location database */ | 220 | /* Volume location database */ |
@@ -242,14 +243,26 @@ struct afs_net { | |||
242 | 243 | ||
243 | extern struct afs_net __afs_net;// Dummy AFS network namespace; TODO: replace with real netns | 244 | extern struct afs_net __afs_net;// Dummy AFS network namespace; TODO: replace with real netns |
244 | 245 | ||
246 | enum afs_cell_state { | ||
247 | AFS_CELL_UNSET, | ||
248 | AFS_CELL_ACTIVATING, | ||
249 | AFS_CELL_ACTIVE, | ||
250 | AFS_CELL_DEACTIVATING, | ||
251 | AFS_CELL_INACTIVE, | ||
252 | AFS_CELL_FAILED, | ||
253 | }; | ||
254 | |||
245 | /* | 255 | /* |
246 | * AFS cell record | 256 | * AFS cell record |
247 | */ | 257 | */ |
248 | struct afs_cell { | 258 | struct afs_cell { |
249 | atomic_t usage; | 259 | union { |
250 | struct list_head link; /* main cell list link */ | 260 | struct rcu_head rcu; |
251 | struct afs_net *net; /* The network namespace */ | 261 | struct rb_node net_node; /* Node in net->cells */ |
262 | }; | ||
263 | struct afs_net *net; | ||
252 | struct key *anonymous_key; /* anonymous user key for this cell */ | 264 | struct key *anonymous_key; /* anonymous user key for this cell */ |
265 | struct work_struct manager; /* Manager for init/deinit/dns */ | ||
253 | struct list_head proc_link; /* /proc cell list link */ | 266 | struct list_head proc_link; /* /proc cell list link */ |
254 | #ifdef CONFIG_AFS_FSCACHE | 267 | #ifdef CONFIG_AFS_FSCACHE |
255 | struct fscache_cookie *cache; /* caching cookie */ | 268 | struct fscache_cookie *cache; /* caching cookie */ |
@@ -262,12 +275,26 @@ struct afs_cell { | |||
262 | /* volume location record management */ | 275 | /* volume location record management */ |
263 | struct rw_semaphore vl_sem; /* volume management serialisation semaphore */ | 276 | struct rw_semaphore vl_sem; /* volume management serialisation semaphore */ |
264 | struct list_head vl_list; /* cell's active VL record list */ | 277 | struct list_head vl_list; /* cell's active VL record list */ |
278 | time64_t dns_expiry; /* Time AFSDB/SRV record expires */ | ||
279 | time64_t last_inactive; /* Time of last drop of usage count */ | ||
280 | atomic_t usage; | ||
281 | unsigned long flags; | ||
282 | #define AFS_CELL_FL_NOT_READY 0 /* The cell record is not ready for use */ | ||
283 | #define AFS_CELL_FL_NO_GC 1 /* The cell was added manually, don't auto-gc */ | ||
284 | #define AFS_CELL_FL_NOT_FOUND 2 /* Permanent DNS error */ | ||
285 | #define AFS_CELL_FL_DNS_FAIL 3 /* Failed to access DNS */ | ||
286 | enum afs_cell_state state; | ||
287 | short error; | ||
288 | |||
265 | spinlock_t vl_lock; /* vl_list lock */ | 289 | spinlock_t vl_lock; /* vl_list lock */ |
290 | |||
291 | /* VLDB server list. */ | ||
292 | seqlock_t vl_addrs_lock; | ||
266 | unsigned short vl_naddrs; /* number of VL servers in addr list */ | 293 | unsigned short vl_naddrs; /* number of VL servers in addr list */ |
267 | unsigned short vl_curr_svix; /* current server index */ | 294 | unsigned short vl_curr_svix; /* current server index */ |
268 | struct sockaddr_rxrpc vl_addrs[AFS_CELL_MAX_ADDRS]; /* cell VL server addresses */ | 295 | struct sockaddr_rxrpc vl_addrs[AFS_CELL_MAX_ADDRS]; /* cell VL server addresses */ |
269 | 296 | u8 name_len; /* Length of name */ | |
270 | char name[0]; /* cell name - must go last */ | 297 | char name[64 + 1]; /* Cell name, case-flattened and NUL-padded */ |
271 | }; | 298 | }; |
272 | 299 | ||
273 | /* | 300 | /* |
@@ -494,17 +521,20 @@ static inline struct afs_cb_interest *afs_get_cb_interest(struct afs_cb_interest | |||
494 | /* | 521 | /* |
495 | * cell.c | 522 | * cell.c |
496 | */ | 523 | */ |
497 | static inline struct afs_cell *afs_get_cell(struct afs_cell *cell) | 524 | static inline struct afs_cell *afs_get_cell(struct afs_cell *cell) |
498 | { | 525 | { |
499 | if (cell) | 526 | if (cell) |
500 | atomic_inc(&cell->usage); | 527 | atomic_inc(&cell->usage); |
501 | return cell; | 528 | return cell; |
502 | } | 529 | } |
503 | extern int afs_cell_init(struct afs_net *, char *); | 530 | |
504 | extern struct afs_cell *afs_cell_create(struct afs_net *, const char *, unsigned, char *, bool); | 531 | extern int afs_cell_init(struct afs_net *, const char *); |
505 | extern struct afs_cell *afs_cell_lookup(struct afs_net *, const char *, unsigned, bool); | 532 | extern struct afs_cell *afs_lookup_cell_rcu(struct afs_net *, const char *, unsigned); |
506 | extern struct afs_cell *afs_grab_cell(struct afs_cell *); | 533 | extern struct afs_cell *afs_lookup_cell(struct afs_net *, const char *, unsigned, |
534 | const char *, bool); | ||
507 | extern void afs_put_cell(struct afs_net *, struct afs_cell *); | 535 | extern void afs_put_cell(struct afs_net *, struct afs_cell *); |
536 | extern void afs_manage_cells(struct work_struct *); | ||
537 | extern void afs_cells_timer(struct timer_list *); | ||
508 | extern void __net_exit afs_cell_purge(struct afs_net *); | 538 | extern void __net_exit afs_cell_purge(struct afs_net *); |
509 | 539 | ||
510 | /* | 540 | /* |