Bug Summary

File:xlators/cluster/afr/src/pump.c
Location:line 635, column 17
Description:Value stored to 'ret' is never read

Annotated Source Code

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#include <unistd.h>
12#include <sys/time.h>
13#include <stdlib.h>
14#include <fnmatch.h>
15
16#ifndef _CONFIG_H
17#define _CONFIG_H
18#include "config.h"
19#endif
20
21#include "afr-common.c"
22#include "defaults.c"
23#include "glusterfs.h"
24
25static uint64_t pump_pid = 0;
26static inline void
27pump_fill_loc_info (loc_t *loc, struct iatt *iatt, struct iatt *parent)
28{
29 afr_update_loc_gfids (loc, iatt, parent);
30 uuid_copy (loc->inode->gfid, iatt->ia_gfid);
31}
32
33static int
34pump_mark_start_pending (xlator_t *this)
35{
36 afr_private_t *priv = NULL((void*)0);
37 pump_private_t *pump_priv = NULL((void*)0);
38
39 priv = this->private;
40 pump_priv = priv->pump_private;
41
42 pump_priv->pump_start_pending = 1;
43
44 return 0;
45}
46
47static int
48is_pump_start_pending (xlator_t *this)
49{
50 afr_private_t *priv = NULL((void*)0);
51 pump_private_t *pump_priv = NULL((void*)0);
52
53 priv = this->private;
54 pump_priv = priv->pump_private;
55
56 return (pump_priv->pump_start_pending);
57}
58
59static int
60pump_remove_start_pending (xlator_t *this)
61{
62 afr_private_t *priv = NULL((void*)0);
63 pump_private_t *pump_priv = NULL((void*)0);
64
65 priv = this->private;
66 pump_priv = priv->pump_private;
67
68 pump_priv->pump_start_pending = 0;
69
70 return 0;
71}
72
73static pump_state_t
74pump_get_state ()
75{
76 xlator_t *this = NULL((void*)0);
77 afr_private_t *priv = NULL((void*)0);
78 pump_private_t *pump_priv = NULL((void*)0);
79
80 pump_state_t ret;
81
82 this = THIS(*__glusterfs_this_location());
83 priv = this->private;
84 pump_priv = priv->pump_private;
85
86 LOCK (&pump_priv->pump_state_lock)pthread_spin_lock (&pump_priv->pump_state_lock);
87 {
88 ret = pump_priv->pump_state;
89 }
90 UNLOCK (&pump_priv->pump_state_lock)pthread_spin_unlock (&pump_priv->pump_state_lock);
91
92 return ret;
93}
94
95int
96pump_change_state (xlator_t *this, pump_state_t state)
97{
98 afr_private_t *priv = NULL((void*)0);
99 pump_private_t *pump_priv = NULL((void*)0);
100
101 pump_state_t state_old;
102 pump_state_t state_new;
103
104
105 priv = this->private;
106 pump_priv = priv->pump_private;
107
108 GF_ASSERT (pump_priv)do { if (!(pump_priv)) { do { do { if (0) printf ("Assertion failed: "
"pump_priv"); } while (0); _gf_log_callingfn ("", "pump.c", __FUNCTION__
, 108, GF_LOG_ERROR, "Assertion failed: " "pump_priv"); } while
(0); } } while (0)
;
109
110 LOCK (&pump_priv->pump_state_lock)pthread_spin_lock (&pump_priv->pump_state_lock);
111 {
112 state_old = pump_priv->pump_state;
113 state_new = state;
114
115 pump_priv->pump_state = state;
116
117 }
118 UNLOCK (&pump_priv->pump_state_lock)pthread_spin_unlock (&pump_priv->pump_state_lock);
119
120 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("Pump changing state from %d to %d",
state_old, state_new); } while (0); _gf_log (this->name, "pump.c"
, __FUNCTION__, 123, GF_LOG_DEBUG, "Pump changing state from %d to %d"
, state_old, state_new); } while (0)
121 "Pump changing state from %d to %d",do { do { if (0) printf ("Pump changing state from %d to %d",
state_old, state_new); } while (0); _gf_log (this->name, "pump.c"
, __FUNCTION__, 123, GF_LOG_DEBUG, "Pump changing state from %d to %d"
, state_old, state_new); } while (0)
122 state_old,do { do { if (0) printf ("Pump changing state from %d to %d",
state_old, state_new); } while (0); _gf_log (this->name, "pump.c"
, __FUNCTION__, 123, GF_LOG_DEBUG, "Pump changing state from %d to %d"
, state_old, state_new); } while (0)
123 state_new)do { do { if (0) printf ("Pump changing state from %d to %d",
state_old, state_new); } while (0); _gf_log (this->name, "pump.c"
, __FUNCTION__, 123, GF_LOG_DEBUG, "Pump changing state from %d to %d"
, state_old, state_new); } while (0)
;
124
125 return 0;
126}
127
128static int
129pump_set_resume_path (xlator_t *this, const char *path)
130{
131 int ret = 0;
132
133 afr_private_t *priv = NULL((void*)0);
134 pump_private_t *pump_priv = NULL((void*)0);
135
136 priv = this->private;
137 pump_priv = priv->pump_private;
138
139 GF_ASSERT (pump_priv)do { if (!(pump_priv)) { do { do { if (0) printf ("Assertion failed: "
"pump_priv"); } while (0); _gf_log_callingfn ("", "pump.c", __FUNCTION__
, 139, GF_LOG_ERROR, "Assertion failed: " "pump_priv"); } while
(0); } } while (0)
;
140
141 LOCK (&pump_priv->resume_path_lock)pthread_spin_lock (&pump_priv->resume_path_lock);
142 {
143 strncpy (pump_priv->resume_path, path, strlen (path) + 1);
144 }
145 UNLOCK (&pump_priv->resume_path_lock)pthread_spin_unlock (&pump_priv->resume_path_lock);
146
147 return ret;
148}
149
150static int
151pump_save_path (xlator_t *this, const char *path)
152{
153 afr_private_t *priv = NULL((void*)0);
154 pump_state_t state;
155 dict_t *dict = NULL((void*)0);
156 loc_t loc = {0};
157 int dict_ret = 0;
158 int ret = -1;
159
160 state = pump_get_state ();
161 if (state == PUMP_STATE_RESUME)
162 return 0;
163
164 priv = this->private;
165
166 GF_ASSERT (priv->root_inode)do { if (!(priv->root_inode)) { do { do { if (0) printf ("Assertion failed: "
"priv->root_inode"); } while (0); _gf_log_callingfn ("", "pump.c"
, __FUNCTION__, 166, GF_LOG_ERROR, "Assertion failed: " "priv->root_inode"
); } while (0); } } while (0)
;
167
168 afr_build_root_loc (this, &loc);
169
170 dict = dict_new ();
171 dict_ret = dict_set_str (dict, PUMP_PATH"trusted.glusterfs.pump-path", (char *)path);
172 if (dict_ret)
173 gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("%s: failed to set the key %s", path
, "trusted.glusterfs.pump-path"); } while (0); _gf_log (this->
name, "pump.c", __FUNCTION__, 174, GF_LOG_WARNING, "%s: failed to set the key %s"
, path, "trusted.glusterfs.pump-path"); } while (0)
174 "%s: failed to set the key %s", path, PUMP_PATH)do { do { if (0) printf ("%s: failed to set the key %s", path
, "trusted.glusterfs.pump-path"); } while (0); _gf_log (this->
name, "pump.c", __FUNCTION__, 174, GF_LOG_WARNING, "%s: failed to set the key %s"
, path, "trusted.glusterfs.pump-path"); } while (0)
;
175
176 ret = syncop_setxattr (PUMP_SOURCE_CHILD (this)(this->children->xlator), &loc, dict, 0);
177
178 if (ret < 0) {
179 gf_log (this->name, GF_LOG_INFO,do { do { if (0) printf ("setxattr failed - could not save path=%s"
, path); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 180, GF_LOG_INFO, "setxattr failed - could not save path=%s"
, path); } while (0)
180 "setxattr failed - could not save path=%s", path)do { do { if (0) printf ("setxattr failed - could not save path=%s"
, path); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 180, GF_LOG_INFO, "setxattr failed - could not save path=%s"
, path); } while (0)
;
181 } else {
182 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("setxattr succeeded - saved path=%s"
, path); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 183, GF_LOG_DEBUG, "setxattr succeeded - saved path=%s", path
); } while (0)
183 "setxattr succeeded - saved path=%s", path)do { do { if (0) printf ("setxattr succeeded - saved path=%s"
, path); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 183, GF_LOG_DEBUG, "setxattr succeeded - saved path=%s", path
); } while (0)
;
184 }
185
186 dict_unref (dict);
187
188 loc_wipe (&loc);
189 return 0;
190}
191
192static int
193pump_check_and_update_status (xlator_t *this)
194{
195 pump_state_t state;
196 int ret = -1;
197
198 state = pump_get_state ();
199
200 switch (state) {
201
202 case PUMP_STATE_RESUME:
203 case PUMP_STATE_RUNNING:
204 {
205 ret = 0;
206 break;
207 }
208 case PUMP_STATE_PAUSE:
209 {
210 ret = -1;
211 break;
212 }
213 case PUMP_STATE_ABORT:
214 {
215 pump_save_path (this, "/");
216 ret = -1;
217 break;
218 }
219 default:
220 {
221 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("Unknown pump state"); } while (0); _gf_log
(this->name, "pump.c", __FUNCTION__, 222, GF_LOG_DEBUG, "Unknown pump state"
); } while (0)
222 "Unknown pump state")do { do { if (0) printf ("Unknown pump state"); } while (0); _gf_log
(this->name, "pump.c", __FUNCTION__, 222, GF_LOG_DEBUG, "Unknown pump state"
); } while (0)
;
223 ret = -1;
224 break;
225 }
226
227 }
228
229 return ret;
230}
231
232static const char *
233pump_get_resume_path (xlator_t *this)
234{
235 afr_private_t *priv = NULL((void*)0);
236 pump_private_t *pump_priv = NULL((void*)0);
237
238 const char *resume_path = NULL((void*)0);
239
240 priv = this->private;
241 pump_priv = priv->pump_private;
242
243 resume_path = pump_priv->resume_path;
244
245 return resume_path;
246}
247
248static int
249pump_update_resume_state (xlator_t *this, const char *path)
250{
251 pump_state_t state;
252 const char *resume_path = NULL((void*)0);
253
254 state = pump_get_state ();
255
256 if (state == PUMP_STATE_RESUME) {
257 resume_path = pump_get_resume_path (this);
258 if (strcmp (resume_path, "/") == 0) {
259 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("Reached the resume path (/). Proceeding to change state"
" to running"); } while (0); _gf_log (this->name, "pump.c"
, __FUNCTION__, 261, GF_LOG_DEBUG, "Reached the resume path (/). Proceeding to change state"
" to running"); } while (0)
260 "Reached the resume path (/). Proceeding to change state"do { do { if (0) printf ("Reached the resume path (/). Proceeding to change state"
" to running"); } while (0); _gf_log (this->name, "pump.c"
, __FUNCTION__, 261, GF_LOG_DEBUG, "Reached the resume path (/). Proceeding to change state"
" to running"); } while (0)
261 " to running")do { do { if (0) printf ("Reached the resume path (/). Proceeding to change state"
" to running"); } while (0); _gf_log (this->name, "pump.c"
, __FUNCTION__, 261, GF_LOG_DEBUG, "Reached the resume path (/). Proceeding to change state"
" to running"); } while (0)
;
262 pump_change_state (this, PUMP_STATE_RUNNING);
263 } else if (strcmp (resume_path, path) == 0) {
264 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("Reached the resume path. Proceeding to change state"
" to running"); } while (0); _gf_log (this->name, "pump.c"
, __FUNCTION__, 266, GF_LOG_DEBUG, "Reached the resume path. Proceeding to change state"
" to running"); } while (0)
265 "Reached the resume path. Proceeding to change state"do { do { if (0) printf ("Reached the resume path. Proceeding to change state"
" to running"); } while (0); _gf_log (this->name, "pump.c"
, __FUNCTION__, 266, GF_LOG_DEBUG, "Reached the resume path. Proceeding to change state"
" to running"); } while (0)
266 " to running")do { do { if (0) printf ("Reached the resume path. Proceeding to change state"
" to running"); } while (0); _gf_log (this->name, "pump.c"
, __FUNCTION__, 266, GF_LOG_DEBUG, "Reached the resume path. Proceeding to change state"
" to running"); } while (0)
;
267 pump_change_state (this, PUMP_STATE_RUNNING);
268 } else {
269 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("Not yet hit the resume path:res-path=%s,path=%s"
, resume_path, path); } while (0); _gf_log (this->name, "pump.c"
, __FUNCTION__, 271, GF_LOG_DEBUG, "Not yet hit the resume path:res-path=%s,path=%s"
, resume_path, path); } while (0)
270 "Not yet hit the resume path:res-path=%s,path=%s",do { do { if (0) printf ("Not yet hit the resume path:res-path=%s,path=%s"
, resume_path, path); } while (0); _gf_log (this->name, "pump.c"
, __FUNCTION__, 271, GF_LOG_DEBUG, "Not yet hit the resume path:res-path=%s,path=%s"
, resume_path, path); } while (0)
271 resume_path, path)do { do { if (0) printf ("Not yet hit the resume path:res-path=%s,path=%s"
, resume_path, path); } while (0); _gf_log (this->name, "pump.c"
, __FUNCTION__, 271, GF_LOG_DEBUG, "Not yet hit the resume path:res-path=%s,path=%s"
, resume_path, path); } while (0)
;
272 }
273 }
274
275 return 0;
276}
277
278static gf_boolean_t
279is_pump_traversal_allowed (xlator_t *this, const char *path)
280{
281 pump_state_t state;
282 const char *resume_path = NULL((void*)0);
283 gf_boolean_t ret = _gf_true;
284
285 state = pump_get_state ();
286
287 if (state == PUMP_STATE_RESUME) {
288 resume_path = pump_get_resume_path (this);
289 if (strstr (resume_path, path)) {
290 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("On the right path to resumption path"
); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 291, GF_LOG_DEBUG, "On the right path to resumption path");
} while (0)
291 "On the right path to resumption path")do { do { if (0) printf ("On the right path to resumption path"
); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 291, GF_LOG_DEBUG, "On the right path to resumption path");
} while (0)
;
292 ret = _gf_true;
293 } else {
294 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("Not the right path to resuming=> ignoring traverse"
); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 295, GF_LOG_DEBUG, "Not the right path to resuming=> ignoring traverse"
); } while (0)
295 "Not the right path to resuming=> ignoring traverse")do { do { if (0) printf ("Not the right path to resuming=> ignoring traverse"
); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 295, GF_LOG_DEBUG, "Not the right path to resuming=> ignoring traverse"
); } while (0)
;
296 ret = _gf_false;
297 }
298 }
299
300 return ret;
301}
302
303static int
304pump_save_file_stats (xlator_t *this, const char *path)
305{
306 afr_private_t *priv = NULL((void*)0);
307 pump_private_t *pump_priv = NULL((void*)0);
308
309 priv = this->private;
310 pump_priv = priv->pump_private;
311
312 LOCK (&pump_priv->resume_path_lock)pthread_spin_lock (&pump_priv->resume_path_lock);
313 {
314 pump_priv->number_files_pumped++;
315
316 strncpy (pump_priv->current_file, path,
317 PATH_MAX4096);
318 }
319 UNLOCK (&pump_priv->resume_path_lock)pthread_spin_unlock (&pump_priv->resume_path_lock);
320
321 return 0;
322}
323
324static int
325gf_pump_traverse_directory (loc_t *loc)
326{
327 xlator_t *this = NULL((void*)0);
328 fd_t *fd = NULL((void*)0);
329 off_t offset = 0;
330 loc_t entry_loc = {0};
331 gf_dirent_t *entry = NULL((void*)0);
332 gf_dirent_t *tmp = NULL((void*)0);
333 gf_dirent_t entries;
334 struct iatt iatt = {0};
335 struct iatt parent = {0};
336 dict_t *xattr_rsp = NULL((void*)0);
337 int ret = 0;
338 gf_boolean_t is_directory_empty = _gf_true;
339 gf_boolean_t free_entries = _gf_false;
340
341 INIT_LIST_HEAD (&entries.list)do { (&entries.list)->next = (&entries.list)->prev
= &entries.list; } while (0)
;
342 this = THIS(*__glusterfs_this_location());
343
344 GF_ASSERT (loc->inode)do { if (!(loc->inode)) { do { do { if (0) printf ("Assertion failed: "
"loc->inode"); } while (0); _gf_log_callingfn ("", "pump.c"
, __FUNCTION__, 344, GF_LOG_ERROR, "Assertion failed: " "loc->inode"
); } while (0); } } while (0)
;
345
346 fd = fd_create (loc->inode, pump_pid);
347 if (!fd) {
348 gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("Failed to create fd for %s", loc->
path); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 349, GF_LOG_ERROR, "Failed to create fd for %s", loc->path
); } while (0)
349 "Failed to create fd for %s", loc->path)do { do { if (0) printf ("Failed to create fd for %s", loc->
path); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 349, GF_LOG_ERROR, "Failed to create fd for %s", loc->path
); } while (0)
;
350 goto out;
351 }
352
353 ret = syncop_opendir (this, loc, fd);
354 if (ret < 0) {
355 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("opendir failed on %s", loc->path
); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 356, GF_LOG_DEBUG, "opendir failed on %s", loc->path); }
while (0)
356 "opendir failed on %s", loc->path)do { do { if (0) printf ("opendir failed on %s", loc->path
); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 356, GF_LOG_DEBUG, "opendir failed on %s", loc->path); }
while (0)
;
357 goto out;
358 }
359
360 gf_log (this->name, GF_LOG_TRACE,do { do { if (0) printf ("pump opendir on %s returned=%d", loc
->path, ret); } while (0); _gf_log (this->name, "pump.c"
, __FUNCTION__, 362, GF_LOG_TRACE, "pump opendir on %s returned=%d"
, loc->path, ret); } while (0)
361 "pump opendir on %s returned=%d",do { do { if (0) printf ("pump opendir on %s returned=%d", loc
->path, ret); } while (0); _gf_log (this->name, "pump.c"
, __FUNCTION__, 362, GF_LOG_TRACE, "pump opendir on %s returned=%d"
, loc->path, ret); } while (0)
362 loc->path, ret)do { do { if (0) printf ("pump opendir on %s returned=%d", loc
->path, ret); } while (0); _gf_log (this->name, "pump.c"
, __FUNCTION__, 362, GF_LOG_TRACE, "pump opendir on %s returned=%d"
, loc->path, ret); } while (0)
;
363
364 while (syncop_readdirp (this, fd, 131072, offset, NULL((void*)0), &entries)) {
365 free_entries = _gf_true;
366
367 if (list_empty (&entries.list)) {
368 gf_log (this->name, GF_LOG_TRACE,do { do { if (0) printf ("no more entries in directory"); } while
(0); _gf_log (this->name, "pump.c", __FUNCTION__, 369, GF_LOG_TRACE
, "no more entries in directory"); } while (0)
369 "no more entries in directory")do { do { if (0) printf ("no more entries in directory"); } while
(0); _gf_log (this->name, "pump.c", __FUNCTION__, 369, GF_LOG_TRACE
, "no more entries in directory"); } while (0)
;
370 goto out;
371 }
372
373 list_for_each_entry_safe (entry, tmp, &entries.list, list)for (entry = ((typeof(*entry) *)((char *)((&entries.list)
->next)-(unsigned long)(&((typeof(*entry) *)0)->list
))), tmp = ((typeof(*entry) *)((char *)(entry->list.next)-
(unsigned long)(&((typeof(*entry) *)0)->list))); &
entry->list != (&entries.list); entry = tmp, tmp = ((typeof
(*tmp) *)((char *)(tmp->list.next)-(unsigned long)(&((
typeof(*tmp) *)0)->list))))
{
374 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("found readdir entry=%s", entry->
d_name); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 375, GF_LOG_DEBUG, "found readdir entry=%s", entry->d_name
); } while (0)
375 "found readdir entry=%s", entry->d_name)do { do { if (0) printf ("found readdir entry=%s", entry->
d_name); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 375, GF_LOG_DEBUG, "found readdir entry=%s", entry->d_name
); } while (0)
;
376
377 offset = entry->d_off;
378 if (uuid_is_null (entry->d_stat.ia_gfid)) {
379 gf_log (this->name, GF_LOG_WARNING, "%s/%s: No "do { do { if (0) printf ("%s/%s: No " "gfid present skipping"
, loc->path, entry->d_name); } while (0); _gf_log (this
->name, "pump.c", __FUNCTION__, 381, GF_LOG_WARNING, "%s/%s: No "
"gfid present skipping", loc->path, entry->d_name); } while
(0)
380 "gfid present skipping",do { do { if (0) printf ("%s/%s: No " "gfid present skipping"
, loc->path, entry->d_name); } while (0); _gf_log (this
->name, "pump.c", __FUNCTION__, 381, GF_LOG_WARNING, "%s/%s: No "
"gfid present skipping", loc->path, entry->d_name); } while
(0)
381 loc->path, entry->d_name)do { do { if (0) printf ("%s/%s: No " "gfid present skipping"
, loc->path, entry->d_name); } while (0); _gf_log (this
->name, "pump.c", __FUNCTION__, 381, GF_LOG_WARNING, "%s/%s: No "
"gfid present skipping", loc->path, entry->d_name); } while
(0)
;
382 continue;
383 }
384 loc_wipe (&entry_loc);
385 ret = afr_build_child_loc (this, &entry_loc, loc,
386 entry->d_name);
387 if (ret)
388 goto out;
389
390 if (!IS_ENTRY_CWD (entry->d_name)(!strcmp (entry->d_name, ".")) &&
391 !IS_ENTRY_PARENT (entry->d_name)(!strcmp (entry->d_name, ".."))) {
392
393 is_directory_empty = _gf_false;
394 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("lookup %s => %""ll" "d", entry_loc
.path, iatt.ia_ino); } while (0); _gf_log (this->name, "pump.c"
, __FUNCTION__, 397, GF_LOG_DEBUG, "lookup %s => %""ll" "d"
, entry_loc.path, iatt.ia_ino); } while (0)
395 "lookup %s => %"PRId64,do { do { if (0) printf ("lookup %s => %""ll" "d", entry_loc
.path, iatt.ia_ino); } while (0); _gf_log (this->name, "pump.c"
, __FUNCTION__, 397, GF_LOG_DEBUG, "lookup %s => %""ll" "d"
, entry_loc.path, iatt.ia_ino); } while (0)
396 entry_loc.path,do { do { if (0) printf ("lookup %s => %""ll" "d", entry_loc
.path, iatt.ia_ino); } while (0); _gf_log (this->name, "pump.c"
, __FUNCTION__, 397, GF_LOG_DEBUG, "lookup %s => %""ll" "d"
, entry_loc.path, iatt.ia_ino); } while (0)
397 iatt.ia_ino)do { do { if (0) printf ("lookup %s => %""ll" "d", entry_loc
.path, iatt.ia_ino); } while (0); _gf_log (this->name, "pump.c"
, __FUNCTION__, 397, GF_LOG_DEBUG, "lookup %s => %""ll" "d"
, entry_loc.path, iatt.ia_ino); } while (0)
;
398
399 ret = syncop_lookup (this, &entry_loc, NULL((void*)0),
400 &iatt, &xattr_rsp, &parent);
401
402 if (ret) {
403 gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("%s: lookup failed", entry_loc.path)
; } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 405, GF_LOG_ERROR, "%s: lookup failed", entry_loc.path); } while
(0)
404 "%s: lookup failed",do { do { if (0) printf ("%s: lookup failed", entry_loc.path)
; } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 405, GF_LOG_ERROR, "%s: lookup failed", entry_loc.path); } while
(0)
405 entry_loc.path)do { do { if (0) printf ("%s: lookup failed", entry_loc.path)
; } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 405, GF_LOG_ERROR, "%s: lookup failed", entry_loc.path); } while
(0)
;
406 continue;
407 }
408 pump_fill_loc_info (&entry_loc, &iatt,
409 &parent);
410
411 pump_update_resume_state (this, entry_loc.path);
412
413 pump_save_path (this, entry_loc.path);
414 pump_save_file_stats (this, entry_loc.path);
415
416 ret = pump_check_and_update_status (this);
417 if (ret < 0) {
418 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("Pump beginning to exit out"); } while
(0); _gf_log (this->name, "pump.c", __FUNCTION__, 419, GF_LOG_DEBUG
, "Pump beginning to exit out"); } while (0)
419 "Pump beginning to exit out")do { do { if (0) printf ("Pump beginning to exit out"); } while
(0); _gf_log (this->name, "pump.c", __FUNCTION__, 419, GF_LOG_DEBUG
, "Pump beginning to exit out"); } while (0)
;
420 goto out;
421 }
422
423 if (IA_ISDIR (iatt.ia_type)(iatt.ia_type == IA_IFDIR)) {
424 if (is_pump_traversal_allowed (this, entry_loc.path)) {
425 gf_log (this->name, GF_LOG_TRACE,do { do { if (0) printf ("entering dir=%s", entry->d_name)
; } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 427, GF_LOG_TRACE, "entering dir=%s", entry->d_name); } while
(0)
426 "entering dir=%s",do { do { if (0) printf ("entering dir=%s", entry->d_name)
; } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 427, GF_LOG_TRACE, "entering dir=%s", entry->d_name); } while
(0)
427 entry->d_name)do { do { if (0) printf ("entering dir=%s", entry->d_name)
; } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 427, GF_LOG_TRACE, "entering dir=%s", entry->d_name); } while
(0)
;
428 gf_pump_traverse_directory (&entry_loc);
429 }
430 }
431 }
432 }
433
434 gf_dirent_free (&entries);
435 free_entries = _gf_false;
436 gf_log (this->name, GF_LOG_TRACE,do { do { if (0) printf ("offset incremented to %d", (int32_t
) offset); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 438, GF_LOG_TRACE, "offset incremented to %d", (int32_t ) offset
); } while (0)
437 "offset incremented to %d",do { do { if (0) printf ("offset incremented to %d", (int32_t
) offset); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 438, GF_LOG_TRACE, "offset incremented to %d", (int32_t ) offset
); } while (0)
438 (int32_t ) offset)do { do { if (0) printf ("offset incremented to %d", (int32_t
) offset); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 438, GF_LOG_TRACE, "offset incremented to %d", (int32_t ) offset
); } while (0)
;
439
440 }
441
442 ret = syncop_close (fd);
443 if (ret < 0)
444 gf_log (this->name, GF_LOG_DEBUG, "closing the fd failed")do { do { if (0) printf ("closing the fd failed"); } while (0
); _gf_log (this->name, "pump.c", __FUNCTION__, 444, GF_LOG_DEBUG
, "closing the fd failed"); } while (0)
;
445
446 if (is_directory_empty && IS_ROOT_PATH (loc->path)(!strcmp (loc->path, "/"))) {
447 pump_change_state (this, PUMP_STATE_RUNNING);
448 gf_log (this->name, GF_LOG_INFO, "Empty source brick. "do { do { if (0) printf ("Empty source brick. " "Nothing to be done."
); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 449, GF_LOG_INFO, "Empty source brick. " "Nothing to be done."
); } while (0)
449 "Nothing to be done.")do { do { if (0) printf ("Empty source brick. " "Nothing to be done."
); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 449, GF_LOG_INFO, "Empty source brick. " "Nothing to be done."
); } while (0)
;
450 }
451
452out:
453 if (entry_loc.path)
454 loc_wipe (&entry_loc);
455 if (free_entries)
456 gf_dirent_free (&entries);
457 return 0;
458}
459
460static int
461pump_update_resume_path (xlator_t *this)
462{
463 const char *resume_path = NULL((void*)0);
464
465 resume_path = pump_get_resume_path (this);
466
467 if (resume_path) {
468 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("Found a path to resume from: %s", resume_path
); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 470, GF_LOG_DEBUG, "Found a path to resume from: %s", resume_path
); } while (0)
469 "Found a path to resume from: %s",do { do { if (0) printf ("Found a path to resume from: %s", resume_path
); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 470, GF_LOG_DEBUG, "Found a path to resume from: %s", resume_path
); } while (0)
470 resume_path)do { do { if (0) printf ("Found a path to resume from: %s", resume_path
); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 470, GF_LOG_DEBUG, "Found a path to resume from: %s", resume_path
); } while (0)
;
471
472 }else {
473 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("Did not find a path=> setting to '/'"
); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 474, GF_LOG_DEBUG, "Did not find a path=> setting to '/'"
); } while (0)
474 "Did not find a path=> setting to '/'")do { do { if (0) printf ("Did not find a path=> setting to '/'"
); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 474, GF_LOG_DEBUG, "Did not find a path=> setting to '/'"
); } while (0)
;
475 pump_set_resume_path (this, "/");
476 }
477
478 pump_change_state (this, PUMP_STATE_RESUME);
479
480 return 0;
481}
482
483static int32_t
484pump_xattr_cleaner (call_frame_t *frame, void *cookie, xlator_t *this,
485 int32_t op_ret, int32_t op_errno, dict_t *xdata)
486{
487 afr_private_t *priv = NULL((void*)0);
488 loc_t loc = {0};
489 int i = 0;
490 int ret = 0;
491 int source = 0;
492 int sink = 1;
493
494 priv = this->private;
495
496 afr_build_root_loc (this, &loc);
497
498 ret = syncop_removexattr (priv->children[source], &loc,
499 PUMP_PATH"trusted.glusterfs.pump-path");
500
501 ret = syncop_removexattr (priv->children[sink], &loc,
502 PUMP_SINK_COMPLETE"trusted.glusterfs.pump-sink-complete");
503
504 for (i = 0; i < priv->child_count; i++) {
505 ret = syncop_removexattr (priv->children[i], &loc,
506 PUMP_SOURCE_COMPLETE"trusted.glusterfs.pump-source-complete");
507 if (ret)
508 gf_log (this->name, GF_LOG_DEBUG, "removexattr "do { do { if (0) printf ("removexattr " "failed with %s", strerror
((*__errno_location ()))); } while (0); _gf_log (this->name
, "pump.c", __FUNCTION__, 509, GF_LOG_DEBUG, "removexattr " "failed with %s"
, strerror ((*__errno_location ()))); } while (0)
509 "failed with %s", strerror (errno))do { do { if (0) printf ("removexattr " "failed with %s", strerror
((*__errno_location ()))); } while (0); _gf_log (this->name
, "pump.c", __FUNCTION__, 509, GF_LOG_DEBUG, "removexattr " "failed with %s"
, strerror ((*__errno_location ()))); } while (0)
;
510 }
511
512 loc_wipe (&loc);
513 return pump_command_reply (frame, this);
514}
515
516static int
517pump_complete_migration (xlator_t *this)
518{
519 afr_private_t *priv = NULL((void*)0);
520 pump_private_t *pump_priv = NULL((void*)0);
521 dict_t *dict = NULL((void*)0);
522 pump_state_t state;
523 loc_t loc = {0};
524 int dict_ret = 0;
525 int ret = -1;
526
527 priv = this->private;
528 pump_priv = priv->pump_private;
529
530 GF_ASSERT (priv->root_inode)do { if (!(priv->root_inode)) { do { do { if (0) printf ("Assertion failed: "
"priv->root_inode"); } while (0); _gf_log_callingfn ("", "pump.c"
, __FUNCTION__, 530, GF_LOG_ERROR, "Assertion failed: " "priv->root_inode"
); } while (0); } } while (0)
;
531
532 afr_build_root_loc (this, &loc);
533
534 dict = dict_new ();
535
536 state = pump_get_state ();
537 if (state == PUMP_STATE_RUNNING) {
538 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("Pump finished pumping"); } while (0
); _gf_log (this->name, "pump.c", __FUNCTION__, 539, GF_LOG_DEBUG
, "Pump finished pumping"); } while (0)
539 "Pump finished pumping")do { do { if (0) printf ("Pump finished pumping"); } while (0
); _gf_log (this->name, "pump.c", __FUNCTION__, 539, GF_LOG_DEBUG
, "Pump finished pumping"); } while (0)
;
540
541 pump_priv->pump_finished = _gf_true;
542
543 dict_ret = dict_set_str (dict, PUMP_SOURCE_COMPLETE"trusted.glusterfs.pump-source-complete", "jargon");
544 if (dict_ret)
545 gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("%s: failed to set the key %s", loc.
path, "trusted.glusterfs.pump-source-complete"); } while (0);
_gf_log (this->name, "pump.c", __FUNCTION__, 547, GF_LOG_WARNING
, "%s: failed to set the key %s", loc.path, "trusted.glusterfs.pump-source-complete"
); } while (0)
546 "%s: failed to set the key %s",do { do { if (0) printf ("%s: failed to set the key %s", loc.
path, "trusted.glusterfs.pump-source-complete"); } while (0);
_gf_log (this->name, "pump.c", __FUNCTION__, 547, GF_LOG_WARNING
, "%s: failed to set the key %s", loc.path, "trusted.glusterfs.pump-source-complete"
); } while (0)
547 loc.path, PUMP_SOURCE_COMPLETE)do { do { if (0) printf ("%s: failed to set the key %s", loc.
path, "trusted.glusterfs.pump-source-complete"); } while (0);
_gf_log (this->name, "pump.c", __FUNCTION__, 547, GF_LOG_WARNING
, "%s: failed to set the key %s", loc.path, "trusted.glusterfs.pump-source-complete"
); } while (0)
;
548
549 ret = syncop_setxattr (PUMP_SOURCE_CHILD (this)(this->children->xlator), &loc, dict, 0);
550 if (ret < 0) {
551 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("setxattr failed - while notifying source complete"
); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 552, GF_LOG_DEBUG, "setxattr failed - while notifying source complete"
); } while (0)
552 "setxattr failed - while notifying source complete")do { do { if (0) printf ("setxattr failed - while notifying source complete"
); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 552, GF_LOG_DEBUG, "setxattr failed - while notifying source complete"
); } while (0)
;
553 }
554 dict_ret = dict_set_str (dict, PUMP_SINK_COMPLETE"trusted.glusterfs.pump-sink-complete", "jargon");
555 if (dict_ret)
556 gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("%s: failed to set the key %s", loc.
path, "trusted.glusterfs.pump-sink-complete"); } while (0); _gf_log
(this->name, "pump.c", __FUNCTION__, 558, GF_LOG_WARNING,
"%s: failed to set the key %s", loc.path, "trusted.glusterfs.pump-sink-complete"
); } while (0)
557 "%s: failed to set the key %s",do { do { if (0) printf ("%s: failed to set the key %s", loc.
path, "trusted.glusterfs.pump-sink-complete"); } while (0); _gf_log
(this->name, "pump.c", __FUNCTION__, 558, GF_LOG_WARNING,
"%s: failed to set the key %s", loc.path, "trusted.glusterfs.pump-sink-complete"
); } while (0)
558 loc.path, PUMP_SINK_COMPLETE)do { do { if (0) printf ("%s: failed to set the key %s", loc.
path, "trusted.glusterfs.pump-sink-complete"); } while (0); _gf_log
(this->name, "pump.c", __FUNCTION__, 558, GF_LOG_WARNING,
"%s: failed to set the key %s", loc.path, "trusted.glusterfs.pump-sink-complete"
); } while (0)
;
559
560 ret = syncop_setxattr (PUMP_SINK_CHILD (this)(this->children->next->xlator), &loc, dict, 0);
561 if (ret < 0) {
562 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("setxattr failed - while notifying sink complete"
); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 563, GF_LOG_DEBUG, "setxattr failed - while notifying sink complete"
); } while (0)
563 "setxattr failed - while notifying sink complete")do { do { if (0) printf ("setxattr failed - while notifying sink complete"
); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 563, GF_LOG_DEBUG, "setxattr failed - while notifying sink complete"
); } while (0)
;
564 }
565
566 pump_save_path (this, "/");
567
568 } else if (state == PUMP_STATE_ABORT) {
569 gf_log (this->name, GF_LOG_DEBUG, "Starting cleanup "do { do { if (0) printf ("Starting cleanup " "of pump internal xattrs"
); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 570, GF_LOG_DEBUG, "Starting cleanup " "of pump internal xattrs"
); } while (0)
570 "of pump internal xattrs")do { do { if (0) printf ("Starting cleanup " "of pump internal xattrs"
); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 570, GF_LOG_DEBUG, "Starting cleanup " "of pump internal xattrs"
); } while (0)
;
571 call_resume (pump_priv->cleaner);
572 }
573
574 loc_wipe (&loc);
575 return 0;
576}
577
578static int
579pump_lookup_sink (loc_t *loc)
580{
581 xlator_t *this = NULL((void*)0);
582 struct iatt iatt, parent;
583 dict_t *xattr_rsp;
584 dict_t *xattr_req = NULL((void*)0);
585 int ret = 0;
586
587 this = THIS(*__glusterfs_this_location());
588
589 xattr_req = dict_new ();
590
591 ret = afr_set_root_gfid (xattr_req);
592 if (ret)
593 goto out;
594
595 ret = syncop_lookup (PUMP_SINK_CHILD (this)(this->children->next->xlator), loc,
596 xattr_req, &iatt, &xattr_rsp, &parent);
597
598 if (ret) {
599 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("Lookup on sink child failed"); } while
(0); _gf_log (this->name, "pump.c", __FUNCTION__, 600, GF_LOG_DEBUG
, "Lookup on sink child failed"); } while (0)
600 "Lookup on sink child failed")do { do { if (0) printf ("Lookup on sink child failed"); } while
(0); _gf_log (this->name, "pump.c", __FUNCTION__, 600, GF_LOG_DEBUG
, "Lookup on sink child failed"); } while (0)
;
601 goto out;
602 }
603
604out:
605 if (xattr_req)
606 dict_unref (xattr_req);
607
608 return ret;
609}
610
611static int
612pump_task (void *data)
613{
614 xlator_t *this = NULL((void*)0);
615 afr_private_t *priv = NULL((void*)0);
616
617
618 loc_t loc = {0};
619 struct iatt iatt, parent;
620 dict_t *xattr_rsp = NULL((void*)0);
621 dict_t *xattr_req = NULL((void*)0);
622
623 int ret = -1;
624
625 this = THIS(*__glusterfs_this_location());
626 priv = this->private;
627
628 GF_ASSERT (priv->root_inode)do { if (!(priv->root_inode)) { do { do { if (0) printf ("Assertion failed: "
"priv->root_inode"); } while (0); _gf_log_callingfn ("", "pump.c"
, __FUNCTION__, 628, GF_LOG_ERROR, "Assertion failed: " "priv->root_inode"
); } while (0); } } while (0)
;
629
630 afr_build_root_loc (this, &loc);
631 xattr_req = dict_new ();
632 if (!xattr_req) {
633 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("Out of memory"); } while (0); _gf_log
(this->name, "pump.c", __FUNCTION__, 634, GF_LOG_DEBUG, "Out of memory"
); } while (0)
634 "Out of memory")do { do { if (0) printf ("Out of memory"); } while (0); _gf_log
(this->name, "pump.c", __FUNCTION__, 634, GF_LOG_DEBUG, "Out of memory"
); } while (0)
;
635 ret = -1;
Value stored to 'ret' is never read
636 goto out;
637 }
638
639 afr_set_root_gfid (xattr_req);
640 ret = syncop_lookup (this, &loc, xattr_req,
641 &iatt, &xattr_rsp, &parent);
642
643 gf_log (this->name, GF_LOG_TRACE,do { do { if (0) printf ("lookup: path=%s gfid=%s", loc.path,
uuid_utoa (loc.inode->gfid)); } while (0); _gf_log (this->
name, "pump.c", __FUNCTION__, 645, GF_LOG_TRACE, "lookup: path=%s gfid=%s"
, loc.path, uuid_utoa (loc.inode->gfid)); } while (0)
644 "lookup: path=%s gfid=%s",do { do { if (0) printf ("lookup: path=%s gfid=%s", loc.path,
uuid_utoa (loc.inode->gfid)); } while (0); _gf_log (this->
name, "pump.c", __FUNCTION__, 645, GF_LOG_TRACE, "lookup: path=%s gfid=%s"
, loc.path, uuid_utoa (loc.inode->gfid)); } while (0)
645 loc.path, uuid_utoa (loc.inode->gfid))do { do { if (0) printf ("lookup: path=%s gfid=%s", loc.path,
uuid_utoa (loc.inode->gfid)); } while (0); _gf_log (this->
name, "pump.c", __FUNCTION__, 645, GF_LOG_TRACE, "lookup: path=%s gfid=%s"
, loc.path, uuid_utoa (loc.inode->gfid)); } while (0)
;
646
647 ret = pump_check_and_update_status (this);
648 if (ret < 0) {
649 goto out;
650 }
651
652 pump_update_resume_path (this);
653
654 afr_set_root_gfid (xattr_req);
655 ret = pump_lookup_sink (&loc);
656 if (ret) {
657 pump_update_resume_path (this);
658 goto out;
659 }
660
661 gf_pump_traverse_directory (&loc);
662
663 pump_complete_migration (this);
664out:
665 if (xattr_req)
666 dict_unref (xattr_req);
667
668 loc_wipe (&loc);
669 return 0;
670}
671
672
673static int
674pump_task_completion (int ret, call_frame_t *sync_frame, void *data)
675{
676 xlator_t *this = NULL((void*)0);
677 afr_private_t *priv = NULL((void*)0);
678
679 this = THIS(*__glusterfs_this_location());
680
681 priv = this->private;
682
683 inode_unref (priv->root_inode);
684 STACK_DESTROY (sync_frame->root);
685
686 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("Pump xlator exiting"); } while (0);
_gf_log (this->name, "pump.c", __FUNCTION__, 687, GF_LOG_DEBUG
, "Pump xlator exiting"); } while (0)
687 "Pump xlator exiting")do { do { if (0) printf ("Pump xlator exiting"); } while (0);
_gf_log (this->name, "pump.c", __FUNCTION__, 687, GF_LOG_DEBUG
, "Pump xlator exiting"); } while (0)
;
688 return 0;
689}
690
691int
692pump_start (call_frame_t *pump_frame, xlator_t *this)
693{
694 afr_private_t *priv = NULL((void*)0);
695 pump_private_t *pump_priv = NULL((void*)0);
696
697 int ret = -1;
698
699 priv = this->private;
700 pump_priv = priv->pump_private;
701
702 afr_set_lk_owner (pump_frame, this, pump_frame->root);
703 pump_pid = (uint64_t) (unsigned long)pump_frame->root;
704
705 ret = synctask_new (pump_priv->env, pump_task,
706 pump_task_completion,
707 pump_frame, NULL((void*)0));
708 if (ret == -1) {
709 gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("starting pump failed"); } while (0)
; _gf_log (this->name, "pump.c", __FUNCTION__, 710, GF_LOG_ERROR
, "starting pump failed"); } while (0)
710 "starting pump failed")do { do { if (0) printf ("starting pump failed"); } while (0)
; _gf_log (this->name, "pump.c", __FUNCTION__, 710, GF_LOG_ERROR
, "starting pump failed"); } while (0)
;
711 pump_change_state (this, PUMP_STATE_ABORT);
712 goto out;
713 }
714
715 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("setting pump as started lk_owner: %s %"
"ll" "u", lkowner_utoa (&pump_frame->root->lk_owner
), pump_pid); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 717, GF_LOG_DEBUG, "setting pump as started lk_owner: %s %"
"ll" "u", lkowner_utoa (&pump_frame->root->lk_owner
), pump_pid); } while (0)
716 "setting pump as started lk_owner: %s %"PRIu64,do { do { if (0) printf ("setting pump as started lk_owner: %s %"
"ll" "u", lkowner_utoa (&pump_frame->root->lk_owner
), pump_pid); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 717, GF_LOG_DEBUG, "setting pump as started lk_owner: %s %"
"ll" "u", lkowner_utoa (&pump_frame->root->lk_owner
), pump_pid); } while (0)
717 lkowner_utoa (&pump_frame->root->lk_owner), pump_pid)do { do { if (0) printf ("setting pump as started lk_owner: %s %"
"ll" "u", lkowner_utoa (&pump_frame->root->lk_owner
), pump_pid); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 717, GF_LOG_DEBUG, "setting pump as started lk_owner: %s %"
"ll" "u", lkowner_utoa (&pump_frame->root->lk_owner
), pump_pid); } while (0)
;
718
719 priv->use_afr_in_pump = 1;
720out:
721 return ret;
722}
723
724static int
725pump_start_synctask (xlator_t *this)
726{
727 call_frame_t *frame = NULL((void*)0);
728 int ret = 0;
729
730 frame = create_frame (this, this->ctx->pool);
731 if (!frame) {
732 gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("Out of memory"); } while (0); _gf_log
(this->name, "pump.c", __FUNCTION__, 733, GF_LOG_ERROR, "Out of memory"
); } while (0)
733 "Out of memory")do { do { if (0) printf ("Out of memory"); } while (0); _gf_log
(this->name, "pump.c", __FUNCTION__, 733, GF_LOG_ERROR, "Out of memory"
); } while (0)
;
734 ret = -1;
735 goto out;
736 }
737
738 pump_change_state (this, PUMP_STATE_RUNNING);
739
740 ret = pump_start (frame, this);
741
742out:
743 return ret;
744}
745
746int32_t
747pump_cmd_start_setxattr_cbk (call_frame_t *frame,
748 void *cookie,
749 xlator_t *this,
750 int32_t op_ret,
751 int32_t op_errno, dict_t *xdata)
752
753{
754 call_frame_t *prev = NULL((void*)0);
755 afr_local_t *local = NULL((void*)0);
756 int ret = 0;
757
758 local = frame->local;
759
760 if (op_ret < 0) {
761 gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("Could not initiate destination " "brick connect"
); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 763, GF_LOG_ERROR, "Could not initiate destination " "brick connect"
); } while (0)
762 "Could not initiate destination "do { do { if (0) printf ("Could not initiate destination " "brick connect"
); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 763, GF_LOG_ERROR, "Could not initiate destination " "brick connect"
); } while (0)
763 "brick connect")do { do { if (0) printf ("Could not initiate destination " "brick connect"
); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 763, GF_LOG_ERROR, "Could not initiate destination " "brick connect"
); } while (0)
;
764 ret = op_ret;
765 goto out;
766 }
767
768 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("Successfully initiated destination "
"brick connect"); } while (0); _gf_log (this->name, "pump.c"
, __FUNCTION__, 770, GF_LOG_DEBUG, "Successfully initiated destination "
"brick connect"); } while (0)
769 "Successfully initiated destination "do { do { if (0) printf ("Successfully initiated destination "
"brick connect"); } while (0); _gf_log (this->name, "pump.c"
, __FUNCTION__, 770, GF_LOG_DEBUG, "Successfully initiated destination "
"brick connect"); } while (0)
770 "brick connect")do { do { if (0) printf ("Successfully initiated destination "
"brick connect"); } while (0); _gf_log (this->name, "pump.c"
, __FUNCTION__, 770, GF_LOG_DEBUG, "Successfully initiated destination "
"brick connect"); } while (0)
;
771
772 pump_mark_start_pending (this);
773
774 /* send the PARENT_UP as pump is ready now */
775 prev = cookie;
776 if (prev && prev->this)
777 prev->this->notify (prev->this, GF_EVENT_PARENT_UP, this);
778
779out:
780 local->op_ret = ret;
781 pump_command_reply (frame, this);
782
783 return 0;
784}
785
786static int
787pump_initiate_sink_connect (call_frame_t *frame, xlator_t *this)
788{
789 afr_local_t *local = NULL((void*)0);
790 afr_private_t *priv = NULL((void*)0);
791 dict_t *dict = NULL((void*)0);
792 data_t *data = NULL((void*)0);
793 char *clnt_cmd = NULL((void*)0);
794 loc_t loc = {0};
795
796 int ret = 0;
797
798 priv = this->private;
799 local = frame->local;
800
801 GF_ASSERT (priv->root_inode)do { if (!(priv->root_inode)) { do { do { if (0) printf ("Assertion failed: "
"priv->root_inode"); } while (0); _gf_log_callingfn ("", "pump.c"
, __FUNCTION__, 801, GF_LOG_ERROR, "Assertion failed: " "priv->root_inode"
); } while (0); } } while (0)
;
802
803 afr_build_root_loc (this, &loc);
804
805 data = data_ref (dict_get (local->dict, RB_PUMP_CMD_START"glusterfs.pump.start"));
806 if (!data) {
807 ret = -1;
808 gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("Could not get destination brick value"
); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 809, GF_LOG_ERROR, "Could not get destination brick value")
; } while (0)
809 "Could not get destination brick value")do { do { if (0) printf ("Could not get destination brick value"
); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 809, GF_LOG_ERROR, "Could not get destination brick value")
; } while (0)
;
810 goto out;
811 }
812
813 dict = dict_new ();
814 if (!dict) {
815 ret = -1;
816 goto out;
817 }
818
819 clnt_cmd = GF_CALLOC (1, data->len+1, gf_common_mt_char)__gf_calloc (1, data->len+1, gf_common_mt_char);
820 if (!clnt_cmd) {
821 ret = -1;
822 goto out;
823 }
824
825 memcpy (clnt_cmd, data->data, data->len);
826 clnt_cmd[data->len] = '\0';
827 gf_log (this->name, GF_LOG_DEBUG, "Got destination brick %s\n",do { do { if (0) printf ("Got destination brick %s\n", clnt_cmd
); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 828, GF_LOG_DEBUG, "Got destination brick %s\n", clnt_cmd);
} while (0)
828 clnt_cmd)do { do { if (0) printf ("Got destination brick %s\n", clnt_cmd
); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 828, GF_LOG_DEBUG, "Got destination brick %s\n", clnt_cmd);
} while (0)
;
829
830 ret = dict_set_dynstr (dict, CLIENT_CMD_CONNECT"trusted.glusterfs.client-connect", clnt_cmd);
831 if (ret < 0) {
832 gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("Could not inititiate destination brick "
"connect"); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 834, GF_LOG_ERROR, "Could not inititiate destination brick "
"connect"); } while (0)
833 "Could not inititiate destination brick "do { do { if (0) printf ("Could not inititiate destination brick "
"connect"); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 834, GF_LOG_ERROR, "Could not inititiate destination brick "
"connect"); } while (0)
834 "connect")do { do { if (0) printf ("Could not inititiate destination brick "
"connect"); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 834, GF_LOG_ERROR, "Could not inititiate destination brick "
"connect"); } while (0)
;
835 goto out;
836 }
837
838 STACK_WIND (frame,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 844, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->next->xlator)->fops->setxattr_cbk) tmp_cbk = pump_cmd_start_setxattr_cbk
; _new->root = frame->root; _new->this = (this->children
->next->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new
->parent = frame; _new->cookie = _new; _new->wind_from
= __FUNCTION__; _new->wind_to = "PUMP_SINK_CHILD(this)->fops->setxattr"
; _new->unwind_to = "pump_cmd_start_setxattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->next->xlator); if (frame->
this->ctx->measure_latency) gf_latency_begin (_new, (this
->children->next->xlator)->fops->setxattr); (this
->children->next->xlator)->fops->setxattr (_new
, (this->children->next->xlator), &loc, dict, 0,
((void*)0)); (*__glusterfs_this_location()) = old_THIS; } while
(0)
839 pump_cmd_start_setxattr_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 844, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->next->xlator)->fops->setxattr_cbk) tmp_cbk = pump_cmd_start_setxattr_cbk
; _new->root = frame->root; _new->this = (this->children
->next->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new
->parent = frame; _new->cookie = _new; _new->wind_from
= __FUNCTION__; _new->wind_to = "PUMP_SINK_CHILD(this)->fops->setxattr"
; _new->unwind_to = "pump_cmd_start_setxattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->next->xlator); if (frame->
this->ctx->measure_latency) gf_latency_begin (_new, (this
->children->next->xlator)->fops->setxattr); (this
->children->next->xlator)->fops->setxattr (_new
, (this->children->next->xlator), &loc, dict, 0,
((void*)0)); (*__glusterfs_this_location()) = old_THIS; } while
(0)
840 PUMP_SINK_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 844, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->next->xlator)->fops->setxattr_cbk) tmp_cbk = pump_cmd_start_setxattr_cbk
; _new->root = frame->root; _new->this = (this->children
->next->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new
->parent = frame; _new->cookie = _new; _new->wind_from
= __FUNCTION__; _new->wind_to = "PUMP_SINK_CHILD(this)->fops->setxattr"
; _new->unwind_to = "pump_cmd_start_setxattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->next->xlator); if (frame->
this->ctx->measure_latency) gf_latency_begin (_new, (this
->children->next->xlator)->fops->setxattr); (this
->children->next->xlator)->fops->setxattr (_new
, (this->children->next->xlator), &loc, dict, 0,
((void*)0)); (*__glusterfs_this_location()) = old_THIS; } while
(0)
841 PUMP_SINK_CHILD(this)->fops->setxattr,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 844, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->next->xlator)->fops->setxattr_cbk) tmp_cbk = pump_cmd_start_setxattr_cbk
; _new->root = frame->root; _new->this = (this->children
->next->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new
->parent = frame; _new->cookie = _new; _new->wind_from
= __FUNCTION__; _new->wind_to = "PUMP_SINK_CHILD(this)->fops->setxattr"
; _new->unwind_to = "pump_cmd_start_setxattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->next->xlator); if (frame->
this->ctx->measure_latency) gf_latency_begin (_new, (this
->children->next->xlator)->fops->setxattr); (this
->children->next->xlator)->fops->setxattr (_new
, (this->children->next->xlator), &loc, dict, 0,
((void*)0)); (*__glusterfs_this_location()) = old_THIS; } while
(0)
842 &loc,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 844, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->next->xlator)->fops->setxattr_cbk) tmp_cbk = pump_cmd_start_setxattr_cbk
; _new->root = frame->root; _new->this = (this->children
->next->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new
->parent = frame; _new->cookie = _new; _new->wind_from
= __FUNCTION__; _new->wind_to = "PUMP_SINK_CHILD(this)->fops->setxattr"
; _new->unwind_to = "pump_cmd_start_setxattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->next->xlator); if (frame->
this->ctx->measure_latency) gf_latency_begin (_new, (this
->children->next->xlator)->fops->setxattr); (this
->children->next->xlator)->fops->setxattr (_new
, (this->children->next->xlator), &loc, dict, 0,
((void*)0)); (*__glusterfs_this_location()) = old_THIS; } while
(0)
843 dict,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 844, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->next->xlator)->fops->setxattr_cbk) tmp_cbk = pump_cmd_start_setxattr_cbk
; _new->root = frame->root; _new->this = (this->children
->next->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new
->parent = frame; _new->cookie = _new; _new->wind_from
= __FUNCTION__; _new->wind_to = "PUMP_SINK_CHILD(this)->fops->setxattr"
; _new->unwind_to = "pump_cmd_start_setxattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->next->xlator); if (frame->
this->ctx->measure_latency) gf_latency_begin (_new, (this
->children->next->xlator)->fops->setxattr); (this
->children->next->xlator)->fops->setxattr (_new
, (this->children->next->xlator), &loc, dict, 0,
((void*)0)); (*__glusterfs_this_location()) = old_THIS; } while
(0)
844 0, NULL)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 844, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->next->xlator)->fops->setxattr_cbk) tmp_cbk = pump_cmd_start_setxattr_cbk
; _new->root = frame->root; _new->this = (this->children
->next->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new
->parent = frame; _new->cookie = _new; _new->wind_from
= __FUNCTION__; _new->wind_to = "PUMP_SINK_CHILD(this)->fops->setxattr"
; _new->unwind_to = "pump_cmd_start_setxattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->next->xlator); if (frame->
this->ctx->measure_latency) gf_latency_begin (_new, (this
->children->next->xlator)->fops->setxattr); (this
->children->next->xlator)->fops->setxattr (_new
, (this->children->next->xlator), &loc, dict, 0,
((void*)0)); (*__glusterfs_this_location()) = old_THIS; } while
(0)
;
845
846 ret = 0;
847
848out:
849 if (dict)
850 dict_unref (dict);
851
852 if (data)
853 data_unref (data);
854
855 if (ret && clnt_cmd)
856 GF_FREE (clnt_cmd)__gf_free (clnt_cmd);
857
858 loc_wipe (&loc);
859 return ret;
860}
861
862static int
863is_pump_aborted (xlator_t *this)
864{
865 pump_state_t state;
866
867 state = pump_get_state ();
868
869 return ((state == PUMP_STATE_ABORT));
870}
871
872int32_t
873pump_cmd_start_getxattr_cbk (call_frame_t *frame,
874 void *cookie,
875 xlator_t *this,
876 int32_t op_ret,
877 int32_t op_errno,
878 dict_t *dict, dict_t *xdata)
879{
880 afr_local_t *local = NULL((void*)0);
881 char *path = NULL((void*)0);
882
883 pump_state_t state;
884 int ret = 0;
885 int need_unwind = 0;
886 int dict_ret = -1;
887
888 local = frame->local;
889
890 if (op_ret < 0) {
891 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("getxattr failed - changing pump " "state to RUNNING with '/'"
); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 893, GF_LOG_DEBUG, "getxattr failed - changing pump " "state to RUNNING with '/'"
); } while (0)
892 "getxattr failed - changing pump "do { do { if (0) printf ("getxattr failed - changing pump " "state to RUNNING with '/'"
); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 893, GF_LOG_DEBUG, "getxattr failed - changing pump " "state to RUNNING with '/'"
); } while (0)
893 "state to RUNNING with '/'")do { do { if (0) printf ("getxattr failed - changing pump " "state to RUNNING with '/'"
); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 893, GF_LOG_DEBUG, "getxattr failed - changing pump " "state to RUNNING with '/'"
); } while (0)
;
894 path = "/";
895 ret = op_ret;
896 } else {
897 gf_log (this->name, GF_LOG_TRACE,do { do { if (0) printf ("getxattr succeeded"); } while (0); _gf_log
(this->name, "pump.c", __FUNCTION__, 898, GF_LOG_TRACE, "getxattr succeeded"
); } while (0)
898 "getxattr succeeded")do { do { if (0) printf ("getxattr succeeded"); } while (0); _gf_log
(this->name, "pump.c", __FUNCTION__, 898, GF_LOG_TRACE, "getxattr succeeded"
); } while (0)
;
899
900 dict_ret = dict_get_str (dict, PUMP_PATH"trusted.glusterfs.pump-path", &path);
901 if (dict_ret < 0)
902 path = "/";
903 }
904
905 state = pump_get_state ();
906 if ((state == PUMP_STATE_RUNNING) ||
907 (state == PUMP_STATE_RESUME)) {
908 gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("Pump is already started"); } while (
0); _gf_log (this->name, "pump.c", __FUNCTION__, 909, GF_LOG_ERROR
, "Pump is already started"); } while (0)
909 "Pump is already started")do { do { if (0) printf ("Pump is already started"); } while (
0); _gf_log (this->name, "pump.c", __FUNCTION__, 909, GF_LOG_ERROR
, "Pump is already started"); } while (0)
;
910 ret = -1;
911 goto out;
912 }
913
914 pump_set_resume_path (this, path);
915
916 if (is_pump_aborted (this))
917 /* We're re-starting pump afresh */
918 ret = pump_initiate_sink_connect (frame, this);
919 else {
920 /* We're re-starting pump from a previous
921 pause */
922 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("about to start synctask"); } while (
0); _gf_log (this->name, "pump.c", __FUNCTION__, 923, GF_LOG_DEBUG
, "about to start synctask"); } while (0)
923 "about to start synctask")do { do { if (0) printf ("about to start synctask"); } while (
0); _gf_log (this->name, "pump.c", __FUNCTION__, 923, GF_LOG_DEBUG
, "about to start synctask"); } while (0)
;
924 ret = pump_start_synctask (this);
925 need_unwind = 1;
926 }
927
928out:
929 if ((ret < 0) || (need_unwind == 1)) {
930 local->op_ret = ret;
931 pump_command_reply (frame, this);
932 }
933 return 0;
934}
935
936int
937pump_execute_status (call_frame_t *frame, xlator_t *this)
938{
939 afr_private_t *priv = NULL((void*)0);
940 pump_private_t *pump_priv = NULL((void*)0);
941
942 uint64_t number_files = 0;
943
944 char filename[PATH_MAX4096];
945 char summary[PATH_MAX4096+256];
946 char *dict_str = NULL((void*)0);
947
948 int32_t op_ret = 0;
949 int32_t op_errno = 0;
950
951 dict_t *dict = NULL((void*)0);
952 int ret = -1;
953
954 priv = this->private;
955 pump_priv = priv->pump_private;
956
957 LOCK (&pump_priv->resume_path_lock)pthread_spin_lock (&pump_priv->resume_path_lock);
958 {
959 number_files = pump_priv->number_files_pumped;
960 strncpy (filename, pump_priv->current_file, PATH_MAX4096);
961 }
962 UNLOCK (&pump_priv->resume_path_lock)pthread_spin_unlock (&pump_priv->resume_path_lock);
963
964 dict_str = GF_CALLOC (1, PATH_MAX + 256, gf_afr_mt_char)__gf_calloc (1, 4096 + 256, gf_afr_mt_char);
965 if (!dict_str) {
966 gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("Out of memory"); } while (0); _gf_log
(this->name, "pump.c", __FUNCTION__, 967, GF_LOG_ERROR, "Out of memory"
); } while (0)
967 "Out of memory")do { do { if (0) printf ("Out of memory"); } while (0); _gf_log
(this->name, "pump.c", __FUNCTION__, 967, GF_LOG_ERROR, "Out of memory"
); } while (0)
;
968 op_ret = -1;
969 op_errno = ENOMEM12;
970 goto out;
971 }
972
973 if (pump_priv->pump_finished) {
974 snprintf (summary, PATH_MAX4096+256,
975 "no_of_files=%"PRIu64"ll" "u", number_files);
976 } else {
977 snprintf (summary, PATH_MAX4096+256,
978 "no_of_files=%"PRIu64"ll" "u"":current_file=%s",
979 number_files, filename);
980 }
981 snprintf (dict_str, PATH_MAX4096+256, "status=%d:%s",
982 (pump_priv->pump_finished)?1:0, summary);
983
984 dict = dict_new ();
985
986 ret = dict_set_dynstr (dict, RB_PUMP_CMD_STATUS"glusterfs.pump.status", dict_str);
987 if (ret < 0) {
988 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("dict_set_dynstr returned negative value"
); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 989, GF_LOG_DEBUG, "dict_set_dynstr returned negative value"
); } while (0)
989 "dict_set_dynstr returned negative value")do { do { if (0) printf ("dict_set_dynstr returned negative value"
); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 989, GF_LOG_DEBUG, "dict_set_dynstr returned negative value"
); } while (0)
;
990 } else {
991 dict_str = NULL((void*)0);
992 }
993
994 op_ret = 0;
995
996out:
997
998 AFR_STACK_UNWIND (getxattr, frame, op_ret, op_errno, dict, NULL)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (frame) { __local = frame->local; __this = frame
->this; frame->local = ((void*)0); } do { fop_getxattr_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "pump.c", __FUNCTION__
, 998, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_getxattr_cbk_t )frame->ret; _parent = frame->parent
; pthread_spin_lock (&frame->root->stack_lock); { _parent
->ref_count--; } pthread_spin_unlock (&frame->root->
stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, op_ret, op_errno, dict, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); if (__local) { afr_local_cleanup
(__local, __this); mem_put (__local); } } while (0)
;
999
1000 if (dict)
1001 dict_unref (dict);
1002
1003 GF_FREE (dict_str)__gf_free (dict_str);
1004
1005 return 0;
1006}
1007
1008int
1009pump_execute_pause (call_frame_t *frame, xlator_t *this)
1010{
1011 afr_local_t *local = NULL((void*)0);
1012
1013 local = frame->local;
1014
1015 pump_change_state (this, PUMP_STATE_PAUSE);
1016
1017 local->op_ret = 0;
1018 pump_command_reply (frame, this);
1019
1020 return 0;
1021}
1022
1023int
1024pump_execute_start (call_frame_t *frame, xlator_t *this)
1025{
1026 afr_private_t *priv = NULL((void*)0);
1027 afr_local_t *local = NULL((void*)0);
1028
1029 int ret = 0;
1030 loc_t loc = {0};
1031
1032 priv = this->private;
1033 local = frame->local;
1034
1035 if (!priv->root_inode) {
1036 gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("Pump xlator cannot be started without an initial "
"lookup"); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 1038, GF_LOG_ERROR, "Pump xlator cannot be started without an initial "
"lookup"); } while (0)
1037 "Pump xlator cannot be started without an initial "do { do { if (0) printf ("Pump xlator cannot be started without an initial "
"lookup"); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 1038, GF_LOG_ERROR, "Pump xlator cannot be started without an initial "
"lookup"); } while (0)
1038 "lookup")do { do { if (0) printf ("Pump xlator cannot be started without an initial "
"lookup"); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 1038, GF_LOG_ERROR, "Pump xlator cannot be started without an initial "
"lookup"); } while (0)
;
1039 ret = -1;
1040 goto out;
1041 }
1042
1043 GF_ASSERT (priv->root_inode)do { if (!(priv->root_inode)) { do { do { if (0) printf ("Assertion failed: "
"priv->root_inode"); } while (0); _gf_log_callingfn ("", "pump.c"
, __FUNCTION__, 1043, GF_LOG_ERROR, "Assertion failed: " "priv->root_inode"
); } while (0); } } while (0)
;
1044
1045 afr_build_root_loc (this, &loc);
1046
1047 STACK_WIND (frame,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1052, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->getxattr_cbk) tmp_cbk = pump_cmd_start_getxattr_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "PUMP_SOURCE_CHILD(this)->fops->getxattr"
; _new->unwind_to = "pump_cmd_start_getxattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->getxattr); (this->children->xlator
)->fops->getxattr (_new, (this->children->xlator)
, &loc, "trusted.glusterfs.pump-path", ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1048 pump_cmd_start_getxattr_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1052, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->getxattr_cbk) tmp_cbk = pump_cmd_start_getxattr_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "PUMP_SOURCE_CHILD(this)->fops->getxattr"
; _new->unwind_to = "pump_cmd_start_getxattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->getxattr); (this->children->xlator
)->fops->getxattr (_new, (this->children->xlator)
, &loc, "trusted.glusterfs.pump-path", ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1049 PUMP_SOURCE_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1052, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->getxattr_cbk) tmp_cbk = pump_cmd_start_getxattr_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "PUMP_SOURCE_CHILD(this)->fops->getxattr"
; _new->unwind_to = "pump_cmd_start_getxattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->getxattr); (this->children->xlator
)->fops->getxattr (_new, (this->children->xlator)
, &loc, "trusted.glusterfs.pump-path", ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1050 PUMP_SOURCE_CHILD(this)->fops->getxattr,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1052, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->getxattr_cbk) tmp_cbk = pump_cmd_start_getxattr_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "PUMP_SOURCE_CHILD(this)->fops->getxattr"
; _new->unwind_to = "pump_cmd_start_getxattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->getxattr); (this->children->xlator
)->fops->getxattr (_new, (this->children->xlator)
, &loc, "trusted.glusterfs.pump-path", ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1051 &loc,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1052, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->getxattr_cbk) tmp_cbk = pump_cmd_start_getxattr_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "PUMP_SOURCE_CHILD(this)->fops->getxattr"
; _new->unwind_to = "pump_cmd_start_getxattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->getxattr); (this->children->xlator
)->fops->getxattr (_new, (this->children->xlator)
, &loc, "trusted.glusterfs.pump-path", ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1052 PUMP_PATH, NULL)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1052, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->getxattr_cbk) tmp_cbk = pump_cmd_start_getxattr_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "PUMP_SOURCE_CHILD(this)->fops->getxattr"
; _new->unwind_to = "pump_cmd_start_getxattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->getxattr); (this->children->xlator
)->fops->getxattr (_new, (this->children->xlator)
, &loc, "trusted.glusterfs.pump-path", ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
;
1053
1054 ret = 0;
1055
1056out:
1057 if (ret < 0) {
1058 local->op_ret = ret;
1059 pump_command_reply (frame, this);
1060 }
1061
1062 loc_wipe (&loc);
1063 return 0;
1064}
1065
1066static int
1067pump_cleanup_helper (void *data) {
1068 call_frame_t *frame = data;
1069
1070 pump_xattr_cleaner (frame, 0, frame->this, 0, 0, NULL((void*)0));
1071
1072 return 0;
1073}
1074
1075static int
1076pump_cleanup_done (int ret, call_frame_t *sync_frame, void *data)
1077{
1078 STACK_DESTROY (sync_frame->root);
1079
1080 return 0;
1081}
1082
1083int
1084pump_execute_commit (call_frame_t *frame, xlator_t *this)
1085{
1086 afr_private_t *priv = NULL((void*)0);
1087 pump_private_t *pump_priv = NULL((void*)0);
1088 afr_local_t *local = NULL((void*)0);
1089 call_frame_t *sync_frame = NULL((void*)0);
1090 int ret = 0;
1091
1092 priv = this->private;
1093 pump_priv = priv->pump_private;
1094 local = frame->local;
1095
1096 local->op_ret = 0;
1097 if (pump_priv->pump_finished) {
1098 pump_change_state (this, PUMP_STATE_COMMIT);
1099 sync_frame = create_frame (this, this->ctx->pool);
1100 ret = synctask_new (pump_priv->env, pump_cleanup_helper,
1101 pump_cleanup_done, sync_frame, frame);
1102 if (ret) {
1103 gf_log (this->name, GF_LOG_DEBUG, "Couldn't create "do { do { if (0) printf ("Couldn't create " "synctask for cleaning up xattrs."
); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 1104, GF_LOG_DEBUG, "Couldn't create " "synctask for cleaning up xattrs."
); } while (0)
1104 "synctask for cleaning up xattrs.")do { do { if (0) printf ("Couldn't create " "synctask for cleaning up xattrs."
); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 1104, GF_LOG_DEBUG, "Couldn't create " "synctask for cleaning up xattrs."
); } while (0)
;
1105 }
1106
1107 } else {
1108 gf_log (this->name, GF_LOG_ERROR, "Commit can't proceed. "do { do { if (0) printf ("Commit can't proceed. " "Migration in progress"
); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 1109, GF_LOG_ERROR, "Commit can't proceed. " "Migration in progress"
); } while (0)
1109 "Migration in progress")do { do { if (0) printf ("Commit can't proceed. " "Migration in progress"
); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 1109, GF_LOG_ERROR, "Commit can't proceed. " "Migration in progress"
); } while (0)
;
1110 local->op_ret = -1;
1111 local->op_errno = EINPROGRESS115;
1112 pump_command_reply (frame, this);
1113 }
1114
1115 return 0;
1116}
1117int
1118pump_execute_abort (call_frame_t *frame, xlator_t *this)
1119{
1120 afr_private_t *priv = NULL((void*)0);
1121 pump_private_t *pump_priv = NULL((void*)0);
1122 afr_local_t *local = NULL((void*)0);
1123 call_frame_t *sync_frame = NULL((void*)0);
1124 int ret = 0;
1125
1126 priv = this->private;
1127 pump_priv = priv->pump_private;
1128 local = frame->local;
1129
1130 pump_change_state (this, PUMP_STATE_ABORT);
1131
1132 LOCK (&pump_priv->resume_path_lock)pthread_spin_lock (&pump_priv->resume_path_lock);
1133 {
1134 pump_priv->number_files_pumped = 0;
1135 pump_priv->current_file[0] = '\0';
1136 }
1137 UNLOCK (&pump_priv->resume_path_lock)pthread_spin_unlock (&pump_priv->resume_path_lock);
1138
1139 local->op_ret = 0;
1140 if (pump_priv->pump_finished) {
1141 sync_frame = create_frame (this, this->ctx->pool);
1142 ret = synctask_new (pump_priv->env, pump_cleanup_helper,
1143 pump_cleanup_done, sync_frame, frame);
1144 if (ret) {
1145 gf_log (this->name, GF_LOG_DEBUG, "Couldn't create "do { do { if (0) printf ("Couldn't create " "synctask for cleaning up xattrs."
); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 1146, GF_LOG_DEBUG, "Couldn't create " "synctask for cleaning up xattrs."
); } while (0)
1146 "synctask for cleaning up xattrs.")do { do { if (0) printf ("Couldn't create " "synctask for cleaning up xattrs."
); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 1146, GF_LOG_DEBUG, "Couldn't create " "synctask for cleaning up xattrs."
); } while (0)
;
1147 }
1148
1149 } else {
1150 pump_priv->cleaner = fop_setxattr_cbk_stub (frame,
1151 pump_xattr_cleaner,
1152 0, 0, NULL((void*)0));
1153 }
1154
1155 return 0;
1156}
1157
1158gf_boolean_t
1159pump_command_status (xlator_t *this, dict_t *dict)
1160{
1161 char *cmd = NULL((void*)0);
1162 int dict_ret = -1;
1163 int ret = _gf_true;
1164
1165 dict_ret = dict_get_str (dict, RB_PUMP_CMD_STATUS"glusterfs.pump.status", &cmd);
1166 if (dict_ret < 0) {
1167 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("Not a pump status command"); } while
(0); _gf_log (this->name, "pump.c", __FUNCTION__, 1168, GF_LOG_DEBUG
, "Not a pump status command"); } while (0)
1168 "Not a pump status command")do { do { if (0) printf ("Not a pump status command"); } while
(0); _gf_log (this->name, "pump.c", __FUNCTION__, 1168, GF_LOG_DEBUG
, "Not a pump status command"); } while (0)
;
1169 ret = _gf_false;
1170 goto out;
1171 }
1172
1173 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("Hit a pump command - status"); } while
(0); _gf_log (this->name, "pump.c", __FUNCTION__, 1174, GF_LOG_DEBUG
, "Hit a pump command - status"); } while (0)
1174 "Hit a pump command - status")do { do { if (0) printf ("Hit a pump command - status"); } while
(0); _gf_log (this->name, "pump.c", __FUNCTION__, 1174, GF_LOG_DEBUG
, "Hit a pump command - status"); } while (0)
;
1175 ret = _gf_true;
1176
1177out:
1178 return ret;
1179
1180}
1181
1182gf_boolean_t
1183pump_command_pause (xlator_t *this, dict_t *dict)
1184{
1185 char *cmd = NULL((void*)0);
1186 int dict_ret = -1;
1187 int ret = _gf_true;
1188
1189 dict_ret = dict_get_str (dict, RB_PUMP_CMD_PAUSE"glusterfs.pump.pause", &cmd);
1190 if (dict_ret < 0) {
1191 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("Not a pump pause command"); } while
(0); _gf_log (this->name, "pump.c", __FUNCTION__, 1192, GF_LOG_DEBUG
, "Not a pump pause command"); } while (0)
1192 "Not a pump pause command")do { do { if (0) printf ("Not a pump pause command"); } while
(0); _gf_log (this->name, "pump.c", __FUNCTION__, 1192, GF_LOG_DEBUG
, "Not a pump pause command"); } while (0)
;
1193 ret = _gf_false;
1194 goto out;
1195 }
1196
1197 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("Hit a pump command - pause"); } while
(0); _gf_log (this->name, "pump.c", __FUNCTION__, 1198, GF_LOG_DEBUG
, "Hit a pump command - pause"); } while (0)
1198 "Hit a pump command - pause")do { do { if (0) printf ("Hit a pump command - pause"); } while
(0); _gf_log (this->name, "pump.c", __FUNCTION__, 1198, GF_LOG_DEBUG
, "Hit a pump command - pause"); } while (0)
;
1199 ret = _gf_true;
1200
1201out:
1202 return ret;
1203
1204}
1205
1206gf_boolean_t
1207pump_command_commit (xlator_t *this, dict_t *dict)
1208{
1209 char *cmd = NULL((void*)0);
1210 int dict_ret = -1;
1211 int ret = _gf_true;
1212
1213 dict_ret = dict_get_str (dict, RB_PUMP_CMD_COMMIT"glusterfs.pump.commit", &cmd);
1214 if (dict_ret < 0) {
1215 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("Not a pump commit command"); } while
(0); _gf_log (this->name, "pump.c", __FUNCTION__, 1216, GF_LOG_DEBUG
, "Not a pump commit command"); } while (0)
1216 "Not a pump commit command")do { do { if (0) printf ("Not a pump commit command"); } while
(0); _gf_log (this->name, "pump.c", __FUNCTION__, 1216, GF_LOG_DEBUG
, "Not a pump commit command"); } while (0)
;
1217 ret = _gf_false;
1218 goto out;
1219 }
1220
1221 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("Hit a pump command - commit"); } while
(0); _gf_log (this->name, "pump.c", __FUNCTION__, 1222, GF_LOG_DEBUG
, "Hit a pump command - commit"); } while (0)
1222 "Hit a pump command - commit")do { do { if (0) printf ("Hit a pump command - commit"); } while
(0); _gf_log (this->name, "pump.c", __FUNCTION__, 1222, GF_LOG_DEBUG
, "Hit a pump command - commit"); } while (0)
;
1223 ret = _gf_true;
1224
1225out:
1226 return ret;
1227
1228}
1229
1230gf_boolean_t
1231pump_command_abort (xlator_t *this, dict_t *dict)
1232{
1233 char *cmd = NULL((void*)0);
1234 int dict_ret = -1;
1235 int ret = _gf_true;
1236
1237 dict_ret = dict_get_str (dict, RB_PUMP_CMD_ABORT"glusterfs.pump.abort", &cmd);
1238 if (dict_ret < 0) {
1239 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("Not a pump abort command"); } while
(0); _gf_log (this->name, "pump.c", __FUNCTION__, 1240, GF_LOG_DEBUG
, "Not a pump abort command"); } while (0)
1240 "Not a pump abort command")do { do { if (0) printf ("Not a pump abort command"); } while
(0); _gf_log (this->name, "pump.c", __FUNCTION__, 1240, GF_LOG_DEBUG
, "Not a pump abort command"); } while (0)
;
1241 ret = _gf_false;
1242 goto out;
1243 }
1244
1245 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("Hit a pump command - abort"); } while
(0); _gf_log (this->name, "pump.c", __FUNCTION__, 1246, GF_LOG_DEBUG
, "Hit a pump command - abort"); } while (0)
1246 "Hit a pump command - abort")do { do { if (0) printf ("Hit a pump command - abort"); } while
(0); _gf_log (this->name, "pump.c", __FUNCTION__, 1246, GF_LOG_DEBUG
, "Hit a pump command - abort"); } while (0)
;
1247 ret = _gf_true;
1248
1249out:
1250 return ret;
1251
1252}
1253
1254gf_boolean_t
1255pump_command_start (xlator_t *this, dict_t *dict)
1256{
1257 char *cmd = NULL((void*)0);
1258 int dict_ret = -1;
1259 int ret = _gf_true;
1260
1261 dict_ret = dict_get_str (dict, RB_PUMP_CMD_START"glusterfs.pump.start", &cmd);
1262 if (dict_ret < 0) {
1263 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("Not a pump start command"); } while
(0); _gf_log (this->name, "pump.c", __FUNCTION__, 1264, GF_LOG_DEBUG
, "Not a pump start command"); } while (0)
1264 "Not a pump start command")do { do { if (0) printf ("Not a pump start command"); } while
(0); _gf_log (this->name, "pump.c", __FUNCTION__, 1264, GF_LOG_DEBUG
, "Not a pump start command"); } while (0)
;
1265 ret = _gf_false;
1266 goto out;
1267 }
1268
1269 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("Hit a pump command - start"); } while
(0); _gf_log (this->name, "pump.c", __FUNCTION__, 1270, GF_LOG_DEBUG
, "Hit a pump command - start"); } while (0)
1270 "Hit a pump command - start")do { do { if (0) printf ("Hit a pump command - start"); } while
(0); _gf_log (this->name, "pump.c", __FUNCTION__, 1270, GF_LOG_DEBUG
, "Hit a pump command - start"); } while (0)
;
1271 ret = _gf_true;
1272
1273out:
1274 return ret;
1275
1276}
1277
1278struct _xattr_key {
1279 char *key;
1280 struct list_head list;
1281};
1282
1283static int
1284__gather_xattr_keys (dict_t *dict, char *key, data_t *value,
1285 void *data)
1286{
1287 struct list_head * list = data;
1288 struct _xattr_key * xkey = NULL((void*)0);
1289
1290 if (!strncmp (key, AFR_XATTR_PREFIX"trusted.afr",
1291 strlen (AFR_XATTR_PREFIX"trusted.afr"))) {
1292
1293 xkey = GF_CALLOC (1, sizeof (*xkey), gf_afr_mt_xattr_key)__gf_calloc (1, sizeof (*xkey), gf_afr_mt_xattr_key);
1294 if (!xkey)
1295 return -1;
1296
1297 xkey->key = key;
1298 INIT_LIST_HEAD (&xkey->list)do { (&xkey->list)->next = (&xkey->list)->
prev = &xkey->list; } while (0)
;
1299
1300 list_add_tail (&xkey->list, list);
1301 }
1302 return 0;
1303}
1304
1305static void
1306__filter_xattrs (dict_t *dict)
1307{
1308 struct list_head keys;
1309
1310 struct _xattr_key *key;
1311 struct _xattr_key *tmp;
1312
1313 INIT_LIST_HEAD (&keys)do { (&keys)->next = (&keys)->prev = &keys;
} while (0)
;
1314
1315 dict_foreach (dict, __gather_xattr_keys,
1316 (void *) &keys);
1317
1318 list_for_each_entry_safe (key, tmp, &keys, list)for (key = ((typeof(*key) *)((char *)((&keys)->next)-(
unsigned long)(&((typeof(*key) *)0)->list))), tmp = ((
typeof(*key) *)((char *)(key->list.next)-(unsigned long)(&
((typeof(*key) *)0)->list))); &key->list != (&keys
); key = tmp, tmp = ((typeof(*tmp) *)((char *)(tmp->list.next
)-(unsigned long)(&((typeof(*tmp) *)0)->list))))
{
1319 dict_del (dict, key->key);
1320
1321 list_del_init (&key->list);
1322
1323 GF_FREE (key)__gf_free (key);
1324 }
1325}
1326
1327int32_t
1328pump_getxattr_cbk (call_frame_t *frame, void *cookie,
1329 xlator_t *this, int32_t op_ret, int32_t op_errno,
1330 dict_t *dict, dict_t *xdata)
1331{
1332 afr_private_t *priv = NULL((void*)0);
1333 afr_local_t *local = NULL((void*)0);
1334 xlator_t **children = NULL((void*)0);
1335 int unwind = 1;
1336 int32_t *last_index = NULL((void*)0);
1337 int32_t next_call_child = -1;
1338 int32_t read_child = -1;
1339 int32_t *fresh_children = NULL((void*)0);
1340
1341
1342 priv = this->private;
1343 children = priv->children;
1344
1345 local = frame->local;
1346
1347 read_child = (long) cookie;
1348
1349 if (op_ret == -1) {
1350 last_index = &local->cont.getxattr.last_index;
1351 fresh_children = local->fresh_children;
1352 next_call_child = afr_next_call_child (fresh_children,
1353 local->child_up,
1354 priv->child_count,
1355 last_index, read_child);
1356 if (next_call_child < 0)
1357 goto out;
1358
1359 unwind = 0;
1360 STACK_WIND_COOKIE (frame, pump_getxattr_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1365, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( children[next_call_child
]->fops->getxattr_cbk) tmp_cbk = pump_getxattr_cbk; _new
->root = frame->root; _new->this = children[next_call_child
]; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame
; _new->cookie = (void *) (long) read_child; _new->wind_from
= __FUNCTION__; _new->wind_to = "children[next_call_child]->fops->getxattr"
; _new->unwind_to = "pump_getxattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { frame->ref_count++; _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; } pthread_spin_unlock (&frame->root->stack_lock
); children[next_call_child]->fops->getxattr_cbk = pump_getxattr_cbk
; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = children[next_call_child]; if (children[next_call_child
]->ctx->measure_latency) gf_latency_begin (_new, children
[next_call_child]->fops->getxattr); children[next_call_child
]->fops->getxattr (_new, children[next_call_child], &
local->loc, local->cont.getxattr.name, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1361 (void *) (long) read_child,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1365, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( children[next_call_child
]->fops->getxattr_cbk) tmp_cbk = pump_getxattr_cbk; _new
->root = frame->root; _new->this = children[next_call_child
]; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame
; _new->cookie = (void *) (long) read_child; _new->wind_from
= __FUNCTION__; _new->wind_to = "children[next_call_child]->fops->getxattr"
; _new->unwind_to = "pump_getxattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { frame->ref_count++; _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; } pthread_spin_unlock (&frame->root->stack_lock
); children[next_call_child]->fops->getxattr_cbk = pump_getxattr_cbk
; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = children[next_call_child]; if (children[next_call_child
]->ctx->measure_latency) gf_latency_begin (_new, children
[next_call_child]->fops->getxattr); children[next_call_child
]->fops->getxattr (_new, children[next_call_child], &
local->loc, local->cont.getxattr.name, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1362 children[next_call_child],do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1365, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( children[next_call_child
]->fops->getxattr_cbk) tmp_cbk = pump_getxattr_cbk; _new
->root = frame->root; _new->this = children[next_call_child
]; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame
; _new->cookie = (void *) (long) read_child; _new->wind_from
= __FUNCTION__; _new->wind_to = "children[next_call_child]->fops->getxattr"
; _new->unwind_to = "pump_getxattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { frame->ref_count++; _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; } pthread_spin_unlock (&frame->root->stack_lock
); children[next_call_child]->fops->getxattr_cbk = pump_getxattr_cbk
; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = children[next_call_child]; if (children[next_call_child
]->ctx->measure_latency) gf_latency_begin (_new, children
[next_call_child]->fops->getxattr); children[next_call_child
]->fops->getxattr (_new, children[next_call_child], &
local->loc, local->cont.getxattr.name, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1363 children[next_call_child]->fops->getxattr,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1365, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( children[next_call_child
]->fops->getxattr_cbk) tmp_cbk = pump_getxattr_cbk; _new
->root = frame->root; _new->this = children[next_call_child
]; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame
; _new->cookie = (void *) (long) read_child; _new->wind_from
= __FUNCTION__; _new->wind_to = "children[next_call_child]->fops->getxattr"
; _new->unwind_to = "pump_getxattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { frame->ref_count++; _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; } pthread_spin_unlock (&frame->root->stack_lock
); children[next_call_child]->fops->getxattr_cbk = pump_getxattr_cbk
; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = children[next_call_child]; if (children[next_call_child
]->ctx->measure_latency) gf_latency_begin (_new, children
[next_call_child]->fops->getxattr); children[next_call_child
]->fops->getxattr (_new, children[next_call_child], &
local->loc, local->cont.getxattr.name, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1364 &local->loc,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1365, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( children[next_call_child
]->fops->getxattr_cbk) tmp_cbk = pump_getxattr_cbk; _new
->root = frame->root; _new->this = children[next_call_child
]; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame
; _new->cookie = (void *) (long) read_child; _new->wind_from
= __FUNCTION__; _new->wind_to = "children[next_call_child]->fops->getxattr"
; _new->unwind_to = "pump_getxattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { frame->ref_count++; _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; } pthread_spin_unlock (&frame->root->stack_lock
); children[next_call_child]->fops->getxattr_cbk = pump_getxattr_cbk
; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = children[next_call_child]; if (children[next_call_child
]->ctx->measure_latency) gf_latency_begin (_new, children
[next_call_child]->fops->getxattr); children[next_call_child
]->fops->getxattr (_new, children[next_call_child], &
local->loc, local->cont.getxattr.name, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1365 local->cont.getxattr.name, NULL)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1365, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( children[next_call_child
]->fops->getxattr_cbk) tmp_cbk = pump_getxattr_cbk; _new
->root = frame->root; _new->this = children[next_call_child
]; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame
; _new->cookie = (void *) (long) read_child; _new->wind_from
= __FUNCTION__; _new->wind_to = "children[next_call_child]->fops->getxattr"
; _new->unwind_to = "pump_getxattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { frame->ref_count++; _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; } pthread_spin_unlock (&frame->root->stack_lock
); children[next_call_child]->fops->getxattr_cbk = pump_getxattr_cbk
; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = children[next_call_child]; if (children[next_call_child
]->ctx->measure_latency) gf_latency_begin (_new, children
[next_call_child]->fops->getxattr); children[next_call_child
]->fops->getxattr (_new, children[next_call_child], &
local->loc, local->cont.getxattr.name, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
;
1366 }
1367
1368out:
1369 if (unwind) {
1370 if (op_ret >= 0 && dict)
1371 __filter_xattrs (dict);
1372
1373 AFR_STACK_UNWIND (getxattr, frame, op_ret, op_errno, dict, NULL)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (frame) { __local = frame->local; __this = frame
->this; frame->local = ((void*)0); } do { fop_getxattr_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "pump.c", __FUNCTION__
, 1373, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_getxattr_cbk_t )frame->ret; _parent = frame->parent
; pthread_spin_lock (&frame->root->stack_lock); { _parent
->ref_count--; } pthread_spin_unlock (&frame->root->
stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, op_ret, op_errno, dict, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); if (__local) { afr_local_cleanup
(__local, __this); mem_put (__local); } } while (0)
;
1374 }
1375
1376 return 0;
1377}
1378
1379int32_t
1380pump_getxattr (call_frame_t *frame, xlator_t *this,
1381 loc_t *loc, const char *name, dict_t *xdata)
1382{
1383 afr_private_t * priv = NULL((void*)0);
1384 xlator_t ** children = NULL((void*)0);
1385 int call_child = 0;
1386 afr_local_t *local = NULL((void*)0);
1387 int32_t ret = -1;
1388 int32_t op_errno = 0;
1389 uint64_t read_child = 0;
1390
1391
1392 VALIDATE_OR_GOTO (frame, out)do { if (!frame) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "frame"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "pump.c",
__FUNCTION__, 1392, GF_LOG_WARNING, "invalid argument: " "frame"
); } while (0); goto out; } } while (0)
;
1393 VALIDATE_OR_GOTO (this, out)do { if (!this) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "this"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "pump.c",
__FUNCTION__, 1393, GF_LOG_WARNING, "invalid argument: " "this"
); } while (0); goto out; } } while (0)
;
1394 VALIDATE_OR_GOTO (this->private, out)do { if (!this->private) { (*__errno_location ()) = 22; do
{ do { if (0) printf ("invalid argument: " "this->private"
); } while (0); _gf_log_callingfn ((this ? (this->name) : "(Govinda! Govinda!)"
), "pump.c", __FUNCTION__, 1394, GF_LOG_WARNING, "invalid argument: "
"this->private"); } while (0); goto out; } } while (0)
;
1395
1396 priv = this->private;
1397 VALIDATE_OR_GOTO (priv->children, out)do { if (!priv->children) { (*__errno_location ()) = 22; do
{ do { if (0) printf ("invalid argument: " "priv->children"
); } while (0); _gf_log_callingfn ((this ? (this->name) : "(Govinda! Govinda!)"
), "pump.c", __FUNCTION__, 1397, GF_LOG_WARNING, "invalid argument: "
"priv->children"); } while (0); goto out; } } while (0)
;
1398
1399 children = priv->children;
1400 if (!priv->use_afr_in_pump) {
1401 STACK_WIND (frame, default_getxattr_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1404, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( ((this->children
->xlator))->fops->getxattr_cbk) tmp_cbk = default_getxattr_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "(FIRST_CHILD (this))->fops->getxattr"
; _new->unwind_to = "default_getxattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, ((this->children
->xlator))->fops->getxattr); ((this->children->
xlator))->fops->getxattr (_new, (this->children->
xlator), loc, name, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
1402 FIRST_CHILD (this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1404, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( ((this->children
->xlator))->fops->getxattr_cbk) tmp_cbk = default_getxattr_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "(FIRST_CHILD (this))->fops->getxattr"
; _new->unwind_to = "default_getxattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, ((this->children
->xlator))->fops->getxattr); ((this->children->
xlator))->fops->getxattr (_new, (this->children->
xlator), loc, name, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
1403 (FIRST_CHILD (this))->fops->getxattr,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1404, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( ((this->children
->xlator))->fops->getxattr_cbk) tmp_cbk = default_getxattr_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "(FIRST_CHILD (this))->fops->getxattr"
; _new->unwind_to = "default_getxattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, ((this->children
->xlator))->fops->getxattr); ((this->children->
xlator))->fops->getxattr (_new, (this->children->
xlator), loc, name, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
1404 loc, name, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1404, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( ((this->children
->xlator))->fops->getxattr_cbk) tmp_cbk = default_getxattr_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "(FIRST_CHILD (this))->fops->getxattr"
; _new->unwind_to = "default_getxattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, ((this->children
->xlator))->fops->getxattr); ((this->children->
xlator))->fops->getxattr (_new, (this->children->
xlator), loc, name, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
;
1405 return 0;
1406 }
1407
1408
1409 AFR_LOCAL_ALLOC_OR_GOTO (frame->local, out)do { frame->local = mem_get0 ((*__glusterfs_this_location(
))->local_pool); if (!frame->local) { do { do { if (0) printf
("out of memory :("); } while (0); _gf_log (this->name, "pump.c"
, __FUNCTION__, 1409, GF_LOG_ERROR, "out of memory :("); } while
(0); op_errno = 12; goto out; } } while (0);
;
1410 local = frame->local;
1411
1412 ret = afr_local_init (local, priv, &op_errno);
1413 if (ret < 0)
1414 goto out;
1415
1416 if (name) {
1417 if (!strncmp (name, AFR_XATTR_PREFIX"trusted.afr",
1418 strlen (AFR_XATTR_PREFIX"trusted.afr"))) {
1419
1420 op_errno = ENODATA61;
1421 goto out;
1422 }
1423
1424 if (!strcmp (name, RB_PUMP_CMD_STATUS"glusterfs.pump.status")) {
1425 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("Hit pump command - status"); } while
(0); _gf_log (this->name, "pump.c", __FUNCTION__, 1426, GF_LOG_DEBUG
, "Hit pump command - status"); } while (0)
1426 "Hit pump command - status")do { do { if (0) printf ("Hit pump command - status"); } while
(0); _gf_log (this->name, "pump.c", __FUNCTION__, 1426, GF_LOG_DEBUG
, "Hit pump command - status"); } while (0)
;
1427 pump_execute_status (frame, this);
1428 ret = 0;
1429 goto out;
1430 }
1431 }
1432
1433 local->fresh_children = GF_CALLOC (priv->child_count,__gf_calloc (priv->child_count, sizeof (*local->fresh_children
), gf_afr_mt_int32_t)
1434 sizeof (*local->fresh_children),__gf_calloc (priv->child_count, sizeof (*local->fresh_children
), gf_afr_mt_int32_t)
1435 gf_afr_mt_int32_t)__gf_calloc (priv->child_count, sizeof (*local->fresh_children
), gf_afr_mt_int32_t)
;
1436 if (!local->fresh_children) {
1437 ret = -1;
1438 op_errno = ENOMEM12;
1439 goto out;
1440 }
1441
1442 read_child = afr_inode_get_read_ctx (this, loc->inode, local->fresh_children);
1443 ret = afr_get_call_child (this, local->child_up, read_child,
1444 local->fresh_children,
1445 &call_child,
1446 &local->cont.getxattr.last_index);
1447 if (ret < 0) {
1448 op_errno = -ret;
1449 goto out;
1450 }
1451 loc_copy (&local->loc, loc);
1452 if (name)
1453 local->cont.getxattr.name = gf_strdup (name);
1454
1455 STACK_WIND_COOKIE (frame, pump_getxattr_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1458, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( children[call_child
]->fops->getxattr_cbk) tmp_cbk = pump_getxattr_cbk; _new
->root = frame->root; _new->this = children[call_child
]; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame
; _new->cookie = (void *) (long) call_child; _new->wind_from
= __FUNCTION__; _new->wind_to = "children[call_child]->fops->getxattr"
; _new->unwind_to = "pump_getxattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { frame->ref_count++; _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; } pthread_spin_unlock (&frame->root->stack_lock
); children[call_child]->fops->getxattr_cbk = pump_getxattr_cbk
; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = children[call_child]; if (children[call_child]->ctx->
measure_latency) gf_latency_begin (_new, children[call_child]
->fops->getxattr); children[call_child]->fops->getxattr
(_new, children[call_child], loc, name, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1456 (void *) (long) call_child,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1458, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( children[call_child
]->fops->getxattr_cbk) tmp_cbk = pump_getxattr_cbk; _new
->root = frame->root; _new->this = children[call_child
]; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame
; _new->cookie = (void *) (long) call_child; _new->wind_from
= __FUNCTION__; _new->wind_to = "children[call_child]->fops->getxattr"
; _new->unwind_to = "pump_getxattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { frame->ref_count++; _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; } pthread_spin_unlock (&frame->root->stack_lock
); children[call_child]->fops->getxattr_cbk = pump_getxattr_cbk
; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = children[call_child]; if (children[call_child]->ctx->
measure_latency) gf_latency_begin (_new, children[call_child]
->fops->getxattr); children[call_child]->fops->getxattr
(_new, children[call_child], loc, name, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1457 children[call_child], children[call_child]->fops->getxattr,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1458, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( children[call_child
]->fops->getxattr_cbk) tmp_cbk = pump_getxattr_cbk; _new
->root = frame->root; _new->this = children[call_child
]; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame
; _new->cookie = (void *) (long) call_child; _new->wind_from
= __FUNCTION__; _new->wind_to = "children[call_child]->fops->getxattr"
; _new->unwind_to = "pump_getxattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { frame->ref_count++; _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; } pthread_spin_unlock (&frame->root->stack_lock
); children[call_child]->fops->getxattr_cbk = pump_getxattr_cbk
; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = children[call_child]; if (children[call_child]->ctx->
measure_latency) gf_latency_begin (_new, children[call_child]
->fops->getxattr); children[call_child]->fops->getxattr
(_new, children[call_child], loc, name, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1458 loc, name, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1458, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( children[call_child
]->fops->getxattr_cbk) tmp_cbk = pump_getxattr_cbk; _new
->root = frame->root; _new->this = children[call_child
]; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame
; _new->cookie = (void *) (long) call_child; _new->wind_from
= __FUNCTION__; _new->wind_to = "children[call_child]->fops->getxattr"
; _new->unwind_to = "pump_getxattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { frame->ref_count++; _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; } pthread_spin_unlock (&frame->root->stack_lock
); children[call_child]->fops->getxattr_cbk = pump_getxattr_cbk
; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = children[call_child]; if (children[call_child]->ctx->
measure_latency) gf_latency_begin (_new, children[call_child]
->fops->getxattr); children[call_child]->fops->getxattr
(_new, children[call_child], loc, name, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0)
;
1459
1460 ret = 0;
1461out:
1462 if (ret < 0)
1463 AFR_STACK_UNWIND (getxattr, frame, -1, op_errno, NULL, NULL)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (frame) { __local = frame->local; __this = frame
->this; frame->local = ((void*)0); } do { fop_getxattr_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "pump.c", __FUNCTION__
, 1463, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_getxattr_cbk_t )frame->ret; _parent = frame->parent
; pthread_spin_lock (&frame->root->stack_lock); { _parent
->ref_count--; } pthread_spin_unlock (&frame->root->
stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, -1, op_errno, ((void*)0), ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); if (__local) { afr_local_cleanup
(__local, __this); mem_put (__local); } } while (0)
;
1464 return 0;
1465}
1466
1467static int
1468afr_setxattr_unwind (call_frame_t *frame, xlator_t *this)
1469{
1470 afr_local_t * local = NULL((void*)0);
1471 call_frame_t *main_frame = NULL((void*)0);
1472
1473 local = frame->local;
1474
1475 LOCK (&frame->lock)pthread_spin_lock (&frame->lock);
1476 {
1477 if (local->transaction.main_frame)
1478 main_frame = local->transaction.main_frame;
1479 local->transaction.main_frame = NULL((void*)0);
1480 }
1481 UNLOCK (&frame->lock)pthread_spin_unlock (&frame->lock);
1482
1483 if (main_frame) {
1484 AFR_STACK_UNWIND (setxattr, main_frame,do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (main_frame) { __local = main_frame->local; __this
= main_frame->this; main_frame->local = ((void*)0); } do
{ fop_setxattr_cbk_t fn = ((void*)0); call_frame_t *_parent =
((void*)0); xlator_t *old_THIS = ((void*)0); if (!main_frame
) { do { do { if (0) printf ("!frame"); } while (0); _gf_log (
"stack", "pump.c", __FUNCTION__, 1485, GF_LOG_CRITICAL, "!frame"
); } while (0); break; } fn = (fop_setxattr_cbk_t )main_frame
->ret; _parent = main_frame->parent; pthread_spin_lock (
&main_frame->root->stack_lock); { _parent->ref_count
--; } pthread_spin_unlock (&main_frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; main_frame->complete = _gf_true; main_frame
->unwind_from = __FUNCTION__; if (main_frame->this->
ctx->measure_latency) gf_latency_end (main_frame); fn (_parent
, main_frame->cookie, _parent->this, local->op_ret, local
->op_errno, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0); if (__local) { afr_local_cleanup (__local, __this
); mem_put (__local); } } while (0)
1485 local->op_ret, local->op_errno, NULL)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (main_frame) { __local = main_frame->local; __this
= main_frame->this; main_frame->local = ((void*)0); } do
{ fop_setxattr_cbk_t fn = ((void*)0); call_frame_t *_parent =
((void*)0); xlator_t *old_THIS = ((void*)0); if (!main_frame
) { do { do { if (0) printf ("!frame"); } while (0); _gf_log (
"stack", "pump.c", __FUNCTION__, 1485, GF_LOG_CRITICAL, "!frame"
); } while (0); break; } fn = (fop_setxattr_cbk_t )main_frame
->ret; _parent = main_frame->parent; pthread_spin_lock (
&main_frame->root->stack_lock); { _parent->ref_count
--; } pthread_spin_unlock (&main_frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; main_frame->complete = _gf_true; main_frame
->unwind_from = __FUNCTION__; if (main_frame->this->
ctx->measure_latency) gf_latency_end (main_frame); fn (_parent
, main_frame->cookie, _parent->this, local->op_ret, local
->op_errno, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0); if (__local) { afr_local_cleanup (__local, __this
); mem_put (__local); } } while (0)
;
1486 }
1487 return 0;
1488}
1489
1490static int
1491afr_setxattr_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
1492 int32_t op_ret, int32_t op_errno, dict_t *xdata)
1493{
1494 afr_local_t * local = NULL((void*)0);
1495 afr_private_t * priv = NULL((void*)0);
1496
1497 int call_count = -1;
1498 int need_unwind = 0;
1499
1500 local = frame->local;
1501 priv = this->private;
1502
1503 LOCK (&frame->lock)pthread_spin_lock (&frame->lock);
1504 {
1505 if (op_ret != -1) {
1506 if (local->success_count == 0) {
1507 local->op_ret = op_ret;
1508 }
1509 local->success_count++;
1510
1511 if (local->success_count == priv->child_count) {
1512 need_unwind = 1;
1513 }
1514 }
1515
1516 local->op_errno = op_errno;
1517 }
1518 UNLOCK (&frame->lock)pthread_spin_unlock (&frame->lock);
1519
1520 if (need_unwind)
1521 local->transaction.unwind (frame, this);
1522
1523 call_count = afr_frame_return (frame);
1524
1525 if (call_count == 0) {
1526 local->transaction.resume (frame, this);
1527 }
1528
1529 return 0;
1530}
1531
1532static int
1533afr_setxattr_wind (call_frame_t *frame, xlator_t *this)
1534{
1535 afr_local_t *local = NULL((void*)0);
1536 afr_private_t *priv = NULL((void*)0);
1537
1538 int call_count = -1;
1539 int i = 0;
1540
1541 local = frame->local;
1542 priv = this->private;
1543
1544 call_count = afr_up_children_count (local->child_up, priv->child_count);
1545
1546 if (call_count == 0) {
1547 local->transaction.resume (frame, this);
1548 return 0;
1549 }
1550
1551 local->call_count = call_count;
1552
1553 for (i = 0; i < priv->child_count; i++) {
1554 if (local->child_up[i]) {
1555 STACK_WIND_COOKIE (frame, afr_setxattr_wind_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1561, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( priv->children
[i]->fops->setxattr_cbk) tmp_cbk = afr_setxattr_wind_cbk
; _new->root = frame->root; _new->this = priv->children
[i]; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame
; _new->cookie = (void *) (long) i; _new->wind_from = __FUNCTION__
; _new->wind_to = "priv->children[i]->fops->setxattr"
; _new->unwind_to = "afr_setxattr_wind_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { frame->ref_count++; _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; } pthread_spin_unlock (&frame->root->stack_lock
); priv->children[i]->fops->setxattr_cbk = afr_setxattr_wind_cbk
; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = priv->children[i]; if (priv->children[i]->ctx->
measure_latency) gf_latency_begin (_new, priv->children[i]
->fops->setxattr); priv->children[i]->fops->setxattr
(_new, priv->children[i], &local->loc, local->cont
.setxattr.dict, local->cont.setxattr.flags, ((void*)0)); (
*__glusterfs_this_location()) = old_THIS; } while (0)
1556 (void *) (long) i,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1561, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( priv->children
[i]->fops->setxattr_cbk) tmp_cbk = afr_setxattr_wind_cbk
; _new->root = frame->root; _new->this = priv->children
[i]; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame
; _new->cookie = (void *) (long) i; _new->wind_from = __FUNCTION__
; _new->wind_to = "priv->children[i]->fops->setxattr"
; _new->unwind_to = "afr_setxattr_wind_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { frame->ref_count++; _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; } pthread_spin_unlock (&frame->root->stack_lock
); priv->children[i]->fops->setxattr_cbk = afr_setxattr_wind_cbk
; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = priv->children[i]; if (priv->children[i]->ctx->
measure_latency) gf_latency_begin (_new, priv->children[i]
->fops->setxattr); priv->children[i]->fops->setxattr
(_new, priv->children[i], &local->loc, local->cont
.setxattr.dict, local->cont.setxattr.flags, ((void*)0)); (
*__glusterfs_this_location()) = old_THIS; } while (0)
1557 priv->children[i],do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1561, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( priv->children
[i]->fops->setxattr_cbk) tmp_cbk = afr_setxattr_wind_cbk
; _new->root = frame->root; _new->this = priv->children
[i]; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame
; _new->cookie = (void *) (long) i; _new->wind_from = __FUNCTION__
; _new->wind_to = "priv->children[i]->fops->setxattr"
; _new->unwind_to = "afr_setxattr_wind_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { frame->ref_count++; _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; } pthread_spin_unlock (&frame->root->stack_lock
); priv->children[i]->fops->setxattr_cbk = afr_setxattr_wind_cbk
; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = priv->children[i]; if (priv->children[i]->ctx->
measure_latency) gf_latency_begin (_new, priv->children[i]
->fops->setxattr); priv->children[i]->fops->setxattr
(_new, priv->children[i], &local->loc, local->cont
.setxattr.dict, local->cont.setxattr.flags, ((void*)0)); (
*__glusterfs_this_location()) = old_THIS; } while (0)
1558 priv->children[i]->fops->setxattr,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1561, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( priv->children
[i]->fops->setxattr_cbk) tmp_cbk = afr_setxattr_wind_cbk
; _new->root = frame->root; _new->this = priv->children
[i]; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame
; _new->cookie = (void *) (long) i; _new->wind_from = __FUNCTION__
; _new->wind_to = "priv->children[i]->fops->setxattr"
; _new->unwind_to = "afr_setxattr_wind_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { frame->ref_count++; _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; } pthread_spin_unlock (&frame->root->stack_lock
); priv->children[i]->fops->setxattr_cbk = afr_setxattr_wind_cbk
; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = priv->children[i]; if (priv->children[i]->ctx->
measure_latency) gf_latency_begin (_new, priv->children[i]
->fops->setxattr); priv->children[i]->fops->setxattr
(_new, priv->children[i], &local->loc, local->cont
.setxattr.dict, local->cont.setxattr.flags, ((void*)0)); (
*__glusterfs_this_location()) = old_THIS; } while (0)
1559 &local->loc,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1561, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( priv->children
[i]->fops->setxattr_cbk) tmp_cbk = afr_setxattr_wind_cbk
; _new->root = frame->root; _new->this = priv->children
[i]; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame
; _new->cookie = (void *) (long) i; _new->wind_from = __FUNCTION__
; _new->wind_to = "priv->children[i]->fops->setxattr"
; _new->unwind_to = "afr_setxattr_wind_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { frame->ref_count++; _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; } pthread_spin_unlock (&frame->root->stack_lock
); priv->children[i]->fops->setxattr_cbk = afr_setxattr_wind_cbk
; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = priv->children[i]; if (priv->children[i]->ctx->
measure_latency) gf_latency_begin (_new, priv->children[i]
->fops->setxattr); priv->children[i]->fops->setxattr
(_new, priv->children[i], &local->loc, local->cont
.setxattr.dict, local->cont.setxattr.flags, ((void*)0)); (
*__glusterfs_this_location()) = old_THIS; } while (0)
1560 local->cont.setxattr.dict,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1561, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( priv->children
[i]->fops->setxattr_cbk) tmp_cbk = afr_setxattr_wind_cbk
; _new->root = frame->root; _new->this = priv->children
[i]; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame
; _new->cookie = (void *) (long) i; _new->wind_from = __FUNCTION__
; _new->wind_to = "priv->children[i]->fops->setxattr"
; _new->unwind_to = "afr_setxattr_wind_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { frame->ref_count++; _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; } pthread_spin_unlock (&frame->root->stack_lock
); priv->children[i]->fops->setxattr_cbk = afr_setxattr_wind_cbk
; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = priv->children[i]; if (priv->children[i]->ctx->
measure_latency) gf_latency_begin (_new, priv->children[i]
->fops->setxattr); priv->children[i]->fops->setxattr
(_new, priv->children[i], &local->loc, local->cont
.setxattr.dict, local->cont.setxattr.flags, ((void*)0)); (
*__glusterfs_this_location()) = old_THIS; } while (0)
1561 local->cont.setxattr.flags, NULL)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1561, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( priv->children
[i]->fops->setxattr_cbk) tmp_cbk = afr_setxattr_wind_cbk
; _new->root = frame->root; _new->this = priv->children
[i]; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame
; _new->cookie = (void *) (long) i; _new->wind_from = __FUNCTION__
; _new->wind_to = "priv->children[i]->fops->setxattr"
; _new->unwind_to = "afr_setxattr_wind_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { frame->ref_count++; _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; } pthread_spin_unlock (&frame->root->stack_lock
); priv->children[i]->fops->setxattr_cbk = afr_setxattr_wind_cbk
; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = priv->children[i]; if (priv->children[i]->ctx->
measure_latency) gf_latency_begin (_new, priv->children[i]
->fops->setxattr); priv->children[i]->fops->setxattr
(_new, priv->children[i], &local->loc, local->cont
.setxattr.dict, local->cont.setxattr.flags, ((void*)0)); (
*__glusterfs_this_location()) = old_THIS; } while (0)
;
1562
1563 if (!--call_count)
1564 break;
1565 }
1566 }
1567
1568 return 0;
1569}
1570
1571
1572static int
1573afr_setxattr_done (call_frame_t *frame, xlator_t *this)
1574{
1575 afr_local_t * local = frame->local;
1576
1577 local->transaction.unwind (frame, this);
1578
1579 AFR_STACK_DESTROY (frame)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); __local = frame->local; __this = frame->this;
frame->local = ((void*)0); STACK_DESTROY (frame->root)
; if (__local) { afr_local_cleanup (__local, __this); mem_put
(__local); } } while (0);
;
1580
1581 return 0;
1582}
1583
1584int32_t
1585pump_setxattr_cbk (call_frame_t *frame,
1586 void *cookie,
1587 xlator_t *this,
1588 int32_t op_ret,
1589 int32_t op_errno, dict_t *xdata)
1590{
1591 AFR_STACK_UNWIND (setxattr, frame, op_ret, op_errno, xdata)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (frame) { __local = frame->local; __this = frame
->this; frame->local = ((void*)0); } do { fop_setxattr_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "pump.c", __FUNCTION__
, 1591, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_setxattr_cbk_t )frame->ret; _parent = frame->parent
; pthread_spin_lock (&frame->root->stack_lock); { _parent
->ref_count--; } pthread_spin_unlock (&frame->root->
stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, op_ret, op_errno, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0); if (__local) { afr_local_cleanup
(__local, __this); mem_put (__local); } } while (0)
;
1592 return 0;
1593}
1594
1595int
1596pump_command_reply (call_frame_t *frame, xlator_t *this)
1597{
1598 afr_local_t *local = NULL((void*)0);
1599
1600 local = frame->local;
1601
1602 if (local->op_ret < 0)
1603 gf_log (this->name, GF_LOG_INFO,do { do { if (0) printf ("Command failed"); } while (0); _gf_log
(this->name, "pump.c", __FUNCTION__, 1604, GF_LOG_INFO, "Command failed"
); } while (0)
1604 "Command failed")do { do { if (0) printf ("Command failed"); } while (0); _gf_log
(this->name, "pump.c", __FUNCTION__, 1604, GF_LOG_INFO, "Command failed"
); } while (0)
;
1605 else
1606 gf_log (this->name, GF_LOG_INFO,do { do { if (0) printf ("Command succeeded"); } while (0); _gf_log
(this->name, "pump.c", __FUNCTION__, 1607, GF_LOG_INFO, "Command succeeded"
); } while (0)
1607 "Command succeeded")do { do { if (0) printf ("Command succeeded"); } while (0); _gf_log
(this->name, "pump.c", __FUNCTION__, 1607, GF_LOG_INFO, "Command succeeded"
); } while (0)
;
1608
1609 AFR_STACK_UNWIND (setxattr,do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (frame) { __local = frame->local; __this = frame
->this; frame->local = ((void*)0); } do { fop_setxattr_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "pump.c", __FUNCTION__
, 1612, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_setxattr_cbk_t )frame->ret; _parent = frame->parent
; pthread_spin_lock (&frame->root->stack_lock); { _parent
->ref_count--; } pthread_spin_unlock (&frame->root->
stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, local->op_ret, local->op_errno, ((void*)0));
(*__glusterfs_this_location()) = old_THIS; } while (0); if (
__local) { afr_local_cleanup (__local, __this); mem_put (__local
); } } while (0)
1610 frame,do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (frame) { __local = frame->local; __this = frame
->this; frame->local = ((void*)0); } do { fop_setxattr_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "pump.c", __FUNCTION__
, 1612, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_setxattr_cbk_t )frame->ret; _parent = frame->parent
; pthread_spin_lock (&frame->root->stack_lock); { _parent
->ref_count--; } pthread_spin_unlock (&frame->root->
stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, local->op_ret, local->op_errno, ((void*)0));
(*__glusterfs_this_location()) = old_THIS; } while (0); if (
__local) { afr_local_cleanup (__local, __this); mem_put (__local
); } } while (0)
1611 local->op_ret,do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (frame) { __local = frame->local; __this = frame
->this; frame->local = ((void*)0); } do { fop_setxattr_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "pump.c", __FUNCTION__
, 1612, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_setxattr_cbk_t )frame->ret; _parent = frame->parent
; pthread_spin_lock (&frame->root->stack_lock); { _parent
->ref_count--; } pthread_spin_unlock (&frame->root->
stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, local->op_ret, local->op_errno, ((void*)0));
(*__glusterfs_this_location()) = old_THIS; } while (0); if (
__local) { afr_local_cleanup (__local, __this); mem_put (__local
); } } while (0)
1612 local->op_errno, NULL)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (frame) { __local = frame->local; __this = frame
->this; frame->local = ((void*)0); } do { fop_setxattr_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "pump.c", __FUNCTION__
, 1612, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_setxattr_cbk_t )frame->ret; _parent = frame->parent
; pthread_spin_lock (&frame->root->stack_lock); { _parent
->ref_count--; } pthread_spin_unlock (&frame->root->
stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, local->op_ret, local->op_errno, ((void*)0));
(*__glusterfs_this_location()) = old_THIS; } while (0); if (
__local) { afr_local_cleanup (__local, __this); mem_put (__local
); } } while (0)
;
1613
1614 return 0;
1615}
1616
1617int
1618pump_parse_command (call_frame_t *frame, xlator_t *this,
1619 afr_local_t *local, dict_t *dict)
1620{
1621
1622 int ret = -1;
1623
1624 if (pump_command_start (this, dict)) {
1625 frame->local = local;
1626 local->dict = dict_ref (dict);
1627 ret = pump_execute_start (frame, this);
1628
1629 } else if (pump_command_pause (this, dict)) {
1630 frame->local = local;
1631 local->dict = dict_ref (dict);
1632 ret = pump_execute_pause (frame, this);
1633
1634 } else if (pump_command_abort (this, dict)) {
1635 frame->local = local;
1636 local->dict = dict_ref (dict);
1637 ret = pump_execute_abort (frame, this);
1638
1639 } else if (pump_command_commit (this, dict)) {
1640 frame->local = local;
1641 local->dict = dict_ref (dict);
1642 ret = pump_execute_commit (frame, this);
1643 }
1644 return ret;
1645}
1646
1647int
1648pump_setxattr (call_frame_t *frame, xlator_t *this,
1649 loc_t *loc, dict_t *dict, int32_t flags, dict_t *xdata)
1650{
1651 afr_private_t * priv = NULL((void*)0);
1652 afr_local_t * local = NULL((void*)0);
1653 call_frame_t *transaction_frame = NULL((void*)0);
1654 int ret = -1;
1655 int op_errno = 0;
1656
1657 VALIDATE_OR_GOTO (frame, out)do { if (!frame) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "frame"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "pump.c",
__FUNCTION__, 1657, GF_LOG_WARNING, "invalid argument: " "frame"
); } while (0); goto out; } } while (0)
;
1658 VALIDATE_OR_GOTO (this, out)do { if (!this) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "this"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "pump.c",
__FUNCTION__, 1658, GF_LOG_WARNING, "invalid argument: " "this"
); } while (0); goto out; } } while (0)
;
1659 VALIDATE_OR_GOTO (this->private, out)do { if (!this->private) { (*__errno_location ()) = 22; do
{ do { if (0) printf ("invalid argument: " "this->private"
); } while (0); _gf_log_callingfn ((this ? (this->name) : "(Govinda! Govinda!)"
), "pump.c", __FUNCTION__, 1659, GF_LOG_WARNING, "invalid argument: "
"this->private"); } while (0); goto out; } } while (0)
;
1660
1661 GF_IF_INTERNAL_XATTR_GOTO ("trusted.glusterfs.pump*", dict,do { if (!dict) { do { do { if (0) printf ("setxattr dict is null"
); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 1662, GF_LOG_ERROR, "setxattr dict is null"); } while (0); goto
out; } if (dict_foreach_fnmatch (dict, "trusted.glusterfs.pump*"
, dict_null_foreach_fn, ((void*)0)) > 0) { op_errno = 1; do
{ do { if (0) printf ("attempt to set internal" " xattr: %s: %s"
, "trusted.glusterfs.pump*", strerror (op_errno)); } while (0
); _gf_log (this->name, "pump.c", __FUNCTION__, 1662, GF_LOG_ERROR
, "attempt to set internal" " xattr: %s: %s", "trusted.glusterfs.pump*"
, strerror (op_errno)); } while (0); goto out; } } while (0)
1662 op_errno, out)do { if (!dict) { do { do { if (0) printf ("setxattr dict is null"
); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 1662, GF_LOG_ERROR, "setxattr dict is null"); } while (0); goto
out; } if (dict_foreach_fnmatch (dict, "trusted.glusterfs.pump*"
, dict_null_foreach_fn, ((void*)0)) > 0) { op_errno = 1; do
{ do { if (0) printf ("attempt to set internal" " xattr: %s: %s"
, "trusted.glusterfs.pump*", strerror (op_errno)); } while (0
); _gf_log (this->name, "pump.c", __FUNCTION__, 1662, GF_LOG_ERROR
, "attempt to set internal" " xattr: %s: %s", "trusted.glusterfs.pump*"
, strerror (op_errno)); } while (0); goto out; } } while (0)
;
1663
1664 priv = this->private;
1665 if (!priv->use_afr_in_pump) {
1666 STACK_WIND (frame, default_setxattr_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1669, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( ((this->children
->xlator))->fops->setxattr_cbk) tmp_cbk = default_setxattr_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "(FIRST_CHILD (this))->fops->setxattr"
; _new->unwind_to = "default_setxattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, ((this->children
->xlator))->fops->setxattr); ((this->children->
xlator))->fops->setxattr (_new, (this->children->
xlator), loc, dict, flags, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1667 FIRST_CHILD (this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1669, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( ((this->children
->xlator))->fops->setxattr_cbk) tmp_cbk = default_setxattr_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "(FIRST_CHILD (this))->fops->setxattr"
; _new->unwind_to = "default_setxattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, ((this->children
->xlator))->fops->setxattr); ((this->children->
xlator))->fops->setxattr (_new, (this->children->
xlator), loc, dict, flags, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1668 (FIRST_CHILD (this))->fops->setxattr,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1669, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( ((this->children
->xlator))->fops->setxattr_cbk) tmp_cbk = default_setxattr_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "(FIRST_CHILD (this))->fops->setxattr"
; _new->unwind_to = "default_setxattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, ((this->children
->xlator))->fops->setxattr); ((this->children->
xlator))->fops->setxattr (_new, (this->children->
xlator), loc, dict, flags, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1669 loc, dict, flags, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1669, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( ((this->children
->xlator))->fops->setxattr_cbk) tmp_cbk = default_setxattr_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "(FIRST_CHILD (this))->fops->setxattr"
; _new->unwind_to = "default_setxattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, ((this->children
->xlator))->fops->setxattr); ((this->children->
xlator))->fops->setxattr (_new, (this->children->
xlator), loc, dict, flags, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0)
;
1670 return 0;
1671 }
1672
1673
1674 AFR_LOCAL_ALLOC_OR_GOTO (local, out)do { local = mem_get0 ((*__glusterfs_this_location())->local_pool
); if (!local) { do { do { if (0) printf ("out of memory :(")
; } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 1674, GF_LOG_ERROR, "out of memory :("); } while (0); op_errno
= 12; goto out; } } while (0);
;
1675
1676 ret = afr_local_init (local, priv, &op_errno);
1677 if (ret < 0) {
1678 afr_local_cleanup (local, this);
1679 goto out;
1680 }
1681
1682 ret = pump_parse_command (frame, this,
1683 local, dict);
1684 if (ret >= 0) {
1685 ret = 0;
1686 goto out;
1687 }
1688
1689 transaction_frame = copy_frame (frame);
1690 if (!transaction_frame) {
1691 gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("Out of memory."); } while (0); _gf_log
(this->name, "pump.c", __FUNCTION__, 1692, GF_LOG_ERROR, "Out of memory."
); } while (0)
1692 "Out of memory.")do { do { if (0) printf ("Out of memory."); } while (0); _gf_log
(this->name, "pump.c", __FUNCTION__, 1692, GF_LOG_ERROR, "Out of memory."
); } while (0)
;
1693 op_errno = ENOMEM12;
1694 ret = -1;
1695 afr_local_cleanup (local, this);
1696 goto out;
1697 }
1698
1699 transaction_frame->local = local;
1700
1701 local->op_ret = -1;
1702
1703 local->cont.setxattr.dict = dict_ref (dict);
1704 local->cont.setxattr.flags = flags;
1705
1706 local->transaction.fop = afr_setxattr_wind;
1707 local->transaction.done = afr_setxattr_done;
1708 local->transaction.unwind = afr_setxattr_unwind;
1709
1710 loc_copy (&local->loc, loc);
1711
1712 local->transaction.main_frame = frame;
1713 local->transaction.start = LLONG_MAX9223372036854775807LL - 1;
1714 local->transaction.len = 0;
1715
1716 afr_transaction (transaction_frame, this, AFR_METADATA_TRANSACTION);
1717
1718 ret = 0;
1719out:
1720 if (ret < 0) {
1721 if (transaction_frame)
1722 AFR_STACK_DESTROY (transaction_frame)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); __local = transaction_frame->local; __this = transaction_frame
->this; transaction_frame->local = ((void*)0); STACK_DESTROY
(transaction_frame->root); if (__local) { afr_local_cleanup
(__local, __this); mem_put (__local); } } while (0);
;
1723 AFR_STACK_UNWIND (setxattr, frame, -1, op_errno, NULL)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (frame) { __local = frame->local; __this = frame
->this; frame->local = ((void*)0); } do { fop_setxattr_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "pump.c", __FUNCTION__
, 1723, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_setxattr_cbk_t )frame->ret; _parent = frame->parent
; pthread_spin_lock (&frame->root->stack_lock); { _parent
->ref_count--; } pthread_spin_unlock (&frame->root->
stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, -1, op_errno, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); if (__local) { afr_local_cleanup
(__local, __this); mem_put (__local); } } while (0)
;
1724 }
1725
1726 return 0;
1727}
1728
1729/* Defaults */
1730static int32_t
1731pump_lookup (call_frame_t *frame,
1732 xlator_t *this,
1733 loc_t *loc,
1734 dict_t *xattr_req)
1735{
1736 afr_private_t *priv = NULL((void*)0);
1737 priv = this->private;
1738 if (!priv->use_afr_in_pump) {
1739 STACK_WIND (frame,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1744, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->lookup_cbk) tmp_cbk = default_lookup_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->lookup";
_new->unwind_to = "default_lookup_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->lookup); (this->children->xlator
)->fops->lookup (_new, (this->children->xlator), loc
, xattr_req); (*__glusterfs_this_location()) = old_THIS; } while
(0)
1740 default_lookup_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1744, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->lookup_cbk) tmp_cbk = default_lookup_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->lookup";
_new->unwind_to = "default_lookup_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->lookup); (this->children->xlator
)->fops->lookup (_new, (this->children->xlator), loc
, xattr_req); (*__glusterfs_this_location()) = old_THIS; } while
(0)
1741 FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1744, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->lookup_cbk) tmp_cbk = default_lookup_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->lookup";
_new->unwind_to = "default_lookup_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->lookup); (this->children->xlator
)->fops->lookup (_new, (this->children->xlator), loc
, xattr_req); (*__glusterfs_this_location()) = old_THIS; } while
(0)
1742 FIRST_CHILD(this)->fops->lookup,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1744, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->lookup_cbk) tmp_cbk = default_lookup_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->lookup";
_new->unwind_to = "default_lookup_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->lookup); (this->children->xlator
)->fops->lookup (_new, (this->children->xlator), loc
, xattr_req); (*__glusterfs_this_location()) = old_THIS; } while
(0)
1743 loc,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1744, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->lookup_cbk) tmp_cbk = default_lookup_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->lookup";
_new->unwind_to = "default_lookup_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->lookup); (this->children->xlator
)->fops->lookup (_new, (this->children->xlator), loc
, xattr_req); (*__glusterfs_this_location()) = old_THIS; } while
(0)
1744 xattr_req)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1744, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->lookup_cbk) tmp_cbk = default_lookup_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->lookup";
_new->unwind_to = "default_lookup_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->lookup); (this->children->xlator
)->fops->lookup (_new, (this->children->xlator), loc
, xattr_req); (*__glusterfs_this_location()) = old_THIS; } while
(0)
;
1745 return 0;
1746 }
1747
1748 afr_lookup (frame, this, loc, xattr_req);
1749 return 0;
1750}
1751
1752
1753static int32_t
1754pump_truncate (call_frame_t *frame,
1755 xlator_t *this,
1756 loc_t *loc,
1757 off_t offset, dict_t *xdata)
1758{
1759 afr_private_t *priv = NULL((void*)0);
1760 priv = this->private;
1761 if (!priv->use_afr_in_pump) {
1762 STACK_WIND (frame,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1767, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->truncate_cbk) tmp_cbk = default_truncate_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->truncate"
; _new->unwind_to = "default_truncate_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->truncate); (this->children->xlator
)->fops->truncate (_new, (this->children->xlator)
, loc, offset, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
1763 default_truncate_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1767, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->truncate_cbk) tmp_cbk = default_truncate_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->truncate"
; _new->unwind_to = "default_truncate_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->truncate); (this->children->xlator
)->fops->truncate (_new, (this->children->xlator)
, loc, offset, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
1764 FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1767, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->truncate_cbk) tmp_cbk = default_truncate_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->truncate"
; _new->unwind_to = "default_truncate_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->truncate); (this->children->xlator
)->fops->truncate (_new, (this->children->xlator)
, loc, offset, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
1765 FIRST_CHILD(this)->fops->truncate,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1767, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->truncate_cbk) tmp_cbk = default_truncate_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->truncate"
; _new->unwind_to = "default_truncate_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->truncate); (this->children->xlator
)->fops->truncate (_new, (this->children->xlator)
, loc, offset, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
1766 loc,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1767, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->truncate_cbk) tmp_cbk = default_truncate_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->truncate"
; _new->unwind_to = "default_truncate_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->truncate); (this->children->xlator
)->fops->truncate (_new, (this->children->xlator)
, loc, offset, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
1767 offset, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1767, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->truncate_cbk) tmp_cbk = default_truncate_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->truncate"
; _new->unwind_to = "default_truncate_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->truncate); (this->children->xlator
)->fops->truncate (_new, (this->children->xlator)
, loc, offset, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
;
1768 return 0;
1769 }
1770
1771 afr_truncate (frame, this, loc, offset, xdata);
1772 return 0;
1773}
1774
1775
1776static int32_t
1777pump_ftruncate (call_frame_t *frame,
1778 xlator_t *this,
1779 fd_t *fd,
1780 off_t offset, dict_t *xdata)
1781{
1782 afr_private_t *priv = NULL((void*)0);
1783 priv = this->private;
1784 if (!priv->use_afr_in_pump) {
1785 STACK_WIND (frame,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1790, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->ftruncate_cbk) tmp_cbk = default_ftruncate_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->ftruncate"
; _new->unwind_to = "default_ftruncate_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->ftruncate); (this->children->
xlator)->fops->ftruncate (_new, (this->children->
xlator), fd, offset, xdata); (*__glusterfs_this_location()) =
old_THIS; } while (0)
1786 default_ftruncate_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1790, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->ftruncate_cbk) tmp_cbk = default_ftruncate_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->ftruncate"
; _new->unwind_to = "default_ftruncate_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->ftruncate); (this->children->
xlator)->fops->ftruncate (_new, (this->children->
xlator), fd, offset, xdata); (*__glusterfs_this_location()) =
old_THIS; } while (0)
1787 FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1790, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->ftruncate_cbk) tmp_cbk = default_ftruncate_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->ftruncate"
; _new->unwind_to = "default_ftruncate_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->ftruncate); (this->children->
xlator)->fops->ftruncate (_new, (this->children->
xlator), fd, offset, xdata); (*__glusterfs_this_location()) =
old_THIS; } while (0)
1788 FIRST_CHILD(this)->fops->ftruncate,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1790, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->ftruncate_cbk) tmp_cbk = default_ftruncate_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->ftruncate"
; _new->unwind_to = "default_ftruncate_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->ftruncate); (this->children->
xlator)->fops->ftruncate (_new, (this->children->
xlator), fd, offset, xdata); (*__glusterfs_this_location()) =
old_THIS; } while (0)
1789 fd,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1790, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->ftruncate_cbk) tmp_cbk = default_ftruncate_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->ftruncate"
; _new->unwind_to = "default_ftruncate_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->ftruncate); (this->children->
xlator)->fops->ftruncate (_new, (this->children->
xlator), fd, offset, xdata); (*__glusterfs_this_location()) =
old_THIS; } while (0)
1790 offset, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1790, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->ftruncate_cbk) tmp_cbk = default_ftruncate_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->ftruncate"
; _new->unwind_to = "default_ftruncate_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->ftruncate); (this->children->
xlator)->fops->ftruncate (_new, (this->children->
xlator), fd, offset, xdata); (*__glusterfs_this_location()) =
old_THIS; } while (0)
;
1791 return 0;
1792 }
1793
1794 afr_ftruncate (frame, this, fd, offset, xdata);
1795 return 0;
1796}
1797
1798
1799
1800
1801int
1802pump_mknod (call_frame_t *frame, xlator_t *this,
1803 loc_t *loc, mode_t mode, dev_t rdev, mode_t umask, dict_t *xdata)
1804{
1805 afr_private_t *priv = NULL((void*)0);
1806 priv = this->private;
1807 if (!priv->use_afr_in_pump) {
1808 STACK_WIND (frame, default_mknod_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1811, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->mknod_cbk) tmp_cbk = default_mknod_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->mknod"; _new
->unwind_to = "default_mknod_cbk"; pthread_spin_init (&
_new->lock, 0); pthread_spin_lock (&frame->root->
stack_lock); { _new->next = frame->root->frames.next
; _new->prev = &frame->root->frames; if (frame->
root->frames.next) frame->root->frames.next->prev
= _new; frame->root->frames.next = _new; frame->ref_count
++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->mknod); (this->children->xlator
)->fops->mknod (_new, (this->children->xlator), loc
, mode, rdev, umask, xdata); (*__glusterfs_this_location()) =
old_THIS; } while (0)
1809 FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1811, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->mknod_cbk) tmp_cbk = default_mknod_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->mknod"; _new
->unwind_to = "default_mknod_cbk"; pthread_spin_init (&
_new->lock, 0); pthread_spin_lock (&frame->root->
stack_lock); { _new->next = frame->root->frames.next
; _new->prev = &frame->root->frames; if (frame->
root->frames.next) frame->root->frames.next->prev
= _new; frame->root->frames.next = _new; frame->ref_count
++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->mknod); (this->children->xlator
)->fops->mknod (_new, (this->children->xlator), loc
, mode, rdev, umask, xdata); (*__glusterfs_this_location()) =
old_THIS; } while (0)
1810 FIRST_CHILD(this)->fops->mknod,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1811, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->mknod_cbk) tmp_cbk = default_mknod_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->mknod"; _new
->unwind_to = "default_mknod_cbk"; pthread_spin_init (&
_new->lock, 0); pthread_spin_lock (&frame->root->
stack_lock); { _new->next = frame->root->frames.next
; _new->prev = &frame->root->frames; if (frame->
root->frames.next) frame->root->frames.next->prev
= _new; frame->root->frames.next = _new; frame->ref_count
++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->mknod); (this->children->xlator
)->fops->mknod (_new, (this->children->xlator), loc
, mode, rdev, umask, xdata); (*__glusterfs_this_location()) =
old_THIS; } while (0)
1811 loc, mode, rdev, umask, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1811, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->mknod_cbk) tmp_cbk = default_mknod_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->mknod"; _new
->unwind_to = "default_mknod_cbk"; pthread_spin_init (&
_new->lock, 0); pthread_spin_lock (&frame->root->
stack_lock); { _new->next = frame->root->frames.next
; _new->prev = &frame->root->frames; if (frame->
root->frames.next) frame->root->frames.next->prev
= _new; frame->root->frames.next = _new; frame->ref_count
++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->mknod); (this->children->xlator
)->fops->mknod (_new, (this->children->xlator), loc
, mode, rdev, umask, xdata); (*__glusterfs_this_location()) =
old_THIS; } while (0)
;
1812 return 0;
1813 }
1814 afr_mknod (frame, this, loc, mode, rdev, umask, xdata);
1815 return 0;
1816
1817}
1818
1819
1820
1821int
1822pump_mkdir (call_frame_t *frame, xlator_t *this,
1823 loc_t *loc, mode_t mode, mode_t umask, dict_t *xdata)
1824{
1825 afr_private_t *priv = NULL((void*)0);
1826 priv = this->private;
1827 if (!priv->use_afr_in_pump) {
1828 STACK_WIND (frame, default_mkdir_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1831, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->mkdir_cbk) tmp_cbk = default_mkdir_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->mkdir"; _new
->unwind_to = "default_mkdir_cbk"; pthread_spin_init (&
_new->lock, 0); pthread_spin_lock (&frame->root->
stack_lock); { _new->next = frame->root->frames.next
; _new->prev = &frame->root->frames; if (frame->
root->frames.next) frame->root->frames.next->prev
= _new; frame->root->frames.next = _new; frame->ref_count
++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->mkdir); (this->children->xlator
)->fops->mkdir (_new, (this->children->xlator), loc
, mode, umask, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
1829 FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1831, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->mkdir_cbk) tmp_cbk = default_mkdir_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->mkdir"; _new
->unwind_to = "default_mkdir_cbk"; pthread_spin_init (&
_new->lock, 0); pthread_spin_lock (&frame->root->
stack_lock); { _new->next = frame->root->frames.next
; _new->prev = &frame->root->frames; if (frame->
root->frames.next) frame->root->frames.next->prev
= _new; frame->root->frames.next = _new; frame->ref_count
++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->mkdir); (this->children->xlator
)->fops->mkdir (_new, (this->children->xlator), loc
, mode, umask, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
1830 FIRST_CHILD(this)->fops->mkdir,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1831, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->mkdir_cbk) tmp_cbk = default_mkdir_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->mkdir"; _new
->unwind_to = "default_mkdir_cbk"; pthread_spin_init (&
_new->lock, 0); pthread_spin_lock (&frame->root->
stack_lock); { _new->next = frame->root->frames.next
; _new->prev = &frame->root->frames; if (frame->
root->frames.next) frame->root->frames.next->prev
= _new; frame->root->frames.next = _new; frame->ref_count
++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->mkdir); (this->children->xlator
)->fops->mkdir (_new, (this->children->xlator), loc
, mode, umask, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
1831 loc, mode, umask, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1831, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->mkdir_cbk) tmp_cbk = default_mkdir_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->mkdir"; _new
->unwind_to = "default_mkdir_cbk"; pthread_spin_init (&
_new->lock, 0); pthread_spin_lock (&frame->root->
stack_lock); { _new->next = frame->root->frames.next
; _new->prev = &frame->root->frames; if (frame->
root->frames.next) frame->root->frames.next->prev
= _new; frame->root->frames.next = _new; frame->ref_count
++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->mkdir); (this->children->xlator
)->fops->mkdir (_new, (this->children->xlator), loc
, mode, umask, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
;
1832 return 0;
1833 }
1834 afr_mkdir (frame, this, loc, mode, umask, xdata);
1835 return 0;
1836
1837}
1838
1839
1840static int32_t
1841pump_unlink (call_frame_t *frame,
1842 xlator_t *this,
1843 loc_t *loc, int xflag, dict_t *xdata)
1844{
1845 afr_private_t *priv = NULL((void*)0);
1846 priv = this->private;
1847 if (!priv->use_afr_in_pump) {
1848 STACK_WIND (frame,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1852, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->unlink_cbk) tmp_cbk = default_unlink_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->unlink";
_new->unwind_to = "default_unlink_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->unlink); (this->children->xlator
)->fops->unlink (_new, (this->children->xlator), loc
, xflag, xdata); (*__glusterfs_this_location()) = old_THIS; }
while (0)
1849 default_unlink_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1852, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->unlink_cbk) tmp_cbk = default_unlink_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->unlink";
_new->unwind_to = "default_unlink_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->unlink); (this->children->xlator
)->fops->unlink (_new, (this->children->xlator), loc
, xflag, xdata); (*__glusterfs_this_location()) = old_THIS; }
while (0)
1850 FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1852, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->unlink_cbk) tmp_cbk = default_unlink_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->unlink";
_new->unwind_to = "default_unlink_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->unlink); (this->children->xlator
)->fops->unlink (_new, (this->children->xlator), loc
, xflag, xdata); (*__glusterfs_this_location()) = old_THIS; }
while (0)
1851 FIRST_CHILD(this)->fops->unlink,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1852, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->unlink_cbk) tmp_cbk = default_unlink_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->unlink";
_new->unwind_to = "default_unlink_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->unlink); (this->children->xlator
)->fops->unlink (_new, (this->children->xlator), loc
, xflag, xdata); (*__glusterfs_this_location()) = old_THIS; }
while (0)
1852 loc, xflag, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1852, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->unlink_cbk) tmp_cbk = default_unlink_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->unlink";
_new->unwind_to = "default_unlink_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->unlink); (this->children->xlator
)->fops->unlink (_new, (this->children->xlator), loc
, xflag, xdata); (*__glusterfs_this_location()) = old_THIS; }
while (0)
;
1853 return 0;
1854 }
1855 afr_unlink (frame, this, loc, xflag, xdata);
1856 return 0;
1857
1858}
1859
1860
1861static int
1862pump_rmdir (call_frame_t *frame, xlator_t *this,
1863 loc_t *loc, int flags, dict_t *xdata)
1864{
1865 afr_private_t *priv = NULL((void*)0);
1866
1867 priv = this->private;
1868
1869 if (!priv->use_afr_in_pump) {
1870 STACK_WIND (frame, default_rmdir_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1873, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->rmdir_cbk) tmp_cbk = default_rmdir_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->rmdir"; _new
->unwind_to = "default_rmdir_cbk"; pthread_spin_init (&
_new->lock, 0); pthread_spin_lock (&frame->root->
stack_lock); { _new->next = frame->root->frames.next
; _new->prev = &frame->root->frames; if (frame->
root->frames.next) frame->root->frames.next->prev
= _new; frame->root->frames.next = _new; frame->ref_count
++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->rmdir); (this->children->xlator
)->fops->rmdir (_new, (this->children->xlator), loc
, flags, xdata); (*__glusterfs_this_location()) = old_THIS; }
while (0)
1871 FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1873, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->rmdir_cbk) tmp_cbk = default_rmdir_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->rmdir"; _new
->unwind_to = "default_rmdir_cbk"; pthread_spin_init (&
_new->lock, 0); pthread_spin_lock (&frame->root->
stack_lock); { _new->next = frame->root->frames.next
; _new->prev = &frame->root->frames; if (frame->
root->frames.next) frame->root->frames.next->prev
= _new; frame->root->frames.next = _new; frame->ref_count
++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->rmdir); (this->children->xlator
)->fops->rmdir (_new, (this->children->xlator), loc
, flags, xdata); (*__glusterfs_this_location()) = old_THIS; }
while (0)
1872 FIRST_CHILD(this)->fops->rmdir,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1873, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->rmdir_cbk) tmp_cbk = default_rmdir_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->rmdir"; _new
->unwind_to = "default_rmdir_cbk"; pthread_spin_init (&
_new->lock, 0); pthread_spin_lock (&frame->root->
stack_lock); { _new->next = frame->root->frames.next
; _new->prev = &frame->root->frames; if (frame->
root->frames.next) frame->root->frames.next->prev
= _new; frame->root->frames.next = _new; frame->ref_count
++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->rmdir); (this->children->xlator
)->fops->rmdir (_new, (this->children->xlator), loc
, flags, xdata); (*__glusterfs_this_location()) = old_THIS; }
while (0)
1873 loc, flags, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1873, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->rmdir_cbk) tmp_cbk = default_rmdir_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->rmdir"; _new
->unwind_to = "default_rmdir_cbk"; pthread_spin_init (&
_new->lock, 0); pthread_spin_lock (&frame->root->
stack_lock); { _new->next = frame->root->frames.next
; _new->prev = &frame->root->frames; if (frame->
root->frames.next) frame->root->frames.next->prev
= _new; frame->root->frames.next = _new; frame->ref_count
++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->rmdir); (this->children->xlator
)->fops->rmdir (_new, (this->children->xlator), loc
, flags, xdata); (*__glusterfs_this_location()) = old_THIS; }
while (0)
;
1874 return 0;
1875 }
1876
1877 afr_rmdir (frame, this, loc, flags, xdata);
1878 return 0;
1879
1880}
1881
1882
1883
1884int
1885pump_symlink (call_frame_t *frame, xlator_t *this,
1886 const char *linkpath, loc_t *loc, mode_t umask, dict_t *xdata)
1887{
1888 afr_private_t *priv = NULL((void*)0);
1889 priv = this->private;
1890 if (!priv->use_afr_in_pump) {
1891 STACK_WIND (frame, default_symlink_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1894, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->symlink_cbk) tmp_cbk = default_symlink_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->symlink"
; _new->unwind_to = "default_symlink_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->symlink); (this->children->xlator
)->fops->symlink (_new, (this->children->xlator),
linkpath, loc, umask, xdata); (*__glusterfs_this_location())
= old_THIS; } while (0)
1892 FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1894, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->symlink_cbk) tmp_cbk = default_symlink_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->symlink"
; _new->unwind_to = "default_symlink_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->symlink); (this->children->xlator
)->fops->symlink (_new, (this->children->xlator),
linkpath, loc, umask, xdata); (*__glusterfs_this_location())
= old_THIS; } while (0)
1893 FIRST_CHILD(this)->fops->symlink,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1894, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->symlink_cbk) tmp_cbk = default_symlink_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->symlink"
; _new->unwind_to = "default_symlink_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->symlink); (this->children->xlator
)->fops->symlink (_new, (this->children->xlator),
linkpath, loc, umask, xdata); (*__glusterfs_this_location())
= old_THIS; } while (0)
1894 linkpath, loc, umask, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1894, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->symlink_cbk) tmp_cbk = default_symlink_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->symlink"
; _new->unwind_to = "default_symlink_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->symlink); (this->children->xlator
)->fops->symlink (_new, (this->children->xlator),
linkpath, loc, umask, xdata); (*__glusterfs_this_location())
= old_THIS; } while (0)
;
1895 return 0;
1896 }
1897 afr_symlink (frame, this, linkpath, loc, umask, xdata);
1898 return 0;
1899
1900}
1901
1902
1903static int32_t
1904pump_rename (call_frame_t *frame,
1905 xlator_t *this,
1906 loc_t *oldloc,
1907 loc_t *newloc, dict_t *xdata)
1908{
1909 afr_private_t *priv = NULL((void*)0);
1910 priv = this->private;
1911 if (!priv->use_afr_in_pump) {
1912 STACK_WIND (frame,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1916, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->rename_cbk) tmp_cbk = default_rename_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->rename";
_new->unwind_to = "default_rename_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->rename); (this->children->xlator
)->fops->rename (_new, (this->children->xlator), oldloc
, newloc, xdata); (*__glusterfs_this_location()) = old_THIS; }
while (0)
1913 default_rename_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1916, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->rename_cbk) tmp_cbk = default_rename_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->rename";
_new->unwind_to = "default_rename_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->rename); (this->children->xlator
)->fops->rename (_new, (this->children->xlator), oldloc
, newloc, xdata); (*__glusterfs_this_location()) = old_THIS; }
while (0)
1914 FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1916, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->rename_cbk) tmp_cbk = default_rename_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->rename";
_new->unwind_to = "default_rename_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->rename); (this->children->xlator
)->fops->rename (_new, (this->children->xlator), oldloc
, newloc, xdata); (*__glusterfs_this_location()) = old_THIS; }
while (0)
1915 FIRST_CHILD(this)->fops->rename,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1916, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->rename_cbk) tmp_cbk = default_rename_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->rename";
_new->unwind_to = "default_rename_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->rename); (this->children->xlator
)->fops->rename (_new, (this->children->xlator), oldloc
, newloc, xdata); (*__glusterfs_this_location()) = old_THIS; }
while (0)
1916 oldloc, newloc, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1916, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->rename_cbk) tmp_cbk = default_rename_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->rename";
_new->unwind_to = "default_rename_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->rename); (this->children->xlator
)->fops->rename (_new, (this->children->xlator), oldloc
, newloc, xdata); (*__glusterfs_this_location()) = old_THIS; }
while (0)
;
1917 return 0;
1918 }
1919 afr_rename (frame, this, oldloc, newloc, xdata);
1920 return 0;
1921
1922}
1923
1924
1925static int32_t
1926pump_link (call_frame_t *frame,
1927 xlator_t *this,
1928 loc_t *oldloc,
1929 loc_t *newloc, dict_t *xdata)
1930{
1931 afr_private_t *priv = NULL((void*)0);
1932 priv = this->private;
1933 if (!priv->use_afr_in_pump) {
1934 STACK_WIND (frame,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1938, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->link_cbk) tmp_cbk = default_link_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->link"; _new
->unwind_to = "default_link_cbk"; pthread_spin_init (&
_new->lock, 0); pthread_spin_lock (&frame->root->
stack_lock); { _new->next = frame->root->frames.next
; _new->prev = &frame->root->frames; if (frame->
root->frames.next) frame->root->frames.next->prev
= _new; frame->root->frames.next = _new; frame->ref_count
++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->link); (this->children->xlator
)->fops->link (_new, (this->children->xlator), oldloc
, newloc, xdata); (*__glusterfs_this_location()) = old_THIS; }
while (0)
1935 default_link_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1938, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->link_cbk) tmp_cbk = default_link_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->link"; _new
->unwind_to = "default_link_cbk"; pthread_spin_init (&
_new->lock, 0); pthread_spin_lock (&frame->root->
stack_lock); { _new->next = frame->root->frames.next
; _new->prev = &frame->root->frames; if (frame->
root->frames.next) frame->root->frames.next->prev
= _new; frame->root->frames.next = _new; frame->ref_count
++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->link); (this->children->xlator
)->fops->link (_new, (this->children->xlator), oldloc
, newloc, xdata); (*__glusterfs_this_location()) = old_THIS; }
while (0)
1936 FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1938, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->link_cbk) tmp_cbk = default_link_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->link"; _new
->unwind_to = "default_link_cbk"; pthread_spin_init (&
_new->lock, 0); pthread_spin_lock (&frame->root->
stack_lock); { _new->next = frame->root->frames.next
; _new->prev = &frame->root->frames; if (frame->
root->frames.next) frame->root->frames.next->prev
= _new; frame->root->frames.next = _new; frame->ref_count
++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->link); (this->children->xlator
)->fops->link (_new, (this->children->xlator), oldloc
, newloc, xdata); (*__glusterfs_this_location()) = old_THIS; }
while (0)
1937 FIRST_CHILD(this)->fops->link,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1938, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->link_cbk) tmp_cbk = default_link_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->link"; _new
->unwind_to = "default_link_cbk"; pthread_spin_init (&
_new->lock, 0); pthread_spin_lock (&frame->root->
stack_lock); { _new->next = frame->root->frames.next
; _new->prev = &frame->root->frames; if (frame->
root->frames.next) frame->root->frames.next->prev
= _new; frame->root->frames.next = _new; frame->ref_count
++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->link); (this->children->xlator
)->fops->link (_new, (this->children->xlator), oldloc
, newloc, xdata); (*__glusterfs_this_location()) = old_THIS; }
while (0)
1938 oldloc, newloc, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1938, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->link_cbk) tmp_cbk = default_link_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->link"; _new
->unwind_to = "default_link_cbk"; pthread_spin_init (&
_new->lock, 0); pthread_spin_lock (&frame->root->
stack_lock); { _new->next = frame->root->frames.next
; _new->prev = &frame->root->frames; if (frame->
root->frames.next) frame->root->frames.next->prev
= _new; frame->root->frames.next = _new; frame->ref_count
++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->link); (this->children->xlator
)->fops->link (_new, (this->children->xlator), oldloc
, newloc, xdata); (*__glusterfs_this_location()) = old_THIS; }
while (0)
;
1939 return 0;
1940 }
1941 afr_link (frame, this, oldloc, newloc, xdata);
1942 return 0;
1943
1944}
1945
1946
1947static int32_t
1948pump_create (call_frame_t *frame, xlator_t *this,
1949 loc_t *loc, int32_t flags, mode_t mode,
1950 mode_t umask, fd_t *fd, dict_t *xdata)
1951{
1952 afr_private_t *priv = NULL((void*)0);
1953 priv = this->private;
1954 if (!priv->use_afr_in_pump) {
1955 STACK_WIND (frame, default_create_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1958, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->create_cbk) tmp_cbk = default_create_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->create";
_new->unwind_to = "default_create_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->create); (this->children->xlator
)->fops->create (_new, (this->children->xlator), loc
, flags, mode, umask, fd, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1956 FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1958, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->create_cbk) tmp_cbk = default_create_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->create";
_new->unwind_to = "default_create_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->create); (this->children->xlator
)->fops->create (_new, (this->children->xlator), loc
, flags, mode, umask, fd, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1957 FIRST_CHILD(this)->fops->create,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1958, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->create_cbk) tmp_cbk = default_create_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->create";
_new->unwind_to = "default_create_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->create); (this->children->xlator
)->fops->create (_new, (this->children->xlator), loc
, flags, mode, umask, fd, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1958 loc, flags, mode, umask, fd, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1958, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->create_cbk) tmp_cbk = default_create_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->create";
_new->unwind_to = "default_create_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->create); (this->children->xlator
)->fops->create (_new, (this->children->xlator), loc
, flags, mode, umask, fd, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0)
;
1959 return 0;
1960 }
1961 afr_create (frame, this, loc, flags, mode, umask, fd, xdata);
1962 return 0;
1963
1964}
1965
1966
1967static int32_t
1968pump_open (call_frame_t *frame,
1969 xlator_t *this,
1970 loc_t *loc,
1971 int32_t flags, fd_t *fd, dict_t *xdata)
1972{
1973 afr_private_t *priv = NULL((void*)0);
1974 priv = this->private;
1975 if (!priv->use_afr_in_pump) {
1976 STACK_WIND (frame,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1980, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->open_cbk) tmp_cbk = default_open_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->open"; _new
->unwind_to = "default_open_cbk"; pthread_spin_init (&
_new->lock, 0); pthread_spin_lock (&frame->root->
stack_lock); { _new->next = frame->root->frames.next
; _new->prev = &frame->root->frames; if (frame->
root->frames.next) frame->root->frames.next->prev
= _new; frame->root->frames.next = _new; frame->ref_count
++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->open); (this->children->xlator
)->fops->open (_new, (this->children->xlator), loc
, flags, fd, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
1977 default_open_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1980, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->open_cbk) tmp_cbk = default_open_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->open"; _new
->unwind_to = "default_open_cbk"; pthread_spin_init (&
_new->lock, 0); pthread_spin_lock (&frame->root->
stack_lock); { _new->next = frame->root->frames.next
; _new->prev = &frame->root->frames; if (frame->
root->frames.next) frame->root->frames.next->prev
= _new; frame->root->frames.next = _new; frame->ref_count
++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->open); (this->children->xlator
)->fops->open (_new, (this->children->xlator), loc
, flags, fd, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
1978 FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1980, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->open_cbk) tmp_cbk = default_open_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->open"; _new
->unwind_to = "default_open_cbk"; pthread_spin_init (&
_new->lock, 0); pthread_spin_lock (&frame->root->
stack_lock); { _new->next = frame->root->frames.next
; _new->prev = &frame->root->frames; if (frame->
root->frames.next) frame->root->frames.next->prev
= _new; frame->root->frames.next = _new; frame->ref_count
++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->open); (this->children->xlator
)->fops->open (_new, (this->children->xlator), loc
, flags, fd, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
1979 FIRST_CHILD(this)->fops->open,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1980, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->open_cbk) tmp_cbk = default_open_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->open"; _new
->unwind_to = "default_open_cbk"; pthread_spin_init (&
_new->lock, 0); pthread_spin_lock (&frame->root->
stack_lock); { _new->next = frame->root->frames.next
; _new->prev = &frame->root->frames; if (frame->
root->frames.next) frame->root->frames.next->prev
= _new; frame->root->frames.next = _new; frame->ref_count
++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->open); (this->children->xlator
)->fops->open (_new, (this->children->xlator), loc
, flags, fd, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
1980 loc, flags, fd, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 1980, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->open_cbk) tmp_cbk = default_open_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->open"; _new
->unwind_to = "default_open_cbk"; pthread_spin_init (&
_new->lock, 0); pthread_spin_lock (&frame->root->
stack_lock); { _new->next = frame->root->frames.next
; _new->prev = &frame->root->frames; if (frame->
root->frames.next) frame->root->frames.next->prev
= _new; frame->root->frames.next = _new; frame->ref_count
++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->open); (this->children->xlator
)->fops->open (_new, (this->children->xlator), loc
, flags, fd, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
;
1981 return 0;
1982 }
1983 afr_open (frame, this, loc, flags, fd, xdata);
1984 return 0;
1985
1986}
1987
1988
1989static int32_t
1990pump_writev (call_frame_t *frame,
1991 xlator_t *this,
1992 fd_t *fd,
1993 struct iovec *vector,
1994 int32_t count,
1995 off_t off, uint32_t flags,
1996 struct iobref *iobref, dict_t *xdata)
1997{
1998 afr_private_t *priv = NULL((void*)0);
1999 priv = this->private;
2000 if (!priv->use_afr_in_pump) {
2001 STACK_WIND (frame,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2009, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->writev_cbk) tmp_cbk = default_writev_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->writev";
_new->unwind_to = "default_writev_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->writev); (this->children->xlator
)->fops->writev (_new, (this->children->xlator), fd
, vector, count, off, flags, iobref, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0)
2002 default_writev_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2009, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->writev_cbk) tmp_cbk = default_writev_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->writev";
_new->unwind_to = "default_writev_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->writev); (this->children->xlator
)->fops->writev (_new, (this->children->xlator), fd
, vector, count, off, flags, iobref, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0)
2003 FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2009, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->writev_cbk) tmp_cbk = default_writev_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->writev";
_new->unwind_to = "default_writev_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->writev); (this->children->xlator
)->fops->writev (_new, (this->children->xlator), fd
, vector, count, off, flags, iobref, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0)
2004 FIRST_CHILD(this)->fops->writev,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2009, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->writev_cbk) tmp_cbk = default_writev_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->writev";
_new->unwind_to = "default_writev_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->writev); (this->children->xlator
)->fops->writev (_new, (this->children->xlator), fd
, vector, count, off, flags, iobref, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0)
2005 fd,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2009, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->writev_cbk) tmp_cbk = default_writev_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->writev";
_new->unwind_to = "default_writev_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->writev); (this->children->xlator
)->fops->writev (_new, (this->children->xlator), fd
, vector, count, off, flags, iobref, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0)
2006 vector,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2009, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->writev_cbk) tmp_cbk = default_writev_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->writev";
_new->unwind_to = "default_writev_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->writev); (this->children->xlator
)->fops->writev (_new, (this->children->xlator), fd
, vector, count, off, flags, iobref, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0)
2007 count,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2009, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->writev_cbk) tmp_cbk = default_writev_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->writev";
_new->unwind_to = "default_writev_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->writev); (this->children->xlator
)->fops->writev (_new, (this->children->xlator), fd
, vector, count, off, flags, iobref, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0)
2008 off, flags,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2009, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->writev_cbk) tmp_cbk = default_writev_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->writev";
_new->unwind_to = "default_writev_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->writev); (this->children->xlator
)->fops->writev (_new, (this->children->xlator), fd
, vector, count, off, flags, iobref, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0)
2009 iobref, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2009, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->writev_cbk) tmp_cbk = default_writev_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->writev";
_new->unwind_to = "default_writev_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->writev); (this->children->xlator
)->fops->writev (_new, (this->children->xlator), fd
, vector, count, off, flags, iobref, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0)
;
2010 return 0;
2011 }
2012
2013 afr_writev (frame, this, fd, vector, count, off, flags, iobref, xdata);
2014 return 0;
2015}
2016
2017
2018static int32_t
2019pump_flush (call_frame_t *frame,
2020 xlator_t *this,
2021 fd_t *fd, dict_t *xdata)
2022{
2023 afr_private_t *priv = NULL((void*)0);
2024 priv = this->private;
2025 if (!priv->use_afr_in_pump) {
2026 STACK_WIND (frame,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2030, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->flush_cbk) tmp_cbk = default_flush_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->flush"; _new
->unwind_to = "default_flush_cbk"; pthread_spin_init (&
_new->lock, 0); pthread_spin_lock (&frame->root->
stack_lock); { _new->next = frame->root->frames.next
; _new->prev = &frame->root->frames; if (frame->
root->frames.next) frame->root->frames.next->prev
= _new; frame->root->frames.next = _new; frame->ref_count
++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->flush); (this->children->xlator
)->fops->flush (_new, (this->children->xlator), fd
, xdata); (*__glusterfs_this_location()) = old_THIS; } while (
0)
2027 default_flush_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2030, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->flush_cbk) tmp_cbk = default_flush_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->flush"; _new
->unwind_to = "default_flush_cbk"; pthread_spin_init (&
_new->lock, 0); pthread_spin_lock (&frame->root->
stack_lock); { _new->next = frame->root->frames.next
; _new->prev = &frame->root->frames; if (frame->
root->frames.next) frame->root->frames.next->prev
= _new; frame->root->frames.next = _new; frame->ref_count
++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->flush); (this->children->xlator
)->fops->flush (_new, (this->children->xlator), fd
, xdata); (*__glusterfs_this_location()) = old_THIS; } while (
0)
2028 FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2030, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->flush_cbk) tmp_cbk = default_flush_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->flush"; _new
->unwind_to = "default_flush_cbk"; pthread_spin_init (&
_new->lock, 0); pthread_spin_lock (&frame->root->
stack_lock); { _new->next = frame->root->frames.next
; _new->prev = &frame->root->frames; if (frame->
root->frames.next) frame->root->frames.next->prev
= _new; frame->root->frames.next = _new; frame->ref_count
++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->flush); (this->children->xlator
)->fops->flush (_new, (this->children->xlator), fd
, xdata); (*__glusterfs_this_location()) = old_THIS; } while (
0)
2029 FIRST_CHILD(this)->fops->flush,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2030, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->flush_cbk) tmp_cbk = default_flush_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->flush"; _new
->unwind_to = "default_flush_cbk"; pthread_spin_init (&
_new->lock, 0); pthread_spin_lock (&frame->root->
stack_lock); { _new->next = frame->root->frames.next
; _new->prev = &frame->root->frames; if (frame->
root->frames.next) frame->root->frames.next->prev
= _new; frame->root->frames.next = _new; frame->ref_count
++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->flush); (this->children->xlator
)->fops->flush (_new, (this->children->xlator), fd
, xdata); (*__glusterfs_this_location()) = old_THIS; } while (
0)
2030 fd, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2030, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->flush_cbk) tmp_cbk = default_flush_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->flush"; _new
->unwind_to = "default_flush_cbk"; pthread_spin_init (&
_new->lock, 0); pthread_spin_lock (&frame->root->
stack_lock); { _new->next = frame->root->frames.next
; _new->prev = &frame->root->frames; if (frame->
root->frames.next) frame->root->frames.next->prev
= _new; frame->root->frames.next = _new; frame->ref_count
++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->flush); (this->children->xlator
)->fops->flush (_new, (this->children->xlator), fd
, xdata); (*__glusterfs_this_location()) = old_THIS; } while (
0)
;
2031 return 0;
2032 }
2033 afr_flush (frame, this, fd, xdata);
2034 return 0;
2035
2036}
2037
2038
2039static int32_t
2040pump_fsync (call_frame_t *frame,
2041 xlator_t *this,
2042 fd_t *fd,
2043 int32_t flags, dict_t *xdata)
2044{
2045 afr_private_t *priv = NULL((void*)0);
2046 priv = this->private;
2047 if (!priv->use_afr_in_pump) {
2048 STACK_WIND (frame,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2053, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->fsync_cbk) tmp_cbk = default_fsync_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->fsync"; _new
->unwind_to = "default_fsync_cbk"; pthread_spin_init (&
_new->lock, 0); pthread_spin_lock (&frame->root->
stack_lock); { _new->next = frame->root->frames.next
; _new->prev = &frame->root->frames; if (frame->
root->frames.next) frame->root->frames.next->prev
= _new; frame->root->frames.next = _new; frame->ref_count
++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->fsync); (this->children->xlator
)->fops->fsync (_new, (this->children->xlator), fd
, flags, xdata); (*__glusterfs_this_location()) = old_THIS; }
while (0)
2049 default_fsync_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2053, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->fsync_cbk) tmp_cbk = default_fsync_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->fsync"; _new
->unwind_to = "default_fsync_cbk"; pthread_spin_init (&
_new->lock, 0); pthread_spin_lock (&frame->root->
stack_lock); { _new->next = frame->root->frames.next
; _new->prev = &frame->root->frames; if (frame->
root->frames.next) frame->root->frames.next->prev
= _new; frame->root->frames.next = _new; frame->ref_count
++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->fsync); (this->children->xlator
)->fops->fsync (_new, (this->children->xlator), fd
, flags, xdata); (*__glusterfs_this_location()) = old_THIS; }
while (0)
2050 FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2053, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->fsync_cbk) tmp_cbk = default_fsync_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->fsync"; _new
->unwind_to = "default_fsync_cbk"; pthread_spin_init (&
_new->lock, 0); pthread_spin_lock (&frame->root->
stack_lock); { _new->next = frame->root->frames.next
; _new->prev = &frame->root->frames; if (frame->
root->frames.next) frame->root->frames.next->prev
= _new; frame->root->frames.next = _new; frame->ref_count
++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->fsync); (this->children->xlator
)->fops->fsync (_new, (this->children->xlator), fd
, flags, xdata); (*__glusterfs_this_location()) = old_THIS; }
while (0)
2051 FIRST_CHILD(this)->fops->fsync,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2053, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->fsync_cbk) tmp_cbk = default_fsync_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->fsync"; _new
->unwind_to = "default_fsync_cbk"; pthread_spin_init (&
_new->lock, 0); pthread_spin_lock (&frame->root->
stack_lock); { _new->next = frame->root->frames.next
; _new->prev = &frame->root->frames; if (frame->
root->frames.next) frame->root->frames.next->prev
= _new; frame->root->frames.next = _new; frame->ref_count
++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->fsync); (this->children->xlator
)->fops->fsync (_new, (this->children->xlator), fd
, flags, xdata); (*__glusterfs_this_location()) = old_THIS; }
while (0)
2052 fd,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2053, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->fsync_cbk) tmp_cbk = default_fsync_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->fsync"; _new
->unwind_to = "default_fsync_cbk"; pthread_spin_init (&
_new->lock, 0); pthread_spin_lock (&frame->root->
stack_lock); { _new->next = frame->root->frames.next
; _new->prev = &frame->root->frames; if (frame->
root->frames.next) frame->root->frames.next->prev
= _new; frame->root->frames.next = _new; frame->ref_count
++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->fsync); (this->children->xlator
)->fops->fsync (_new, (this->children->xlator), fd
, flags, xdata); (*__glusterfs_this_location()) = old_THIS; }
while (0)
2053 flags, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2053, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->fsync_cbk) tmp_cbk = default_fsync_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->fsync"; _new
->unwind_to = "default_fsync_cbk"; pthread_spin_init (&
_new->lock, 0); pthread_spin_lock (&frame->root->
stack_lock); { _new->next = frame->root->frames.next
; _new->prev = &frame->root->frames; if (frame->
root->frames.next) frame->root->frames.next->prev
= _new; frame->root->frames.next = _new; frame->ref_count
++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->fsync); (this->children->xlator
)->fops->fsync (_new, (this->children->xlator), fd
, flags, xdata); (*__glusterfs_this_location()) = old_THIS; }
while (0)
;
2054 return 0;
2055 }
2056 afr_fsync (frame, this, fd, flags, xdata);
2057 return 0;
2058
2059}
2060
2061
2062static int32_t
2063pump_opendir (call_frame_t *frame,
2064 xlator_t *this,
2065 loc_t *loc, fd_t *fd, dict_t *xdata)
2066{
2067 afr_private_t *priv = NULL((void*)0);
2068 priv = this->private;
2069 if (!priv->use_afr_in_pump) {
2070 STACK_WIND (frame,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2074, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->opendir_cbk) tmp_cbk = default_opendir_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->opendir"
; _new->unwind_to = "default_opendir_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->opendir); (this->children->xlator
)->fops->opendir (_new, (this->children->xlator),
loc, fd, xdata); (*__glusterfs_this_location()) = old_THIS; }
while (0)
2071 default_opendir_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2074, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->opendir_cbk) tmp_cbk = default_opendir_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->opendir"
; _new->unwind_to = "default_opendir_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->opendir); (this->children->xlator
)->fops->opendir (_new, (this->children->xlator),
loc, fd, xdata); (*__glusterfs_this_location()) = old_THIS; }
while (0)
2072 FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2074, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->opendir_cbk) tmp_cbk = default_opendir_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->opendir"
; _new->unwind_to = "default_opendir_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->opendir); (this->children->xlator
)->fops->opendir (_new, (this->children->xlator),
loc, fd, xdata); (*__glusterfs_this_location()) = old_THIS; }
while (0)
2073 FIRST_CHILD(this)->fops->opendir,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2074, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->opendir_cbk) tmp_cbk = default_opendir_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->opendir"
; _new->unwind_to = "default_opendir_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->opendir); (this->children->xlator
)->fops->opendir (_new, (this->children->xlator),
loc, fd, xdata); (*__glusterfs_this_location()) = old_THIS; }
while (0)
2074 loc, fd, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2074, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->opendir_cbk) tmp_cbk = default_opendir_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->opendir"
; _new->unwind_to = "default_opendir_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->opendir); (this->children->xlator
)->fops->opendir (_new, (this->children->xlator),
loc, fd, xdata); (*__glusterfs_this_location()) = old_THIS; }
while (0)
;
2075 return 0;
2076 }
2077 afr_opendir (frame, this, loc, fd, xdata);
2078 return 0;
2079
2080}
2081
2082
2083static int32_t
2084pump_fsyncdir (call_frame_t *frame,
2085 xlator_t *this,
2086 fd_t *fd,
2087 int32_t flags, dict_t *xdata)
2088{
2089 afr_private_t *priv = NULL((void*)0);
2090 priv = this->private;
2091 if (!priv->use_afr_in_pump) {
2092 STACK_WIND (frame,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2097, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->fsyncdir_cbk) tmp_cbk = default_fsyncdir_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->fsyncdir"
; _new->unwind_to = "default_fsyncdir_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->fsyncdir); (this->children->xlator
)->fops->fsyncdir (_new, (this->children->xlator)
, fd, flags, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
2093 default_fsyncdir_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2097, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->fsyncdir_cbk) tmp_cbk = default_fsyncdir_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->fsyncdir"
; _new->unwind_to = "default_fsyncdir_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->fsyncdir); (this->children->xlator
)->fops->fsyncdir (_new, (this->children->xlator)
, fd, flags, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
2094 FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2097, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->fsyncdir_cbk) tmp_cbk = default_fsyncdir_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->fsyncdir"
; _new->unwind_to = "default_fsyncdir_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->fsyncdir); (this->children->xlator
)->fops->fsyncdir (_new, (this->children->xlator)
, fd, flags, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
2095 FIRST_CHILD(this)->fops->fsyncdir,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2097, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->fsyncdir_cbk) tmp_cbk = default_fsyncdir_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->fsyncdir"
; _new->unwind_to = "default_fsyncdir_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->fsyncdir); (this->children->xlator
)->fops->fsyncdir (_new, (this->children->xlator)
, fd, flags, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
2096 fd,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2097, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->fsyncdir_cbk) tmp_cbk = default_fsyncdir_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->fsyncdir"
; _new->unwind_to = "default_fsyncdir_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->fsyncdir); (this->children->xlator
)->fops->fsyncdir (_new, (this->children->xlator)
, fd, flags, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
2097 flags, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2097, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->fsyncdir_cbk) tmp_cbk = default_fsyncdir_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->fsyncdir"
; _new->unwind_to = "default_fsyncdir_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->fsyncdir); (this->children->xlator
)->fops->fsyncdir (_new, (this->children->xlator)
, fd, flags, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
;
2098 return 0;
2099 }
2100 afr_fsyncdir (frame, this, fd, flags, xdata);
2101 return 0;
2102
2103}
2104
2105
2106static int32_t
2107pump_xattrop (call_frame_t *frame,
2108 xlator_t *this,
2109 loc_t *loc,
2110 gf_xattrop_flags_t flags,
2111 dict_t *dict, dict_t *xdata)
2112{
2113 afr_private_t *priv = NULL((void*)0);
2114 priv = this->private;
2115 if (!priv->use_afr_in_pump) {
2116 STACK_WIND (frame,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2122, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->xattrop_cbk) tmp_cbk = default_xattrop_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->xattrop"
; _new->unwind_to = "default_xattrop_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->xattrop); (this->children->xlator
)->fops->xattrop (_new, (this->children->xlator),
loc, flags, dict, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
2117 default_xattrop_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2122, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->xattrop_cbk) tmp_cbk = default_xattrop_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->xattrop"
; _new->unwind_to = "default_xattrop_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->xattrop); (this->children->xlator
)->fops->xattrop (_new, (this->children->xlator),
loc, flags, dict, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
2118 FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2122, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->xattrop_cbk) tmp_cbk = default_xattrop_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->xattrop"
; _new->unwind_to = "default_xattrop_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->xattrop); (this->children->xlator
)->fops->xattrop (_new, (this->children->xlator),
loc, flags, dict, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
2119 FIRST_CHILD(this)->fops->xattrop,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2122, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->xattrop_cbk) tmp_cbk = default_xattrop_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->xattrop"
; _new->unwind_to = "default_xattrop_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->xattrop); (this->children->xlator
)->fops->xattrop (_new, (this->children->xlator),
loc, flags, dict, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
2120 loc,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2122, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->xattrop_cbk) tmp_cbk = default_xattrop_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->xattrop"
; _new->unwind_to = "default_xattrop_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->xattrop); (this->children->xlator
)->fops->xattrop (_new, (this->children->xlator),
loc, flags, dict, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
2121 flags,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2122, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->xattrop_cbk) tmp_cbk = default_xattrop_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->xattrop"
; _new->unwind_to = "default_xattrop_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->xattrop); (this->children->xlator
)->fops->xattrop (_new, (this->children->xlator),
loc, flags, dict, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
2122 dict, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2122, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->xattrop_cbk) tmp_cbk = default_xattrop_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->xattrop"
; _new->unwind_to = "default_xattrop_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->xattrop); (this->children->xlator
)->fops->xattrop (_new, (this->children->xlator),
loc, flags, dict, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
;
2123 return 0;
2124 }
2125 afr_xattrop (frame, this, loc, flags, dict, xdata);
2126 return 0;
2127
2128}
2129
2130static int32_t
2131pump_fxattrop (call_frame_t *frame,
2132 xlator_t *this,
2133 fd_t *fd,
2134 gf_xattrop_flags_t flags,
2135 dict_t *dict, dict_t *xdata)
2136{
2137 afr_private_t *priv = NULL((void*)0);
2138 priv = this->private;
2139 if (!priv->use_afr_in_pump) {
2140 STACK_WIND (frame,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2146, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->fxattrop_cbk) tmp_cbk = default_fxattrop_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->fxattrop"
; _new->unwind_to = "default_fxattrop_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->fxattrop); (this->children->xlator
)->fops->fxattrop (_new, (this->children->xlator)
, fd, flags, dict, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
2141 default_fxattrop_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2146, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->fxattrop_cbk) tmp_cbk = default_fxattrop_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->fxattrop"
; _new->unwind_to = "default_fxattrop_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->fxattrop); (this->children->xlator
)->fops->fxattrop (_new, (this->children->xlator)
, fd, flags, dict, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
2142 FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2146, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->fxattrop_cbk) tmp_cbk = default_fxattrop_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->fxattrop"
; _new->unwind_to = "default_fxattrop_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->fxattrop); (this->children->xlator
)->fops->fxattrop (_new, (this->children->xlator)
, fd, flags, dict, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
2143 FIRST_CHILD(this)->fops->fxattrop,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2146, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->fxattrop_cbk) tmp_cbk = default_fxattrop_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->fxattrop"
; _new->unwind_to = "default_fxattrop_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->fxattrop); (this->children->xlator
)->fops->fxattrop (_new, (this->children->xlator)
, fd, flags, dict, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
2144 fd,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2146, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->fxattrop_cbk) tmp_cbk = default_fxattrop_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->fxattrop"
; _new->unwind_to = "default_fxattrop_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->fxattrop); (this->children->xlator
)->fops->fxattrop (_new, (this->children->xlator)
, fd, flags, dict, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
2145 flags,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2146, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->fxattrop_cbk) tmp_cbk = default_fxattrop_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->fxattrop"
; _new->unwind_to = "default_fxattrop_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->fxattrop); (this->children->xlator
)->fops->fxattrop (_new, (this->children->xlator)
, fd, flags, dict, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
2146 dict, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2146, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->fxattrop_cbk) tmp_cbk = default_fxattrop_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->fxattrop"
; _new->unwind_to = "default_fxattrop_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->fxattrop); (this->children->xlator
)->fops->fxattrop (_new, (this->children->xlator)
, fd, flags, dict, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
;
2147 return 0;
2148 }
2149 afr_fxattrop (frame, this, fd, flags, dict, xdata);
2150 return 0;
2151
2152}
2153
2154
2155static int32_t
2156pump_removexattr (call_frame_t *frame,
2157 xlator_t *this,
2158 loc_t *loc,
2159 const char *name, dict_t *xdata)
2160{
2161 afr_private_t *priv = NULL((void*)0);
2162 int op_errno = -1;
2163
2164 VALIDATE_OR_GOTO (this, out)do { if (!this) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "this"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "pump.c",
__FUNCTION__, 2164, GF_LOG_WARNING, "invalid argument: " "this"
); } while (0); goto out; } } while (0)
;
2165
2166 GF_IF_NATIVE_XATTR_GOTO ("trusted.glusterfs.pump*",do { if (!name) { do { do { if (0) printf ("no key for removexattr"
); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 2167, GF_LOG_ERROR, "no key for removexattr"); } while (0);
goto out; } if (!fnmatch ("trusted.glusterfs.pump*", name, 0
)) { op_errno = 1; do { do { if (0) printf ("attempt to remove internal "
"xattr: %s: %s", name, strerror (op_errno)); } while (0); _gf_log
(this->name, "pump.c", __FUNCTION__, 2167, GF_LOG_ERROR, "attempt to remove internal "
"xattr: %s: %s", name, strerror (op_errno)); } while (0); goto
out; } } while (0)
2167 name, op_errno, out)do { if (!name) { do { do { if (0) printf ("no key for removexattr"
); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 2167, GF_LOG_ERROR, "no key for removexattr"); } while (0);
goto out; } if (!fnmatch ("trusted.glusterfs.pump*", name, 0
)) { op_errno = 1; do { do { if (0) printf ("attempt to remove internal "
"xattr: %s: %s", name, strerror (op_errno)); } while (0); _gf_log
(this->name, "pump.c", __FUNCTION__, 2167, GF_LOG_ERROR, "attempt to remove internal "
"xattr: %s: %s", name, strerror (op_errno)); } while (0); goto
out; } } while (0)
;
2168
2169 op_errno = 0;
2170 priv = this->private;
2171 if (!priv->use_afr_in_pump) {
2172 STACK_WIND (frame,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2177, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->removexattr_cbk) tmp_cbk = default_removexattr_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->removexattr"
; _new->unwind_to = "default_removexattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->removexattr); (this->children->
xlator)->fops->removexattr (_new, (this->children->
xlator), loc, name, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
2173 default_removexattr_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2177, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->removexattr_cbk) tmp_cbk = default_removexattr_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->removexattr"
; _new->unwind_to = "default_removexattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->removexattr); (this->children->
xlator)->fops->removexattr (_new, (this->children->
xlator), loc, name, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
2174 FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2177, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->removexattr_cbk) tmp_cbk = default_removexattr_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->removexattr"
; _new->unwind_to = "default_removexattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->removexattr); (this->children->
xlator)->fops->removexattr (_new, (this->children->
xlator), loc, name, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
2175 FIRST_CHILD(this)->fops->removexattr,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2177, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->removexattr_cbk) tmp_cbk = default_removexattr_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->removexattr"
; _new->unwind_to = "default_removexattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->removexattr); (this->children->
xlator)->fops->removexattr (_new, (this->children->
xlator), loc, name, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
2176 loc,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2177, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->removexattr_cbk) tmp_cbk = default_removexattr_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->removexattr"
; _new->unwind_to = "default_removexattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->removexattr); (this->children->
xlator)->fops->removexattr (_new, (this->children->
xlator), loc, name, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
2177 name, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2177, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->removexattr_cbk) tmp_cbk = default_removexattr_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->removexattr"
; _new->unwind_to = "default_removexattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->removexattr); (this->children->
xlator)->fops->removexattr (_new, (this->children->
xlator), loc, name, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
;
2178 return 0;
2179 }
2180 afr_removexattr (frame, this, loc, name, xdata);
2181
2182 out:
2183 if (op_errno)
2184 AFR_STACK_UNWIND (removexattr, frame, -1, op_errno, NULL)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); if (frame) { __local = frame->local; __this = frame
->this; frame->local = ((void*)0); } do { fop_removexattr_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "pump.c", __FUNCTION__
, 2184, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_removexattr_cbk_t )frame->ret; _parent = frame->parent
; pthread_spin_lock (&frame->root->stack_lock); { _parent
->ref_count--; } pthread_spin_unlock (&frame->root->
stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, -1, op_errno, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); if (__local) { afr_local_cleanup
(__local, __this); mem_put (__local); } } while (0)
;
2185 return 0;
2186
2187}
2188
2189
2190
2191static int32_t
2192pump_readdir (call_frame_t *frame,
2193 xlator_t *this,
2194 fd_t *fd,
2195 size_t size,
2196 off_t off, dict_t *xdata)
2197{
2198 afr_private_t *priv = NULL((void*)0);
2199 priv = this->private;
2200 if (!priv->use_afr_in_pump) {
2201 STACK_WIND (frame,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2205, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->readdir_cbk) tmp_cbk = default_readdir_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->readdir"
; _new->unwind_to = "default_readdir_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->readdir); (this->children->xlator
)->fops->readdir (_new, (this->children->xlator),
fd, size, off, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
2202 default_readdir_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2205, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->readdir_cbk) tmp_cbk = default_readdir_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->readdir"
; _new->unwind_to = "default_readdir_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->readdir); (this->children->xlator
)->fops->readdir (_new, (this->children->xlator),
fd, size, off, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
2203 FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2205, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->readdir_cbk) tmp_cbk = default_readdir_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->readdir"
; _new->unwind_to = "default_readdir_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->readdir); (this->children->xlator
)->fops->readdir (_new, (this->children->xlator),
fd, size, off, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
2204 FIRST_CHILD(this)->fops->readdir,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2205, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->readdir_cbk) tmp_cbk = default_readdir_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->readdir"
; _new->unwind_to = "default_readdir_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->readdir); (this->children->xlator
)->fops->readdir (_new, (this->children->xlator),
fd, size, off, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
2205 fd, size, off, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2205, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->readdir_cbk) tmp_cbk = default_readdir_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->readdir"
; _new->unwind_to = "default_readdir_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->readdir); (this->children->xlator
)->fops->readdir (_new, (this->children->xlator),
fd, size, off, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
;
2206 return 0;
2207 }
2208 afr_readdir (frame, this, fd, size, off, xdata);
2209 return 0;
2210
2211}
2212
2213
2214static int32_t
2215pump_readdirp (call_frame_t *frame, xlator_t *this, fd_t *fd,
2216 size_t size, off_t off, dict_t *dict)
2217{
2218 afr_private_t *priv = NULL((void*)0);
2219 priv = this->private;
2220 if (!priv->use_afr_in_pump) {
2221 STACK_WIND (frame,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2225, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->readdirp_cbk) tmp_cbk = default_readdirp_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->readdirp"
; _new->unwind_to = "default_readdirp_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->readdirp); (this->children->xlator
)->fops->readdirp (_new, (this->children->xlator)
, fd, size, off, dict); (*__glusterfs_this_location()) = old_THIS
; } while (0)
2222 default_readdirp_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2225, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->readdirp_cbk) tmp_cbk = default_readdirp_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->readdirp"
; _new->unwind_to = "default_readdirp_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->readdirp); (this->children->xlator
)->fops->readdirp (_new, (this->children->xlator)
, fd, size, off, dict); (*__glusterfs_this_location()) = old_THIS
; } while (0)
2223 FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2225, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->readdirp_cbk) tmp_cbk = default_readdirp_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->readdirp"
; _new->unwind_to = "default_readdirp_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->readdirp); (this->children->xlator
)->fops->readdirp (_new, (this->children->xlator)
, fd, size, off, dict); (*__glusterfs_this_location()) = old_THIS
; } while (0)
2224 FIRST_CHILD(this)->fops->readdirp,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2225, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->readdirp_cbk) tmp_cbk = default_readdirp_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->readdirp"
; _new->unwind_to = "default_readdirp_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->readdirp); (this->children->xlator
)->fops->readdirp (_new, (this->children->xlator)
, fd, size, off, dict); (*__glusterfs_this_location()) = old_THIS
; } while (0)
2225 fd, size, off, dict)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2225, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->readdirp_cbk) tmp_cbk = default_readdirp_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->readdirp"
; _new->unwind_to = "default_readdirp_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->readdirp); (this->children->xlator
)->fops->readdirp (_new, (this->children->xlator)
, fd, size, off, dict); (*__glusterfs_this_location()) = old_THIS
; } while (0)
;
2226 return 0;
2227 }
2228 afr_readdirp (frame, this, fd, size, off, dict);
2229 return 0;
2230
2231}
2232
2233
2234
2235static int32_t
2236pump_releasedir (xlator_t *this,
2237 fd_t *fd)
2238{
2239 afr_private_t *priv = NULL((void*)0);
2240 priv = this->private;
2241 if (priv->use_afr_in_pump)
2242 afr_releasedir (this, fd);
2243 return 0;
2244
2245}
2246
2247static int32_t
2248pump_release (xlator_t *this,
2249 fd_t *fd)
2250{
2251 afr_private_t *priv = NULL((void*)0);
2252 priv = this->private;
2253 if (priv->use_afr_in_pump)
2254 afr_release (this, fd);
2255 return 0;
2256
2257}
2258
2259static int32_t
2260pump_forget (xlator_t *this, inode_t *inode)
2261{
2262 afr_private_t *priv = NULL((void*)0);
2263
2264 priv = this->private;
2265 if (priv->use_afr_in_pump)
2266 afr_forget (this, inode);
2267
2268 return 0;
2269}
2270
2271static int32_t
2272pump_setattr (call_frame_t *frame,
2273 xlator_t *this,
2274 loc_t *loc,
2275 struct iatt *stbuf,
2276 int32_t valid, dict_t *xdata)
2277{
2278 afr_private_t *priv = NULL((void*)0);
2279 priv = this->private;
2280 if (!priv->use_afr_in_pump) {
2281 STACK_WIND (frame,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2285, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->setattr_cbk) tmp_cbk = default_setattr_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD (this)->fops->setattr"
; _new->unwind_to = "default_setattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->setattr); (this->children->xlator
)->fops->setattr (_new, (this->children->xlator),
loc, stbuf, valid, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
2282 default_setattr_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2285, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->setattr_cbk) tmp_cbk = default_setattr_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD (this)->fops->setattr"
; _new->unwind_to = "default_setattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->setattr); (this->children->xlator
)->fops->setattr (_new, (this->children->xlator),
loc, stbuf, valid, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
2283 FIRST_CHILD (this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2285, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->setattr_cbk) tmp_cbk = default_setattr_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD (this)->fops->setattr"
; _new->unwind_to = "default_setattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->setattr); (this->children->xlator
)->fops->setattr (_new, (this->children->xlator),
loc, stbuf, valid, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
2284 FIRST_CHILD (this)->fops->setattr,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2285, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->setattr_cbk) tmp_cbk = default_setattr_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD (this)->fops->setattr"
; _new->unwind_to = "default_setattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->setattr); (this->children->xlator
)->fops->setattr (_new, (this->children->xlator),
loc, stbuf, valid, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
2285 loc, stbuf, valid, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2285, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->setattr_cbk) tmp_cbk = default_setattr_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD (this)->fops->setattr"
; _new->unwind_to = "default_setattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->setattr); (this->children->xlator
)->fops->setattr (_new, (this->children->xlator),
loc, stbuf, valid, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
;
2286 return 0;
2287 }
2288 afr_setattr (frame, this, loc, stbuf, valid, xdata);
2289 return 0;
2290
2291}
2292
2293
2294static int32_t
2295pump_fsetattr (call_frame_t *frame,
2296 xlator_t *this,
2297 fd_t *fd,
2298 struct iatt *stbuf,
2299 int32_t valid, dict_t *xdata)
2300{
2301 afr_private_t *priv = NULL((void*)0);
2302 priv = this->private;
2303 if (!priv->use_afr_in_pump) {
2304 STACK_WIND (frame,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2308, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->fsetattr_cbk) tmp_cbk = default_fsetattr_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD (this)->fops->fsetattr"
; _new->unwind_to = "default_fsetattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->fsetattr); (this->children->xlator
)->fops->fsetattr (_new, (this->children->xlator)
, fd, stbuf, valid, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
2305 default_fsetattr_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2308, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->fsetattr_cbk) tmp_cbk = default_fsetattr_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD (this)->fops->fsetattr"
; _new->unwind_to = "default_fsetattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->fsetattr); (this->children->xlator
)->fops->fsetattr (_new, (this->children->xlator)
, fd, stbuf, valid, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
2306 FIRST_CHILD (this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2308, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->fsetattr_cbk) tmp_cbk = default_fsetattr_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD (this)->fops->fsetattr"
; _new->unwind_to = "default_fsetattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->fsetattr); (this->children->xlator
)->fops->fsetattr (_new, (this->children->xlator)
, fd, stbuf, valid, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
2307 FIRST_CHILD (this)->fops->fsetattr,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2308, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->fsetattr_cbk) tmp_cbk = default_fsetattr_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD (this)->fops->fsetattr"
; _new->unwind_to = "default_fsetattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->fsetattr); (this->children->xlator
)->fops->fsetattr (_new, (this->children->xlator)
, fd, stbuf, valid, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
2308 fd, stbuf, valid, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "pump.c", __FUNCTION__, 2308, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->fsetattr_cbk) tmp_cbk = default_fsetattr_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD (this)->fops->fsetattr"
; _new->unwind_to = "default_fsetattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->fsetattr); (this->children->xlator
)->fops->fsetattr (_new, (this->children->xlator)
, fd, stbuf, valid, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
;
2309 return 0;
2310 }
2311 afr_fsetattr (frame, this, fd, stbuf, valid, xdata);
2312 return 0;
2313
2314}
2315
2316
2317/* End of defaults */
2318
2319
2320int32_t
2321mem_acct_init (xlator_t *this)
2322{
2323 int ret = -1;
2324
2325 if (!this)
2326 return ret;
2327
2328 ret = xlator_mem_acct_init (this, gf_afr_mt_end + 1);
2329
2330 if (ret != 0) {
2331 gf_log(this->name, GF_LOG_ERROR, "Memory accounting init"do { do { if (0) printf ("Memory accounting init" "failed"); }
while (0); _gf_log (this->name, "pump.c", __FUNCTION__, 2332
, GF_LOG_ERROR, "Memory accounting init" "failed"); } while (
0)
2332 "failed")do { do { if (0) printf ("Memory accounting init" "failed"); }
while (0); _gf_log (this->name, "pump.c", __FUNCTION__, 2332
, GF_LOG_ERROR, "Memory accounting init" "failed"); } while (
0)
;
2333 return ret;
2334 }
2335
2336 return ret;
2337}
2338
2339static int
2340is_xlator_pump_sink (xlator_t *child)
2341{
2342 return (child == PUMP_SINK_CHILD(THIS)((*__glusterfs_this_location())->children->next->xlator
)
);
2343}
2344
2345static int
2346is_xlator_pump_source (xlator_t *child)
2347{
2348 return (child == PUMP_SOURCE_CHILD(THIS)((*__glusterfs_this_location())->children->xlator));
2349}
2350
2351int32_t
2352notify (xlator_t *this, int32_t event,
2353 void *data, ...)
2354{
2355 int ret = -1;
2356 xlator_t *child_xl = NULL((void*)0);
2357
2358 child_xl = (xlator_t *) data;
2359
2360 ret = afr_notify (this, event, data, NULL((void*)0));
2361
2362 switch (event) {
2363 case GF_EVENT_CHILD_DOWN:
2364 if (is_xlator_pump_source (child_xl))
2365 pump_change_state (this, PUMP_STATE_ABORT);
2366 break;
2367
2368 case GF_EVENT_CHILD_UP:
2369 if (is_xlator_pump_sink (child_xl))
2370 if (is_pump_start_pending (this)) {
2371 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("about to start synctask"); } while (
0); _gf_log (this->name, "pump.c", __FUNCTION__, 2372, GF_LOG_DEBUG
, "about to start synctask"); } while (0)
2372 "about to start synctask")do { do { if (0) printf ("about to start synctask"); } while (
0); _gf_log (this->name, "pump.c", __FUNCTION__, 2372, GF_LOG_DEBUG
, "about to start synctask"); } while (0)
;
2373 ret = pump_start_synctask (this);
2374 if (ret < 0)
2375 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("Could not start pump " "synctask");
} while (0); _gf_log (this->name, "pump.c", __FUNCTION__,
2377, GF_LOG_DEBUG, "Could not start pump " "synctask"); } while
(0)
2376 "Could not start pump "do { do { if (0) printf ("Could not start pump " "synctask");
} while (0); _gf_log (this->name, "pump.c", __FUNCTION__,
2377, GF_LOG_DEBUG, "Could not start pump " "synctask"); } while
(0)
2377 "synctask")do { do { if (0) printf ("Could not start pump " "synctask");
} while (0); _gf_log (this->name, "pump.c", __FUNCTION__,
2377, GF_LOG_DEBUG, "Could not start pump " "synctask"); } while
(0)
;
2378 else
2379 pump_remove_start_pending (this);
2380 }
2381 }
2382
2383 return ret;
2384}
2385
2386int32_t
2387init (xlator_t *this)
2388{
2389 afr_private_t * priv = NULL((void*)0);
2390 pump_private_t *pump_priv = NULL((void*)0);
2391 int child_count = 0;
2392 xlator_list_t * trav = NULL((void*)0);
2393 int i = 0;
2394 int ret = -1;
2395 GF_UNUSED__attribute__((unused)) int op_errno = 0;
2396
2397 int source_child = 0;
2398
2399 if (!this->children) {
2400 gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("pump translator needs a source and sink"
"subvolumes defined."); } while (0); _gf_log (this->name,
"pump.c", __FUNCTION__, 2402, GF_LOG_ERROR, "pump translator needs a source and sink"
"subvolumes defined."); } while (0)
2401 "pump translator needs a source and sink"do { do { if (0) printf ("pump translator needs a source and sink"
"subvolumes defined."); } while (0); _gf_log (this->name,
"pump.c", __FUNCTION__, 2402, GF_LOG_ERROR, "pump translator needs a source and sink"
"subvolumes defined."); } while (0)
2402 "subvolumes defined.")do { do { if (0) printf ("pump translator needs a source and sink"
"subvolumes defined."); } while (0); _gf_log (this->name,
"pump.c", __FUNCTION__, 2402, GF_LOG_ERROR, "pump translator needs a source and sink"
"subvolumes defined."); } while (0)
;
2403 return -1;
2404 }
2405
2406 if (!this->parents) {
2407 gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("Volume is dangling."); } while (0);
_gf_log (this->name, "pump.c", __FUNCTION__, 2408, GF_LOG_WARNING
, "Volume is dangling."); } while (0)
2408 "Volume is dangling.")do { do { if (0) printf ("Volume is dangling."); } while (0);
_gf_log (this->name, "pump.c", __FUNCTION__, 2408, GF_LOG_WARNING
, "Volume is dangling."); } while (0)
;
2409 }
2410
2411 this->private = GF_CALLOC (1, sizeof (afr_private_t),__gf_calloc (1, sizeof (afr_private_t), gf_afr_mt_afr_private_t
)
2412 gf_afr_mt_afr_private_t)__gf_calloc (1, sizeof (afr_private_t), gf_afr_mt_afr_private_t
)
;
2413 if (!this->private)
2414 goto out;
2415
2416 priv = this->private;
2417 LOCK_INIT (&priv->lock)pthread_spin_init (&priv->lock, 0);
2418 LOCK_INIT (&priv->read_child_lock)pthread_spin_init (&priv->read_child_lock, 0);
2419 //lock recovery is not done in afr
2420 pthread_mutex_init (&priv->mutex, NULL((void*)0));
2421 INIT_LIST_HEAD (&priv->saved_fds)do { (&priv->saved_fds)->next = (&priv->saved_fds
)->prev = &priv->saved_fds; } while (0)
;
2422
2423 child_count = xlator_subvolume_count (this);
2424 if (child_count != 2) {
2425 gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("There should be exactly 2 children - one source "
"and one sink"); } while (0); _gf_log (this->name, "pump.c"
, __FUNCTION__, 2427, GF_LOG_ERROR, "There should be exactly 2 children - one source "
"and one sink"); } while (0)
2426 "There should be exactly 2 children - one source "do { do { if (0) printf ("There should be exactly 2 children - one source "
"and one sink"); } while (0); _gf_log (this->name, "pump.c"
, __FUNCTION__, 2427, GF_LOG_ERROR, "There should be exactly 2 children - one source "
"and one sink"); } while (0)
2427 "and one sink")do { do { if (0) printf ("There should be exactly 2 children - one source "
"and one sink"); } while (0); _gf_log (this->name, "pump.c"
, __FUNCTION__, 2427, GF_LOG_ERROR, "There should be exactly 2 children - one source "
"and one sink"); } while (0)
;
2428 return -1;
2429 }
2430 priv->child_count = child_count;
2431
2432 priv->read_child = source_child;
2433 priv->favorite_child = source_child;
2434 priv->background_self_heal_count = 0;
2435
2436 priv->data_self_heal = "on";
2437 priv->metadata_self_heal = 1;
2438 priv->entry_self_heal = 1;
2439
2440 priv->data_self_heal_window_size = 16;
2441
2442 priv->data_change_log = 1;
2443 priv->metadata_change_log = 1;
2444 priv->entry_change_log = 1;
2445 priv->use_afr_in_pump = 1;
2446 priv->sh_readdir_size = 65536;
2447
2448 /* Locking options */
2449
2450 /* Lock server count infact does not matter. Locks are held
2451 on all subvolumes, in this case being the source
2452 and the sink.
2453 */
2454
2455 priv->strict_readdir = _gf_false;
2456
2457 priv->wait_count = 1;
2458 priv->child_up = GF_CALLOC (sizeof (unsigned char), child_count,__gf_calloc (sizeof (unsigned char), child_count, gf_afr_mt_char
)
2459 gf_afr_mt_char)__gf_calloc (sizeof (unsigned char), child_count, gf_afr_mt_char
)
;
2460 if (!priv->child_up) {
2461 gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("Out of memory."); } while (0); _gf_log
(this->name, "pump.c", __FUNCTION__, 2462, GF_LOG_ERROR, "Out of memory."
); } while (0)
2462 "Out of memory.")do { do { if (0) printf ("Out of memory."); } while (0); _gf_log
(this->name, "pump.c", __FUNCTION__, 2462, GF_LOG_ERROR, "Out of memory."
); } while (0)
;
2463 op_errno = ENOMEM12;
2464 goto out;
2465 }
2466
2467 priv->children = GF_CALLOC (sizeof (xlator_t *), child_count,__gf_calloc (sizeof (xlator_t *), child_count, gf_afr_mt_xlator_t
)
2468 gf_afr_mt_xlator_t)__gf_calloc (sizeof (xlator_t *), child_count, gf_afr_mt_xlator_t
)
;
2469 if (!priv->children) {
2470 gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("Out of memory."); } while (0); _gf_log
(this->name, "pump.c", __FUNCTION__, 2471, GF_LOG_ERROR, "Out of memory."
); } while (0)
2471 "Out of memory.")do { do { if (0) printf ("Out of memory."); } while (0); _gf_log
(this->name, "pump.c", __FUNCTION__, 2471, GF_LOG_ERROR, "Out of memory."
); } while (0)
;
2472 op_errno = ENOMEM12;
2473 goto out;
2474 }
2475
2476 priv->pending_key = GF_CALLOC (sizeof (*priv->pending_key),__gf_calloc (sizeof (*priv->pending_key), child_count, gf_afr_mt_char
)
2477 child_count,__gf_calloc (sizeof (*priv->pending_key), child_count, gf_afr_mt_char
)
2478 gf_afr_mt_char)__gf_calloc (sizeof (*priv->pending_key), child_count, gf_afr_mt_char
)
;
2479 if (!priv->pending_key) {
2480 gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("Out of memory."); } while (0); _gf_log
(this->name, "pump.c", __FUNCTION__, 2481, GF_LOG_ERROR, "Out of memory."
); } while (0)
2481 "Out of memory.")do { do { if (0) printf ("Out of memory."); } while (0); _gf_log
(this->name, "pump.c", __FUNCTION__, 2481, GF_LOG_ERROR, "Out of memory."
); } while (0)
;
2482 op_errno = ENOMEM12;
2483 goto out;
2484 }
2485
2486 trav = this->children;
2487 i = 0;
2488 while (i < child_count) {
2489 priv->children[i] = trav->xlator;
2490
2491 ret = gf_asprintf (&priv->pending_key[i], "%s.%s", AFR_XATTR_PREFIX"trusted.afr",
2492 trav->xlator->name);
2493 if (-1 == ret) {
2494 gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("asprintf failed to set pending key"
); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 2495, GF_LOG_ERROR, "asprintf failed to set pending key"); }
while (0)
2495 "asprintf failed to set pending key")do { do { if (0) printf ("asprintf failed to set pending key"
); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 2495, GF_LOG_ERROR, "asprintf failed to set pending key"); }
while (0)
;
2496 op_errno = ENOMEM12;
2497 goto out;
2498 }
2499
2500 trav = trav->next;
2501 i++;
2502 }
2503
2504 priv->first_lookup = 1;
2505 priv->root_inode = NULL((void*)0);
2506
2507 priv->last_event = GF_CALLOC (child_count, sizeof (*priv->last_event),__gf_calloc (child_count, sizeof (*priv->last_event), gf_afr_mt_int32_t
)
2508 gf_afr_mt_int32_t)__gf_calloc (child_count, sizeof (*priv->last_event), gf_afr_mt_int32_t
)
;
2509 if (!priv->last_event) {
2510 ret = -ENOMEM12;
2511 goto out;
2512 }
2513
2514 pump_priv = GF_CALLOC (1, sizeof (*pump_priv),__gf_calloc (1, sizeof (*pump_priv), gf_afr_mt_pump_priv)
2515 gf_afr_mt_pump_priv)__gf_calloc (1, sizeof (*pump_priv), gf_afr_mt_pump_priv);
2516 if (!pump_priv) {
2517 gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("Out of memory"); } while (0); _gf_log
(this->name, "pump.c", __FUNCTION__, 2518, GF_LOG_ERROR, "Out of memory"
); } while (0)
2518 "Out of memory")do { do { if (0) printf ("Out of memory"); } while (0); _gf_log
(this->name, "pump.c", __FUNCTION__, 2518, GF_LOG_ERROR, "Out of memory"
); } while (0)
;
2519 op_errno = ENOMEM12;
2520 goto out;
2521 }
2522
2523 LOCK_INIT (&pump_priv->resume_path_lock)pthread_spin_init (&pump_priv->resume_path_lock, 0);
2524 LOCK_INIT (&pump_priv->pump_state_lock)pthread_spin_init (&pump_priv->pump_state_lock, 0);
2525
2526 pump_priv->resume_path = GF_CALLOC (1, PATH_MAX,__gf_calloc (1, 4096, gf_afr_mt_char)
2527 gf_afr_mt_char)__gf_calloc (1, 4096, gf_afr_mt_char);
2528 if (!pump_priv->resume_path) {
2529 gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("Out of memory"); } while (0); _gf_log
(this->name, "pump.c", __FUNCTION__, 2530, GF_LOG_ERROR, "Out of memory"
); } while (0)
2530 "Out of memory")do { do { if (0) printf ("Out of memory"); } while (0); _gf_log
(this->name, "pump.c", __FUNCTION__, 2530, GF_LOG_ERROR, "Out of memory"
); } while (0)
;
2531 ret = -1;
2532 goto out;
2533 }
2534
2535 pump_priv->env = syncenv_new (0);
2536 if (!pump_priv->env) {
2537 gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("Could not create new sync-environment"
); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 2538, GF_LOG_ERROR, "Could not create new sync-environment"
); } while (0)
2538 "Could not create new sync-environment")do { do { if (0) printf ("Could not create new sync-environment"
); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 2538, GF_LOG_ERROR, "Could not create new sync-environment"
); } while (0)
;
2539 ret = -1;
2540 goto out;
2541 }
2542
2543 /* keep more local here as we may need them for self-heal etc */
2544 this->local_pool = mem_pool_new (afr_local_t, 128)mem_pool_new_fn (sizeof(afr_local_t), 128, "afr_local_t");
2545 if (!this->local_pool) {
2546 ret = -1;
2547 gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("failed to create local_t's memory pool"
); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 2548, GF_LOG_ERROR, "failed to create local_t's memory pool"
); } while (0)
2548 "failed to create local_t's memory pool")do { do { if (0) printf ("failed to create local_t's memory pool"
); } while (0); _gf_log (this->name, "pump.c", __FUNCTION__
, 2548, GF_LOG_ERROR, "failed to create local_t's memory pool"
); } while (0)
;
2549 goto out;
2550 }
2551
2552 priv->pump_private = pump_priv;
2553
2554 pump_change_state (this, PUMP_STATE_ABORT);
2555
2556 ret = 0;
2557out:
2558 return ret;
2559}
2560
2561int
2562fini (xlator_t *this)
2563{
2564 afr_private_t * priv = NULL((void*)0);
2565 pump_private_t *pump_priv = NULL((void*)0);
2566
2567 priv = this->private;
2568 this->private = NULL((void*)0);
2569 if (!priv)
2570 goto out;
2571
2572 pump_priv = priv->pump_private;
2573 if (!pump_priv)
2574 goto afr_priv;
2575
2576 if (pump_priv->env)
2577 syncenv_destroy (pump_priv->env);
2578
2579 GF_FREE (pump_priv->resume_path)__gf_free (pump_priv->resume_path);
2580 LOCK_DESTROY (&pump_priv->resume_path_lock)pthread_spin_destroy (&pump_priv->resume_path_lock);
2581 LOCK_DESTROY (&pump_priv->pump_state_lock)pthread_spin_destroy (&pump_priv->pump_state_lock);
2582 GF_FREE (pump_priv)__gf_free (pump_priv);
2583afr_priv:
2584 afr_priv_destroy (priv);
2585out:
2586 return 0;
2587}
2588
2589
2590struct xlator_fops fops = {
2591 .lookup = pump_lookup,
2592 .open = pump_open,
2593 .flush = pump_flush,
2594 .fsync = pump_fsync,
2595 .fsyncdir = pump_fsyncdir,
2596 .xattrop = pump_xattrop,
2597 .fxattrop = pump_fxattrop,
2598 .getxattr = pump_getxattr,
2599
2600 /* inode write */
2601 .writev = pump_writev,
2602 .truncate = pump_truncate,
2603 .ftruncate = pump_ftruncate,
2604 .setxattr = pump_setxattr,
2605 .setattr = pump_setattr,
2606 .fsetattr = pump_fsetattr,
2607 .removexattr = pump_removexattr,
2608
2609 /* dir read */
2610 .opendir = pump_opendir,
2611 .readdir = pump_readdir,
2612 .readdirp = pump_readdirp,
2613
2614 /* dir write */
2615 .create = pump_create,
2616 .mknod = pump_mknod,
2617 .mkdir = pump_mkdir,
2618 .unlink = pump_unlink,
2619 .rmdir = pump_rmdir,
2620 .link = pump_link,
2621 .symlink = pump_symlink,
2622 .rename = pump_rename,
2623};
2624
2625struct xlator_dumpops dumpops = {
2626 .priv = afr_priv_dump,
2627};
2628
2629
2630struct xlator_cbks cbks = {
2631 .release = pump_release,
2632 .releasedir = pump_releasedir,
2633 .forget = pump_forget,
2634};
2635
2636struct volume_options options[] = {
2637 { .key = {NULL((void*)0)} },
2638};