Bug Summary

File:xlators/cluster/afr/src/afr-transaction.c
Location:line 601, column 17
Description:Call to 'alloca' has an allocation size of 0 bytes

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 "dict.h"
12#include "byte-order.h"
13#include "common-utils.h"
14#include "timer.h"
15
16#include "afr.h"
17#include "afr-transaction.h"
18
19#include <signal.h>
20
21
22#define LOCKED_NO0x0 0x0 /* no lock held */
23#define LOCKED_YES0x1 0x1 /* for DATA, METADATA, ENTRY and higher_path
24 of RENAME */
25#define LOCKED_LOWER0x2 0x2 /* for lower_path of RENAME */
26
27afr_fd_ctx_t *
28__afr_fd_ctx_get (fd_t *fd, xlator_t *this)
29{
30 uint64_t ctx = 0;
31 int ret = 0;
32 afr_fd_ctx_t *fd_ctx = NULL((void*)0);
33 int i = 0;
34 afr_private_t *priv = NULL((void*)0);
35
36 priv = this->private;
37
38 ret = __fd_ctx_get (fd, this, &ctx);
39
40 if (ret < 0 && fd_is_anonymous (fd)) {
41 ret = __afr_fd_ctx_set (this, fd);
42 if (ret < 0)
43 goto out;
44
45 ret = __fd_ctx_get (fd, this, &ctx);
46 if (ret < 0)
47 goto out;
48
49 fd_ctx = (afr_fd_ctx_t *)(long) ctx;
50 for (i = 0; i < priv->child_count; i++)
51 fd_ctx->opened_on[i] = AFR_FD_OPENED;
52 }
53
54 fd_ctx = (afr_fd_ctx_t *)(long) ctx;
55out:
56 return fd_ctx;
57}
58
59
60afr_fd_ctx_t *
61afr_fd_ctx_get (fd_t *fd, xlator_t *this)
62{
63 afr_fd_ctx_t *fd_ctx = NULL((void*)0);
64
65 LOCK(&fd->lock)pthread_spin_lock (&fd->lock);
66 {
67 fd_ctx = __afr_fd_ctx_get (fd, this);
68 }
69 UNLOCK(&fd->lock)pthread_spin_unlock (&fd->lock);
70
71 return fd_ctx;
72}
73
74
75static void
76afr_save_lk_owner (call_frame_t *frame)
77{
78 afr_local_t * local = NULL((void*)0);
79
80 local = frame->local;
81
82 local->saved_lk_owner = frame->root->lk_owner;
83}
84
85
86static void
87afr_restore_lk_owner (call_frame_t *frame)
88{
89 afr_local_t * local = NULL((void*)0);
90
91 local = frame->local;
92
93 frame->root->lk_owner = local->saved_lk_owner;
94}
95
96
97static void
98__mark_all_pending (int32_t *pending[], int child_count,
99 afr_transaction_type type)
100{
101 int i = 0;
102 int j = 0;
103
104 for (i = 0; i < child_count; i++) {
105 j = afr_index_for_transaction_type (type);
106 pending[i][j] = hton32 (1);
107 }
108}
109
110
111static void
112__mark_child_dead (int32_t *pending[], int child_count, int child,
113 afr_transaction_type type)
114{
115 int j = 0;
116
117 j = afr_index_for_transaction_type (type);
118
119 pending[child][j] = 0;
120}
121
122
123static void
124__mark_pre_op_done_on_fd (call_frame_t *frame, xlator_t *this, int child_index)
125{
126 afr_local_t *local = NULL((void*)0);
127 afr_fd_ctx_t *fd_ctx = NULL((void*)0);
128
129 local = frame->local;
130
131 if (!local->fd)
132 return;
133
134 fd_ctx = afr_fd_ctx_get (local->fd, this);
135
136 if (!fd_ctx)
137 goto out;
138
139 LOCK (&local->fd->lock)pthread_spin_lock (&local->fd->lock);
140 {
141 if (local->transaction.type == AFR_DATA_TRANSACTION)
142 fd_ctx->pre_op_done[child_index]++;
143 }
144 UNLOCK (&local->fd->lock)pthread_spin_unlock (&local->fd->lock);
145out:
146 return;
147}
148
149static void
150__mark_non_participant_children (int32_t *pending[], int child_count,
151 unsigned char *participants,
152 afr_transaction_type type)
153{
154 int i = 0;
155 int j = 0;
156
157 j = afr_index_for_transaction_type (type);
158 for (i = 0; i < child_count; i++) {
159 if (!participants[i])
160 pending[i][j] = 0;
161 }
162}
163
164
165void
166__mark_all_success (int32_t *pending[], int child_count,
167 afr_transaction_type type)
168{
169 int i;
170 int j;
171
172 for (i = 0; i < child_count; i++) {
173 j = afr_index_for_transaction_type (type);
174 pending[i][j] = hton32 (-1);
175 }
176}
177
178void
179_set_all_child_errno (int *child_errno, unsigned int child_count)
180{
181 int i = 0;
182
183 for (i = 0; i < child_count; i++)
184 if (child_errno[i] == 0)
185 child_errno[i] = ENOTCONN107;
186}
187
188void
189afr_transaction_perform_fop (call_frame_t *frame, xlator_t *this)
190{
191 afr_local_t *local = NULL((void*)0);
192 afr_private_t *priv = NULL((void*)0);
193 fd_t *fd = NULL((void*)0);
194
195 local = frame->local;
196 priv = this->private;
197 fd = local->fd;
198
199 __mark_all_success (local->pending, priv->child_count,
200 local->transaction.type);
201
202 _set_all_child_errno (local->child_errno, priv->child_count);
203
204 /* Perform fops with the lk-owner from top xlator.
205 * Eg: lk-owner of posix-lk and flush should be same,
206 * flush cant clear the posix-lks without that lk-owner.
207 */
208 afr_save_lk_owner (frame);
209 frame->root->lk_owner =
210 local->transaction.main_frame->root->lk_owner;
211
212
213 /* The wake up needs to happen independent of
214 what type of fop arrives here. If it was
215 a write, then it has already inherited the
216 lock and changelog. If it was not a write,
217 then the presumption of the optimization (of
218 optimizing for successive write operations)
219 fails.
220 */
221 if (fd)
222 afr_delayed_changelog_wake_up (this, fd);
223 local->transaction.fop (frame, this);
224}
225
226
227static int
228__changelog_enabled (afr_private_t *priv, afr_transaction_type type)
229{
230 int ret = 0;
231
232 switch (type) {
233 case AFR_DATA_TRANSACTION:
234 if (priv->data_change_log)
235 ret = 1;
236
237 break;
238
239 case AFR_METADATA_TRANSACTION:
240 if (priv->metadata_change_log)
241 ret = 1;
242
243 break;
244
245 case AFR_ENTRY_TRANSACTION:
246 case AFR_ENTRY_RENAME_TRANSACTION:
247 if (priv->entry_change_log)
248 ret = 1;
249
250 break;
251 }
252
253 return ret;
254}
255
256
257static int
258__fop_changelog_needed (call_frame_t *frame, xlator_t *this)
259{
260 afr_private_t * priv = NULL((void*)0);
261 afr_local_t * local = NULL((void*)0);
262 int op_ret = 0;
263 afr_transaction_type type = -1;
264
265 priv = this->private;
266 local = frame->local;
267 type = local->transaction.type;
268
269 if (__changelog_enabled (priv, type)) {
270 switch (local->op) {
271
272 case GF_FOP_WRITE:
273 case GF_FOP_FTRUNCATE:
274 op_ret = 1;
275 break;
276
277 case GF_FOP_FLUSH:
278 op_ret = 0;
279 break;
280
281 default:
282 op_ret = 1;
283 }
284 }
285
286 return op_ret;
287}
288
289int
290afr_set_pending_dict (afr_private_t *priv, dict_t *xattr, int32_t **pending,
291 int child, afr_xattrop_type_t op)
292{
293 int i = 0;
294 int ret = 0;
295
296 if (op == LOCAL_FIRST) {
297 ret = dict_set_static_bin (xattr, priv->pending_key[child],
298 pending[child],
299 AFR_NUM_CHANGE_LOGS3 * sizeof (int32_t));
300 if (ret)
301 goto out;
302 }
303 for (i = 0; i < priv->child_count; i++) {
304 if (i == child)
305 continue;
306 ret = dict_set_static_bin (xattr, priv->pending_key[i],
307 pending[i],
308 AFR_NUM_CHANGE_LOGS3 * sizeof (int32_t));
309 /* 3 = data+metadata+entry */
310
311 if (ret < 0)
312 goto out;
313 }
314 if (op == LOCAL_LAST) {
315 ret = dict_set_static_bin (xattr, priv->pending_key[child],
316 pending[child],
317 AFR_NUM_CHANGE_LOGS3 * sizeof (int32_t));
318 if (ret)
319 goto out;
320 }
321out:
322 return ret;
323}
324
325int
326afr_lock_server_count (afr_private_t *priv, afr_transaction_type type)
327{
328 int ret = 0;
329
330 switch (type) {
331 case AFR_DATA_TRANSACTION:
332 ret = priv->child_count;
333 break;
334
335 case AFR_METADATA_TRANSACTION:
336 ret = priv->child_count;
337 break;
338
339 case AFR_ENTRY_TRANSACTION:
340 case AFR_ENTRY_RENAME_TRANSACTION:
341 ret = priv->child_count;
342 break;
343 }
344
345 return ret;
346}
347
348/* {{{ pending */
349
350int32_t
351afr_changelog_post_op_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
352 int32_t op_ret, int32_t op_errno, dict_t *xattr,
353 dict_t *xdata)
354{
355 afr_internal_lock_t *int_lock = NULL((void*)0);
356 afr_private_t *priv = NULL((void*)0);
357 afr_local_t *local = NULL((void*)0);
358 int call_count = -1;
359
360 priv = this->private;
361 local = frame->local;
362 int_lock = &local->internal_lock;
363
364 LOCK (&frame->lock)pthread_spin_lock (&frame->lock);
365 {
366 call_count = --local->call_count;
367 }
368 UNLOCK (&frame->lock)pthread_spin_unlock (&frame->lock);
369
370 if (call_count == 0) {
371 if (local->transaction.resume_stub) {
372 AFR_CALL_RESUME (local->transaction.resume_stub)do { afr_local_t *__local = ((void*)0); xlator_t *__this = ((
void*)0); __local = local->transaction.resume_stub->frame
->local; __this = local->transaction.resume_stub->frame
->this; local->transaction.resume_stub->frame->local
= ((void*)0); call_resume (local->transaction.resume_stub
); if (__local) { afr_local_cleanup (__local, __this); mem_put
(__local); } } while (0)
;
373 local->transaction.resume_stub = NULL((void*)0);
374 }
375
376 if (afr_lock_server_count (priv, local->transaction.type) == 0) {
377 local->transaction.done (frame, this);
378 } else {
379 int_lock->lock_cbk = local->transaction.done;
380 afr_unlock (frame, this);
381 }
382 }
383
384 return 0;
385}
386
387
388void
389afr_transaction_rm_stale_children (call_frame_t *frame, xlator_t *this,
390 inode_t *inode, afr_transaction_type type)
391{
392 int i = -1;
393 int count = 0;
394 int read_child = -1;
395 afr_private_t *priv = NULL((void*)0);
396 afr_local_t *local = NULL((void*)0);
397 int **pending = NULL((void*)0);
398 int idx = 0;
399 int32_t *stale_children = NULL((void*)0);
400 int32_t *fresh_children = NULL((void*)0);
401 gf_boolean_t rm_stale_children = _gf_false;
402
403 idx = afr_index_for_transaction_type (type);
404
405 priv = this->private;
406 local = frame->local;
407 pending = local->pending;
408
409 if (local->op_ret < 0)
410 goto out;
411 fresh_children = local->fresh_children;
412 read_child = afr_inode_get_read_ctx (this, inode, fresh_children);
413 if (read_child < 0) {
414 gf_log (this->name, GF_LOG_DEBUG, "Possible split-brain "do { do { if (0) printf ("Possible split-brain " "for %s", uuid_utoa
(inode->gfid)); } while (0); _gf_log (this->name, "afr-transaction.c"
, __FUNCTION__, 415, GF_LOG_DEBUG, "Possible split-brain " "for %s"
, uuid_utoa (inode->gfid)); } while (0)
415 "for %s", uuid_utoa (inode->gfid))do { do { if (0) printf ("Possible split-brain " "for %s", uuid_utoa
(inode->gfid)); } while (0); _gf_log (this->name, "afr-transaction.c"
, __FUNCTION__, 415, GF_LOG_DEBUG, "Possible split-brain " "for %s"
, uuid_utoa (inode->gfid)); } while (0)
;
416 goto out;
417 }
418
419 for (i = 0; i < priv->child_count; i++) {
420 if (!afr_is_child_present (fresh_children,
421 priv->child_count, i))
422 continue;
423 if (pending[i][idx])
424 continue;
425 /* child is down or op failed on it */
426 if (!stale_children)
427 stale_children = afr_children_create (priv->child_count);
428 if (!stale_children)
429 goto out;
430
431 rm_stale_children = _gf_true;
432 stale_children[count++] = i;
433 gf_log (this->name, GF_LOG_DEBUG, "Removing stale child "do { do { if (0) printf ("Removing stale child " "%d for %s",
i, uuid_utoa (inode->gfid)); } while (0); _gf_log (this->
name, "afr-transaction.c", __FUNCTION__, 434, GF_LOG_DEBUG, "Removing stale child "
"%d for %s", i, uuid_utoa (inode->gfid)); } while (0)
434 "%d for %s", i, uuid_utoa (inode->gfid))do { do { if (0) printf ("Removing stale child " "%d for %s",
i, uuid_utoa (inode->gfid)); } while (0); _gf_log (this->
name, "afr-transaction.c", __FUNCTION__, 434, GF_LOG_DEBUG, "Removing stale child "
"%d for %s", i, uuid_utoa (inode->gfid)); } while (0)
;
435 }
436
437 if (!rm_stale_children)
438 goto out;
439
440 afr_inode_rm_stale_children (this, inode, stale_children);
441out:
442 GF_FREE (stale_children)__gf_free (stale_children);
443 return;
444}
445
446unsigned char*
447afr_locked_nodes_get (afr_transaction_type type, afr_internal_lock_t *int_lock)
448{
449 unsigned char *locked_nodes = NULL((void*)0);
450 switch (type) {
451 case AFR_DATA_TRANSACTION:
452 case AFR_METADATA_TRANSACTION:
453 locked_nodes = int_lock->inode_locked_nodes;
454 break;
455
456 case AFR_ENTRY_TRANSACTION:
457 case AFR_ENTRY_RENAME_TRANSACTION:
458 /*Because same set of subvols participate in all lockee
459 * entities*/
460 locked_nodes = int_lock->lockee[0].locked_nodes;
461 break;
462 }
463 return locked_nodes;
464}
465
466int
467afr_changelog_pre_op_call_count (afr_transaction_type type,
468 afr_internal_lock_t *int_lock,
469 unsigned int child_count)
470{
471 int call_count = 0;
472 unsigned char *locked_nodes = NULL((void*)0);
473
474 locked_nodes = afr_locked_nodes_get (type, int_lock);
475 GF_ASSERT (locked_nodes)do { if (!(locked_nodes)) { do { do { if (0) printf ("Assertion failed: "
"locked_nodes"); } while (0); _gf_log_callingfn ("", "afr-transaction.c"
, __FUNCTION__, 475, GF_LOG_ERROR, "Assertion failed: " "locked_nodes"
); } while (0); } } while (0)
;
476
477 call_count = afr_locked_children_count (locked_nodes, child_count);
478 if (type == AFR_ENTRY_RENAME_TRANSACTION)
479 call_count *= 2;
480
481 return call_count;
482}
483
484int
485afr_changelog_post_op_call_count (afr_transaction_type type,
486 unsigned char *pre_op,
487 unsigned int child_count)
488{
489 int call_count = 0;
490
491 call_count = afr_pre_op_done_children_count (pre_op, child_count);
492 if (type == AFR_ENTRY_RENAME_TRANSACTION)
493 call_count *= 2;
494
495 return call_count;
496}
497
498void
499afr_compute_txn_changelog (afr_local_t *local, afr_private_t *priv)
500{
501 int i = 0;
502 int index = 0;
503 int32_t postop = 0;
504 int32_t preop = 1;
505 int32_t **txn_changelog = NULL((void*)0);
506
507 txn_changelog = local->transaction.txn_changelog;
508 index = afr_index_for_transaction_type (local->transaction.type);
509 for (i = 0; i < priv->child_count; i++) {
510 postop = ntoh32hton32 (local->pending[i][index]);
511 txn_changelog[i][index] = hton32 (postop + preop);
512 }
513}
514
515afr_xattrop_type_t
516afr_get_postop_xattrop_type (int32_t **pending, int optimized, int child,
517 afr_transaction_type type)
518{
519 int index = 0;
520 afr_xattrop_type_t op = LOCAL_LAST;
521
522 index = afr_index_for_transaction_type (type);
523 if (optimized && !pending[child][index])
524 op = LOCAL_FIRST;
525 return op;
526}
527
528void
529afr_set_postop_dict (afr_local_t *local, xlator_t *this, dict_t *xattr,
530 int optimized, int child)
531{
532 int32_t **txn_changelog = NULL((void*)0);
533 int32_t **changelog = NULL((void*)0);
534 afr_private_t *priv = NULL((void*)0);
535 int ret = 0;
536 afr_xattrop_type_t op = LOCAL_LAST;
537
538 priv = this->private;
539 txn_changelog = local->transaction.txn_changelog;
540 op = afr_get_postop_xattrop_type (local->pending, optimized, child,
541 local->transaction.type);
542 if (optimized)
543 changelog = txn_changelog;
544 else
545 changelog = local->pending;
546 ret = afr_set_pending_dict (priv, xattr, changelog, child, op);
547 if (ret < 0)
548 gf_log (this->name, GF_LOG_INFO,do { do { if (0) printf ("failed to set pending entry"); } while
(0); _gf_log (this->name, "afr-transaction.c", __FUNCTION__
, 549, GF_LOG_INFO, "failed to set pending entry"); } while (
0)
549 "failed to set pending entry")do { do { if (0) printf ("failed to set pending entry"); } while
(0); _gf_log (this->name, "afr-transaction.c", __FUNCTION__
, 549, GF_LOG_INFO, "failed to set pending entry"); } while (
0)
;
550}
551
552
553gf_boolean_t
554afr_txn_nothing_failed (call_frame_t *frame, xlator_t *this)
555{
556 afr_private_t *priv = NULL((void*)0);
557 afr_local_t *local = NULL((void*)0);
558 int index = -1;
559 int i = 0;
560
561 local = frame->local;
562 priv = this->private;
563
564 index = afr_index_for_transaction_type (local->transaction.type);
565
566 for (i = 0; i < priv->child_count; i++) {
567 if (local->pending[i][index] == 0)
568 return _gf_false;
569 }
570
571 return _gf_true;
572}
573
574
575int
576afr_changelog_post_op_now (call_frame_t *frame, xlator_t *this)
577{
578 afr_private_t * priv = this->private;
579 afr_internal_lock_t *int_lock = NULL((void*)0);
580 int i = 0;
581 int call_count = 0;
582
583 afr_local_t * local = NULL((void*)0);
584 afr_fd_ctx_t *fdctx = NULL((void*)0);
585 dict_t **xattr = NULL((void*)0);
586 int piggyback = 0;
587 int nothing_failed = 1;
588
589 local = frame->local;
590 int_lock = &local->internal_lock;
591
592 __mark_non_participant_children (local->pending, priv->child_count,
593 local->transaction.pre_op,
594 local->transaction.type);
595
596 if (local->fd)
1
Taking false branch
597 afr_transaction_rm_stale_children (frame, this,
598 local->fd->inode,
599 local->transaction.type);
600
601 xattr = alloca (priv->child_count * sizeof (*xattr))__builtin_alloca (priv->child_count * sizeof (*xattr));
2
Within the expansion of the macro 'alloca':
a
Call to 'alloca' has an allocation size of 0 bytes
602 memset (xattr, 0, (priv->child_count * sizeof (*xattr)));
603 for (i = 0; i < priv->child_count; i++) {
604 xattr[i] = dict_new ();
605 }
606
607 call_count = afr_changelog_post_op_call_count (local->transaction.type,
608 local->transaction.pre_op,
609 priv->child_count);
610 local->call_count = call_count;
611
612 if (local->fd)
613 fdctx = afr_fd_ctx_get (local->fd, this);
614
615 if (call_count == 0) {
616 /* no child is up */
617 int_lock->lock_cbk = local->transaction.done;
618 afr_unlock (frame, this);
619 goto out;
620 }
621
622 nothing_failed = afr_txn_nothing_failed (frame, this);
623
624 afr_compute_txn_changelog (local , priv);
625
626 for (i = 0; i < priv->child_count; i++) {
627 if (!local->transaction.pre_op[i])
628 continue;
629
630 if (local->transaction.type != AFR_DATA_TRANSACTION)
631 afr_set_postop_dict (local, this, xattr[i],
632 local->optimistic_change_log, i);
633 switch (local->transaction.type) {
634 case AFR_DATA_TRANSACTION:
635 {
636 if (!fdctx) {
637 afr_set_postop_dict (local, this, xattr[i],
638 0, i);
639 STACK_WIND (frame, afr_changelog_post_op_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", "afr-transaction.c", __FUNCTION__, 644
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->xattrop_cbk) tmp_cbk = afr_changelog_post_op_cbk
; _new->root = frame->root; _new->this = priv->children
[i]; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame
; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new
->wind_to = "priv->children[i]->fops->xattrop"; _new
->unwind_to = "afr_changelog_post_op_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
()) = priv->children[i]; if (frame->this->ctx->measure_latency
) gf_latency_begin (_new, priv->children[i]->fops->xattrop
); priv->children[i]->fops->xattrop (_new, priv->
children[i], &local->loc, GF_XATTROP_ADD_ARRAY, xattr[
i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS; }
while (0)
640 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", "afr-transaction.c", __FUNCTION__, 644
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->xattrop_cbk) tmp_cbk = afr_changelog_post_op_cbk
; _new->root = frame->root; _new->this = priv->children
[i]; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame
; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new
->wind_to = "priv->children[i]->fops->xattrop"; _new
->unwind_to = "afr_changelog_post_op_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
()) = priv->children[i]; if (frame->this->ctx->measure_latency
) gf_latency_begin (_new, priv->children[i]->fops->xattrop
); priv->children[i]->fops->xattrop (_new, priv->
children[i], &local->loc, GF_XATTROP_ADD_ARRAY, xattr[
i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS; }
while (0)
641 priv->children[i]->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", "afr-transaction.c", __FUNCTION__, 644
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->xattrop_cbk) tmp_cbk = afr_changelog_post_op_cbk
; _new->root = frame->root; _new->this = priv->children
[i]; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame
; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new
->wind_to = "priv->children[i]->fops->xattrop"; _new
->unwind_to = "afr_changelog_post_op_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
()) = priv->children[i]; if (frame->this->ctx->measure_latency
) gf_latency_begin (_new, priv->children[i]->fops->xattrop
); priv->children[i]->fops->xattrop (_new, priv->
children[i], &local->loc, GF_XATTROP_ADD_ARRAY, xattr[
i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS; }
while (0)
642 &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", "afr-transaction.c", __FUNCTION__, 644
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->xattrop_cbk) tmp_cbk = afr_changelog_post_op_cbk
; _new->root = frame->root; _new->this = priv->children
[i]; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame
; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new
->wind_to = "priv->children[i]->fops->xattrop"; _new
->unwind_to = "afr_changelog_post_op_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
()) = priv->children[i]; if (frame->this->ctx->measure_latency
) gf_latency_begin (_new, priv->children[i]->fops->xattrop
); priv->children[i]->fops->xattrop (_new, priv->
children[i], &local->loc, GF_XATTROP_ADD_ARRAY, xattr[
i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS; }
while (0)
643 GF_XATTROP_ADD_ARRAY, xattr[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", "afr-transaction.c", __FUNCTION__, 644
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->xattrop_cbk) tmp_cbk = afr_changelog_post_op_cbk
; _new->root = frame->root; _new->this = priv->children
[i]; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame
; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new
->wind_to = "priv->children[i]->fops->xattrop"; _new
->unwind_to = "afr_changelog_post_op_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
()) = priv->children[i]; if (frame->this->ctx->measure_latency
) gf_latency_begin (_new, priv->children[i]->fops->xattrop
); priv->children[i]->fops->xattrop (_new, priv->
children[i], &local->loc, GF_XATTROP_ADD_ARRAY, xattr[
i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS; }
while (0)
644 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", "afr-transaction.c", __FUNCTION__, 644
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->xattrop_cbk) tmp_cbk = afr_changelog_post_op_cbk
; _new->root = frame->root; _new->this = priv->children
[i]; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame
; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new
->wind_to = "priv->children[i]->fops->xattrop"; _new
->unwind_to = "afr_changelog_post_op_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
()) = priv->children[i]; if (frame->this->ctx->measure_latency
) gf_latency_begin (_new, priv->children[i]->fops->xattrop
); priv->children[i]->fops->xattrop (_new, priv->
children[i], &local->loc, GF_XATTROP_ADD_ARRAY, xattr[
i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS; }
while (0)
;
645 break;
646 }
647
648 /* local->transaction.postop_piggybacked[] was
649 precomputed in is_piggyback_postop() when called from
650 afr_changelog_post_op_safe()
651 */
652
653 piggyback = 0;
654 if (local->transaction.postop_piggybacked[i])
655 piggyback = 1;
656
657 afr_set_postop_dict (local, this, xattr[i],
658 piggyback, i);
659
660 if (nothing_failed && piggyback) {
661 afr_changelog_post_op_cbk (frame, (void *)(long)i,
662 this, 1, 0, xattr[i], NULL((void*)0));
663 } else {
664 STACK_WIND_COOKIE (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", "afr-transaction.c", __FUNCTION__, 671
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fxattrop_cbk) tmp_cbk = afr_changelog_post_op_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->fxattrop"
; _new->unwind_to = "afr_changelog_post_op_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->fxattrop_cbk = afr_changelog_post_op_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->fxattrop); priv->children[i]->fops->fxattrop
(_new, priv->children[i], local->fd, GF_XATTROP_ADD_ARRAY
, xattr[i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
665 afr_changelog_post_op_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", "afr-transaction.c", __FUNCTION__, 671
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fxattrop_cbk) tmp_cbk = afr_changelog_post_op_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->fxattrop"
; _new->unwind_to = "afr_changelog_post_op_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->fxattrop_cbk = afr_changelog_post_op_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->fxattrop); priv->children[i]->fops->fxattrop
(_new, priv->children[i], local->fd, GF_XATTROP_ADD_ARRAY
, xattr[i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
666 (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", "afr-transaction.c", __FUNCTION__, 671
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fxattrop_cbk) tmp_cbk = afr_changelog_post_op_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->fxattrop"
; _new->unwind_to = "afr_changelog_post_op_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->fxattrop_cbk = afr_changelog_post_op_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->fxattrop); priv->children[i]->fops->fxattrop
(_new, priv->children[i], local->fd, GF_XATTROP_ADD_ARRAY
, xattr[i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
667 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", "afr-transaction.c", __FUNCTION__, 671
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fxattrop_cbk) tmp_cbk = afr_changelog_post_op_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->fxattrop"
; _new->unwind_to = "afr_changelog_post_op_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->fxattrop_cbk = afr_changelog_post_op_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->fxattrop); priv->children[i]->fops->fxattrop
(_new, priv->children[i], local->fd, GF_XATTROP_ADD_ARRAY
, xattr[i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
668 priv->children[i]->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", "afr-transaction.c", __FUNCTION__, 671
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fxattrop_cbk) tmp_cbk = afr_changelog_post_op_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->fxattrop"
; _new->unwind_to = "afr_changelog_post_op_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->fxattrop_cbk = afr_changelog_post_op_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->fxattrop); priv->children[i]->fops->fxattrop
(_new, priv->children[i], local->fd, GF_XATTROP_ADD_ARRAY
, xattr[i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
669 local->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", "afr-transaction.c", __FUNCTION__, 671
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fxattrop_cbk) tmp_cbk = afr_changelog_post_op_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->fxattrop"
; _new->unwind_to = "afr_changelog_post_op_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->fxattrop_cbk = afr_changelog_post_op_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->fxattrop); priv->children[i]->fops->fxattrop
(_new, priv->children[i], local->fd, GF_XATTROP_ADD_ARRAY
, xattr[i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
670 GF_XATTROP_ADD_ARRAY, xattr[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", "afr-transaction.c", __FUNCTION__, 671
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fxattrop_cbk) tmp_cbk = afr_changelog_post_op_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->fxattrop"
; _new->unwind_to = "afr_changelog_post_op_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->fxattrop_cbk = afr_changelog_post_op_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->fxattrop); priv->children[i]->fops->fxattrop
(_new, priv->children[i], local->fd, GF_XATTROP_ADD_ARRAY
, xattr[i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
671 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", "afr-transaction.c", __FUNCTION__, 671
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fxattrop_cbk) tmp_cbk = afr_changelog_post_op_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->fxattrop"
; _new->unwind_to = "afr_changelog_post_op_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->fxattrop_cbk = afr_changelog_post_op_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->fxattrop); priv->children[i]->fops->fxattrop
(_new, priv->children[i], local->fd, GF_XATTROP_ADD_ARRAY
, xattr[i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
;
672 }
673 }
674 break;
675 case AFR_METADATA_TRANSACTION:
676 {
677 if (nothing_failed && local->optimistic_change_log) {
678 afr_changelog_post_op_cbk (frame, (void *)(long)i,
679 this, 1, 0, xattr[i],
680 NULL((void*)0));
681 break;
682 }
683
684 if (local->fd)
685 STACK_WIND (frame, afr_changelog_post_op_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", "afr-transaction.c", __FUNCTION__, 690
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fxattrop_cbk) tmp_cbk = afr_changelog_post_op_cbk
; _new->root = frame->root; _new->this = priv->children
[i]; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame
; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new
->wind_to = "priv->children[i]->fops->fxattrop"; _new
->unwind_to = "afr_changelog_post_op_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
()) = priv->children[i]; if (frame->this->ctx->measure_latency
) gf_latency_begin (_new, priv->children[i]->fops->fxattrop
); priv->children[i]->fops->fxattrop (_new, priv->
children[i], local->fd, GF_XATTROP_ADD_ARRAY, xattr[i], ((
void*)0)); (*__glusterfs_this_location()) = old_THIS; } while
(0)
686 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", "afr-transaction.c", __FUNCTION__, 690
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fxattrop_cbk) tmp_cbk = afr_changelog_post_op_cbk
; _new->root = frame->root; _new->this = priv->children
[i]; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame
; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new
->wind_to = "priv->children[i]->fops->fxattrop"; _new
->unwind_to = "afr_changelog_post_op_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
()) = priv->children[i]; if (frame->this->ctx->measure_latency
) gf_latency_begin (_new, priv->children[i]->fops->fxattrop
); priv->children[i]->fops->fxattrop (_new, priv->
children[i], local->fd, GF_XATTROP_ADD_ARRAY, xattr[i], ((
void*)0)); (*__glusterfs_this_location()) = old_THIS; } while
(0)
687 priv->children[i]->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", "afr-transaction.c", __FUNCTION__, 690
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fxattrop_cbk) tmp_cbk = afr_changelog_post_op_cbk
; _new->root = frame->root; _new->this = priv->children
[i]; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame
; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new
->wind_to = "priv->children[i]->fops->fxattrop"; _new
->unwind_to = "afr_changelog_post_op_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
()) = priv->children[i]; if (frame->this->ctx->measure_latency
) gf_latency_begin (_new, priv->children[i]->fops->fxattrop
); priv->children[i]->fops->fxattrop (_new, priv->
children[i], local->fd, GF_XATTROP_ADD_ARRAY, xattr[i], ((
void*)0)); (*__glusterfs_this_location()) = old_THIS; } while
(0)
688 local->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", "afr-transaction.c", __FUNCTION__, 690
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fxattrop_cbk) tmp_cbk = afr_changelog_post_op_cbk
; _new->root = frame->root; _new->this = priv->children
[i]; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame
; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new
->wind_to = "priv->children[i]->fops->fxattrop"; _new
->unwind_to = "afr_changelog_post_op_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
()) = priv->children[i]; if (frame->this->ctx->measure_latency
) gf_latency_begin (_new, priv->children[i]->fops->fxattrop
); priv->children[i]->fops->fxattrop (_new, priv->
children[i], local->fd, GF_XATTROP_ADD_ARRAY, xattr[i], ((
void*)0)); (*__glusterfs_this_location()) = old_THIS; } while
(0)
689 GF_XATTROP_ADD_ARRAY, xattr[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", "afr-transaction.c", __FUNCTION__, 690
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fxattrop_cbk) tmp_cbk = afr_changelog_post_op_cbk
; _new->root = frame->root; _new->this = priv->children
[i]; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame
; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new
->wind_to = "priv->children[i]->fops->fxattrop"; _new
->unwind_to = "afr_changelog_post_op_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
()) = priv->children[i]; if (frame->this->ctx->measure_latency
) gf_latency_begin (_new, priv->children[i]->fops->fxattrop
); priv->children[i]->fops->fxattrop (_new, priv->
children[i], local->fd, GF_XATTROP_ADD_ARRAY, xattr[i], ((
void*)0)); (*__glusterfs_this_location()) = old_THIS; } while
(0)
690 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", "afr-transaction.c", __FUNCTION__, 690
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fxattrop_cbk) tmp_cbk = afr_changelog_post_op_cbk
; _new->root = frame->root; _new->this = priv->children
[i]; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame
; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new
->wind_to = "priv->children[i]->fops->fxattrop"; _new
->unwind_to = "afr_changelog_post_op_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
()) = priv->children[i]; if (frame->this->ctx->measure_latency
) gf_latency_begin (_new, priv->children[i]->fops->fxattrop
); priv->children[i]->fops->fxattrop (_new, priv->
children[i], local->fd, GF_XATTROP_ADD_ARRAY, xattr[i], ((
void*)0)); (*__glusterfs_this_location()) = old_THIS; } while
(0)
;
691 else
692 STACK_WIND (frame, afr_changelog_post_op_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", "afr-transaction.c", __FUNCTION__, 697
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->xattrop_cbk) tmp_cbk = afr_changelog_post_op_cbk
; _new->root = frame->root; _new->this = priv->children
[i]; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame
; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new
->wind_to = "priv->children[i]->fops->xattrop"; _new
->unwind_to = "afr_changelog_post_op_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
()) = priv->children[i]; if (frame->this->ctx->measure_latency
) gf_latency_begin (_new, priv->children[i]->fops->xattrop
); priv->children[i]->fops->xattrop (_new, priv->
children[i], &local->loc, GF_XATTROP_ADD_ARRAY, xattr[
i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS; }
while (0)
693 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", "afr-transaction.c", __FUNCTION__, 697
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->xattrop_cbk) tmp_cbk = afr_changelog_post_op_cbk
; _new->root = frame->root; _new->this = priv->children
[i]; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame
; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new
->wind_to = "priv->children[i]->fops->xattrop"; _new
->unwind_to = "afr_changelog_post_op_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
()) = priv->children[i]; if (frame->this->ctx->measure_latency
) gf_latency_begin (_new, priv->children[i]->fops->xattrop
); priv->children[i]->fops->xattrop (_new, priv->
children[i], &local->loc, GF_XATTROP_ADD_ARRAY, xattr[
i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS; }
while (0)
694 priv->children[i]->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", "afr-transaction.c", __FUNCTION__, 697
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->xattrop_cbk) tmp_cbk = afr_changelog_post_op_cbk
; _new->root = frame->root; _new->this = priv->children
[i]; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame
; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new
->wind_to = "priv->children[i]->fops->xattrop"; _new
->unwind_to = "afr_changelog_post_op_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
()) = priv->children[i]; if (frame->this->ctx->measure_latency
) gf_latency_begin (_new, priv->children[i]->fops->xattrop
); priv->children[i]->fops->xattrop (_new, priv->
children[i], &local->loc, GF_XATTROP_ADD_ARRAY, xattr[
i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS; }
while (0)
695 &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", "afr-transaction.c", __FUNCTION__, 697
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->xattrop_cbk) tmp_cbk = afr_changelog_post_op_cbk
; _new->root = frame->root; _new->this = priv->children
[i]; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame
; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new
->wind_to = "priv->children[i]->fops->xattrop"; _new
->unwind_to = "afr_changelog_post_op_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
()) = priv->children[i]; if (frame->this->ctx->measure_latency
) gf_latency_begin (_new, priv->children[i]->fops->xattrop
); priv->children[i]->fops->xattrop (_new, priv->
children[i], &local->loc, GF_XATTROP_ADD_ARRAY, xattr[
i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS; }
while (0)
696 GF_XATTROP_ADD_ARRAY, xattr[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", "afr-transaction.c", __FUNCTION__, 697
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->xattrop_cbk) tmp_cbk = afr_changelog_post_op_cbk
; _new->root = frame->root; _new->this = priv->children
[i]; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame
; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new
->wind_to = "priv->children[i]->fops->xattrop"; _new
->unwind_to = "afr_changelog_post_op_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
()) = priv->children[i]; if (frame->this->ctx->measure_latency
) gf_latency_begin (_new, priv->children[i]->fops->xattrop
); priv->children[i]->fops->xattrop (_new, priv->
children[i], &local->loc, GF_XATTROP_ADD_ARRAY, xattr[
i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS; }
while (0)
697 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", "afr-transaction.c", __FUNCTION__, 697
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->xattrop_cbk) tmp_cbk = afr_changelog_post_op_cbk
; _new->root = frame->root; _new->this = priv->children
[i]; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame
; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new
->wind_to = "priv->children[i]->fops->xattrop"; _new
->unwind_to = "afr_changelog_post_op_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
()) = priv->children[i]; if (frame->this->ctx->measure_latency
) gf_latency_begin (_new, priv->children[i]->fops->xattrop
); priv->children[i]->fops->xattrop (_new, priv->
children[i], &local->loc, GF_XATTROP_ADD_ARRAY, xattr[
i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS; }
while (0)
;
698 }
699 break;
700
701 case AFR_ENTRY_RENAME_TRANSACTION:
702 {
703 if (nothing_failed && local->optimistic_change_log) {
704 afr_changelog_post_op_cbk (frame, (void *)(long)i,
705 this, 1, 0, xattr[i],
706 NULL((void*)0));
707 } else {
708 STACK_WIND_COOKIE (frame, afr_changelog_post_op_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", "afr-transaction.c", __FUNCTION__, 714
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->xattrop_cbk) tmp_cbk = afr_changelog_post_op_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->xattrop"
; _new->unwind_to = "afr_changelog_post_op_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->xattrop_cbk = afr_changelog_post_op_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->xattrop); priv->children[i]->fops->xattrop
(_new, priv->children[i], &local->transaction.new_parent_loc
, GF_XATTROP_ADD_ARRAY, xattr[i], ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
709 (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", "afr-transaction.c", __FUNCTION__, 714
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->xattrop_cbk) tmp_cbk = afr_changelog_post_op_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->xattrop"
; _new->unwind_to = "afr_changelog_post_op_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->xattrop_cbk = afr_changelog_post_op_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->xattrop); priv->children[i]->fops->xattrop
(_new, priv->children[i], &local->transaction.new_parent_loc
, GF_XATTROP_ADD_ARRAY, xattr[i], ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
710 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", "afr-transaction.c", __FUNCTION__, 714
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->xattrop_cbk) tmp_cbk = afr_changelog_post_op_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->xattrop"
; _new->unwind_to = "afr_changelog_post_op_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->xattrop_cbk = afr_changelog_post_op_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->xattrop); priv->children[i]->fops->xattrop
(_new, priv->children[i], &local->transaction.new_parent_loc
, GF_XATTROP_ADD_ARRAY, xattr[i], ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
711 priv->children[i]->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", "afr-transaction.c", __FUNCTION__, 714
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->xattrop_cbk) tmp_cbk = afr_changelog_post_op_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->xattrop"
; _new->unwind_to = "afr_changelog_post_op_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->xattrop_cbk = afr_changelog_post_op_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->xattrop); priv->children[i]->fops->xattrop
(_new, priv->children[i], &local->transaction.new_parent_loc
, GF_XATTROP_ADD_ARRAY, xattr[i], ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
712 &local->transaction.new_parent_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", "afr-transaction.c", __FUNCTION__, 714
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->xattrop_cbk) tmp_cbk = afr_changelog_post_op_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->xattrop"
; _new->unwind_to = "afr_changelog_post_op_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->xattrop_cbk = afr_changelog_post_op_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->xattrop); priv->children[i]->fops->xattrop
(_new, priv->children[i], &local->transaction.new_parent_loc
, GF_XATTROP_ADD_ARRAY, xattr[i], ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
713 GF_XATTROP_ADD_ARRAY, xattr[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", "afr-transaction.c", __FUNCTION__, 714
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->xattrop_cbk) tmp_cbk = afr_changelog_post_op_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->xattrop"
; _new->unwind_to = "afr_changelog_post_op_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->xattrop_cbk = afr_changelog_post_op_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->xattrop); priv->children[i]->fops->xattrop
(_new, priv->children[i], &local->transaction.new_parent_loc
, GF_XATTROP_ADD_ARRAY, xattr[i], ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
714 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", "afr-transaction.c", __FUNCTION__, 714
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->xattrop_cbk) tmp_cbk = afr_changelog_post_op_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->xattrop"
; _new->unwind_to = "afr_changelog_post_op_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->xattrop_cbk = afr_changelog_post_op_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->xattrop); priv->children[i]->fops->xattrop
(_new, priv->children[i], &local->transaction.new_parent_loc
, GF_XATTROP_ADD_ARRAY, xattr[i], ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
;
715 }
716 call_count--;
717 }
718
719 /*
720 set it again because previous stack_wind
721 might have already returned (think of case
722 where subvolume is posix) and would have
723 used the dict as placeholder for return
724 value
725 */
726
727 afr_set_postop_dict (local, this, xattr[i],
728 local->optimistic_change_log, i);
729
730 /* fall through */
731
732 case AFR_ENTRY_TRANSACTION:
733 {
734 if (nothing_failed && local->optimistic_change_log) {
735 afr_changelog_post_op_cbk (frame, (void *)(long)i,
736 this, 1, 0, xattr[i],
737 NULL((void*)0));
738 break;
739 }
740
741 if (local->fd)
742 STACK_WIND (frame, afr_changelog_post_op_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", "afr-transaction.c", __FUNCTION__, 747
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fxattrop_cbk) tmp_cbk = afr_changelog_post_op_cbk
; _new->root = frame->root; _new->this = priv->children
[i]; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame
; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new
->wind_to = "priv->children[i]->fops->fxattrop"; _new
->unwind_to = "afr_changelog_post_op_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
()) = priv->children[i]; if (frame->this->ctx->measure_latency
) gf_latency_begin (_new, priv->children[i]->fops->fxattrop
); priv->children[i]->fops->fxattrop (_new, priv->
children[i], local->fd, GF_XATTROP_ADD_ARRAY, xattr[i], ((
void*)0)); (*__glusterfs_this_location()) = old_THIS; } while
(0)
743 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", "afr-transaction.c", __FUNCTION__, 747
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fxattrop_cbk) tmp_cbk = afr_changelog_post_op_cbk
; _new->root = frame->root; _new->this = priv->children
[i]; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame
; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new
->wind_to = "priv->children[i]->fops->fxattrop"; _new
->unwind_to = "afr_changelog_post_op_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
()) = priv->children[i]; if (frame->this->ctx->measure_latency
) gf_latency_begin (_new, priv->children[i]->fops->fxattrop
); priv->children[i]->fops->fxattrop (_new, priv->
children[i], local->fd, GF_XATTROP_ADD_ARRAY, xattr[i], ((
void*)0)); (*__glusterfs_this_location()) = old_THIS; } while
(0)
744 priv->children[i]->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", "afr-transaction.c", __FUNCTION__, 747
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fxattrop_cbk) tmp_cbk = afr_changelog_post_op_cbk
; _new->root = frame->root; _new->this = priv->children
[i]; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame
; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new
->wind_to = "priv->children[i]->fops->fxattrop"; _new
->unwind_to = "afr_changelog_post_op_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
()) = priv->children[i]; if (frame->this->ctx->measure_latency
) gf_latency_begin (_new, priv->children[i]->fops->fxattrop
); priv->children[i]->fops->fxattrop (_new, priv->
children[i], local->fd, GF_XATTROP_ADD_ARRAY, xattr[i], ((
void*)0)); (*__glusterfs_this_location()) = old_THIS; } while
(0)
745 local->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", "afr-transaction.c", __FUNCTION__, 747
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fxattrop_cbk) tmp_cbk = afr_changelog_post_op_cbk
; _new->root = frame->root; _new->this = priv->children
[i]; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame
; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new
->wind_to = "priv->children[i]->fops->fxattrop"; _new
->unwind_to = "afr_changelog_post_op_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
()) = priv->children[i]; if (frame->this->ctx->measure_latency
) gf_latency_begin (_new, priv->children[i]->fops->fxattrop
); priv->children[i]->fops->fxattrop (_new, priv->
children[i], local->fd, GF_XATTROP_ADD_ARRAY, xattr[i], ((
void*)0)); (*__glusterfs_this_location()) = old_THIS; } while
(0)
746 GF_XATTROP_ADD_ARRAY, xattr[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", "afr-transaction.c", __FUNCTION__, 747
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fxattrop_cbk) tmp_cbk = afr_changelog_post_op_cbk
; _new->root = frame->root; _new->this = priv->children
[i]; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame
; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new
->wind_to = "priv->children[i]->fops->fxattrop"; _new
->unwind_to = "afr_changelog_post_op_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
()) = priv->children[i]; if (frame->this->ctx->measure_latency
) gf_latency_begin (_new, priv->children[i]->fops->fxattrop
); priv->children[i]->fops->fxattrop (_new, priv->
children[i], local->fd, GF_XATTROP_ADD_ARRAY, xattr[i], ((
void*)0)); (*__glusterfs_this_location()) = old_THIS; } while
(0)
747 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", "afr-transaction.c", __FUNCTION__, 747
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fxattrop_cbk) tmp_cbk = afr_changelog_post_op_cbk
; _new->root = frame->root; _new->this = priv->children
[i]; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame
; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new
->wind_to = "priv->children[i]->fops->fxattrop"; _new
->unwind_to = "afr_changelog_post_op_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
()) = priv->children[i]; if (frame->this->ctx->measure_latency
) gf_latency_begin (_new, priv->children[i]->fops->fxattrop
); priv->children[i]->fops->fxattrop (_new, priv->
children[i], local->fd, GF_XATTROP_ADD_ARRAY, xattr[i], ((
void*)0)); (*__glusterfs_this_location()) = old_THIS; } while
(0)
;
748 else
749 STACK_WIND (frame, afr_changelog_post_op_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", "afr-transaction.c", __FUNCTION__, 754
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->xattrop_cbk) tmp_cbk = afr_changelog_post_op_cbk
; _new->root = frame->root; _new->this = priv->children
[i]; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame
; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new
->wind_to = "priv->children[i]->fops->xattrop"; _new
->unwind_to = "afr_changelog_post_op_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
()) = priv->children[i]; if (frame->this->ctx->measure_latency
) gf_latency_begin (_new, priv->children[i]->fops->xattrop
); priv->children[i]->fops->xattrop (_new, priv->
children[i], &local->transaction.parent_loc, GF_XATTROP_ADD_ARRAY
, xattr[i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
750 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", "afr-transaction.c", __FUNCTION__, 754
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->xattrop_cbk) tmp_cbk = afr_changelog_post_op_cbk
; _new->root = frame->root; _new->this = priv->children
[i]; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame
; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new
->wind_to = "priv->children[i]->fops->xattrop"; _new
->unwind_to = "afr_changelog_post_op_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
()) = priv->children[i]; if (frame->this->ctx->measure_latency
) gf_latency_begin (_new, priv->children[i]->fops->xattrop
); priv->children[i]->fops->xattrop (_new, priv->
children[i], &local->transaction.parent_loc, GF_XATTROP_ADD_ARRAY
, xattr[i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
751 priv->children[i]->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", "afr-transaction.c", __FUNCTION__, 754
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->xattrop_cbk) tmp_cbk = afr_changelog_post_op_cbk
; _new->root = frame->root; _new->this = priv->children
[i]; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame
; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new
->wind_to = "priv->children[i]->fops->xattrop"; _new
->unwind_to = "afr_changelog_post_op_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
()) = priv->children[i]; if (frame->this->ctx->measure_latency
) gf_latency_begin (_new, priv->children[i]->fops->xattrop
); priv->children[i]->fops->xattrop (_new, priv->
children[i], &local->transaction.parent_loc, GF_XATTROP_ADD_ARRAY
, xattr[i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
752 &local->transaction.parent_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", "afr-transaction.c", __FUNCTION__, 754
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->xattrop_cbk) tmp_cbk = afr_changelog_post_op_cbk
; _new->root = frame->root; _new->this = priv->children
[i]; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame
; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new
->wind_to = "priv->children[i]->fops->xattrop"; _new
->unwind_to = "afr_changelog_post_op_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
()) = priv->children[i]; if (frame->this->ctx->measure_latency
) gf_latency_begin (_new, priv->children[i]->fops->xattrop
); priv->children[i]->fops->xattrop (_new, priv->
children[i], &local->transaction.parent_loc, GF_XATTROP_ADD_ARRAY
, xattr[i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
753 GF_XATTROP_ADD_ARRAY, xattr[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", "afr-transaction.c", __FUNCTION__, 754
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->xattrop_cbk) tmp_cbk = afr_changelog_post_op_cbk
; _new->root = frame->root; _new->this = priv->children
[i]; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame
; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new
->wind_to = "priv->children[i]->fops->xattrop"; _new
->unwind_to = "afr_changelog_post_op_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
()) = priv->children[i]; if (frame->this->ctx->measure_latency
) gf_latency_begin (_new, priv->children[i]->fops->xattrop
); priv->children[i]->fops->xattrop (_new, priv->
children[i], &local->transaction.parent_loc, GF_XATTROP_ADD_ARRAY
, xattr[i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
754 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", "afr-transaction.c", __FUNCTION__, 754
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->xattrop_cbk) tmp_cbk = afr_changelog_post_op_cbk
; _new->root = frame->root; _new->this = priv->children
[i]; _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame
; _new->cookie = _new; _new->wind_from = __FUNCTION__; _new
->wind_to = "priv->children[i]->fops->xattrop"; _new
->unwind_to = "afr_changelog_post_op_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
()) = priv->children[i]; if (frame->this->ctx->measure_latency
) gf_latency_begin (_new, priv->children[i]->fops->xattrop
); priv->children[i]->fops->xattrop (_new, priv->
children[i], &local->transaction.parent_loc, GF_XATTROP_ADD_ARRAY
, xattr[i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
;
755 }
756 break;
757 }
758
759 if (!--call_count)
760 break;
761 }
762
763out:
764 for (i = 0; i < priv->child_count; i++) {
765 dict_unref (xattr[i]);
766 }
767
768 return 0;
769}
770
771
772int32_t
773afr_changelog_pre_op_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
774 int32_t op_ret, int32_t op_errno, dict_t *xattr,
775 dict_t *xdata)
776{
777 afr_local_t * local = NULL((void*)0);
778 afr_private_t * priv = this->private;
779 int call_count = -1;
780 int child_index = (long) cookie;
781
782 local = frame->local;
783
784 LOCK (&frame->lock)pthread_spin_lock (&frame->lock);
785 {
786 switch (op_ret) {
787 case 0:
788 __mark_pre_op_done_on_fd (frame, this, child_index);
789 //fallthrough we need to mark the pre_op
790 case 1:
791 local->transaction.pre_op[child_index] = 1;
792 /* special op_ret for piggyback */
793 break;
794 case -1:
795 if (op_errno == ENOTSUP95) {
796 gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("xattrop not supported by %s", priv->
children[child_index]->name); } while (0); _gf_log (this->
name, "afr-transaction.c", __FUNCTION__, 798, GF_LOG_ERROR, "xattrop not supported by %s"
, priv->children[child_index]->name); } while (0)
797 "xattrop not supported by %s",do { do { if (0) printf ("xattrop not supported by %s", priv->
children[child_index]->name); } while (0); _gf_log (this->
name, "afr-transaction.c", __FUNCTION__, 798, GF_LOG_ERROR, "xattrop not supported by %s"
, priv->children[child_index]->name); } while (0)
798 priv->children[child_index]->name)do { do { if (0) printf ("xattrop not supported by %s", priv->
children[child_index]->name); } while (0); _gf_log (this->
name, "afr-transaction.c", __FUNCTION__, 798, GF_LOG_ERROR, "xattrop not supported by %s"
, priv->children[child_index]->name); } while (0)
;
799 local->op_ret = -1;
800
801 } else if (!child_went_down (op_ret, op_errno)(((op_ret) < 0) && ((op_errno == 107) || (op_errno
== 77)))
) {
802 gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("xattrop failed on child %s: %s", priv
->children[child_index]->name, strerror (op_errno)); } while
(0); _gf_log (this->name, "afr-transaction.c", __FUNCTION__
, 805, GF_LOG_ERROR, "xattrop failed on child %s: %s", priv->
children[child_index]->name, strerror (op_errno)); } while
(0)
803 "xattrop failed on child %s: %s",do { do { if (0) printf ("xattrop failed on child %s: %s", priv
->children[child_index]->name, strerror (op_errno)); } while
(0); _gf_log (this->name, "afr-transaction.c", __FUNCTION__
, 805, GF_LOG_ERROR, "xattrop failed on child %s: %s", priv->
children[child_index]->name, strerror (op_errno)); } while
(0)
804 priv->children[child_index]->name,do { do { if (0) printf ("xattrop failed on child %s: %s", priv
->children[child_index]->name, strerror (op_errno)); } while
(0); _gf_log (this->name, "afr-transaction.c", __FUNCTION__
, 805, GF_LOG_ERROR, "xattrop failed on child %s: %s", priv->
children[child_index]->name, strerror (op_errno)); } while
(0)
805 strerror (op_errno))do { do { if (0) printf ("xattrop failed on child %s: %s", priv
->children[child_index]->name, strerror (op_errno)); } while
(0); _gf_log (this->name, "afr-transaction.c", __FUNCTION__
, 805, GF_LOG_ERROR, "xattrop failed on child %s: %s", priv->
children[child_index]->name, strerror (op_errno)); } while
(0)
;
806 }
807 local->op_errno = op_errno;
808 break;
809 }
810
811 call_count = --local->call_count;
812 }
813 UNLOCK (&frame->lock)pthread_spin_unlock (&frame->lock);
814
815 if (call_count == 0) {
816 if ((local->op_ret == -1) &&
817 (local->op_errno == ENOTSUP95)) {
818 local->transaction.resume (frame, this);
819 } else {
820 afr_transaction_perform_fop (frame, this);
821 }
822 }
823
824 return 0;
825}
826
827int
828afr_changelog_pre_op (call_frame_t *frame, xlator_t *this)
829{
830 afr_private_t * priv = this->private;
831 int i = 0;
832 int ret = 0;
833 int call_count = 0;
834 dict_t **xattr = NULL((void*)0);
835 afr_fd_ctx_t *fdctx = NULL((void*)0);
836 afr_local_t *local = NULL((void*)0);
837 int piggyback = 0;
838 afr_internal_lock_t *int_lock = NULL((void*)0);
839 unsigned char *locked_nodes = NULL((void*)0);
840
841 local = frame->local;
842 int_lock = &local->internal_lock;
843
844 xattr = alloca (priv->child_count * sizeof (*xattr))__builtin_alloca (priv->child_count * sizeof (*xattr));
845 memset (xattr, 0, (priv->child_count * sizeof (*xattr)));
846
847 for (i = 0; i < priv->child_count; i++) {
848 xattr[i] = dict_new ();
849 }
850
851 call_count = afr_changelog_pre_op_call_count (local->transaction.type,
852 int_lock,
853 priv->child_count);
854 if (call_count == 0) {
855 local->internal_lock.lock_cbk =
856 local->transaction.done;
857 afr_unlock (frame, this);
858 goto out;
859 }
860
861 local->call_count = call_count;
862
863 __mark_all_pending (local->pending, priv->child_count,
864 local->transaction.type);
865
866 if (local->fd)
867 fdctx = afr_fd_ctx_get (local->fd, this);
868
869 locked_nodes = afr_locked_nodes_get (local->transaction.type, int_lock);
870 for (i = 0; i < priv->child_count; i++) {
871 if (!locked_nodes[i])
872 continue;
873 ret = afr_set_pending_dict (priv, xattr[i], local->pending,
874 i, LOCAL_FIRST);
875
876 if (ret < 0)
877 gf_log (this->name, GF_LOG_INFO,do { do { if (0) printf ("failed to set pending entry"); } while
(0); _gf_log (this->name, "afr-transaction.c", __FUNCTION__
, 878, GF_LOG_INFO, "failed to set pending entry"); } while (
0)
878 "failed to set pending entry")do { do { if (0) printf ("failed to set pending entry"); } while
(0); _gf_log (this->name, "afr-transaction.c", __FUNCTION__
, 878, GF_LOG_INFO, "failed to set pending entry"); } while (
0)
;
879
880
881 switch (local->transaction.type) {
882 case AFR_DATA_TRANSACTION:
883 {
884 if (!fdctx) {
885 STACK_WIND_COOKIE (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", "afr-transaction.c", __FUNCTION__, 892
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->xattrop_cbk) tmp_cbk = afr_changelog_pre_op_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->xattrop"
; _new->unwind_to = "afr_changelog_pre_op_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->xattrop_cbk = afr_changelog_pre_op_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->xattrop); priv->children[i]->fops->xattrop
(_new, priv->children[i], &(local->loc), GF_XATTROP_ADD_ARRAY
, xattr[i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
886 afr_changelog_pre_op_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", "afr-transaction.c", __FUNCTION__, 892
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->xattrop_cbk) tmp_cbk = afr_changelog_pre_op_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->xattrop"
; _new->unwind_to = "afr_changelog_pre_op_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->xattrop_cbk = afr_changelog_pre_op_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->xattrop); priv->children[i]->fops->xattrop
(_new, priv->children[i], &(local->loc), GF_XATTROP_ADD_ARRAY
, xattr[i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
887 (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", "afr-transaction.c", __FUNCTION__, 892
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->xattrop_cbk) tmp_cbk = afr_changelog_pre_op_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->xattrop"
; _new->unwind_to = "afr_changelog_pre_op_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->xattrop_cbk = afr_changelog_pre_op_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->xattrop); priv->children[i]->fops->xattrop
(_new, priv->children[i], &(local->loc), GF_XATTROP_ADD_ARRAY
, xattr[i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
888 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", "afr-transaction.c", __FUNCTION__, 892
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->xattrop_cbk) tmp_cbk = afr_changelog_pre_op_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->xattrop"
; _new->unwind_to = "afr_changelog_pre_op_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->xattrop_cbk = afr_changelog_pre_op_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->xattrop); priv->children[i]->fops->xattrop
(_new, priv->children[i], &(local->loc), GF_XATTROP_ADD_ARRAY
, xattr[i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
889 priv->children[i]->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", "afr-transaction.c", __FUNCTION__, 892
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->xattrop_cbk) tmp_cbk = afr_changelog_pre_op_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->xattrop"
; _new->unwind_to = "afr_changelog_pre_op_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->xattrop_cbk = afr_changelog_pre_op_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->xattrop); priv->children[i]->fops->xattrop
(_new, priv->children[i], &(local->loc), GF_XATTROP_ADD_ARRAY
, xattr[i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
890 &(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", "afr-transaction.c", __FUNCTION__, 892
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->xattrop_cbk) tmp_cbk = afr_changelog_pre_op_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->xattrop"
; _new->unwind_to = "afr_changelog_pre_op_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->xattrop_cbk = afr_changelog_pre_op_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->xattrop); priv->children[i]->fops->xattrop
(_new, priv->children[i], &(local->loc), GF_XATTROP_ADD_ARRAY
, xattr[i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
891 GF_XATTROP_ADD_ARRAY, xattr[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", "afr-transaction.c", __FUNCTION__, 892
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->xattrop_cbk) tmp_cbk = afr_changelog_pre_op_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->xattrop"
; _new->unwind_to = "afr_changelog_pre_op_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->xattrop_cbk = afr_changelog_pre_op_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->xattrop); priv->children[i]->fops->xattrop
(_new, priv->children[i], &(local->loc), GF_XATTROP_ADD_ARRAY
, xattr[i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
892 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", "afr-transaction.c", __FUNCTION__, 892
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->xattrop_cbk) tmp_cbk = afr_changelog_pre_op_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->xattrop"
; _new->unwind_to = "afr_changelog_pre_op_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->xattrop_cbk = afr_changelog_pre_op_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->xattrop); priv->children[i]->fops->xattrop
(_new, priv->children[i], &(local->loc), GF_XATTROP_ADD_ARRAY
, xattr[i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
;
893 break;
894 }
895
896 LOCK (&local->fd->lock)pthread_spin_lock (&local->fd->lock);
897 {
898 piggyback = 0;
899 if (fdctx->pre_op_done[i]) {
900 fdctx->pre_op_piggyback[i]++;
901 piggyback = 1;
902 fdctx->hit++;
903 } else {
904 fdctx->miss++;
905 }
906 }
907 UNLOCK (&local->fd->lock)pthread_spin_unlock (&local->fd->lock);
908
909 afr_set_delayed_post_op (frame, this);
910
911 if (piggyback)
912 afr_changelog_pre_op_cbk (frame, (void *)(long)i,
913 this, 1, 0, xattr[i],
914 NULL((void*)0));
915 else
916 STACK_WIND_COOKIE (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", "afr-transaction.c", __FUNCTION__, 923
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fxattrop_cbk) tmp_cbk = afr_changelog_pre_op_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->fxattrop"
; _new->unwind_to = "afr_changelog_pre_op_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->fxattrop_cbk = afr_changelog_pre_op_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->fxattrop); priv->children[i]->fops->fxattrop
(_new, priv->children[i], local->fd, GF_XATTROP_ADD_ARRAY
, xattr[i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
917 afr_changelog_pre_op_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", "afr-transaction.c", __FUNCTION__, 923
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fxattrop_cbk) tmp_cbk = afr_changelog_pre_op_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->fxattrop"
; _new->unwind_to = "afr_changelog_pre_op_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->fxattrop_cbk = afr_changelog_pre_op_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->fxattrop); priv->children[i]->fops->fxattrop
(_new, priv->children[i], local->fd, GF_XATTROP_ADD_ARRAY
, xattr[i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
918 (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", "afr-transaction.c", __FUNCTION__, 923
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fxattrop_cbk) tmp_cbk = afr_changelog_pre_op_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->fxattrop"
; _new->unwind_to = "afr_changelog_pre_op_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->fxattrop_cbk = afr_changelog_pre_op_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->fxattrop); priv->children[i]->fops->fxattrop
(_new, priv->children[i], local->fd, GF_XATTROP_ADD_ARRAY
, xattr[i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
919 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", "afr-transaction.c", __FUNCTION__, 923
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fxattrop_cbk) tmp_cbk = afr_changelog_pre_op_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->fxattrop"
; _new->unwind_to = "afr_changelog_pre_op_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->fxattrop_cbk = afr_changelog_pre_op_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->fxattrop); priv->children[i]->fops->fxattrop
(_new, priv->children[i], local->fd, GF_XATTROP_ADD_ARRAY
, xattr[i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
920 priv->children[i]->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", "afr-transaction.c", __FUNCTION__, 923
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fxattrop_cbk) tmp_cbk = afr_changelog_pre_op_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->fxattrop"
; _new->unwind_to = "afr_changelog_pre_op_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->fxattrop_cbk = afr_changelog_pre_op_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->fxattrop); priv->children[i]->fops->fxattrop
(_new, priv->children[i], local->fd, GF_XATTROP_ADD_ARRAY
, xattr[i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
921 local->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", "afr-transaction.c", __FUNCTION__, 923
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fxattrop_cbk) tmp_cbk = afr_changelog_pre_op_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->fxattrop"
; _new->unwind_to = "afr_changelog_pre_op_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->fxattrop_cbk = afr_changelog_pre_op_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->fxattrop); priv->children[i]->fops->fxattrop
(_new, priv->children[i], local->fd, GF_XATTROP_ADD_ARRAY
, xattr[i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
922 GF_XATTROP_ADD_ARRAY, xattr[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", "afr-transaction.c", __FUNCTION__, 923
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fxattrop_cbk) tmp_cbk = afr_changelog_pre_op_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->fxattrop"
; _new->unwind_to = "afr_changelog_pre_op_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->fxattrop_cbk = afr_changelog_pre_op_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->fxattrop); priv->children[i]->fops->fxattrop
(_new, priv->children[i], local->fd, GF_XATTROP_ADD_ARRAY
, xattr[i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
923 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", "afr-transaction.c", __FUNCTION__, 923
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fxattrop_cbk) tmp_cbk = afr_changelog_pre_op_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->fxattrop"
; _new->unwind_to = "afr_changelog_pre_op_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->fxattrop_cbk = afr_changelog_pre_op_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->fxattrop); priv->children[i]->fops->fxattrop
(_new, priv->children[i], local->fd, GF_XATTROP_ADD_ARRAY
, xattr[i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
;
924 }
925 break;
926 case AFR_METADATA_TRANSACTION:
927 {
928 if (local->optimistic_change_log) {
929 afr_changelog_pre_op_cbk (frame, (void *)(long)i,
930 this, 1, 0, xattr[i],
931 NULL((void*)0));
932 break;
933 }
934
935 if (local->fd)
936 STACK_WIND_COOKIE (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", "afr-transaction.c", __FUNCTION__, 943
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fxattrop_cbk) tmp_cbk = afr_changelog_pre_op_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->fxattrop"
; _new->unwind_to = "afr_changelog_pre_op_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->fxattrop_cbk = afr_changelog_pre_op_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->fxattrop); priv->children[i]->fops->fxattrop
(_new, priv->children[i], local->fd, GF_XATTROP_ADD_ARRAY
, xattr[i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
937 afr_changelog_pre_op_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", "afr-transaction.c", __FUNCTION__, 943
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fxattrop_cbk) tmp_cbk = afr_changelog_pre_op_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->fxattrop"
; _new->unwind_to = "afr_changelog_pre_op_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->fxattrop_cbk = afr_changelog_pre_op_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->fxattrop); priv->children[i]->fops->fxattrop
(_new, priv->children[i], local->fd, GF_XATTROP_ADD_ARRAY
, xattr[i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
938 (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", "afr-transaction.c", __FUNCTION__, 943
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fxattrop_cbk) tmp_cbk = afr_changelog_pre_op_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->fxattrop"
; _new->unwind_to = "afr_changelog_pre_op_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->fxattrop_cbk = afr_changelog_pre_op_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->fxattrop); priv->children[i]->fops->fxattrop
(_new, priv->children[i], local->fd, GF_XATTROP_ADD_ARRAY
, xattr[i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
939 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", "afr-transaction.c", __FUNCTION__, 943
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fxattrop_cbk) tmp_cbk = afr_changelog_pre_op_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->fxattrop"
; _new->unwind_to = "afr_changelog_pre_op_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->fxattrop_cbk = afr_changelog_pre_op_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->fxattrop); priv->children[i]->fops->fxattrop
(_new, priv->children[i], local->fd, GF_XATTROP_ADD_ARRAY
, xattr[i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
940 priv->children[i]->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", "afr-transaction.c", __FUNCTION__, 943
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fxattrop_cbk) tmp_cbk = afr_changelog_pre_op_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->fxattrop"
; _new->unwind_to = "afr_changelog_pre_op_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->fxattrop_cbk = afr_changelog_pre_op_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->fxattrop); priv->children[i]->fops->fxattrop
(_new, priv->children[i], local->fd, GF_XATTROP_ADD_ARRAY
, xattr[i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
941 local->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", "afr-transaction.c", __FUNCTION__, 943
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fxattrop_cbk) tmp_cbk = afr_changelog_pre_op_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->fxattrop"
; _new->unwind_to = "afr_changelog_pre_op_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->fxattrop_cbk = afr_changelog_pre_op_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->fxattrop); priv->children[i]->fops->fxattrop
(_new, priv->children[i], local->fd, GF_XATTROP_ADD_ARRAY
, xattr[i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
942 GF_XATTROP_ADD_ARRAY, xattr[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", "afr-transaction.c", __FUNCTION__, 943
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fxattrop_cbk) tmp_cbk = afr_changelog_pre_op_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->fxattrop"
; _new->unwind_to = "afr_changelog_pre_op_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->fxattrop_cbk = afr_changelog_pre_op_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->fxattrop); priv->children[i]->fops->fxattrop
(_new, priv->children[i], local->fd, GF_XATTROP_ADD_ARRAY
, xattr[i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
943 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", "afr-transaction.c", __FUNCTION__, 943
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fxattrop_cbk) tmp_cbk = afr_changelog_pre_op_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->fxattrop"
; _new->unwind_to = "afr_changelog_pre_op_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->fxattrop_cbk = afr_changelog_pre_op_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->fxattrop); priv->children[i]->fops->fxattrop
(_new, priv->children[i], local->fd, GF_XATTROP_ADD_ARRAY
, xattr[i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
;
944 else
945 STACK_WIND_COOKIE (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", "afr-transaction.c", __FUNCTION__, 952
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->xattrop_cbk) tmp_cbk = afr_changelog_pre_op_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->xattrop"
; _new->unwind_to = "afr_changelog_pre_op_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->xattrop_cbk = afr_changelog_pre_op_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->xattrop); priv->children[i]->fops->xattrop
(_new, priv->children[i], &(local->loc), GF_XATTROP_ADD_ARRAY
, xattr[i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
946 afr_changelog_pre_op_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", "afr-transaction.c", __FUNCTION__, 952
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->xattrop_cbk) tmp_cbk = afr_changelog_pre_op_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->xattrop"
; _new->unwind_to = "afr_changelog_pre_op_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->xattrop_cbk = afr_changelog_pre_op_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->xattrop); priv->children[i]->fops->xattrop
(_new, priv->children[i], &(local->loc), GF_XATTROP_ADD_ARRAY
, xattr[i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
947 (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", "afr-transaction.c", __FUNCTION__, 952
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->xattrop_cbk) tmp_cbk = afr_changelog_pre_op_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->xattrop"
; _new->unwind_to = "afr_changelog_pre_op_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->xattrop_cbk = afr_changelog_pre_op_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->xattrop); priv->children[i]->fops->xattrop
(_new, priv->children[i], &(local->loc), GF_XATTROP_ADD_ARRAY
, xattr[i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
948 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", "afr-transaction.c", __FUNCTION__, 952
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->xattrop_cbk) tmp_cbk = afr_changelog_pre_op_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->xattrop"
; _new->unwind_to = "afr_changelog_pre_op_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->xattrop_cbk = afr_changelog_pre_op_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->xattrop); priv->children[i]->fops->xattrop
(_new, priv->children[i], &(local->loc), GF_XATTROP_ADD_ARRAY
, xattr[i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
949 priv->children[i]->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", "afr-transaction.c", __FUNCTION__, 952
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->xattrop_cbk) tmp_cbk = afr_changelog_pre_op_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->xattrop"
; _new->unwind_to = "afr_changelog_pre_op_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->xattrop_cbk = afr_changelog_pre_op_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->xattrop); priv->children[i]->fops->xattrop
(_new, priv->children[i], &(local->loc), GF_XATTROP_ADD_ARRAY
, xattr[i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
950 &(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", "afr-transaction.c", __FUNCTION__, 952
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->xattrop_cbk) tmp_cbk = afr_changelog_pre_op_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->xattrop"
; _new->unwind_to = "afr_changelog_pre_op_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->xattrop_cbk = afr_changelog_pre_op_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->xattrop); priv->children[i]->fops->xattrop
(_new, priv->children[i], &(local->loc), GF_XATTROP_ADD_ARRAY
, xattr[i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
951 GF_XATTROP_ADD_ARRAY, xattr[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", "afr-transaction.c", __FUNCTION__, 952
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->xattrop_cbk) tmp_cbk = afr_changelog_pre_op_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->xattrop"
; _new->unwind_to = "afr_changelog_pre_op_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->xattrop_cbk = afr_changelog_pre_op_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->xattrop); priv->children[i]->fops->xattrop
(_new, priv->children[i], &(local->loc), GF_XATTROP_ADD_ARRAY
, xattr[i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
952 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", "afr-transaction.c", __FUNCTION__, 952
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->xattrop_cbk) tmp_cbk = afr_changelog_pre_op_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->xattrop"
; _new->unwind_to = "afr_changelog_pre_op_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->xattrop_cbk = afr_changelog_pre_op_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->xattrop); priv->children[i]->fops->xattrop
(_new, priv->children[i], &(local->loc), GF_XATTROP_ADD_ARRAY
, xattr[i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
;
953 }
954 break;
955
956 case AFR_ENTRY_RENAME_TRANSACTION:
957 {
958 if (local->optimistic_change_log) {
959 afr_changelog_pre_op_cbk (frame, (void *)(long)i,
960 this, 1, 0, xattr[i],
961 NULL((void*)0));
962 } else {
963 STACK_WIND_COOKIE (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", "afr-transaction.c", __FUNCTION__, 970
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->xattrop_cbk) tmp_cbk = afr_changelog_pre_op_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->xattrop"
; _new->unwind_to = "afr_changelog_pre_op_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->xattrop_cbk = afr_changelog_pre_op_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->xattrop); priv->children[i]->fops->xattrop
(_new, priv->children[i], &local->transaction.new_parent_loc
, GF_XATTROP_ADD_ARRAY, xattr[i], ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
964 afr_changelog_pre_op_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", "afr-transaction.c", __FUNCTION__, 970
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->xattrop_cbk) tmp_cbk = afr_changelog_pre_op_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->xattrop"
; _new->unwind_to = "afr_changelog_pre_op_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->xattrop_cbk = afr_changelog_pre_op_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->xattrop); priv->children[i]->fops->xattrop
(_new, priv->children[i], &local->transaction.new_parent_loc
, GF_XATTROP_ADD_ARRAY, xattr[i], ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
965 (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", "afr-transaction.c", __FUNCTION__, 970
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->xattrop_cbk) tmp_cbk = afr_changelog_pre_op_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->xattrop"
; _new->unwind_to = "afr_changelog_pre_op_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->xattrop_cbk = afr_changelog_pre_op_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->xattrop); priv->children[i]->fops->xattrop
(_new, priv->children[i], &local->transaction.new_parent_loc
, GF_XATTROP_ADD_ARRAY, xattr[i], ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
966 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", "afr-transaction.c", __FUNCTION__, 970
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->xattrop_cbk) tmp_cbk = afr_changelog_pre_op_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->xattrop"
; _new->unwind_to = "afr_changelog_pre_op_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->xattrop_cbk = afr_changelog_pre_op_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->xattrop); priv->children[i]->fops->xattrop
(_new, priv->children[i], &local->transaction.new_parent_loc
, GF_XATTROP_ADD_ARRAY, xattr[i], ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
967 priv->children[i]->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", "afr-transaction.c", __FUNCTION__, 970
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->xattrop_cbk) tmp_cbk = afr_changelog_pre_op_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->xattrop"
; _new->unwind_to = "afr_changelog_pre_op_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->xattrop_cbk = afr_changelog_pre_op_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->xattrop); priv->children[i]->fops->xattrop
(_new, priv->children[i], &local->transaction.new_parent_loc
, GF_XATTROP_ADD_ARRAY, xattr[i], ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
968 &local->transaction.new_parent_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", "afr-transaction.c", __FUNCTION__, 970
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->xattrop_cbk) tmp_cbk = afr_changelog_pre_op_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->xattrop"
; _new->unwind_to = "afr_changelog_pre_op_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->xattrop_cbk = afr_changelog_pre_op_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->xattrop); priv->children[i]->fops->xattrop
(_new, priv->children[i], &local->transaction.new_parent_loc
, GF_XATTROP_ADD_ARRAY, xattr[i], ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
969 GF_XATTROP_ADD_ARRAY, xattr[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", "afr-transaction.c", __FUNCTION__, 970
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->xattrop_cbk) tmp_cbk = afr_changelog_pre_op_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->xattrop"
; _new->unwind_to = "afr_changelog_pre_op_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->xattrop_cbk = afr_changelog_pre_op_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->xattrop); priv->children[i]->fops->xattrop
(_new, priv->children[i], &local->transaction.new_parent_loc
, GF_XATTROP_ADD_ARRAY, xattr[i], ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
970 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", "afr-transaction.c", __FUNCTION__, 970
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->xattrop_cbk) tmp_cbk = afr_changelog_pre_op_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->xattrop"
; _new->unwind_to = "afr_changelog_pre_op_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->xattrop_cbk = afr_changelog_pre_op_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->xattrop); priv->children[i]->fops->xattrop
(_new, priv->children[i], &local->transaction.new_parent_loc
, GF_XATTROP_ADD_ARRAY, xattr[i], ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
;
971 }
972
973 call_count--;
974 }
975
976
977 /*
978 set it again because previous stack_wind
979 might have already returned (think of case
980 where subvolume is posix) and would have
981 used the dict as placeholder for return
982 value
983 */
984
985 ret = afr_set_pending_dict (priv, xattr[i], local->pending,
986 i, LOCAL_FIRST);
987
988 if (ret < 0)
989 gf_log (this->name, GF_LOG_INFO,do { do { if (0) printf ("failed to set pending entry"); } while
(0); _gf_log (this->name, "afr-transaction.c", __FUNCTION__
, 990, GF_LOG_INFO, "failed to set pending entry"); } while (
0)
990 "failed to set pending entry")do { do { if (0) printf ("failed to set pending entry"); } while
(0); _gf_log (this->name, "afr-transaction.c", __FUNCTION__
, 990, GF_LOG_INFO, "failed to set pending entry"); } while (
0)
;
991
992 /* fall through */
993
994 case AFR_ENTRY_TRANSACTION:
995 {
996 if (local->optimistic_change_log) {
997 afr_changelog_pre_op_cbk (frame, (void *)(long)i,
998 this, 1, 0, xattr[i],
999 NULL((void*)0));
1000 break;
1001 }
1002
1003 if (local->fd)
1004 STACK_WIND_COOKIE (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", "afr-transaction.c", __FUNCTION__, 1011
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fxattrop_cbk) tmp_cbk = afr_changelog_pre_op_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->fxattrop"
; _new->unwind_to = "afr_changelog_pre_op_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->fxattrop_cbk = afr_changelog_pre_op_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->fxattrop); priv->children[i]->fops->fxattrop
(_new, priv->children[i], local->fd, GF_XATTROP_ADD_ARRAY
, xattr[i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
1005 afr_changelog_pre_op_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", "afr-transaction.c", __FUNCTION__, 1011
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fxattrop_cbk) tmp_cbk = afr_changelog_pre_op_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->fxattrop"
; _new->unwind_to = "afr_changelog_pre_op_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->fxattrop_cbk = afr_changelog_pre_op_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->fxattrop); priv->children[i]->fops->fxattrop
(_new, priv->children[i], local->fd, GF_XATTROP_ADD_ARRAY
, xattr[i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
1006 (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", "afr-transaction.c", __FUNCTION__, 1011
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fxattrop_cbk) tmp_cbk = afr_changelog_pre_op_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->fxattrop"
; _new->unwind_to = "afr_changelog_pre_op_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->fxattrop_cbk = afr_changelog_pre_op_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->fxattrop); priv->children[i]->fops->fxattrop
(_new, priv->children[i], local->fd, GF_XATTROP_ADD_ARRAY
, xattr[i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
1007 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", "afr-transaction.c", __FUNCTION__, 1011
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fxattrop_cbk) tmp_cbk = afr_changelog_pre_op_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->fxattrop"
; _new->unwind_to = "afr_changelog_pre_op_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->fxattrop_cbk = afr_changelog_pre_op_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->fxattrop); priv->children[i]->fops->fxattrop
(_new, priv->children[i], local->fd, GF_XATTROP_ADD_ARRAY
, xattr[i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
1008 priv->children[i]->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", "afr-transaction.c", __FUNCTION__, 1011
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fxattrop_cbk) tmp_cbk = afr_changelog_pre_op_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->fxattrop"
; _new->unwind_to = "afr_changelog_pre_op_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->fxattrop_cbk = afr_changelog_pre_op_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->fxattrop); priv->children[i]->fops->fxattrop
(_new, priv->children[i], local->fd, GF_XATTROP_ADD_ARRAY
, xattr[i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
1009 local->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", "afr-transaction.c", __FUNCTION__, 1011
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fxattrop_cbk) tmp_cbk = afr_changelog_pre_op_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->fxattrop"
; _new->unwind_to = "afr_changelog_pre_op_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->fxattrop_cbk = afr_changelog_pre_op_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->fxattrop); priv->children[i]->fops->fxattrop
(_new, priv->children[i], local->fd, GF_XATTROP_ADD_ARRAY
, xattr[i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
1010 GF_XATTROP_ADD_ARRAY, xattr[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", "afr-transaction.c", __FUNCTION__, 1011
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fxattrop_cbk) tmp_cbk = afr_changelog_pre_op_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->fxattrop"
; _new->unwind_to = "afr_changelog_pre_op_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->fxattrop_cbk = afr_changelog_pre_op_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->fxattrop); priv->children[i]->fops->fxattrop
(_new, priv->children[i], local->fd, GF_XATTROP_ADD_ARRAY
, xattr[i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
1011 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", "afr-transaction.c", __FUNCTION__, 1011
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fxattrop_cbk) tmp_cbk = afr_changelog_pre_op_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->fxattrop"
; _new->unwind_to = "afr_changelog_pre_op_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->fxattrop_cbk = afr_changelog_pre_op_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->fxattrop); priv->children[i]->fops->fxattrop
(_new, priv->children[i], local->fd, GF_XATTROP_ADD_ARRAY
, xattr[i], ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
;
1012 else
1013 STACK_WIND_COOKIE (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", "afr-transaction.c", __FUNCTION__, 1020
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->xattrop_cbk) tmp_cbk = afr_changelog_pre_op_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->xattrop"
; _new->unwind_to = "afr_changelog_pre_op_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->xattrop_cbk = afr_changelog_pre_op_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->xattrop); priv->children[i]->fops->xattrop
(_new, priv->children[i], &local->transaction.parent_loc
, GF_XATTROP_ADD_ARRAY, xattr[i], ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1014 afr_changelog_pre_op_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", "afr-transaction.c", __FUNCTION__, 1020
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->xattrop_cbk) tmp_cbk = afr_changelog_pre_op_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->xattrop"
; _new->unwind_to = "afr_changelog_pre_op_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->xattrop_cbk = afr_changelog_pre_op_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->xattrop); priv->children[i]->fops->xattrop
(_new, priv->children[i], &local->transaction.parent_loc
, GF_XATTROP_ADD_ARRAY, xattr[i], ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1015 (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", "afr-transaction.c", __FUNCTION__, 1020
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->xattrop_cbk) tmp_cbk = afr_changelog_pre_op_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->xattrop"
; _new->unwind_to = "afr_changelog_pre_op_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->xattrop_cbk = afr_changelog_pre_op_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->xattrop); priv->children[i]->fops->xattrop
(_new, priv->children[i], &local->transaction.parent_loc
, GF_XATTROP_ADD_ARRAY, xattr[i], ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1016 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", "afr-transaction.c", __FUNCTION__, 1020
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->xattrop_cbk) tmp_cbk = afr_changelog_pre_op_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->xattrop"
; _new->unwind_to = "afr_changelog_pre_op_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->xattrop_cbk = afr_changelog_pre_op_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->xattrop); priv->children[i]->fops->xattrop
(_new, priv->children[i], &local->transaction.parent_loc
, GF_XATTROP_ADD_ARRAY, xattr[i], ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1017 priv->children[i]->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", "afr-transaction.c", __FUNCTION__, 1020
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->xattrop_cbk) tmp_cbk = afr_changelog_pre_op_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->xattrop"
; _new->unwind_to = "afr_changelog_pre_op_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->xattrop_cbk = afr_changelog_pre_op_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->xattrop); priv->children[i]->fops->xattrop
(_new, priv->children[i], &local->transaction.parent_loc
, GF_XATTROP_ADD_ARRAY, xattr[i], ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1018 &local->transaction.parent_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", "afr-transaction.c", __FUNCTION__, 1020
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->xattrop_cbk) tmp_cbk = afr_changelog_pre_op_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->xattrop"
; _new->unwind_to = "afr_changelog_pre_op_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->xattrop_cbk = afr_changelog_pre_op_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->xattrop); priv->children[i]->fops->xattrop
(_new, priv->children[i], &local->transaction.parent_loc
, GF_XATTROP_ADD_ARRAY, xattr[i], ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1019 GF_XATTROP_ADD_ARRAY, xattr[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", "afr-transaction.c", __FUNCTION__, 1020
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->xattrop_cbk) tmp_cbk = afr_changelog_pre_op_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->xattrop"
; _new->unwind_to = "afr_changelog_pre_op_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->xattrop_cbk = afr_changelog_pre_op_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->xattrop); priv->children[i]->fops->xattrop
(_new, priv->children[i], &local->transaction.parent_loc
, GF_XATTROP_ADD_ARRAY, xattr[i], ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1020 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", "afr-transaction.c", __FUNCTION__, 1020
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->xattrop_cbk) tmp_cbk = afr_changelog_pre_op_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->xattrop"
; _new->unwind_to = "afr_changelog_pre_op_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->xattrop_cbk = afr_changelog_pre_op_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->xattrop); priv->children[i]->fops->xattrop
(_new, priv->children[i], &local->transaction.parent_loc
, GF_XATTROP_ADD_ARRAY, xattr[i], ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
;
1021 }
1022 break;
1023 }
1024
1025 if (!--call_count)
1026 break;
1027 }
1028out:
1029 for (i = 0; i < priv->child_count; i++) {
1030 dict_unref (xattr[i]);
1031 }
1032
1033 return 0;
1034}
1035
1036
1037int
1038afr_post_blocking_inodelk_cbk (call_frame_t *frame, xlator_t *this)
1039{
1040 afr_internal_lock_t *int_lock = NULL((void*)0);
1041 afr_local_t *local = NULL((void*)0);
1042
1043 local = frame->local;
1044 int_lock = &local->internal_lock;
1045
1046 if (int_lock->lock_op_ret < 0) {
1047 gf_log (this->name, GF_LOG_INFO,do { do { if (0) printf ("Blocking inodelks failed."); } while
(0); _gf_log (this->name, "afr-transaction.c", __FUNCTION__
, 1048, GF_LOG_INFO, "Blocking inodelks failed."); } while (0
)
1048 "Blocking inodelks failed.")do { do { if (0) printf ("Blocking inodelks failed."); } while
(0); _gf_log (this->name, "afr-transaction.c", __FUNCTION__
, 1048, GF_LOG_INFO, "Blocking inodelks failed."); } while (0
)
;
1049 local->transaction.done (frame, this);
1050 } else {
1051
1052 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("Blocking inodelks done. Proceeding to FOP"
); } while (0); _gf_log (this->name, "afr-transaction.c", __FUNCTION__
, 1053, GF_LOG_DEBUG, "Blocking inodelks done. Proceeding to FOP"
); } while (0)
1053 "Blocking inodelks done. Proceeding to FOP")do { do { if (0) printf ("Blocking inodelks done. Proceeding to FOP"
); } while (0); _gf_log (this->name, "afr-transaction.c", __FUNCTION__
, 1053, GF_LOG_DEBUG, "Blocking inodelks done. Proceeding to FOP"
); } while (0)
;
1054 afr_internal_lock_finish (frame, this);
1055 }
1056
1057 return 0;
1058}
1059
1060
1061int
1062afr_post_nonblocking_inodelk_cbk (call_frame_t *frame, xlator_t *this)
1063{
1064 afr_internal_lock_t *int_lock = NULL((void*)0);
1065 afr_local_t *local = NULL((void*)0);
1066
1067 local = frame->local;
1068 int_lock = &local->internal_lock;
1069
1070 /* Initiate blocking locks if non-blocking has failed */
1071 if (int_lock->lock_op_ret < 0) {
1072 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("Non blocking inodelks failed. Proceeding to blocking"
); } while (0); _gf_log (this->name, "afr-transaction.c", __FUNCTION__
, 1073, GF_LOG_DEBUG, "Non blocking inodelks failed. Proceeding to blocking"
); } while (0)
1073 "Non blocking inodelks failed. Proceeding to blocking")do { do { if (0) printf ("Non blocking inodelks failed. Proceeding to blocking"
); } while (0); _gf_log (this->name, "afr-transaction.c", __FUNCTION__
, 1073, GF_LOG_DEBUG, "Non blocking inodelks failed. Proceeding to blocking"
); } while (0)
;
1074 int_lock->lock_cbk = afr_post_blocking_inodelk_cbk;
1075 afr_blocking_lock (frame, this);
1076 } else {
1077
1078 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("Non blocking inodelks done. Proceeding to FOP"
); } while (0); _gf_log (this->name, "afr-transaction.c", __FUNCTION__
, 1079, GF_LOG_DEBUG, "Non blocking inodelks done. Proceeding to FOP"
); } while (0)
1079 "Non blocking inodelks done. Proceeding to FOP")do { do { if (0) printf ("Non blocking inodelks done. Proceeding to FOP"
); } while (0); _gf_log (this->name, "afr-transaction.c", __FUNCTION__
, 1079, GF_LOG_DEBUG, "Non blocking inodelks done. Proceeding to FOP"
); } while (0)
;
1080 afr_internal_lock_finish (frame, this);
1081 }
1082
1083 return 0;
1084}
1085
1086
1087int
1088afr_post_blocking_entrylk_cbk (call_frame_t *frame, xlator_t *this)
1089{
1090 afr_internal_lock_t *int_lock = NULL((void*)0);
1091 afr_local_t *local = NULL((void*)0);
1092
1093 local = frame->local;
1094 int_lock = &local->internal_lock;
1095
1096 if (int_lock->lock_op_ret < 0) {
1097 gf_log (this->name, GF_LOG_INFO,do { do { if (0) printf ("Blocking entrylks failed."); } while
(0); _gf_log (this->name, "afr-transaction.c", __FUNCTION__
, 1098, GF_LOG_INFO, "Blocking entrylks failed."); } while (0
)
1098 "Blocking entrylks failed.")do { do { if (0) printf ("Blocking entrylks failed."); } while
(0); _gf_log (this->name, "afr-transaction.c", __FUNCTION__
, 1098, GF_LOG_INFO, "Blocking entrylks failed."); } while (0
)
;
1099 local->transaction.done (frame, this);
1100 } else {
1101
1102 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("Blocking entrylks done. Proceeding to FOP"
); } while (0); _gf_log (this->name, "afr-transaction.c", __FUNCTION__
, 1103, GF_LOG_DEBUG, "Blocking entrylks done. Proceeding to FOP"
); } while (0)
1103 "Blocking entrylks done. Proceeding to FOP")do { do { if (0) printf ("Blocking entrylks done. Proceeding to FOP"
); } while (0); _gf_log (this->name, "afr-transaction.c", __FUNCTION__
, 1103, GF_LOG_DEBUG, "Blocking entrylks done. Proceeding to FOP"
); } while (0)
;
1104 afr_internal_lock_finish (frame, this);
1105 }
1106
1107 return 0;
1108}
1109
1110
1111int
1112afr_post_nonblocking_entrylk_cbk (call_frame_t *frame, xlator_t *this)
1113{
1114 afr_internal_lock_t *int_lock = NULL((void*)0);
1115 afr_local_t *local = NULL((void*)0);
1116
1117 local = frame->local;
1118 int_lock = &local->internal_lock;
1119
1120 /* Initiate blocking locks if non-blocking has failed */
1121 if (int_lock->lock_op_ret < 0) {
1122 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("Non blocking entrylks failed. Proceeding to blocking"
); } while (0); _gf_log (this->name, "afr-transaction.c", __FUNCTION__
, 1123, GF_LOG_DEBUG, "Non blocking entrylks failed. Proceeding to blocking"
); } while (0)
1123 "Non blocking entrylks failed. Proceeding to blocking")do { do { if (0) printf ("Non blocking entrylks failed. Proceeding to blocking"
); } while (0); _gf_log (this->name, "afr-transaction.c", __FUNCTION__
, 1123, GF_LOG_DEBUG, "Non blocking entrylks failed. Proceeding to blocking"
); } while (0)
;
1124 int_lock->lock_cbk = afr_post_blocking_entrylk_cbk;
1125 afr_blocking_lock (frame, this);
1126 } else {
1127
1128 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("Non blocking entrylks done. Proceeding to FOP"
); } while (0); _gf_log (this->name, "afr-transaction.c", __FUNCTION__
, 1129, GF_LOG_DEBUG, "Non blocking entrylks done. Proceeding to FOP"
); } while (0)
1129 "Non blocking entrylks done. Proceeding to FOP")do { do { if (0) printf ("Non blocking entrylks done. Proceeding to FOP"
); } while (0); _gf_log (this->name, "afr-transaction.c", __FUNCTION__
, 1129, GF_LOG_DEBUG, "Non blocking entrylks done. Proceeding to FOP"
); } while (0)
;
1130 afr_internal_lock_finish (frame, this);
1131 }
1132
1133 return 0;
1134}
1135
1136
1137int
1138afr_post_blocking_rename_cbk (call_frame_t *frame, xlator_t *this)
1139{
1140 afr_internal_lock_t *int_lock = NULL((void*)0);
1141 afr_local_t *local = NULL((void*)0);
1142
1143 local = frame->local;
1144 int_lock = &local->internal_lock;
1145
1146 if (int_lock->lock_op_ret < 0) {
1147 gf_log (this->name, GF_LOG_INFO,do { do { if (0) printf ("Blocking entrylks failed."); } while
(0); _gf_log (this->name, "afr-transaction.c", __FUNCTION__
, 1148, GF_LOG_INFO, "Blocking entrylks failed."); } while (0
)
1148 "Blocking entrylks failed.")do { do { if (0) printf ("Blocking entrylks failed."); } while
(0); _gf_log (this->name, "afr-transaction.c", __FUNCTION__
, 1148, GF_LOG_INFO, "Blocking entrylks failed."); } while (0
)
;
1149 local->transaction.done (frame, this);
1150 } else {
1151
1152 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("Blocking entrylks done. Proceeding to FOP"
); } while (0); _gf_log (this->name, "afr-transaction.c", __FUNCTION__
, 1153, GF_LOG_DEBUG, "Blocking entrylks done. Proceeding to FOP"
); } while (0)
1153 "Blocking entrylks done. Proceeding to FOP")do { do { if (0) printf ("Blocking entrylks done. Proceeding to FOP"
); } while (0); _gf_log (this->name, "afr-transaction.c", __FUNCTION__
, 1153, GF_LOG_DEBUG, "Blocking entrylks done. Proceeding to FOP"
); } while (0)
;
1154 afr_internal_lock_finish (frame, this);
1155 }
1156 return 0;
1157}
1158
1159
1160int
1161afr_post_lower_unlock_cbk (call_frame_t *frame, xlator_t *this)
1162{
1163 afr_internal_lock_t *int_lock = NULL((void*)0);
1164 afr_local_t *local = NULL((void*)0);
1165
1166 local = frame->local;
1167 int_lock = &local->internal_lock;
1168
1169 GF_ASSERT (!int_lock->higher_locked)do { if (!(!int_lock->higher_locked)) { do { do { if (0) printf
("Assertion failed: " "!int_lock->higher_locked"); } while
(0); _gf_log_callingfn ("", "afr-transaction.c", __FUNCTION__
, 1169, GF_LOG_ERROR, "Assertion failed: " "!int_lock->higher_locked"
); } while (0); } } while (0)
;
1170
1171 int_lock->lock_cbk = afr_post_blocking_rename_cbk;
1172 afr_blocking_lock (frame, this);
1173
1174 return 0;
1175}
1176
1177
1178int
1179afr_set_transaction_flock (afr_local_t *local)
1180{
1181 afr_internal_lock_t *int_lock = NULL((void*)0);
1182
1183 int_lock = &local->internal_lock;
1184
1185 int_lock->lk_flock.l_len = local->transaction.len;
1186 int_lock->lk_flock.l_start = local->transaction.start;
1187 int_lock->lk_flock.l_type = F_WRLCK1;
1188
1189 return 0;
1190}
1191
1192int
1193afr_lock_rec (call_frame_t *frame, xlator_t *this)
1194{
1195 afr_internal_lock_t *int_lock = NULL((void*)0);
1196 afr_local_t *local = NULL((void*)0);
1197
1198 local = frame->local;
1199 int_lock = &local->internal_lock;
1200
1201 int_lock->transaction_lk_type = AFR_TRANSACTION_LK;
1202
1203 switch (local->transaction.type) {
1204 case AFR_DATA_TRANSACTION:
1205 case AFR_METADATA_TRANSACTION:
1206 afr_set_transaction_flock (local);
1207
1208 int_lock->lock_cbk = afr_post_nonblocking_inodelk_cbk;
1209
1210 afr_nonblocking_inodelk (frame, this);
1211 break;
1212
1213 case AFR_ENTRY_RENAME_TRANSACTION:
1214
1215 int_lock->lock_cbk = afr_post_nonblocking_entrylk_cbk;
1216 afr_nonblocking_entrylk (frame, this);
1217 break;
1218
1219 case AFR_ENTRY_TRANSACTION:
1220 int_lock->lk_basename = local->transaction.basename;
1221 if (&local->transaction.parent_loc)
1222 int_lock->lk_loc = &local->transaction.parent_loc;
1223 else
1224 GF_ASSERT (local->fd)do { if (!(local->fd)) { do { do { if (0) printf ("Assertion failed: "
"local->fd"); } while (0); _gf_log_callingfn ("", "afr-transaction.c"
, __FUNCTION__, 1224, GF_LOG_ERROR, "Assertion failed: " "local->fd"
); } while (0); } } while (0)
;
1225
1226 int_lock->lock_cbk = afr_post_nonblocking_entrylk_cbk;
1227 afr_nonblocking_entrylk (frame, this);
1228 break;
1229 }
1230
1231 return 0;
1232}
1233
1234
1235int
1236afr_lock (call_frame_t *frame, xlator_t *this)
1237{
1238 afr_set_lock_number (frame, this);
1239
1240 return afr_lock_rec (frame, this);
1241}
1242
1243
1244/* }}} */
1245
1246int
1247afr_internal_lock_finish (call_frame_t *frame, xlator_t *this)
1248{
1249 if (__fop_changelog_needed (frame, this)) {
1250 afr_changelog_pre_op (frame, this);
1251 } else {
1252 afr_transaction_perform_fop (frame, this);
1253 }
1254
1255 return 0;
1256}
1257
1258
1259void
1260afr_set_delayed_post_op (call_frame_t *frame, xlator_t *this)
1261{
1262 afr_local_t *local = NULL((void*)0);
1263 afr_private_t *priv = NULL((void*)0);
1264
1265 /* call this function from any of the related optimizations
1266 which benefit from delaying post op are enabled, namely:
1267
1268 - changelog piggybacking
1269 - eager locking
1270 */
1271
1272 priv = this->private;
1273 if (!priv)
1274 return;
1275
1276 if (!priv->post_op_delay_secs)
1277 return;
1278
1279 local = frame->local;
1280 if (!local->transaction.eager_lock_on)
1281 return;
1282
1283 if (!local)
1284 return;
1285
1286 if (!local->fd)
1287 return;
1288
1289 if (local->op == GF_FOP_WRITE)
1290 local->delayed_post_op = _gf_true;
1291}
1292
1293
1294gf_boolean_t
1295is_afr_delayed_changelog_post_op_needed (call_frame_t *frame, xlator_t *this)
1296{
1297 afr_local_t *local = NULL((void*)0);
1298 gf_boolean_t res = _gf_false;
1299
1300 local = frame->local;
1301 if (!local)
1302 goto out;
1303
1304 if (!local->delayed_post_op)
1305 goto out;
1306
1307 res = _gf_true;
1308out:
1309 return res;
1310}
1311
1312
1313void
1314afr_delayed_changelog_post_op (xlator_t *this, call_frame_t *frame, fd_t *fd,
1315 call_stub_t *stub);
1316
1317void
1318afr_delayed_changelog_wake_up_cbk (void *data)
1319{
1320 fd_t *fd = NULL((void*)0);
1321
1322 fd = data;
1323
1324 afr_delayed_changelog_wake_up (THIS(*__glusterfs_this_location()), fd);
1325}
1326
1327
1328/*
1329 Check if the frame is destined to get optimized away
1330 with changelog piggybacking
1331*/
1332static gf_boolean_t
1333is_piggyback_post_op (call_frame_t *frame, fd_t *fd)
1334{
1335 afr_fd_ctx_t *fdctx = NULL((void*)0);
1336 afr_local_t *local = NULL((void*)0);
1337 gf_boolean_t piggyback = _gf_true;
1338 afr_private_t *priv = NULL((void*)0);
1339 int i = 0;
1340
1341 priv = frame->this->private;
1342 local = frame->local;
1343 fdctx = afr_fd_ctx_get (fd, frame->this);
1344
1345 LOCK(&fd->lock)pthread_spin_lock (&fd->lock);
1346 {
1347 piggyback = _gf_true;
1348
1349 for (i = 0; i < priv->child_count; i++) {
1350 if (!local->transaction.pre_op[i])
1351 continue;
1352 if (fdctx->pre_op_piggyback[i]) {
1353 fdctx->pre_op_piggyback[i]--;
1354 local->transaction.postop_piggybacked[i] = 1;
1355 } else {
1356 /* For at least _one_ subvolume we cannot
1357 piggyback on the changelog, and have to
1358 perform a hard POST-OP and therefore fsync
1359 if necesssary
1360 */
1361 piggyback = _gf_false;
1362 GF_ASSERT (fdctx->pre_op_done[i])do { if (!(fdctx->pre_op_done[i])) { do { do { if (0) printf
("Assertion failed: " "fdctx->pre_op_done[i]"); } while (
0); _gf_log_callingfn ("", "afr-transaction.c", __FUNCTION__,
1362, GF_LOG_ERROR, "Assertion failed: " "fdctx->pre_op_done[i]"
); } while (0); } } while (0)
;
1363 fdctx->pre_op_done[i]--;
1364 }
1365 }
1366 }
1367 UNLOCK(&fd->lock)pthread_spin_unlock (&fd->lock);
1368
1369 if (!afr_txn_nothing_failed (frame, frame->this)) {
1370 /* something failed in this transaction,
1371 we will be performing a hard post-op
1372 */
1373 return _gf_false;
1374 }
1375
1376 return piggyback;
1377}
1378
1379
1380/* SET operation */
1381int
1382afr_fd_report_unstable_write (xlator_t *this, fd_t *fd)
1383{
1384 afr_fd_ctx_t *fdctx = NULL((void*)0);
1385
1386 fdctx = afr_fd_ctx_get (fd, this);
1387
1388 LOCK(&fd->lock)pthread_spin_lock (&fd->lock);
1389 {
1390 fdctx->witnessed_unstable_write = _gf_true;
1391 }
1392 UNLOCK(&fd->lock)pthread_spin_unlock (&fd->lock);
1393
1394 return 0;
1395}
1396
1397/* TEST and CLEAR operation */
1398gf_boolean_t
1399afr_fd_has_witnessed_unstable_write (xlator_t *this, fd_t *fd)
1400{
1401 afr_fd_ctx_t *fdctx = NULL((void*)0);
1402 gf_boolean_t witness = _gf_false;
1403
1404 fdctx = afr_fd_ctx_get (fd, this);
1405
1406 LOCK(&fd->lock)pthread_spin_lock (&fd->lock);
1407 {
1408 if (fdctx->witnessed_unstable_write) {
1409 witness = _gf_true;
1410 fdctx->witnessed_unstable_write = _gf_false;
1411 }
1412 }
1413 UNLOCK (&fd->lock)pthread_spin_unlock (&fd->lock);
1414
1415 return witness;
1416}
1417
1418
1419int
1420afr_changelog_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
1421 int op_ret, int op_errno, struct iatt *pre,
1422 struct iatt *post, dict_t *xdata)
1423{
1424 afr_private_t *priv = NULL((void*)0);
1425 int child_index = (long) cookie;
1426 int call_count = -1;
1427 afr_local_t *local = NULL((void*)0);
1428
1429 priv = this->private;
1430 local = frame->local;
1431
1432 if (afr_fop_failed (op_ret, op_errno)((op_ret) == -1)) {
1433 /* Failure of fsync() is as good as failure of previous
1434 write(). So treat it like one.
1435 */
1436 gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("fsync(%s) failed on subvolume %s. Transaction was %s"
, uuid_utoa (local->fd->inode->gfid), priv->children
[child_index]->name, gf_fop_list[local->op]); } while (
0); _gf_log (this->name, "afr-transaction.c", __FUNCTION__
, 1440, GF_LOG_WARNING, "fsync(%s) failed on subvolume %s. Transaction was %s"
, uuid_utoa (local->fd->inode->gfid), priv->children
[child_index]->name, gf_fop_list[local->op]); } while (
0)
1437 "fsync(%s) failed on subvolume %s. Transaction was %s",do { do { if (0) printf ("fsync(%s) failed on subvolume %s. Transaction was %s"
, uuid_utoa (local->fd->inode->gfid), priv->children
[child_index]->name, gf_fop_list[local->op]); } while (
0); _gf_log (this->name, "afr-transaction.c", __FUNCTION__
, 1440, GF_LOG_WARNING, "fsync(%s) failed on subvolume %s. Transaction was %s"
, uuid_utoa (local->fd->inode->gfid), priv->children
[child_index]->name, gf_fop_list[local->op]); } while (
0)
1438 uuid_utoa (local->fd->inode->gfid),do { do { if (0) printf ("fsync(%s) failed on subvolume %s. Transaction was %s"
, uuid_utoa (local->fd->inode->gfid), priv->children
[child_index]->name, gf_fop_list[local->op]); } while (
0); _gf_log (this->name, "afr-transaction.c", __FUNCTION__
, 1440, GF_LOG_WARNING, "fsync(%s) failed on subvolume %s. Transaction was %s"
, uuid_utoa (local->fd->inode->gfid), priv->children
[child_index]->name, gf_fop_list[local->op]); } while (
0)
1439 priv->children[child_index]->name,do { do { if (0) printf ("fsync(%s) failed on subvolume %s. Transaction was %s"
, uuid_utoa (local->fd->inode->gfid), priv->children
[child_index]->name, gf_fop_list[local->op]); } while (
0); _gf_log (this->name, "afr-transaction.c", __FUNCTION__
, 1440, GF_LOG_WARNING, "fsync(%s) failed on subvolume %s. Transaction was %s"
, uuid_utoa (local->fd->inode->gfid), priv->children
[child_index]->name, gf_fop_list[local->op]); } while (
0)
1440 gf_fop_list[local->op])do { do { if (0) printf ("fsync(%s) failed on subvolume %s. Transaction was %s"
, uuid_utoa (local->fd->inode->gfid), priv->children
[child_index]->name, gf_fop_list[local->op]); } while (
0); _gf_log (this->name, "afr-transaction.c", __FUNCTION__
, 1440, GF_LOG_WARNING, "fsync(%s) failed on subvolume %s. Transaction was %s"
, uuid_utoa (local->fd->inode->gfid), priv->children
[child_index]->name, gf_fop_list[local->op]); } while (
0)
;
1441
1442 afr_transaction_fop_failed (frame, this, child_index);
1443 }
1444
1445 call_count = afr_frame_return (frame);
1446
1447 if (call_count == 0)
1448 afr_changelog_post_op_now (frame, this);
1449
1450 return 0;
1451}
1452
1453
1454int
1455afr_changelog_fsync (call_frame_t *frame, xlator_t *this)
1456{
1457 afr_local_t *local = NULL((void*)0);
1458 int i = 0;
1459 int call_count = 0;
1460 afr_private_t *priv = NULL((void*)0);
1461
1462 local = frame->local;
1463 priv = this->private;
1464
1465 call_count = afr_pre_op_done_children_count (local->transaction.pre_op,
1466 priv->child_count);
1467
1468 if (!call_count) {
1469 /* will go straight to unlock */
1470 afr_changelog_post_op_now (frame, this);
1471 return 0;
1472 }
1473
1474 local->call_count = call_count;
1475
1476 for (i = 0; i < priv->child_count; i++) {
1477 if (!local->transaction.pre_op[i])
1478 continue;
1479
1480 STACK_WIND_COOKIE (frame, afr_changelog_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", "afr-transaction.c", __FUNCTION__, 1483
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fsync_cbk) tmp_cbk = afr_changelog_fsync_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->fsync"
; _new->unwind_to = "afr_changelog_fsync_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->fsync_cbk = afr_changelog_fsync_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->fsync); priv->children[i]->fops->fsync
(_new, priv->children[i], local->fd, 1, ((void*)0)); (
*__glusterfs_this_location()) = old_THIS; } while (0)
1481 (void *) (long) i, 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", "afr-transaction.c", __FUNCTION__, 1483
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fsync_cbk) tmp_cbk = afr_changelog_fsync_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->fsync"
; _new->unwind_to = "afr_changelog_fsync_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->fsync_cbk = afr_changelog_fsync_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->fsync); priv->children[i]->fops->fsync
(_new, priv->children[i], local->fd, 1, ((void*)0)); (
*__glusterfs_this_location()) = old_THIS; } while (0)
1482 priv->children[i]->fops->fsync, local->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", "afr-transaction.c", __FUNCTION__, 1483
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fsync_cbk) tmp_cbk = afr_changelog_fsync_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->fsync"
; _new->unwind_to = "afr_changelog_fsync_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->fsync_cbk = afr_changelog_fsync_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->fsync); priv->children[i]->fops->fsync
(_new, priv->children[i], local->fd, 1, ((void*)0)); (
*__glusterfs_this_location()) = old_THIS; } while (0)
1483 1, 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", "afr-transaction.c", __FUNCTION__, 1483
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( priv->children[i]->fops->fsync_cbk) tmp_cbk = afr_changelog_fsync_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->fsync"
; _new->unwind_to = "afr_changelog_fsync_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->fsync_cbk = afr_changelog_fsync_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->fsync); priv->children[i]->fops->fsync
(_new, priv->children[i], local->fd, 1, ((void*)0)); (
*__glusterfs_this_location()) = old_THIS; } while (0)
;
1484 if (!--call_count)
1485 break;
1486 }
1487
1488 return 0;
1489}
1490
1491
1492int
1493afr_changelog_post_op_safe (call_frame_t *frame, xlator_t *this)
1494{
1495 afr_local_t *local = NULL((void*)0);
1496
1497 local = frame->local;
1498
1499 if (!local->fd || local->transaction.type != AFR_DATA_TRANSACTION) {
1500 afr_changelog_post_op_now (frame, this);
1501 return 0;
1502 }
1503
1504 if (is_piggyback_post_op (frame, local->fd)) {
1505 /* just detected that this post-op is about to
1506 be optimized away as a new write() has
1507 already piggybacked on this frame's changelog.
1508 */
1509 afr_changelog_post_op_now (frame, this);
1510 return 0;
1511 }
1512
1513 /* Calling afr_changelog_post_op_now() now will result in
1514 issuing ->[f]xattrop().
1515
1516 Performing a hard POST-OP (->[f]xattrop() FOP) is a more
1517 responsible operation that what it might appear on the surface.
1518
1519 The changelog of a file (in the xattr of the file on the server)
1520 stores information (pending count) about the state of the file
1521 on the OTHER server. This changelog is blindly trusted, and must
1522 therefore be updated in such a way it remains trustworthy. This
1523 implies that decrementing the pending count (essentially "clearing
1524 the dirty flag") must be done STRICTLY after we are sure that the
1525 operation on the other server has reached stable storage.
1526
1527 While the backend filesystem on that server will eventually flush
1528 it to stable storage, we (being in userspace) have no mechanism
1529 to get notified when the write became "stable".
1530
1531 This means we need take matter into our own hands and issue an
1532 fsync() EVEN IF THE APPLICATION WAS PERFORMING UNSTABLE WRITES,
1533 and get an acknowledgement for it. And we need to wait for the
1534 fsync() acknowledgement before initiating the hard POST-OP.
1535
1536 However if the FD itself was opened in O_SYNC or O_DSYNC then
1537 we are already guaranteed that the writes were made stable as
1538 part of the FOP itself. The same holds true for NFS stable
1539 writes which happen on an anonymous FD with O_DSYNC or O_SYNC
1540 flag set in the writev() @flags param. For all other write types,
1541 mark a flag in the fdctx whenever an unstable write is witnessed.
1542 */
1543
1544 if (!afr_fd_has_witnessed_unstable_write (this, local->fd)) {
1545 afr_changelog_post_op_now (frame, this);
1546 return 0;
1547 }
1548
1549 /* Time to fsync() */
1550
1551 afr_changelog_fsync (frame, this);
1552
1553 return 0;
1554}
1555
1556
1557void
1558afr_delayed_changelog_post_op (xlator_t *this, call_frame_t *frame, fd_t *fd,
1559 call_stub_t *stub)
1560{
1561 afr_fd_ctx_t *fd_ctx = NULL((void*)0);
1562 call_frame_t *prev_frame = NULL((void*)0);
1563 struct timeval delta = {0, };
1564 afr_private_t *priv = NULL((void*)0);
1565 afr_local_t *local = NULL((void*)0);
1566
1567 priv = this->private;
1568
1569 fd_ctx = afr_fd_ctx_get (fd, this);
1570 if (!fd_ctx)
1571 return;
1572
1573 delta.tv_sec = priv->post_op_delay_secs;
1574 delta.tv_usec = 0;
1575
1576 pthread_mutex_lock (&fd_ctx->delay_lock);
1577 {
1578 prev_frame = fd_ctx->delay_frame;
1579 fd_ctx->delay_frame = NULL((void*)0);
1580 if (fd_ctx->delay_timer)
1581 gf_timer_call_cancel (this->ctx, fd_ctx->delay_timer);
1582 fd_ctx->delay_timer = NULL((void*)0);
1583 if (!frame)
1584 goto unlock;
1585 fd_ctx->delay_timer = gf_timer_call_after (this->ctx, delta,
1586 afr_delayed_changelog_wake_up_cbk,
1587 fd);
1588 fd_ctx->delay_frame = frame;
1589 }
1590unlock:
1591 pthread_mutex_unlock (&fd_ctx->delay_lock);
1592
1593 if (prev_frame) {
1594 local = prev_frame->local;
1595 local->transaction.resume_stub = stub;
1596 afr_changelog_post_op_safe (prev_frame, this);
1597 } else if (stub) {
1598 call_resume (stub);
1599 }
1600}
1601
1602
1603void
1604afr_changelog_post_op (call_frame_t *frame, xlator_t *this)
1605{
1606 afr_local_t *local = NULL((void*)0);
1607
1608 local = frame->local;
1609
1610 if (is_afr_delayed_changelog_post_op_needed (frame, this))
1611 afr_delayed_changelog_post_op (this, frame, local->fd, NULL((void*)0));
1612 else
1613 afr_changelog_post_op_safe (frame, this);
1614}
1615
1616
1617
1618/* Wake up the sleeping/delayed post-op, and also register
1619 a stub to have it resumed after this transaction
1620 completely finishes.
1621
1622 The @stub gets saved in @local and gets resumed in
1623 afr_local_cleanup()
1624*/
1625void
1626afr_delayed_changelog_wake_resume (xlator_t *this, fd_t *fd, call_stub_t *stub)
1627{
1628 afr_delayed_changelog_post_op (this, NULL((void*)0), fd, stub);
1629}
1630
1631
1632void
1633afr_delayed_changelog_wake_up (xlator_t *this, fd_t *fd)
1634{
1635 afr_delayed_changelog_post_op (this, NULL((void*)0), fd, NULL((void*)0));
1636}
1637
1638
1639int
1640afr_transaction_resume (call_frame_t *frame, xlator_t *this)
1641{
1642 afr_internal_lock_t *int_lock = NULL((void*)0);
1643 afr_local_t *local = NULL((void*)0);
1644 afr_private_t *priv = NULL((void*)0);
1645
1646 local = frame->local;
1647 int_lock = &local->internal_lock;
1648 priv = this->private;
1649
1650 if (local->transaction.eager_lock_on) {
1651 /* We don't need to retain "local" in the
1652 fd list anymore, writes to all subvols
1653 are finished by now */
1654 LOCK (&local->fd->lock)pthread_spin_lock (&local->fd->lock);
1655 {
1656 list_del_init (&local->transaction.eager_locked);
1657 }
1658 UNLOCK (&local->fd->lock)pthread_spin_unlock (&local->fd->lock);
1659 }
1660
1661 afr_restore_lk_owner (frame);
1662
1663 if (__fop_changelog_needed (frame, this)) {
1664 afr_changelog_post_op (frame, this);
1665 } else {
1666 if (afr_lock_server_count (priv, local->transaction.type) == 0) {
1667 local->transaction.done (frame, this);
1668 } else {
1669 int_lock->lock_cbk = local->transaction.done;
1670 afr_unlock (frame, this);
1671 }
1672 }
1673
1674 return 0;
1675}
1676
1677
1678/**
1679 * afr_transaction_fop_failed - inform that an fop failed
1680 */
1681
1682void
1683afr_transaction_fop_failed (call_frame_t *frame, xlator_t *this, int child_index)
1684{
1685 afr_local_t * local = NULL((void*)0);
1686 afr_private_t * priv = NULL((void*)0);
1687
1688 local = frame->local;
1689 priv = this->private;
1690
1691 __mark_child_dead (local->pending, priv->child_count,
1692 child_index, local->transaction.type);
1693}
1694
1695
1696
1697static gf_boolean_t
1698afr_locals_overlap (afr_local_t *local1, afr_local_t *local2)
1699{
1700 uint64_t start1 = local1->transaction.start;
1701 uint64_t start2 = local2->transaction.start;
1702 uint64_t end1 = 0;
1703 uint64_t end2 = 0;
1704
1705 if (local1->transaction.len)
1706 end1 = start1 + local1->transaction.len - 1;
1707 else
1708 end1 = ULLONG_MAX(9223372036854775807LL*2ULL+1ULL);
1709
1710 if (local2->transaction.len)
1711 end2 = start2 + local2->transaction.len - 1;
1712 else
1713 end2 = ULLONG_MAX(9223372036854775807LL*2ULL+1ULL);
1714
1715 return ((end1 >= start2) && (end2 >= start1));
1716}
1717
1718
1719void
1720afr_transaction_eager_lock_init (afr_local_t *local, xlator_t *this)
1721{
1722 afr_private_t *priv = NULL((void*)0);
1723 afr_fd_ctx_t *fdctx = NULL((void*)0);
1724 afr_local_t *each = NULL((void*)0);
1725
1726 priv = this->private;
1727
1728 if (!local->fd)
1729 return;
1730
1731 if (local->transaction.type != AFR_DATA_TRANSACTION)
1732 return;
1733
1734 if (!priv->eager_lock)
1735 return;
1736
1737 fdctx = afr_fd_ctx_get (local->fd, this);
1738 if (!fdctx)
1739 return;
1740
1741 /*
1742 * Once full file lock is acquired in eager-lock phase, overlapping
1743 * writes do not compete for inode-locks, instead are transferred to the
1744 * next writes. Because of this overlapping writes are not ordered.
1745 * This can cause inconsistencies in replication.
1746 * Example:
1747 * Two overlapping writes w1, w2 are sent in parallel on same fd
1748 * in two threads t1, t2.
1749 * Both threads can execute afr_writev_wind in the following manner.
1750 * t1 winds w1 on brick-0
1751 * t2 winds w2 on brick-0
1752 * t2 winds w2 on brick-1
1753 * t1 winds w1 on brick-1
1754 *
1755 * This check makes sure the locks are not transferred for
1756 * overlapping writes.
1757 */
1758 LOCK (&local->fd->lock)pthread_spin_lock (&local->fd->lock);
1759 {
1760 list_for_each_entry (each, &fdctx->eager_locked,for (each = ((typeof(*each) *)((char *)((&fdctx->eager_locked
)->next)-(unsigned long)(&((typeof(*each) *)0)->transaction
.eager_locked))); &each->transaction.eager_locked != (
&fdctx->eager_locked); each = ((typeof(*each) *)((char
*)(each->transaction.eager_locked.next)-(unsigned long)(&
((typeof(*each) *)0)->transaction.eager_locked))))
1761 transaction.eager_locked)for (each = ((typeof(*each) *)((char *)((&fdctx->eager_locked
)->next)-(unsigned long)(&((typeof(*each) *)0)->transaction
.eager_locked))); &each->transaction.eager_locked != (
&fdctx->eager_locked); each = ((typeof(*each) *)((char
*)(each->transaction.eager_locked.next)-(unsigned long)(&
((typeof(*each) *)0)->transaction.eager_locked))))
{
1762 if (afr_locals_overlap (each, local)) {
1763 local->transaction.eager_lock_on = _gf_false;
1764 goto unlock;
1765 }
1766 }
1767
1768 local->transaction.eager_lock_on = _gf_true;
1769 list_add_tail (&local->transaction.eager_locked,
1770 &fdctx->eager_locked);
1771 }
1772unlock:
1773 UNLOCK (&local->fd->lock)pthread_spin_unlock (&local->fd->lock);
1774}
1775
1776
1777int
1778afr_transaction (call_frame_t *frame, xlator_t *this, afr_transaction_type type)
1779{
1780 afr_local_t * local = NULL((void*)0);
1781 afr_private_t * priv = NULL((void*)0);
1782 fd_t *fd = NULL((void*)0);
1783 int ret = -1;
1784
1785 local = frame->local;
1786 priv = this->private;
1787
1788 local->transaction.resume = afr_transaction_resume;
1789 local->transaction.type = type;
1790
1791 ret = afr_transaction_local_init (local, this);
1792 if (ret < 0) {
1793 goto out;
1794 }
1795
1796 afr_transaction_eager_lock_init (local, this);
1797
1798 if (local->fd && local->transaction.eager_lock_on)
1799 afr_set_lk_owner (frame, this, local->fd);
1800 else
1801 afr_set_lk_owner (frame, this, frame->root);
1802
1803 if (!local->transaction.eager_lock_on && local->loc.inode) {
1804 fd = fd_lookup (local->loc.inode, frame->root->pid);
1805 if (fd) {
1806 afr_delayed_changelog_wake_up (this, fd);
1807 fd_unref (fd);
1808 }
1809 }
1810
1811 if (afr_lock_server_count (priv, local->transaction.type) == 0) {
1812 afr_internal_lock_finish (frame, this);
1813 } else {
1814 afr_lock (frame, this);
1815 }
1816 ret = 0;
1817out:
1818 return ret;
1819}