glusterfs  8.2
About: GlusterFS is a network/cluster filesystem. The storage server (or each in a cluster) runs glusterfsd and the clients use mount command or glusterfs client to mount the exported filesystem. Release series 8.x (latest version).
  Fossies Dox: glusterfs-8.2.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

gidcache.h
Go to the documentation of this file.
1 /*
2  Copyright (c) 2008-2012 Red Hat, Inc. <http://www.redhat.com>
3  This file is part of GlusterFS.
4 
5  This file is licensed to you under your choice of the GNU Lesser
6  General Public License, version 3 or any later version (LGPLv3 or
7  later), or the GNU General Public License, version 2 (GPLv2), in all
8  cases as published by the Free Software Foundation.
9 */
10 
11 #ifndef __GIDCACHE_H__
12 #define __GIDCACHE_H__
13 
14 #include "glusterfs/glusterfs.h"
15 #include "glusterfs/locking.h"
16 
17 /*
18  * TBD: make the cache size tunable
19  *
20  * The current size represents a pretty trivial amount of memory, and should
21  * provide good hit rates even for quite busy systems. If we ever want to
22  * support really large cache sizes, we'll need to do dynamic allocation
23  * instead of just defining an array within a private structure. It doesn't make
24  * a whole lot of sense to change the associativity, because it won't improve
25  * hit rates all that much and will increase the maintenance cost as we have
26  * to scan more entries with every lookup/update.
27  */
28 
29 #define AUX_GID_CACHE_ASSOC 4
30 #define AUX_GID_CACHE_BUCKETS 256
31 #define AUX_GID_CACHE_SIZE (AUX_GID_CACHE_ASSOC * AUX_GID_CACHE_BUCKETS)
32 
33 typedef struct {
34  uint64_t gl_id;
35  uint64_t gl_uid;
36  uint64_t gl_gid;
37  int gl_count;
38  gid_t *gl_list;
39  time_t gl_deadline;
40 } gid_list_t;
41 
42 typedef struct {
44  uint32_t gc_max_age;
45  unsigned int gc_nbuckets;
47 } gid_cache_t;
48 
49 int
50 gid_cache_init(gid_cache_t *, uint32_t);
51 int
52 gid_cache_reconf(gid_cache_t *, uint32_t);
53 const gid_list_t *
54 gid_cache_lookup(gid_cache_t *, uint64_t, uint64_t, uint64_t);
55 void
57 int
59 
60 #endif /* __GIDCACHE_H__ */
gid_cache_init
int gid_cache_init(gid_cache_t *, uint32_t)
Definition: gidcache.c:25
glusterfs.h
gid_cache_release
void gid_cache_release(gid_cache_t *, const gid_list_t *)
Definition: gidcache.c:112
gid_cache_reconf
int gid_cache_reconf(gid_cache_t *, uint32_t)
Definition: gidcache.c:42
gid_list_t::gl_id
uint64_t gl_id
Definition: gidcache.h:34
gid_list_t::gl_deadline
time_t gl_deadline
Definition: gidcache.h:39
gid_list_t::gl_gid
uint64_t gl_gid
Definition: gidcache.h:36
gf_lock_t
pthread_mutex_t gf_lock_t
Definition: locking.h:74
gid_list_t
Definition: gidcache.h:33
gid_cache_t::gc_nbuckets
unsigned int gc_nbuckets
Definition: gidcache.h:45
gid_cache_t::gc_lock
gf_lock_t gc_lock
Definition: gidcache.h:43
gid_cache_t::gc_max_age
uint32_t gc_max_age
Definition: gidcache.h:44
gid_cache_lookup
const gid_list_t * gid_cache_lookup(gid_cache_t *, uint64_t, uint64_t, uint64_t)
Definition: gidcache.c:60
gid_cache_t
Definition: gidcache.h:42
locking.h
AUX_GID_CACHE_SIZE
#define AUX_GID_CACHE_SIZE
Definition: gidcache.h:31
gid_list_t::gl_count
int gl_count
Definition: gidcache.h:37
gid_list_t::gl_list
gid_t * gl_list
Definition: gidcache.h:38
gid_cache_add
int gid_cache_add(gid_cache_t *, gid_list_t *)
Definition: gidcache.c:122
gid_list_t::gl_uid
uint64_t gl_uid
Definition: gidcache.h:35