13
#include "glfs-internal.h"
14
#include "glfs-mem-types.h"
15
#include "gfapi-messages.h"
18
graph_setup(struct glfs *fs, glusterfs_graph_t *graph)
20
xlator_t *new_subvol = NULL;
21
xlator_t *old_subvol = NULL;
22
inode_table_t *itable = NULL;
25
new_subvol = graph->top;
30
pthread_mutex_lock(&fs->mutex);
32
if (new_subvol->switched || new_subvol == fs->active_subvol ||
33
new_subvol == fs->next_subvol || new_subvol == fs->mip_subvol) {
39
if (!new_subvol->itable) {
40
itable = inode_table_new(131072, new_subvol, 0, 0);
47
new_subvol->itable = itable;
50
old_subvol = fs->next_subvol;
51
fs->next_subvol = new_subvol;
52
fs->next_subvol->winds++;
56
pthread_mutex_unlock(&fs->mutex);
60
glfs_subvol_done(fs, old_subvol);
66
notify(xlator_t *this, int event, void *data, ...)
68
glusterfs_graph_t *graph = NULL;
69
struct glfs *fs = NULL;
75
case GF_EVENT_GRAPH_NEW:
76
gf_smsg(this->name, GF_LOG_INFO, 0, API_MSG_NEW_GRAPH,
78
uuid_utoa((unsigned char *)graph->graph_uuid), "id=%d",
81
case GF_EVENT_CHILD_UP:
82
pthread_mutex_lock(&fs->mutex);
86
pthread_mutex_unlock(&fs->mutex);
87
graph_setup(fs, graph);
88
glfs_init_done(fs, 0);
90
case GF_EVENT_CHILD_DOWN:
91
pthread_mutex_lock(&fs->mutex);
94
pthread_cond_broadcast(&fs->child_down_cond);
96
pthread_mutex_unlock(&fs->mutex);
97
glfs_init_done(fs, 1);
99
case GF_EVENT_CHILD_CONNECTING:
101
case GF_EVENT_UPCALL:
102
glfs_process_upcall_event(fs, data);
105
gf_msg_debug(this->name, 0, "got notify event %d", event);
113
mem_acct_init(xlator_t *this)
120
ret = xlator_mem_acct_init(this, glfs_mt_end + 1);
122
gf_smsg(this->name, GF_LOG_ERROR, ENOMEM, API_MSG_MEM_ACCT_INIT_FAILED,
143
glfs_forget(xlator_t *this, inode_t *inode)
149
glfs_release(xlator_t *this, fd_t *fd)
155
glfs_releasedir(xlator_t *this, fd_t *fd)
160
struct xlator_dumpops dumpops;
162
struct xlator_fops fops;
164
struct xlator_cbks cbks = {
165
.forget = glfs_forget,
166
.release = glfs_release,
167
.releasedir = glfs_releasedir,
170
xlator_api_t xlator_api = {
174
.mem_acct_init = mem_acct_init,
179
.identifier = "glfs-api",
180
.category = GF_MAINTAINED,