Bug Summary

File:xlators/performance/md-cache/src/md-cache.c
Location:line 624, column 7
Description:Value stored to 'mdc_key' is never read

Annotated Source Code

1/*
2 Copyright (c) 2008-2012 Red Hat, Inc. <http://www.redhat.com>
3 This file is part of GlusterFS.
4
5 This file is licensed to you under your choice of the GNU Lesser
6 General Public License, version 3 or any later version (LGPLv3 or
7 later), or the GNU General Public License, version 2 (GPLv2), in all
8 cases as published by the Free Software Foundation.
9*/
10
11#ifndef _CONFIG_H
12#define _CONFIG_H
13#include "config.h"
14#endif
15
16#include "glusterfs.h"
17#include "logging.h"
18#include "dict.h"
19#include "xlator.h"
20#include "md-cache-mem-types.h"
21#include <assert.h>
22#include <sys/time.h>
23
24
25/* TODO:
26 - cache symlink() link names and nuke symlink-cache
27 - send proper postbuf in setattr_cbk even when op_ret = -1
28*/
29
30
31struct mdc_conf {
32 int timeout;
33 gf_boolean_t cache_posix_acl;
34 gf_boolean_t cache_selinux;
35 gf_boolean_t force_readdirp;
36};
37
38
39static struct mdc_key {
40 const char *name;
41 int load;
42 int check;
43} mdc_keys[] = {
44 {
45 .name = "system.posix_acl_access",
46 .load = 0,
47 .check = 1,
48 },
49 {
50 .name = "system.posix_acl_default",
51 .load = 0,
52 .check = 1,
53 },
54 {
55 .name = GF_SELINUX_XATTR_KEY"security.selinux",
56 .load = 0,
57 .check = 1,
58 },
59 {
60 .name = "security.capability",
61 .load = 0,
62 .check = 1,
63 },
64 {
65 .name = "gfid-req",
66 .load = 0,
67 .check = 1,
68 },
69 {
70 .name = NULL((void*)0),
71 .load = 0,
72 .check = 0,
73 }
74};
75
76
77static uint64_t
78gfid_to_ino (uuid_t gfid)
79{
80 uint64_t ino = 0;
81 int i = 0, j = 0;
82
83 for (i = 15; i > (15 - 8); i--) {
84 ino += (uint64_t)(gfid[i]) << j;
85 j += 8;
86 }
87
88 return ino;
89}
90
91
92struct mdc_local;
93typedef struct mdc_local mdc_local_t;
94
95#define MDC_STACK_UNWIND(fop, frame, params ...)do { mdc_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_fop_cbk_t fn =
((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS
= ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"
); } while (0); _gf_log ("stack", "md-cache.c", __FUNCTION__,
95, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn = (
fop_fop_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock
(&frame->root->stack_lock); { _parent->ref_count
--; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, params ...); (*__glusterfs_this_location()) = old_THIS
; } while (0); mdc_local_wipe (__xl, __local); } while (0)
do { \
96 mdc_local_t *__local = NULL((void*)0); \
97 xlator_t *__xl = NULL((void*)0); \
98 if (frame) { \
99 __xl = frame->this; \
100 __local = frame->local; \
101 frame->local = NULL((void*)0); \
102 } \
103 STACK_UNWIND_STRICT (fop, frame, params)do { fop_fop_cbk_t fn = ((void*)0); call_frame_t *_parent = (
(void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do {
do { if (0) printf ("!frame"); } while (0); _gf_log ("stack"
, "md-cache.c", __FUNCTION__, 103, GF_LOG_CRITICAL, "!frame")
; } while (0); break; } fn = (fop_fop_cbk_t )frame->ret; _parent
= frame->parent; pthread_spin_lock (&frame->root->
stack_lock); { _parent->ref_count--; } pthread_spin_unlock
(&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = _parent->this; frame
->complete = _gf_true; frame->unwind_from = __FUNCTION__
; if (frame->this->ctx->measure_latency) gf_latency_end
(frame); fn (_parent, frame->cookie, _parent->this, params
); (*__glusterfs_this_location()) = old_THIS; } while (0)
; \
104 mdc_local_wipe (__xl, __local); \
105 } while (0)
106
107
108struct md_cache {
109 ia_prot_t md_prot;
110 uint32_t md_nlink;
111 uint32_t md_uid;
112 uint32_t md_gid;
113 uint32_t md_atime;
114 uint32_t md_atime_nsec;
115 uint32_t md_mtime;
116 uint32_t md_mtime_nsec;
117 uint32_t md_ctime;
118 uint32_t md_ctime_nsec;
119 uint64_t md_rdev;
120 uint64_t md_size;
121 uint64_t md_blocks;
122 dict_t *xattr;
123 char *linkname;
124 time_t ia_time;
125 time_t xa_time;
126 gf_lock_t lock;
127};
128
129
130struct mdc_local {
131 loc_t loc;
132 loc_t loc2;
133 fd_t *fd;
134 char *linkname;
135 dict_t *xattr;
136};
137
138
139int
140__mdc_inode_ctx_get (xlator_t *this, inode_t *inode, struct md_cache **mdc_p)
141{
142 int ret = 0;
143 struct md_cache *mdc = NULL((void*)0);
144 uint64_t mdc_int = 0;
145
146 ret = __inode_ctx_get (inode, this, &mdc_int)__inode_ctx_get2(inode,this,&mdc_int,0);
147 mdc = (void *) (long) (mdc_int);
148 if (ret == 0 && mdc_p)
149 *mdc_p = mdc;
150
151 return ret;
152}
153
154
155int
156mdc_inode_ctx_get (xlator_t *this, inode_t *inode, struct md_cache **mdc_p)
157{
158 int ret;
159
160 LOCK(&inode->lock)pthread_spin_lock (&inode->lock);
161 {
162 ret = __mdc_inode_ctx_get (this, inode, mdc_p);
163 }
164 UNLOCK(&inode->lock)pthread_spin_unlock (&inode->lock);
165
166 return ret;
167}
168
169
170int
171__mdc_inode_ctx_set (xlator_t *this, inode_t *inode, struct md_cache *mdc)
172{
173 int ret = 0;
174 uint64_t mdc_int = 0;
175
176 mdc_int = (long) mdc;
177 ret = __inode_ctx_set2 (inode, this, &mdc_int, 0);
178
179 return ret;
180}
181
182
183int
184mdc_inode_ctx_set (xlator_t *this, inode_t *inode, struct md_cache *mdc)
185{
186 int ret;
187
188 LOCK(&inode->lock)pthread_spin_lock (&inode->lock);
189 {
190 ret = __mdc_inode_ctx_set (this, inode, mdc);
191 }
192 UNLOCK(&inode->lock)pthread_spin_unlock (&inode->lock);
193
194 return ret;
195}
196
197
198mdc_local_t *
199mdc_local_get (call_frame_t *frame)
200{
201 mdc_local_t *local = NULL((void*)0);
202
203 local = frame->local;
204 if (local)
205 goto out;
206
207 local = GF_CALLOC (sizeof (*local), 1, gf_mdc_mt_mdc_local_t)__gf_calloc (sizeof (*local), 1, gf_mdc_mt_mdc_local_t);
208 if (!local)
209 goto out;
210
211 frame->local = local;
212out:
213 return local;
214}
215
216
217void
218mdc_local_wipe (xlator_t *this, mdc_local_t *local)
219{
220 if (!local)
221 return;
222
223 loc_wipe (&local->loc);
224
225 loc_wipe (&local->loc2);
226
227 if (local->fd)
228 fd_unref (local->fd);
229
230 GF_FREE (local->linkname)__gf_free (local->linkname);
231
232 if (local->xattr)
233 dict_unref (local->xattr);
234
235 GF_FREE (local)__gf_free (local);
236 return;
237}
238
239
240int
241mdc_inode_wipe (xlator_t *this, inode_t *inode)
242{
243 int ret = 0;
244 uint64_t mdc_int = 0;
245 struct md_cache *mdc = NULL((void*)0);
246
247 ret = inode_ctx_del (inode, this, &mdc_int)inode_ctx_del2(inode,this,&mdc_int,0);
248 if (ret != 0)
249 goto out;
250
251 mdc = (void *) (long) mdc_int;
252
253 if (mdc->xattr)
254 dict_unref (mdc->xattr);
255
256 GF_FREE (mdc->linkname)__gf_free (mdc->linkname);
257
258 GF_FREE (mdc)__gf_free (mdc);
259
260 ret = 0;
261out:
262 return ret;
263}
264
265
266struct md_cache *
267mdc_inode_prep (xlator_t *this, inode_t *inode)
268{
269 int ret = 0;
270 struct md_cache *mdc = NULL((void*)0);
271
272 LOCK (&inode->lock)pthread_spin_lock (&inode->lock);
273 {
274 ret = __mdc_inode_ctx_get (this, inode, &mdc);
275 if (ret == 0)
276 goto unlock;
277
278 mdc = GF_CALLOC (sizeof (*mdc), 1, gf_mdc_mt_md_cache_t)__gf_calloc (sizeof (*mdc), 1, gf_mdc_mt_md_cache_t);
279 if (!mdc) {
280 gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("out of memory :("); } while (0); _gf_log
(this->name, "md-cache.c", __FUNCTION__, 281, GF_LOG_ERROR
, "out of memory :("); } while (0)
281 "out of memory :(")do { do { if (0) printf ("out of memory :("); } while (0); _gf_log
(this->name, "md-cache.c", __FUNCTION__, 281, GF_LOG_ERROR
, "out of memory :("); } while (0)
;
282 goto unlock;
283 }
284
285 LOCK_INIT (&mdc->lock)pthread_spin_init (&mdc->lock, 0);
286
287 ret = __mdc_inode_ctx_set (this, inode, mdc);
288 if (ret) {
289 gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("out of memory :("); } while (0); _gf_log
(this->name, "md-cache.c", __FUNCTION__, 290, GF_LOG_ERROR
, "out of memory :("); } while (0)
290 "out of memory :(")do { do { if (0) printf ("out of memory :("); } while (0); _gf_log
(this->name, "md-cache.c", __FUNCTION__, 290, GF_LOG_ERROR
, "out of memory :("); } while (0)
;
291 GF_FREE (mdc)__gf_free (mdc);
292 mdc = NULL((void*)0);
293 }
294 }
295unlock:
296 UNLOCK (&inode->lock)pthread_spin_unlock (&inode->lock);
297
298 return mdc;
299}
300
301
302static gf_boolean_t
303is_md_cache_iatt_valid (xlator_t *this, struct md_cache *mdc)
304{
305 struct mdc_conf *conf = NULL((void*)0);
306 time_t now = 0;
307 gf_boolean_t ret = _gf_true;
308 conf = this->private;
309
310 time (&now);
311
312 LOCK (&mdc->lock)pthread_spin_lock (&mdc->lock);
313 {
314 if (now >= (mdc->ia_time + conf->timeout))
315 ret = _gf_false;
316 }
317 UNLOCK (&mdc->lock)pthread_spin_unlock (&mdc->lock);
318
319 return ret;
320}
321
322
323static gf_boolean_t
324is_md_cache_xatt_valid (xlator_t *this, struct md_cache *mdc)
325{
326 struct mdc_conf *conf = NULL((void*)0);
327 time_t now = 0;
328 gf_boolean_t ret = _gf_true;
329
330 conf = this->private;
331
332 time (&now);
333
334 LOCK (&mdc->lock)pthread_spin_lock (&mdc->lock);
335 {
336 if (now >= (mdc->xa_time + conf->timeout))
337 ret = _gf_false;
338 }
339 UNLOCK (&mdc->lock)pthread_spin_unlock (&mdc->lock);
340
341 return ret;
342}
343
344
345void
346mdc_from_iatt (struct md_cache *mdc, struct iatt *iatt)
347{
348 mdc->md_prot = iatt->ia_prot;
349 mdc->md_nlink = iatt->ia_nlink;
350 mdc->md_uid = iatt->ia_uid;
351 mdc->md_gid = iatt->ia_gid;
352 mdc->md_atime = iatt->ia_atime;
353 mdc->md_atime_nsec = iatt->ia_atime_nsec;
354 mdc->md_mtime = iatt->ia_mtime;
355 mdc->md_mtime_nsec = iatt->ia_mtime_nsec;
356 mdc->md_ctime = iatt->ia_ctime;
357 mdc->md_ctime_nsec = iatt->ia_ctime_nsec;
358 mdc->md_rdev = iatt->ia_rdev;
359 mdc->md_size = iatt->ia_size;
360 mdc->md_blocks = iatt->ia_blocks;
361}
362
363
364void
365mdc_to_iatt (struct md_cache *mdc, struct iatt *iatt)
366{
367 iatt->ia_prot = mdc->md_prot;
368 iatt->ia_nlink = mdc->md_nlink;
369 iatt->ia_uid = mdc->md_uid;
370 iatt->ia_gid = mdc->md_gid;
371 iatt->ia_atime = mdc->md_atime;
372 iatt->ia_atime_nsec = mdc->md_atime_nsec;
373 iatt->ia_mtime = mdc->md_mtime;
374 iatt->ia_mtime_nsec = mdc->md_mtime_nsec;
375 iatt->ia_ctime = mdc->md_ctime;
376 iatt->ia_ctime_nsec = mdc->md_ctime_nsec;
377 iatt->ia_rdev = mdc->md_rdev;
378 iatt->ia_size = mdc->md_size;
379 iatt->ia_blocks = mdc->md_blocks;
380}
381
382
383int
384mdc_inode_iatt_set_validate(xlator_t *this, inode_t *inode, struct iatt *prebuf,
385 struct iatt *iatt)
386{
387 int ret = -1;
388 struct md_cache *mdc = NULL((void*)0);
389
390 mdc = mdc_inode_prep (this, inode);
391 if (!mdc)
392 goto out;
393
394 LOCK (&mdc->lock)pthread_spin_lock (&mdc->lock);
395 {
396 if (!iatt || !iatt->ia_ctime) {
397 mdc->ia_time = 0;
398 goto unlock;
399 }
400
401 /*
402 * Invalidate the inode if the mtime or ctime has changed
403 * and the prebuf doesn't match the value we have cached.
404 * TODO: writev returns with a NULL iatt due to
405 * performance/write-behind, causing invalidation on writes.
406 */
407 if (IA_ISREG(inode->ia_type)(inode->ia_type == IA_IFREG) &&
408 ((iatt->ia_mtime != mdc->md_mtime) ||
409 (iatt->ia_ctime != mdc->md_ctime)))
410 if (!prebuf || (prebuf->ia_ctime != mdc->md_ctime) ||
411 (prebuf->ia_mtime != mdc->md_mtime))
412 inode_invalidate(inode);
413
414 mdc_from_iatt (mdc, iatt);
415
416 time (&mdc->ia_time);
417 }
418unlock:
419 UNLOCK (&mdc->lock)pthread_spin_unlock (&mdc->lock);
420 ret = 0;
421out:
422 return ret;
423}
424
425int mdc_inode_iatt_set(xlator_t *this, inode_t *inode, struct iatt *iatt)
426{
427 return mdc_inode_iatt_set_validate(this, inode, NULL((void*)0), iatt);
428}
429
430int
431mdc_inode_iatt_get (xlator_t *this, inode_t *inode, struct iatt *iatt)
432{
433 int ret = -1;
434 struct md_cache *mdc = NULL((void*)0);
435
436 if (mdc_inode_ctx_get (this, inode, &mdc) != 0)
437 goto out;
438
439 if (!is_md_cache_iatt_valid (this, mdc))
440 goto out;
441
442 LOCK (&mdc->lock)pthread_spin_lock (&mdc->lock);
443 {
444 mdc_to_iatt (mdc, iatt);
445 }
446 UNLOCK (&mdc->lock)pthread_spin_unlock (&mdc->lock);
447
448 uuid_copy (iatt->ia_gfid, inode->gfid);
449 iatt->ia_ino = gfid_to_ino (inode->gfid);
450 iatt->ia_dev = 42;
451 iatt->ia_type = inode->ia_type;
452
453 ret = 0;
454out:
455 return ret;
456}
457
458struct updatedict {
459 dict_t *dict;
460 int ret;
461};
462
463static int
464updatefn(dict_t *dict, char *key, data_t *value, void *data)
465{
466 struct updatedict *u = data;
467 const char *mdc_key;
468 int i = 0;
469
470 for (mdc_key = mdc_keys[i].name; (mdc_key = mdc_keys[i].name); i++) {
471 if (!mdc_keys[i].check)
472 continue;
473 if (strcmp(mdc_key, key))
474 continue;
475
476 if (!u->dict) {
477 u->dict = dict_new();
478 if (!u->dict) {
479 u->ret = -1;
480 return -1;
481 }
482 }
483
484 if (dict_set(u->dict, key, value) < 0) {
485 u->ret = -1;
486 return -1;
487 }
488
489 break;
490 }
491 return 0;
492}
493
494static int
495mdc_dict_update(dict_t **tgt, dict_t *src)
496{
497 struct updatedict u = {
498 .dict = *tgt,
499 .ret = 0,
500 };
501
502 dict_foreach(src, updatefn, &u);
503
504 if (*tgt)
505 return u.ret;
506
507 if ((u.ret < 0) && u.dict) {
508 dict_unref(u.dict);
509 return u.ret;
510 }
511
512 *tgt = u.dict;
513
514 return u.ret;
515}
516
517int
518mdc_inode_xatt_set (xlator_t *this, inode_t *inode, dict_t *dict)
519{
520 int ret = -1;
521 struct md_cache *mdc = NULL((void*)0);
522 dict_t *newdict = NULL((void*)0);
523
524 mdc = mdc_inode_prep (this, inode);
525 if (!mdc)
526 goto out;
527
528 if (!dict)
529 goto out;
530
531 LOCK (&mdc->lock)pthread_spin_lock (&mdc->lock);
532 {
533 if (mdc->xattr) {
534 dict_unref (mdc->xattr);
535 mdc->xattr = NULL((void*)0);
536 }
537
538 ret = mdc_dict_update(&newdict, dict);
539 if (ret < 0) {
540 UNLOCK(&mdc->lock)pthread_spin_unlock (&mdc->lock);
541 goto out;
542 }
543
544 if (newdict)
545 mdc->xattr = newdict;
546
547 time (&mdc->xa_time);
548 }
549 UNLOCK (&mdc->lock)pthread_spin_unlock (&mdc->lock);
550 ret = 0;
551out:
552 return ret;
553}
554
555
556int
557mdc_inode_xatt_update (xlator_t *this, inode_t *inode, dict_t *dict)
558{
559 int ret = -1;
560 struct md_cache *mdc = NULL((void*)0);
561
562 mdc = mdc_inode_prep (this, inode);
563 if (!mdc)
564 goto out;
565
566 if (!dict)
567 goto out;
568
569 LOCK (&mdc->lock)pthread_spin_lock (&mdc->lock);
570 {
571 ret = mdc_dict_update(&mdc->xattr, dict);
572 if (ret < 0) {
573 UNLOCK(&mdc->lock)pthread_spin_unlock (&mdc->lock);
574 goto out;
575 }
576
577 time (&mdc->xa_time);
578 }
579 UNLOCK (&mdc->lock)pthread_spin_unlock (&mdc->lock);
580
581 ret = 0;
582out:
583 return ret;
584}
585
586
587int
588mdc_inode_xatt_get (xlator_t *this, inode_t *inode, dict_t **dict)
589{
590 int ret = -1;
591 struct md_cache *mdc = NULL((void*)0);
592
593 if (mdc_inode_ctx_get (this, inode, &mdc) != 0)
594 goto out;
595
596 if (!is_md_cache_xatt_valid (this, mdc))
597 goto out;
598
599 LOCK (&mdc->lock)pthread_spin_lock (&mdc->lock);
600 {
601 if (!mdc->xattr)
602 goto unlock;
603
604 if (dict)
605 *dict = dict_ref (mdc->xattr);
606
607 ret = 0;
608 }
609unlock:
610 UNLOCK (&mdc->lock)pthread_spin_unlock (&mdc->lock);
611
612out:
613 return ret;
614}
615
616
617void
618mdc_load_reqs (xlator_t *this, dict_t *dict)
619{
620 const char *mdc_key = NULL((void*)0);
621 int i = 0;
622 int ret = 0;
623
624 for (mdc_key = mdc_keys[i].name; (mdc_key = mdc_keys[i].name); i++) {
Value stored to 'mdc_key' is never read
625 if (!mdc_keys[i].load)
626 continue;
627 ret = dict_set_int8 (dict, (char *)mdc_key, 0);
628 if (ret)
629 return;
630 }
631}
632
633
634struct checkpair {
635 int ret;
636 dict_t *rsp;
637};
638
639
640static int
641is_mdc_key_satisfied (const char *key)
642{
643 const char *mdc_key = NULL((void*)0);
644 int i = 0;
645
646 if (!key)
647 return 0;
648
649 for (mdc_key = mdc_keys[i].name; (mdc_key = mdc_keys[i].name); i++) {
650 if (!mdc_keys[i].check)
651 continue;
652 if (strcmp (mdc_key, key) == 0)
653 return 1;
654 }
655
656 return 0;
657}
658
659
660static int
661checkfn (dict_t *this, char *key, data_t *value, void *data)
662{
663 struct checkpair *pair = data;
664
665 if (!is_mdc_key_satisfied (key))
666 pair->ret = 0;
667
668 return 0;
669}
670
671
672int
673mdc_xattr_satisfied (xlator_t *this, dict_t *req, dict_t *rsp)
674{
675 struct checkpair pair = {
676 .ret = 1,
677 .rsp = rsp,
678 };
679
680 dict_foreach (req, checkfn, &pair);
681
682 return pair.ret;
683}
684
685
686int
687mdc_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
688 int32_t op_ret, int32_t op_errno, inode_t *inode,
689 struct iatt *stbuf, dict_t *dict, struct iatt *postparent)
690{
691 mdc_local_t *local = NULL((void*)0);
692
693 local = frame->local;
694
695 if (op_ret != 0)
696 goto out;
697
698 if (!local)
699 goto out;
700
701 if (local->loc.parent) {
702 mdc_inode_iatt_set (this, local->loc.parent, postparent);
703 }
704
705 if (local->loc.inode) {
706 mdc_inode_iatt_set (this, local->loc.inode, stbuf);
707 mdc_inode_xatt_set (this, local->loc.inode, dict);
708 }
709out:
710 MDC_STACK_UNWIND (lookup, frame, op_ret, op_errno, inode, stbuf,do { mdc_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_lookup_cbk_t fn
= ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *
old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf (
"!frame"); } while (0); _gf_log ("stack", "md-cache.c", __FUNCTION__
, 711, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_lookup_cbk_t )frame->ret; _parent = frame->parent
; pthread_spin_lock (&frame->root->stack_lock); { _parent
->ref_count--; } pthread_spin_unlock (&frame->root->
stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, op_ret, op_errno, inode, stbuf, dict, postparent);
(*__glusterfs_this_location()) = old_THIS; } while (0); mdc_local_wipe
(__xl, __local); } while (0)
711 dict, postparent)do { mdc_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_lookup_cbk_t fn
= ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *
old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf (
"!frame"); } while (0); _gf_log ("stack", "md-cache.c", __FUNCTION__
, 711, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_lookup_cbk_t )frame->ret; _parent = frame->parent
; pthread_spin_lock (&frame->root->stack_lock); { _parent
->ref_count--; } pthread_spin_unlock (&frame->root->
stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, op_ret, op_errno, inode, stbuf, dict, postparent);
(*__glusterfs_this_location()) = old_THIS; } while (0); mdc_local_wipe
(__xl, __local); } while (0)
;
712 return 0;
713}
714
715
716int
717mdc_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc,
718 dict_t *xdata)
719{
720 int ret = 0;
721 struct iatt stbuf = {0, };
722 struct iatt postparent = {0, };
723 dict_t *xattr_rsp = NULL((void*)0);
724 mdc_local_t *local = NULL((void*)0);
725
726
727 local = mdc_local_get (frame);
728 if (!local)
729 goto uncached;
730
731 loc_copy (&local->loc, loc);
732
733 ret = mdc_inode_iatt_get (this, loc->inode, &stbuf);
734 if (ret != 0)
735 goto uncached;
736
737 if (xdata) {
738 ret = mdc_inode_xatt_get (this, loc->inode, &xattr_rsp);
739 if (ret != 0)
740 goto uncached;
741
742 if (!mdc_xattr_satisfied (this, xdata, xattr_rsp))
743 goto uncached;
744 }
745
746 MDC_STACK_UNWIND (lookup, frame, 0, 0, loc->inode, &stbuf,do { mdc_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_lookup_cbk_t fn
= ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *
old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf (
"!frame"); } while (0); _gf_log ("stack", "md-cache.c", __FUNCTION__
, 747, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_lookup_cbk_t )frame->ret; _parent = frame->parent
; pthread_spin_lock (&frame->root->stack_lock); { _parent
->ref_count--; } pthread_spin_unlock (&frame->root->
stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, 0, 0, loc->inode, &stbuf, xattr_rsp, &postparent
); (*__glusterfs_this_location()) = old_THIS; } while (0); mdc_local_wipe
(__xl, __local); } while (0)
747 xattr_rsp, &postparent)do { mdc_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_lookup_cbk_t fn
= ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *
old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf (
"!frame"); } while (0); _gf_log ("stack", "md-cache.c", __FUNCTION__
, 747, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_lookup_cbk_t )frame->ret; _parent = frame->parent
; pthread_spin_lock (&frame->root->stack_lock); { _parent
->ref_count--; } pthread_spin_unlock (&frame->root->
stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, 0, 0, loc->inode, &stbuf, xattr_rsp, &postparent
); (*__glusterfs_this_location()) = old_THIS; } while (0); mdc_local_wipe
(__xl, __local); } while (0)
;
748
749 if (xattr_rsp)
750 dict_unref (xattr_rsp);
751
752 return 0;
753
754uncached:
755 if (xdata)
756 mdc_load_reqs (this, xdata);
757
758 STACK_WIND (frame, mdc_lookup_cbk, FIRST_CHILD (this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 759, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->lookup_cbk) tmp_cbk = mdc_lookup_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD (this)->fops->lookup"
; _new->unwind_to = "mdc_lookup_cbk"; pthread_spin_init (&
_new->lock, 0); pthread_spin_lock (&frame->root->
stack_lock); { _new->next = frame->root->frames.next
; _new->prev = &frame->root->frames; if (frame->
root->frames.next) frame->root->frames.next->prev
= _new; frame->root->frames.next = _new; frame->ref_count
++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->lookup); (this->children->xlator
)->fops->lookup (_new, (this->children->xlator), loc
, xdata); (*__glusterfs_this_location()) = old_THIS; } while (
0)
759 FIRST_CHILD (this)->fops->lookup, loc, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 759, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->lookup_cbk) tmp_cbk = mdc_lookup_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD (this)->fops->lookup"
; _new->unwind_to = "mdc_lookup_cbk"; pthread_spin_init (&
_new->lock, 0); pthread_spin_lock (&frame->root->
stack_lock); { _new->next = frame->root->frames.next
; _new->prev = &frame->root->frames; if (frame->
root->frames.next) frame->root->frames.next->prev
= _new; frame->root->frames.next = _new; frame->ref_count
++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->lookup); (this->children->xlator
)->fops->lookup (_new, (this->children->xlator), loc
, xdata); (*__glusterfs_this_location()) = old_THIS; } while (
0)
;
760
761 if (xattr_rsp)
762 dict_unref (xattr_rsp);
763
764 return 0;
765}
766
767
768int
769mdc_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
770 int32_t op_ret, int32_t op_errno, struct iatt *buf, dict_t *xdata)
771{
772 mdc_local_t *local = NULL((void*)0);
773
774 if (op_ret != 0)
775 goto out;
776
777 local = frame->local;
778 if (!local)
779 goto out;
780
781 mdc_inode_iatt_set (this, local->loc.inode, buf);
782
783out:
784 MDC_STACK_UNWIND (stat, frame, op_ret, op_errno, buf, xdata)do { mdc_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_stat_cbk_t fn
= ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *
old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf (
"!frame"); } while (0); _gf_log ("stack", "md-cache.c", __FUNCTION__
, 784, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_stat_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock
(&frame->root->stack_lock); { _parent->ref_count
--; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, op_ret, op_errno, buf, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0); mdc_local_wipe (__xl, __local); }
while (0)
;
785
786 return 0;
787}
788
789
790int
791mdc_stat (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
792{
793 int ret;
794 struct iatt stbuf;
795 mdc_local_t *local = NULL((void*)0);
796
797 local = mdc_local_get (frame);
798 if (!local)
799 goto uncached;
800
801 loc_copy (&local->loc, loc);
802
803 ret = mdc_inode_iatt_get (this, loc->inode, &stbuf);
804 if (ret != 0)
805 goto uncached;
806
807 MDC_STACK_UNWIND (stat, frame, 0, 0, &stbuf, xdata)do { mdc_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_stat_cbk_t fn
= ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *
old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf (
"!frame"); } while (0); _gf_log ("stack", "md-cache.c", __FUNCTION__
, 807, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_stat_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock
(&frame->root->stack_lock); { _parent->ref_count
--; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, 0, 0, &stbuf, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0); mdc_local_wipe (__xl, __local); }
while (0)
;
808
809 return 0;
810
811uncached:
812 STACK_WIND (frame, mdc_stat_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", "md-cache.c", __FUNCTION__, 814, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->stat_cbk) tmp_cbk = mdc_stat_cbk; _new
->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->stat"; _new
->unwind_to = "mdc_stat_cbk"; pthread_spin_init (&_new
->lock, 0); pthread_spin_lock (&frame->root->stack_lock
); { _new->next = frame->root->frames.next; _new->
prev = &frame->root->frames; if (frame->root->
frames.next) frame->root->frames.next->prev = _new; frame
->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock
(&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = (this->children->
xlator); if (frame->this->ctx->measure_latency) gf_latency_begin
(_new, (this->children->xlator)->fops->stat); (this
->children->xlator)->fops->stat (_new, (this->
children->xlator), loc, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0)
813 FIRST_CHILD(this), FIRST_CHILD(this)->fops->stat,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 814, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->stat_cbk) tmp_cbk = mdc_stat_cbk; _new
->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->stat"; _new
->unwind_to = "mdc_stat_cbk"; pthread_spin_init (&_new
->lock, 0); pthread_spin_lock (&frame->root->stack_lock
); { _new->next = frame->root->frames.next; _new->
prev = &frame->root->frames; if (frame->root->
frames.next) frame->root->frames.next->prev = _new; frame
->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock
(&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = (this->children->
xlator); if (frame->this->ctx->measure_latency) gf_latency_begin
(_new, (this->children->xlator)->fops->stat); (this
->children->xlator)->fops->stat (_new, (this->
children->xlator), loc, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0)
814 loc, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 814, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->stat_cbk) tmp_cbk = mdc_stat_cbk; _new
->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->stat"; _new
->unwind_to = "mdc_stat_cbk"; pthread_spin_init (&_new
->lock, 0); pthread_spin_lock (&frame->root->stack_lock
); { _new->next = frame->root->frames.next; _new->
prev = &frame->root->frames; if (frame->root->
frames.next) frame->root->frames.next->prev = _new; frame
->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock
(&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = (this->children->
xlator); if (frame->this->ctx->measure_latency) gf_latency_begin
(_new, (this->children->xlator)->fops->stat); (this
->children->xlator)->fops->stat (_new, (this->
children->xlator), loc, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0)
;
815 return 0;
816}
817
818
819int
820mdc_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
821 int32_t op_ret, int32_t op_errno, struct iatt *buf,
822 dict_t *xdata)
823{
824 mdc_local_t *local = NULL((void*)0);
825
826 if (op_ret != 0)
827 goto out;
828
829 local = frame->local;
830 if (!local)
831 goto out;
832
833 mdc_inode_iatt_set (this, local->fd->inode, buf);
834
835out:
836 MDC_STACK_UNWIND (fstat, frame, op_ret, op_errno, buf, xdata)do { mdc_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_fstat_cbk_t fn
= ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *
old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf (
"!frame"); } while (0); _gf_log ("stack", "md-cache.c", __FUNCTION__
, 836, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_fstat_cbk_t )frame->ret; _parent = frame->parent;
pthread_spin_lock (&frame->root->stack_lock); { _parent
->ref_count--; } pthread_spin_unlock (&frame->root->
stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, op_ret, op_errno, buf, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0); mdc_local_wipe (__xl, __local); }
while (0)
;
837
838 return 0;
839}
840
841
842int
843mdc_fstat (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata)
844{
845 int ret;
846 struct iatt stbuf;
847 mdc_local_t *local = NULL((void*)0);
848
849 local = mdc_local_get (frame);
850 if (!local)
851 goto uncached;
852
853 local->fd = fd_ref (fd);
854
855 ret = mdc_inode_iatt_get (this, fd->inode, &stbuf);
856 if (ret != 0)
857 goto uncached;
858
859 MDC_STACK_UNWIND (fstat, frame, 0, 0, &stbuf, xdata)do { mdc_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_fstat_cbk_t fn
= ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *
old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf (
"!frame"); } while (0); _gf_log ("stack", "md-cache.c", __FUNCTION__
, 859, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_fstat_cbk_t )frame->ret; _parent = frame->parent;
pthread_spin_lock (&frame->root->stack_lock); { _parent
->ref_count--; } pthread_spin_unlock (&frame->root->
stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, 0, 0, &stbuf, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0); mdc_local_wipe (__xl, __local); }
while (0)
;
860
861 return 0;
862
863uncached:
864 STACK_WIND (frame, mdc_fstat_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", "md-cache.c", __FUNCTION__, 866, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->fstat_cbk) tmp_cbk = mdc_fstat_cbk;
_new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->fstat"; _new
->unwind_to = "mdc_fstat_cbk"; pthread_spin_init (&_new
->lock, 0); pthread_spin_lock (&frame->root->stack_lock
); { _new->next = frame->root->frames.next; _new->
prev = &frame->root->frames; if (frame->root->
frames.next) frame->root->frames.next->prev = _new; frame
->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock
(&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = (this->children->
xlator); if (frame->this->ctx->measure_latency) gf_latency_begin
(_new, (this->children->xlator)->fops->fstat); (
this->children->xlator)->fops->fstat (_new, (this
->children->xlator), fd, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0)
865 FIRST_CHILD(this), FIRST_CHILD(this)->fops->fstat,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 866, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->fstat_cbk) tmp_cbk = mdc_fstat_cbk;
_new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->fstat"; _new
->unwind_to = "mdc_fstat_cbk"; pthread_spin_init (&_new
->lock, 0); pthread_spin_lock (&frame->root->stack_lock
); { _new->next = frame->root->frames.next; _new->
prev = &frame->root->frames; if (frame->root->
frames.next) frame->root->frames.next->prev = _new; frame
->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock
(&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = (this->children->
xlator); if (frame->this->ctx->measure_latency) gf_latency_begin
(_new, (this->children->xlator)->fops->fstat); (
this->children->xlator)->fops->fstat (_new, (this
->children->xlator), fd, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0)
866 fd, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 866, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->fstat_cbk) tmp_cbk = mdc_fstat_cbk;
_new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->fstat"; _new
->unwind_to = "mdc_fstat_cbk"; pthread_spin_init (&_new
->lock, 0); pthread_spin_lock (&frame->root->stack_lock
); { _new->next = frame->root->frames.next; _new->
prev = &frame->root->frames; if (frame->root->
frames.next) frame->root->frames.next->prev = _new; frame
->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock
(&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = (this->children->
xlator); if (frame->this->ctx->measure_latency) gf_latency_begin
(_new, (this->children->xlator)->fops->fstat); (
this->children->xlator)->fops->fstat (_new, (this
->children->xlator), fd, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0)
;
867 return 0;
868}
869
870
871int
872mdc_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
873 int32_t op_ret, int32_t op_errno,
874 struct iatt *prebuf, struct iatt *postbuf, dict_t *xdata)
875{
876 mdc_local_t *local = NULL((void*)0);
877
878 local = frame->local;
879
880 if (op_ret != 0)
881 goto out;
882
883 if (!local)
884 goto out;
885
886 mdc_inode_iatt_set_validate(this, local->loc.inode, prebuf, postbuf);
887
888out:
889 MDC_STACK_UNWIND (truncate, frame, op_ret, op_errno, prebuf, postbuf,do { mdc_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_truncate_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "md-cache.c", __FUNCTION__
, 890, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_truncate_cbk_t )frame->ret; _parent = frame->parent
; pthread_spin_lock (&frame->root->stack_lock); { _parent
->ref_count--; } pthread_spin_unlock (&frame->root->
stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, op_ret, op_errno, prebuf, postbuf, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0); mdc_local_wipe (__xl, __local); }
while (0)
890 xdata)do { mdc_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_truncate_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "md-cache.c", __FUNCTION__
, 890, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_truncate_cbk_t )frame->ret; _parent = frame->parent
; pthread_spin_lock (&frame->root->stack_lock); { _parent
->ref_count--; } pthread_spin_unlock (&frame->root->
stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, op_ret, op_errno, prebuf, postbuf, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0); mdc_local_wipe (__xl, __local); }
while (0)
;
891
892 return 0;
893}
894
895
896int
897mdc_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc,
898 off_t offset, dict_t *xdata)
899{
900 mdc_local_t *local = NULL((void*)0);
901
902 local = mdc_local_get (frame);
903
904 local->loc.inode = inode_ref (loc->inode);
905
906 STACK_WIND (frame, mdc_truncate_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 908, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->truncate_cbk) tmp_cbk = mdc_truncate_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->truncate"
; _new->unwind_to = "mdc_truncate_cbk"; pthread_spin_init (
&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->truncate); (this->children->xlator
)->fops->truncate (_new, (this->children->xlator)
, loc, offset, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
907 FIRST_CHILD(this), FIRST_CHILD(this)->fops->truncate,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 908, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->truncate_cbk) tmp_cbk = mdc_truncate_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->truncate"
; _new->unwind_to = "mdc_truncate_cbk"; pthread_spin_init (
&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->truncate); (this->children->xlator
)->fops->truncate (_new, (this->children->xlator)
, loc, offset, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
908 loc, offset, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 908, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->truncate_cbk) tmp_cbk = mdc_truncate_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->truncate"
; _new->unwind_to = "mdc_truncate_cbk"; pthread_spin_init (
&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->truncate); (this->children->xlator
)->fops->truncate (_new, (this->children->xlator)
, loc, offset, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
;
909 return 0;
910}
911
912
913int
914mdc_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
915 int32_t op_ret, int32_t op_errno,
916 struct iatt *prebuf, struct iatt *postbuf, dict_t *xdata)
917{
918 mdc_local_t *local = NULL((void*)0);
919
920 local = frame->local;
921
922 if (op_ret != 0)
923 goto out;
924
925 if (!local)
926 goto out;
927
928 mdc_inode_iatt_set_validate(this, local->fd->inode, prebuf, postbuf);
929
930out:
931 MDC_STACK_UNWIND (ftruncate, frame, op_ret, op_errno, prebuf, postbuf,do { mdc_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_ftruncate_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "md-cache.c", __FUNCTION__
, 932, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_ftruncate_cbk_t )frame->ret; _parent = frame->parent
; pthread_spin_lock (&frame->root->stack_lock); { _parent
->ref_count--; } pthread_spin_unlock (&frame->root->
stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, op_ret, op_errno, prebuf, postbuf, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0); mdc_local_wipe (__xl, __local); }
while (0)
932 xdata)do { mdc_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_ftruncate_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "md-cache.c", __FUNCTION__
, 932, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_ftruncate_cbk_t )frame->ret; _parent = frame->parent
; pthread_spin_lock (&frame->root->stack_lock); { _parent
->ref_count--; } pthread_spin_unlock (&frame->root->
stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, op_ret, op_errno, prebuf, postbuf, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0); mdc_local_wipe (__xl, __local); }
while (0)
;
933
934 return 0;
935}
936
937
938int
939mdc_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd,
940 off_t offset, dict_t *xdata)
941{
942 mdc_local_t *local = NULL((void*)0);
943
944 local = mdc_local_get (frame);
945
946 local->fd = fd_ref (fd);
947
948 STACK_WIND (frame, mdc_ftruncate_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 950, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->ftruncate_cbk) tmp_cbk = mdc_ftruncate_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->ftruncate"
; _new->unwind_to = "mdc_ftruncate_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->ftruncate); (this->children->
xlator)->fops->ftruncate (_new, (this->children->
xlator), fd, offset, xdata); (*__glusterfs_this_location()) =
old_THIS; } while (0)
949 FIRST_CHILD(this), FIRST_CHILD(this)->fops->ftruncate,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 950, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->ftruncate_cbk) tmp_cbk = mdc_ftruncate_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->ftruncate"
; _new->unwind_to = "mdc_ftruncate_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->ftruncate); (this->children->
xlator)->fops->ftruncate (_new, (this->children->
xlator), fd, offset, xdata); (*__glusterfs_this_location()) =
old_THIS; } while (0)
950 fd, offset, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 950, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->ftruncate_cbk) tmp_cbk = mdc_ftruncate_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->ftruncate"
; _new->unwind_to = "mdc_ftruncate_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->ftruncate); (this->children->
xlator)->fops->ftruncate (_new, (this->children->
xlator), fd, offset, xdata); (*__glusterfs_this_location()) =
old_THIS; } while (0)
;
951 return 0;
952}
953
954
955int
956mdc_mknod_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
957 int32_t op_ret, int32_t op_errno, inode_t *inode,
958 struct iatt *buf, struct iatt *preparent,
959 struct iatt *postparent, dict_t *xdata)
960{
961 mdc_local_t *local = NULL((void*)0);
962
963 local = frame->local;
964
965 if (op_ret != 0)
966 goto out;
967
968 if (!local)
969 goto out;
970
971 if (local->loc.parent) {
972 mdc_inode_iatt_set (this, local->loc.parent, postparent);
973 }
974
975 if (local->loc.inode) {
976 mdc_inode_iatt_set (this, local->loc.inode, buf);
977 mdc_inode_xatt_set (this, local->loc.inode, local->xattr);
978 }
979out:
980 MDC_STACK_UNWIND (mknod, frame, op_ret, op_errno, inode, buf,do { mdc_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_mknod_cbk_t fn
= ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *
old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf (
"!frame"); } while (0); _gf_log ("stack", "md-cache.c", __FUNCTION__
, 981, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_mknod_cbk_t )frame->ret; _parent = frame->parent;
pthread_spin_lock (&frame->root->stack_lock); { _parent
->ref_count--; } pthread_spin_unlock (&frame->root->
stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, op_ret, op_errno, inode, buf, preparent, postparent
, xdata); (*__glusterfs_this_location()) = old_THIS; } while (
0); mdc_local_wipe (__xl, __local); } while (0)
981 preparent, postparent, xdata)do { mdc_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_mknod_cbk_t fn
= ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *
old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf (
"!frame"); } while (0); _gf_log ("stack", "md-cache.c", __FUNCTION__
, 981, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_mknod_cbk_t )frame->ret; _parent = frame->parent;
pthread_spin_lock (&frame->root->stack_lock); { _parent
->ref_count--; } pthread_spin_unlock (&frame->root->
stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, op_ret, op_errno, inode, buf, preparent, postparent
, xdata); (*__glusterfs_this_location()) = old_THIS; } while (
0); mdc_local_wipe (__xl, __local); } while (0)
;
982 return 0;
983}
984
985
986int
987mdc_mknod (call_frame_t *frame, xlator_t *this, loc_t *loc,
988 mode_t mode, dev_t rdev, mode_t umask, dict_t *xdata)
989{
990 mdc_local_t *local = NULL((void*)0);
991
992 local = mdc_local_get (frame);
993
994 loc_copy (&local->loc, loc);
995 local->xattr = dict_ref (xdata);
996
997 STACK_WIND (frame, mdc_mknod_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 999, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->mknod_cbk) tmp_cbk = mdc_mknod_cbk;
_new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->mknod"; _new
->unwind_to = "mdc_mknod_cbk"; pthread_spin_init (&_new
->lock, 0); pthread_spin_lock (&frame->root->stack_lock
); { _new->next = frame->root->frames.next; _new->
prev = &frame->root->frames; if (frame->root->
frames.next) frame->root->frames.next->prev = _new; frame
->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock
(&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = (this->children->
xlator); if (frame->this->ctx->measure_latency) gf_latency_begin
(_new, (this->children->xlator)->fops->mknod); (
this->children->xlator)->fops->mknod (_new, (this
->children->xlator), loc, mode, rdev, umask, xdata); (*
__glusterfs_this_location()) = old_THIS; } while (0)
998 FIRST_CHILD(this), FIRST_CHILD(this)->fops->mknod,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 999, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->mknod_cbk) tmp_cbk = mdc_mknod_cbk;
_new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->mknod"; _new
->unwind_to = "mdc_mknod_cbk"; pthread_spin_init (&_new
->lock, 0); pthread_spin_lock (&frame->root->stack_lock
); { _new->next = frame->root->frames.next; _new->
prev = &frame->root->frames; if (frame->root->
frames.next) frame->root->frames.next->prev = _new; frame
->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock
(&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = (this->children->
xlator); if (frame->this->ctx->measure_latency) gf_latency_begin
(_new, (this->children->xlator)->fops->mknod); (
this->children->xlator)->fops->mknod (_new, (this
->children->xlator), loc, mode, rdev, umask, xdata); (*
__glusterfs_this_location()) = old_THIS; } while (0)
999 loc, mode, rdev, umask, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 999, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->mknod_cbk) tmp_cbk = mdc_mknod_cbk;
_new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->mknod"; _new
->unwind_to = "mdc_mknod_cbk"; pthread_spin_init (&_new
->lock, 0); pthread_spin_lock (&frame->root->stack_lock
); { _new->next = frame->root->frames.next; _new->
prev = &frame->root->frames; if (frame->root->
frames.next) frame->root->frames.next->prev = _new; frame
->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock
(&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = (this->children->
xlator); if (frame->this->ctx->measure_latency) gf_latency_begin
(_new, (this->children->xlator)->fops->mknod); (
this->children->xlator)->fops->mknod (_new, (this
->children->xlator), loc, mode, rdev, umask, xdata); (*
__glusterfs_this_location()) = old_THIS; } while (0)
;
1000 return 0;
1001}
1002
1003
1004int
1005mdc_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
1006 int32_t op_ret, int32_t op_errno, inode_t *inode,
1007 struct iatt *buf, struct iatt *preparent,
1008 struct iatt *postparent, dict_t *xdata)
1009{
1010 mdc_local_t *local = NULL((void*)0);
1011
1012 local = frame->local;
1013
1014 if (op_ret != 0)
1015 goto out;
1016
1017 if (!local)
1018 goto out;
1019
1020 if (local->loc.parent) {
1021 mdc_inode_iatt_set (this, local->loc.parent, postparent);
1022 }
1023
1024 if (local->loc.inode) {
1025 mdc_inode_iatt_set (this, local->loc.inode, buf);
1026 mdc_inode_xatt_set (this, local->loc.inode, local->xattr);
1027 }
1028out:
1029 MDC_STACK_UNWIND (mkdir, frame, op_ret, op_errno, inode, buf,do { mdc_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_mkdir_cbk_t fn
= ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *
old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf (
"!frame"); } while (0); _gf_log ("stack", "md-cache.c", __FUNCTION__
, 1030, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_mkdir_cbk_t )frame->ret; _parent = frame->parent;
pthread_spin_lock (&frame->root->stack_lock); { _parent
->ref_count--; } pthread_spin_unlock (&frame->root->
stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, op_ret, op_errno, inode, buf, preparent, postparent
, xdata); (*__glusterfs_this_location()) = old_THIS; } while (
0); mdc_local_wipe (__xl, __local); } while (0)
1030 preparent, postparent, xdata)do { mdc_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_mkdir_cbk_t fn
= ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *
old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf (
"!frame"); } while (0); _gf_log ("stack", "md-cache.c", __FUNCTION__
, 1030, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_mkdir_cbk_t )frame->ret; _parent = frame->parent;
pthread_spin_lock (&frame->root->stack_lock); { _parent
->ref_count--; } pthread_spin_unlock (&frame->root->
stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, op_ret, op_errno, inode, buf, preparent, postparent
, xdata); (*__glusterfs_this_location()) = old_THIS; } while (
0); mdc_local_wipe (__xl, __local); } while (0)
;
1031 return 0;
1032}
1033
1034
1035int
1036mdc_mkdir (call_frame_t *frame, xlator_t *this, loc_t *loc,
1037 mode_t mode, mode_t umask, dict_t *xdata)
1038{
1039 mdc_local_t *local = NULL((void*)0);
1040
1041 local = mdc_local_get (frame);
1042
1043 loc_copy (&local->loc, loc);
1044 local->xattr = dict_ref (xdata);
1045
1046 STACK_WIND (frame, mdc_mkdir_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 1048, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->mkdir_cbk) tmp_cbk = mdc_mkdir_cbk;
_new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->mkdir"; _new
->unwind_to = "mdc_mkdir_cbk"; pthread_spin_init (&_new
->lock, 0); pthread_spin_lock (&frame->root->stack_lock
); { _new->next = frame->root->frames.next; _new->
prev = &frame->root->frames; if (frame->root->
frames.next) frame->root->frames.next->prev = _new; frame
->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock
(&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = (this->children->
xlator); if (frame->this->ctx->measure_latency) gf_latency_begin
(_new, (this->children->xlator)->fops->mkdir); (
this->children->xlator)->fops->mkdir (_new, (this
->children->xlator), loc, mode, umask, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1047 FIRST_CHILD(this), FIRST_CHILD(this)->fops->mkdir,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 1048, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->mkdir_cbk) tmp_cbk = mdc_mkdir_cbk;
_new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->mkdir"; _new
->unwind_to = "mdc_mkdir_cbk"; pthread_spin_init (&_new
->lock, 0); pthread_spin_lock (&frame->root->stack_lock
); { _new->next = frame->root->frames.next; _new->
prev = &frame->root->frames; if (frame->root->
frames.next) frame->root->frames.next->prev = _new; frame
->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock
(&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = (this->children->
xlator); if (frame->this->ctx->measure_latency) gf_latency_begin
(_new, (this->children->xlator)->fops->mkdir); (
this->children->xlator)->fops->mkdir (_new, (this
->children->xlator), loc, mode, umask, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1048 loc, mode, umask, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 1048, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->mkdir_cbk) tmp_cbk = mdc_mkdir_cbk;
_new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->mkdir"; _new
->unwind_to = "mdc_mkdir_cbk"; pthread_spin_init (&_new
->lock, 0); pthread_spin_lock (&frame->root->stack_lock
); { _new->next = frame->root->frames.next; _new->
prev = &frame->root->frames; if (frame->root->
frames.next) frame->root->frames.next->prev = _new; frame
->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock
(&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = (this->children->
xlator); if (frame->this->ctx->measure_latency) gf_latency_begin
(_new, (this->children->xlator)->fops->mkdir); (
this->children->xlator)->fops->mkdir (_new, (this
->children->xlator), loc, mode, umask, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0)
;
1049 return 0;
1050}
1051
1052
1053int
1054mdc_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
1055 int32_t op_ret, int32_t op_errno,
1056 struct iatt *preparent, struct iatt *postparent, dict_t *xdata)
1057{
1058 mdc_local_t *local = NULL((void*)0);
1059
1060 local = frame->local;
1061
1062 if (op_ret != 0)
1063 goto out;
1064
1065 if (!local)
1066 goto out;
1067
1068 if (local->loc.parent) {
1069 mdc_inode_iatt_set (this, local->loc.parent, postparent);
1070 }
1071
1072 if (local->loc.inode) {
1073 mdc_inode_iatt_set (this, local->loc.inode, NULL((void*)0));
1074 }
1075
1076out:
1077 MDC_STACK_UNWIND (unlink, frame, op_ret, op_errno,do { mdc_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_unlink_cbk_t fn
= ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *
old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf (
"!frame"); } while (0); _gf_log ("stack", "md-cache.c", __FUNCTION__
, 1078, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_unlink_cbk_t )frame->ret; _parent = frame->parent
; pthread_spin_lock (&frame->root->stack_lock); { _parent
->ref_count--; } pthread_spin_unlock (&frame->root->
stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, op_ret, op_errno, preparent, postparent, xdata); (
*__glusterfs_this_location()) = old_THIS; } while (0); mdc_local_wipe
(__xl, __local); } while (0)
1078 preparent, postparent, xdata)do { mdc_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_unlink_cbk_t fn
= ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *
old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf (
"!frame"); } while (0); _gf_log ("stack", "md-cache.c", __FUNCTION__
, 1078, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_unlink_cbk_t )frame->ret; _parent = frame->parent
; pthread_spin_lock (&frame->root->stack_lock); { _parent
->ref_count--; } pthread_spin_unlock (&frame->root->
stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, op_ret, op_errno, preparent, postparent, xdata); (
*__glusterfs_this_location()) = old_THIS; } while (0); mdc_local_wipe
(__xl, __local); } while (0)
;
1079 return 0;
1080}
1081
1082
1083int
1084mdc_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t xflag,
1085 dict_t *xdata)
1086{
1087 mdc_local_t *local = NULL((void*)0);
1088
1089 local = mdc_local_get (frame);
1090
1091 loc_copy (&local->loc, loc);
1092
1093 STACK_WIND (frame, mdc_unlink_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 1095, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->unlink_cbk) tmp_cbk = mdc_unlink_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->unlink";
_new->unwind_to = "mdc_unlink_cbk"; pthread_spin_init (&
_new->lock, 0); pthread_spin_lock (&frame->root->
stack_lock); { _new->next = frame->root->frames.next
; _new->prev = &frame->root->frames; if (frame->
root->frames.next) frame->root->frames.next->prev
= _new; frame->root->frames.next = _new; frame->ref_count
++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->unlink); (this->children->xlator
)->fops->unlink (_new, (this->children->xlator), loc
, xflag, xdata); (*__glusterfs_this_location()) = old_THIS; }
while (0)
1094 FIRST_CHILD(this), FIRST_CHILD(this)->fops->unlink,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 1095, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->unlink_cbk) tmp_cbk = mdc_unlink_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->unlink";
_new->unwind_to = "mdc_unlink_cbk"; pthread_spin_init (&
_new->lock, 0); pthread_spin_lock (&frame->root->
stack_lock); { _new->next = frame->root->frames.next
; _new->prev = &frame->root->frames; if (frame->
root->frames.next) frame->root->frames.next->prev
= _new; frame->root->frames.next = _new; frame->ref_count
++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->unlink); (this->children->xlator
)->fops->unlink (_new, (this->children->xlator), loc
, xflag, xdata); (*__glusterfs_this_location()) = old_THIS; }
while (0)
1095 loc, xflag, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 1095, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->unlink_cbk) tmp_cbk = mdc_unlink_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->unlink";
_new->unwind_to = "mdc_unlink_cbk"; pthread_spin_init (&
_new->lock, 0); pthread_spin_lock (&frame->root->
stack_lock); { _new->next = frame->root->frames.next
; _new->prev = &frame->root->frames; if (frame->
root->frames.next) frame->root->frames.next->prev
= _new; frame->root->frames.next = _new; frame->ref_count
++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->unlink); (this->children->xlator
)->fops->unlink (_new, (this->children->xlator), loc
, xflag, xdata); (*__glusterfs_this_location()) = old_THIS; }
while (0)
;
1096 return 0;
1097}
1098
1099
1100int
1101mdc_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
1102 int32_t op_ret, int32_t op_errno,
1103 struct iatt *preparent, struct iatt *postparent, dict_t *xdata)
1104{
1105 mdc_local_t *local = NULL((void*)0);
1106
1107 local = frame->local;
1108
1109 if (op_ret != 0)
1110 goto out;
1111
1112 if (!local)
1113 goto out;
1114
1115 if (local->loc.parent) {
1116 mdc_inode_iatt_set (this, local->loc.parent, postparent);
1117 }
1118
1119out:
1120 MDC_STACK_UNWIND (rmdir, frame, op_ret, op_errno,do { mdc_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_rmdir_cbk_t fn
= ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *
old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf (
"!frame"); } while (0); _gf_log ("stack", "md-cache.c", __FUNCTION__
, 1121, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_rmdir_cbk_t )frame->ret; _parent = frame->parent;
pthread_spin_lock (&frame->root->stack_lock); { _parent
->ref_count--; } pthread_spin_unlock (&frame->root->
stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, op_ret, op_errno, preparent, postparent, xdata); (
*__glusterfs_this_location()) = old_THIS; } while (0); mdc_local_wipe
(__xl, __local); } while (0)
1121 preparent, postparent, xdata)do { mdc_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_rmdir_cbk_t fn
= ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *
old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf (
"!frame"); } while (0); _gf_log ("stack", "md-cache.c", __FUNCTION__
, 1121, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_rmdir_cbk_t )frame->ret; _parent = frame->parent;
pthread_spin_lock (&frame->root->stack_lock); { _parent
->ref_count--; } pthread_spin_unlock (&frame->root->
stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, op_ret, op_errno, preparent, postparent, xdata); (
*__glusterfs_this_location()) = old_THIS; } while (0); mdc_local_wipe
(__xl, __local); } while (0)
;
1122 return 0;
1123}
1124
1125
1126int
1127mdc_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc, int flag,
1128 dict_t *xdata)
1129{
1130 mdc_local_t *local = NULL((void*)0);
1131
1132 local = mdc_local_get (frame);
1133
1134 loc_copy (&local->loc, loc);
1135
1136 STACK_WIND (frame, mdc_rmdir_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 1138, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->rmdir_cbk) tmp_cbk = mdc_rmdir_cbk;
_new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->rmdir"; _new
->unwind_to = "mdc_rmdir_cbk"; pthread_spin_init (&_new
->lock, 0); pthread_spin_lock (&frame->root->stack_lock
); { _new->next = frame->root->frames.next; _new->
prev = &frame->root->frames; if (frame->root->
frames.next) frame->root->frames.next->prev = _new; frame
->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock
(&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = (this->children->
xlator); if (frame->this->ctx->measure_latency) gf_latency_begin
(_new, (this->children->xlator)->fops->rmdir); (
this->children->xlator)->fops->rmdir (_new, (this
->children->xlator), loc, flag, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1137 FIRST_CHILD(this), FIRST_CHILD(this)->fops->rmdir,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 1138, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->rmdir_cbk) tmp_cbk = mdc_rmdir_cbk;
_new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->rmdir"; _new
->unwind_to = "mdc_rmdir_cbk"; pthread_spin_init (&_new
->lock, 0); pthread_spin_lock (&frame->root->stack_lock
); { _new->next = frame->root->frames.next; _new->
prev = &frame->root->frames; if (frame->root->
frames.next) frame->root->frames.next->prev = _new; frame
->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock
(&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = (this->children->
xlator); if (frame->this->ctx->measure_latency) gf_latency_begin
(_new, (this->children->xlator)->fops->rmdir); (
this->children->xlator)->fops->rmdir (_new, (this
->children->xlator), loc, flag, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1138 loc, flag, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 1138, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->rmdir_cbk) tmp_cbk = mdc_rmdir_cbk;
_new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->rmdir"; _new
->unwind_to = "mdc_rmdir_cbk"; pthread_spin_init (&_new
->lock, 0); pthread_spin_lock (&frame->root->stack_lock
); { _new->next = frame->root->frames.next; _new->
prev = &frame->root->frames; if (frame->root->
frames.next) frame->root->frames.next->prev = _new; frame
->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock
(&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = (this->children->
xlator); if (frame->this->ctx->measure_latency) gf_latency_begin
(_new, (this->children->xlator)->fops->rmdir); (
this->children->xlator)->fops->rmdir (_new, (this
->children->xlator), loc, flag, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0)
;
1139 return 0;
1140}
1141
1142
1143int
1144mdc_symlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
1145 int32_t op_ret, int32_t op_errno, inode_t *inode,
1146 struct iatt *buf, struct iatt *preparent,
1147 struct iatt *postparent, dict_t *xdata)
1148{
1149 mdc_local_t *local = NULL((void*)0);
1150
1151 local = frame->local;
1152
1153 if (op_ret != 0)
1154 goto out;
1155
1156 if (!local)
1157 goto out;
1158
1159 if (local->loc.parent) {
1160 mdc_inode_iatt_set (this, local->loc.parent, postparent);
1161 }
1162
1163 if (local->loc.inode) {
1164 mdc_inode_iatt_set (this, local->loc.inode, buf);
1165 }
1166out:
1167 MDC_STACK_UNWIND (symlink, frame, op_ret, op_errno, inode, buf,do { mdc_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_symlink_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "md-cache.c", __FUNCTION__
, 1168, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_symlink_cbk_t )frame->ret; _parent = frame->parent
; pthread_spin_lock (&frame->root->stack_lock); { _parent
->ref_count--; } pthread_spin_unlock (&frame->root->
stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, op_ret, op_errno, inode, buf, preparent, postparent
, xdata); (*__glusterfs_this_location()) = old_THIS; } while (
0); mdc_local_wipe (__xl, __local); } while (0)
1168 preparent, postparent, xdata)do { mdc_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_symlink_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "md-cache.c", __FUNCTION__
, 1168, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_symlink_cbk_t )frame->ret; _parent = frame->parent
; pthread_spin_lock (&frame->root->stack_lock); { _parent
->ref_count--; } pthread_spin_unlock (&frame->root->
stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, op_ret, op_errno, inode, buf, preparent, postparent
, xdata); (*__glusterfs_this_location()) = old_THIS; } while (
0); mdc_local_wipe (__xl, __local); } while (0)
;
1169 return 0;
1170}
1171
1172
1173int
1174mdc_symlink (call_frame_t *frame, xlator_t *this, const char *linkname,
1175 loc_t *loc, mode_t umask, dict_t *xdata)
1176{
1177 mdc_local_t *local = NULL((void*)0);
1178
1179 local = mdc_local_get (frame);
1180
1181 loc_copy (&local->loc, loc);
1182
1183 local->linkname = gf_strdup (linkname);
1184
1185 STACK_WIND (frame, mdc_symlink_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 1187, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->symlink_cbk) tmp_cbk = mdc_symlink_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->symlink"
; _new->unwind_to = "mdc_symlink_cbk"; pthread_spin_init (
&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->symlink); (this->children->xlator
)->fops->symlink (_new, (this->children->xlator),
linkname, loc, umask, xdata); (*__glusterfs_this_location())
= old_THIS; } while (0)
1186 FIRST_CHILD(this), FIRST_CHILD(this)->fops->symlink,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 1187, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->symlink_cbk) tmp_cbk = mdc_symlink_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->symlink"
; _new->unwind_to = "mdc_symlink_cbk"; pthread_spin_init (
&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->symlink); (this->children->xlator
)->fops->symlink (_new, (this->children->xlator),
linkname, loc, umask, xdata); (*__glusterfs_this_location())
= old_THIS; } while (0)
1187 linkname, loc, umask, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 1187, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->symlink_cbk) tmp_cbk = mdc_symlink_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->symlink"
; _new->unwind_to = "mdc_symlink_cbk"; pthread_spin_init (
&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->symlink); (this->children->xlator
)->fops->symlink (_new, (this->children->xlator),
linkname, loc, umask, xdata); (*__glusterfs_this_location())
= old_THIS; } while (0)
;
1188 return 0;
1189}
1190
1191
1192int
1193mdc_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
1194 int32_t op_ret, int32_t op_errno, struct iatt *buf,
1195 struct iatt *preoldparent, struct iatt *postoldparent,
1196 struct iatt *prenewparent, struct iatt *postnewparent,
1197 dict_t *xdata)
1198{
1199 mdc_local_t *local = NULL((void*)0);
1200
1201 local = frame->local;
1202
1203 if (op_ret != 0)
1204 goto out;
1205
1206 if (!local)
1207 goto out;
1208
1209 if (local->loc.parent) {
1210 mdc_inode_iatt_set (this, local->loc.parent, postoldparent);
1211 }
1212
1213 if (local->loc.inode) {
1214 /* TODO: fix dht_rename() not to return linkfile
1215 attributes before setting attributes here
1216 */
1217
1218 mdc_inode_iatt_set (this, local->loc.inode, NULL((void*)0));
1219 }
1220
1221 if (local->loc2.parent) {
1222 mdc_inode_iatt_set (this, local->loc2.parent, postnewparent);
1223 }
1224out:
1225 MDC_STACK_UNWIND (rename, frame, op_ret, op_errno, buf,do { mdc_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_rename_cbk_t fn
= ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *
old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf (
"!frame"); } while (0); _gf_log ("stack", "md-cache.c", __FUNCTION__
, 1227, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_rename_cbk_t )frame->ret; _parent = frame->parent
; pthread_spin_lock (&frame->root->stack_lock); { _parent
->ref_count--; } pthread_spin_unlock (&frame->root->
stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, op_ret, op_errno, buf, preoldparent, postoldparent
, prenewparent, postnewparent, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0); mdc_local_wipe (__xl, __local); }
while (0)
1226 preoldparent, postoldparent, prenewparent,do { mdc_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_rename_cbk_t fn
= ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *
old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf (
"!frame"); } while (0); _gf_log ("stack", "md-cache.c", __FUNCTION__
, 1227, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_rename_cbk_t )frame->ret; _parent = frame->parent
; pthread_spin_lock (&frame->root->stack_lock); { _parent
->ref_count--; } pthread_spin_unlock (&frame->root->
stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, op_ret, op_errno, buf, preoldparent, postoldparent
, prenewparent, postnewparent, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0); mdc_local_wipe (__xl, __local); }
while (0)
1227 postnewparent, xdata)do { mdc_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_rename_cbk_t fn
= ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *
old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf (
"!frame"); } while (0); _gf_log ("stack", "md-cache.c", __FUNCTION__
, 1227, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_rename_cbk_t )frame->ret; _parent = frame->parent
; pthread_spin_lock (&frame->root->stack_lock); { _parent
->ref_count--; } pthread_spin_unlock (&frame->root->
stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, op_ret, op_errno, buf, preoldparent, postoldparent
, prenewparent, postnewparent, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0); mdc_local_wipe (__xl, __local); }
while (0)
;
1228 return 0;
1229}
1230
1231
1232int
1233mdc_rename (call_frame_t *frame, xlator_t *this,
1234 loc_t *oldloc, loc_t *newloc, dict_t *xdata)
1235{
1236 mdc_local_t *local = NULL((void*)0);
1237
1238 local = mdc_local_get (frame);
1239
1240 loc_copy (&local->loc, oldloc);
1241 loc_copy (&local->loc2, newloc);
1242
1243 STACK_WIND (frame, mdc_rename_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 1245, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->rename_cbk) tmp_cbk = mdc_rename_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->rename";
_new->unwind_to = "mdc_rename_cbk"; pthread_spin_init (&
_new->lock, 0); pthread_spin_lock (&frame->root->
stack_lock); { _new->next = frame->root->frames.next
; _new->prev = &frame->root->frames; if (frame->
root->frames.next) frame->root->frames.next->prev
= _new; frame->root->frames.next = _new; frame->ref_count
++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->rename); (this->children->xlator
)->fops->rename (_new, (this->children->xlator), oldloc
, newloc, xdata); (*__glusterfs_this_location()) = old_THIS; }
while (0)
1244 FIRST_CHILD(this), FIRST_CHILD(this)->fops->rename,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 1245, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->rename_cbk) tmp_cbk = mdc_rename_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->rename";
_new->unwind_to = "mdc_rename_cbk"; pthread_spin_init (&
_new->lock, 0); pthread_spin_lock (&frame->root->
stack_lock); { _new->next = frame->root->frames.next
; _new->prev = &frame->root->frames; if (frame->
root->frames.next) frame->root->frames.next->prev
= _new; frame->root->frames.next = _new; frame->ref_count
++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->rename); (this->children->xlator
)->fops->rename (_new, (this->children->xlator), oldloc
, newloc, xdata); (*__glusterfs_this_location()) = old_THIS; }
while (0)
1245 oldloc, newloc, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 1245, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->rename_cbk) tmp_cbk = mdc_rename_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->rename";
_new->unwind_to = "mdc_rename_cbk"; pthread_spin_init (&
_new->lock, 0); pthread_spin_lock (&frame->root->
stack_lock); { _new->next = frame->root->frames.next
; _new->prev = &frame->root->frames; if (frame->
root->frames.next) frame->root->frames.next->prev
= _new; frame->root->frames.next = _new; frame->ref_count
++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->rename); (this->children->xlator
)->fops->rename (_new, (this->children->xlator), oldloc
, newloc, xdata); (*__glusterfs_this_location()) = old_THIS; }
while (0)
;
1246 return 0;
1247}
1248
1249
1250int
1251mdc_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
1252 int32_t op_ret, int32_t op_errno, inode_t *inode, struct iatt *buf,
1253 struct iatt *preparent, struct iatt *postparent, dict_t *xdata)
1254{
1255 mdc_local_t *local = NULL((void*)0);
1256
1257 local = frame->local;
1258
1259 if (op_ret != 0)
1260 goto out;
1261
1262 if (!local)
1263 goto out;
1264
1265 if (local->loc.inode) {
1266 mdc_inode_iatt_set (this, local->loc.inode, buf);
1267 }
1268
1269 if (local->loc2.parent) {
1270 mdc_inode_iatt_set (this, local->loc2.parent, postparent);
1271 }
1272out:
1273 MDC_STACK_UNWIND (link, frame, op_ret, op_errno, inode, buf,do { mdc_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_link_cbk_t fn
= ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *
old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf (
"!frame"); } while (0); _gf_log ("stack", "md-cache.c", __FUNCTION__
, 1274, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_link_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock
(&frame->root->stack_lock); { _parent->ref_count
--; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, op_ret, op_errno, inode, buf, preparent, postparent
, xdata); (*__glusterfs_this_location()) = old_THIS; } while (
0); mdc_local_wipe (__xl, __local); } while (0)
1274 preparent, postparent, xdata)do { mdc_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_link_cbk_t fn
= ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *
old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf (
"!frame"); } while (0); _gf_log ("stack", "md-cache.c", __FUNCTION__
, 1274, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_link_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock
(&frame->root->stack_lock); { _parent->ref_count
--; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, op_ret, op_errno, inode, buf, preparent, postparent
, xdata); (*__glusterfs_this_location()) = old_THIS; } while (
0); mdc_local_wipe (__xl, __local); } while (0)
;
1275 return 0;
1276}
1277
1278
1279int
1280mdc_link (call_frame_t *frame, xlator_t *this,
1281 loc_t *oldloc, loc_t *newloc, dict_t *xdata)
1282{
1283 mdc_local_t *local = NULL((void*)0);
1284
1285 local = mdc_local_get (frame);
1286
1287 loc_copy (&local->loc, oldloc);
1288 loc_copy (&local->loc2, newloc);
1289
1290 STACK_WIND (frame, mdc_link_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 1292, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->link_cbk) tmp_cbk = mdc_link_cbk; _new
->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->link"; _new
->unwind_to = "mdc_link_cbk"; pthread_spin_init (&_new
->lock, 0); pthread_spin_lock (&frame->root->stack_lock
); { _new->next = frame->root->frames.next; _new->
prev = &frame->root->frames; if (frame->root->
frames.next) frame->root->frames.next->prev = _new; frame
->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock
(&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = (this->children->
xlator); if (frame->this->ctx->measure_latency) gf_latency_begin
(_new, (this->children->xlator)->fops->link); (this
->children->xlator)->fops->link (_new, (this->
children->xlator), oldloc, newloc, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1291 FIRST_CHILD(this), FIRST_CHILD(this)->fops->link,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 1292, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->link_cbk) tmp_cbk = mdc_link_cbk; _new
->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->link"; _new
->unwind_to = "mdc_link_cbk"; pthread_spin_init (&_new
->lock, 0); pthread_spin_lock (&frame->root->stack_lock
); { _new->next = frame->root->frames.next; _new->
prev = &frame->root->frames; if (frame->root->
frames.next) frame->root->frames.next->prev = _new; frame
->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock
(&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = (this->children->
xlator); if (frame->this->ctx->measure_latency) gf_latency_begin
(_new, (this->children->xlator)->fops->link); (this
->children->xlator)->fops->link (_new, (this->
children->xlator), oldloc, newloc, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1292 oldloc, newloc, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 1292, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->link_cbk) tmp_cbk = mdc_link_cbk; _new
->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->link"; _new
->unwind_to = "mdc_link_cbk"; pthread_spin_init (&_new
->lock, 0); pthread_spin_lock (&frame->root->stack_lock
); { _new->next = frame->root->frames.next; _new->
prev = &frame->root->frames; if (frame->root->
frames.next) frame->root->frames.next->prev = _new; frame
->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock
(&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = (this->children->
xlator); if (frame->this->ctx->measure_latency) gf_latency_begin
(_new, (this->children->xlator)->fops->link); (this
->children->xlator)->fops->link (_new, (this->
children->xlator), oldloc, newloc, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0)
;
1293 return 0;
1294}
1295
1296
1297int
1298mdc_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
1299 int32_t op_ret, int32_t op_errno, fd_t *fd, inode_t *inode,
1300 struct iatt *buf, struct iatt *preparent,
1301 struct iatt *postparent, dict_t *xdata)
1302{
1303 mdc_local_t *local = NULL((void*)0);
1304
1305 local = frame->local;
1306
1307 if (op_ret != 0)
1308 goto out;
1309
1310 if (!local)
1311 goto out;
1312
1313 if (local->loc.parent) {
1314 mdc_inode_iatt_set (this, local->loc.parent, postparent);
1315 }
1316
1317 if (local->loc.inode) {
1318 mdc_inode_iatt_set (this, inode, buf);
1319 mdc_inode_xatt_set (this, local->loc.inode, local->xattr);
1320 }
1321out:
1322 MDC_STACK_UNWIND (create, frame, op_ret, op_errno, fd, inode, buf,do { mdc_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_create_cbk_t fn
= ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *
old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf (
"!frame"); } while (0); _gf_log ("stack", "md-cache.c", __FUNCTION__
, 1323, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_create_cbk_t )frame->ret; _parent = frame->parent
; pthread_spin_lock (&frame->root->stack_lock); { _parent
->ref_count--; } pthread_spin_unlock (&frame->root->
stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, op_ret, op_errno, fd, inode, buf, preparent, postparent
, xdata); (*__glusterfs_this_location()) = old_THIS; } while (
0); mdc_local_wipe (__xl, __local); } while (0)
1323 preparent, postparent, xdata)do { mdc_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_create_cbk_t fn
= ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *
old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf (
"!frame"); } while (0); _gf_log ("stack", "md-cache.c", __FUNCTION__
, 1323, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_create_cbk_t )frame->ret; _parent = frame->parent
; pthread_spin_lock (&frame->root->stack_lock); { _parent
->ref_count--; } pthread_spin_unlock (&frame->root->
stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, op_ret, op_errno, fd, inode, buf, preparent, postparent
, xdata); (*__glusterfs_this_location()) = old_THIS; } while (
0); mdc_local_wipe (__xl, __local); } while (0)
;
1324 return 0;
1325}
1326
1327
1328int
1329mdc_create (call_frame_t *frame, xlator_t *this, loc_t *loc, int flags,
1330 mode_t mode, mode_t umask, fd_t *fd, dict_t *xdata)
1331{
1332 mdc_local_t *local = NULL((void*)0);
1333
1334 local = mdc_local_get (frame);
1335
1336 loc_copy (&local->loc, loc);
1337 local->xattr = dict_ref (xdata);
1338
1339 STACK_WIND (frame, mdc_create_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 1341, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->create_cbk) tmp_cbk = mdc_create_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->create";
_new->unwind_to = "mdc_create_cbk"; pthread_spin_init (&
_new->lock, 0); pthread_spin_lock (&frame->root->
stack_lock); { _new->next = frame->root->frames.next
; _new->prev = &frame->root->frames; if (frame->
root->frames.next) frame->root->frames.next->prev
= _new; frame->root->frames.next = _new; frame->ref_count
++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->create); (this->children->xlator
)->fops->create (_new, (this->children->xlator), loc
, flags, mode, umask, fd, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1340 FIRST_CHILD(this), FIRST_CHILD(this)->fops->create,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 1341, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->create_cbk) tmp_cbk = mdc_create_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->create";
_new->unwind_to = "mdc_create_cbk"; pthread_spin_init (&
_new->lock, 0); pthread_spin_lock (&frame->root->
stack_lock); { _new->next = frame->root->frames.next
; _new->prev = &frame->root->frames; if (frame->
root->frames.next) frame->root->frames.next->prev
= _new; frame->root->frames.next = _new; frame->ref_count
++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->create); (this->children->xlator
)->fops->create (_new, (this->children->xlator), loc
, flags, mode, umask, fd, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1341 loc, flags, mode, umask, fd, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 1341, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->create_cbk) tmp_cbk = mdc_create_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->create";
_new->unwind_to = "mdc_create_cbk"; pthread_spin_init (&
_new->lock, 0); pthread_spin_lock (&frame->root->
stack_lock); { _new->next = frame->root->frames.next
; _new->prev = &frame->root->frames; if (frame->
root->frames.next) frame->root->frames.next->prev
= _new; frame->root->frames.next = _new; frame->ref_count
++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->create); (this->children->xlator
)->fops->create (_new, (this->children->xlator), loc
, flags, mode, umask, fd, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0)
;
1342 return 0;
1343}
1344
1345
1346int
1347mdc_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
1348 int32_t op_ret, int32_t op_errno,
1349 struct iovec *vector, int32_t count,
1350 struct iatt *stbuf, struct iobref *iobref, dict_t *xdata)
1351{
1352 mdc_local_t *local = NULL((void*)0);
1353
1354 local = frame->local;
1355
1356 if (op_ret != 0)
1357 goto out;
1358
1359 if (!local)
1360 goto out;
1361
1362 mdc_inode_iatt_set (this, local->fd->inode, stbuf);
1363
1364out:
1365 MDC_STACK_UNWIND (readv, frame, op_ret, op_errno, vector, count,do { mdc_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_readv_cbk_t fn
= ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *
old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf (
"!frame"); } while (0); _gf_log ("stack", "md-cache.c", __FUNCTION__
, 1366, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_readv_cbk_t )frame->ret; _parent = frame->parent;
pthread_spin_lock (&frame->root->stack_lock); { _parent
->ref_count--; } pthread_spin_unlock (&frame->root->
stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, op_ret, op_errno, vector, count, stbuf, iobref, xdata
); (*__glusterfs_this_location()) = old_THIS; } while (0); mdc_local_wipe
(__xl, __local); } while (0)
1366 stbuf, iobref, xdata)do { mdc_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_readv_cbk_t fn
= ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *
old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf (
"!frame"); } while (0); _gf_log ("stack", "md-cache.c", __FUNCTION__
, 1366, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_readv_cbk_t )frame->ret; _parent = frame->parent;
pthread_spin_lock (&frame->root->stack_lock); { _parent
->ref_count--; } pthread_spin_unlock (&frame->root->
stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, op_ret, op_errno, vector, count, stbuf, iobref, xdata
); (*__glusterfs_this_location()) = old_THIS; } while (0); mdc_local_wipe
(__xl, __local); } while (0)
;
1367
1368 return 0;
1369}
1370
1371
1372int
1373mdc_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
1374 off_t offset, uint32_t flags, dict_t *xdata)
1375{
1376 mdc_local_t *local = NULL((void*)0);
1377
1378 local = mdc_local_get (frame);
1379
1380 local->fd = fd_ref (fd);
1381
1382 STACK_WIND (frame, mdc_readv_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", "md-cache.c", __FUNCTION__, 1384, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->readv_cbk) tmp_cbk = mdc_readv_cbk;
_new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->readv"; _new
->unwind_to = "mdc_readv_cbk"; pthread_spin_init (&_new
->lock, 0); pthread_spin_lock (&frame->root->stack_lock
); { _new->next = frame->root->frames.next; _new->
prev = &frame->root->frames; if (frame->root->
frames.next) frame->root->frames.next->prev = _new; frame
->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock
(&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = (this->children->
xlator); if (frame->this->ctx->measure_latency) gf_latency_begin
(_new, (this->children->xlator)->fops->readv); (
this->children->xlator)->fops->readv (_new, (this
->children->xlator), fd, size, offset, flags, xdata); (
*__glusterfs_this_location()) = old_THIS; } while (0)
1383 FIRST_CHILD(this), FIRST_CHILD(this)->fops->readv,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 1384, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->readv_cbk) tmp_cbk = mdc_readv_cbk;
_new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->readv"; _new
->unwind_to = "mdc_readv_cbk"; pthread_spin_init (&_new
->lock, 0); pthread_spin_lock (&frame->root->stack_lock
); { _new->next = frame->root->frames.next; _new->
prev = &frame->root->frames; if (frame->root->
frames.next) frame->root->frames.next->prev = _new; frame
->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock
(&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = (this->children->
xlator); if (frame->this->ctx->measure_latency) gf_latency_begin
(_new, (this->children->xlator)->fops->readv); (
this->children->xlator)->fops->readv (_new, (this
->children->xlator), fd, size, offset, flags, xdata); (
*__glusterfs_this_location()) = old_THIS; } while (0)
1384 fd, size, offset, flags, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 1384, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->readv_cbk) tmp_cbk = mdc_readv_cbk;
_new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->readv"; _new
->unwind_to = "mdc_readv_cbk"; pthread_spin_init (&_new
->lock, 0); pthread_spin_lock (&frame->root->stack_lock
); { _new->next = frame->root->frames.next; _new->
prev = &frame->root->frames; if (frame->root->
frames.next) frame->root->frames.next->prev = _new; frame
->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock
(&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = (this->children->
xlator); if (frame->this->ctx->measure_latency) gf_latency_begin
(_new, (this->children->xlator)->fops->readv); (
this->children->xlator)->fops->readv (_new, (this
->children->xlator), fd, size, offset, flags, xdata); (
*__glusterfs_this_location()) = old_THIS; } while (0)
;
1385 return 0;
1386}
1387
1388
1389int
1390mdc_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
1391 int32_t op_ret, int32_t op_errno,
1392 struct iatt *prebuf, struct iatt *postbuf, dict_t *xdata)
1393{
1394 mdc_local_t *local = NULL((void*)0);
1395
1396 local = frame->local;
1397
1398 if (op_ret == -1)
1399 goto out;
1400
1401 if (!local)
1402 goto out;
1403
1404 mdc_inode_iatt_set_validate(this, local->fd->inode, prebuf, postbuf);
1405
1406out:
1407 MDC_STACK_UNWIND (writev, frame, op_ret, op_errno, prebuf, postbuf,do { mdc_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_writev_cbk_t fn
= ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *
old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf (
"!frame"); } while (0); _gf_log ("stack", "md-cache.c", __FUNCTION__
, 1408, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_writev_cbk_t )frame->ret; _parent = frame->parent
; pthread_spin_lock (&frame->root->stack_lock); { _parent
->ref_count--; } pthread_spin_unlock (&frame->root->
stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, op_ret, op_errno, prebuf, postbuf, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0); mdc_local_wipe (__xl, __local); }
while (0)
1408 xdata)do { mdc_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_writev_cbk_t fn
= ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *
old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf (
"!frame"); } while (0); _gf_log ("stack", "md-cache.c", __FUNCTION__
, 1408, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_writev_cbk_t )frame->ret; _parent = frame->parent
; pthread_spin_lock (&frame->root->stack_lock); { _parent
->ref_count--; } pthread_spin_unlock (&frame->root->
stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, op_ret, op_errno, prebuf, postbuf, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0); mdc_local_wipe (__xl, __local); }
while (0)
;
1409
1410 return 0;
1411}
1412
1413
1414int
1415mdc_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, struct iovec *vector,
1416 int count, off_t offset, uint32_t flags, struct iobref *iobref,
1417 dict_t *xdata)
1418{
1419 mdc_local_t *local = NULL((void*)0);
1420
1421 local = mdc_local_get (frame);
1422
1423 local->fd = fd_ref (fd);
1424
1425 STACK_WIND (frame, mdc_writev_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 1427, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->writev_cbk) tmp_cbk = mdc_writev_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->writev";
_new->unwind_to = "mdc_writev_cbk"; pthread_spin_init (&
_new->lock, 0); pthread_spin_lock (&frame->root->
stack_lock); { _new->next = frame->root->frames.next
; _new->prev = &frame->root->frames; if (frame->
root->frames.next) frame->root->frames.next->prev
= _new; frame->root->frames.next = _new; frame->ref_count
++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->writev); (this->children->xlator
)->fops->writev (_new, (this->children->xlator), fd
, vector, count, offset, flags, iobref, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1426 FIRST_CHILD(this), FIRST_CHILD(this)->fops->writev,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 1427, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->writev_cbk) tmp_cbk = mdc_writev_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->writev";
_new->unwind_to = "mdc_writev_cbk"; pthread_spin_init (&
_new->lock, 0); pthread_spin_lock (&frame->root->
stack_lock); { _new->next = frame->root->frames.next
; _new->prev = &frame->root->frames; if (frame->
root->frames.next) frame->root->frames.next->prev
= _new; frame->root->frames.next = _new; frame->ref_count
++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->writev); (this->children->xlator
)->fops->writev (_new, (this->children->xlator), fd
, vector, count, offset, flags, iobref, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1427 fd, vector, count, offset, flags, iobref, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 1427, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->writev_cbk) tmp_cbk = mdc_writev_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->writev";
_new->unwind_to = "mdc_writev_cbk"; pthread_spin_init (&
_new->lock, 0); pthread_spin_lock (&frame->root->
stack_lock); { _new->next = frame->root->frames.next
; _new->prev = &frame->root->frames; if (frame->
root->frames.next) frame->root->frames.next->prev
= _new; frame->root->frames.next = _new; frame->ref_count
++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->writev); (this->children->xlator
)->fops->writev (_new, (this->children->xlator), fd
, vector, count, offset, flags, iobref, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0)
;
1428 return 0;
1429}
1430
1431
1432int
1433mdc_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
1434 int32_t op_ret, int32_t op_errno,
1435 struct iatt *prebuf, struct iatt *postbuf, dict_t *xdata)
1436{
1437 mdc_local_t *local = NULL((void*)0);
1438
1439 local = frame->local;
1440
1441 if (op_ret != 0) {
1442 mdc_inode_iatt_set (this, local->loc.inode, NULL((void*)0));
1443 goto out;
1444 }
1445
1446 if (!local)
1447 goto out;
1448
1449 mdc_inode_iatt_set_validate(this, local->loc.inode, prebuf, postbuf);
1450
1451out:
1452 MDC_STACK_UNWIND (setattr, frame, op_ret, op_errno, prebuf, postbuf,do { mdc_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_setattr_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "md-cache.c", __FUNCTION__
, 1453, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_setattr_cbk_t )frame->ret; _parent = frame->parent
; pthread_spin_lock (&frame->root->stack_lock); { _parent
->ref_count--; } pthread_spin_unlock (&frame->root->
stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, op_ret, op_errno, prebuf, postbuf, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0); mdc_local_wipe (__xl, __local); }
while (0)
1453 xdata)do { mdc_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_setattr_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "md-cache.c", __FUNCTION__
, 1453, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_setattr_cbk_t )frame->ret; _parent = frame->parent
; pthread_spin_lock (&frame->root->stack_lock); { _parent
->ref_count--; } pthread_spin_unlock (&frame->root->
stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, op_ret, op_errno, prebuf, postbuf, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0); mdc_local_wipe (__xl, __local); }
while (0)
;
1454
1455 return 0;
1456}
1457
1458
1459int
1460mdc_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc,
1461 struct iatt *stbuf, int valid, dict_t *xdata)
1462{
1463 mdc_local_t *local = NULL((void*)0);
1464
1465 local = mdc_local_get (frame);
1466
1467 loc_copy (&local->loc, loc);
1468
1469 STACK_WIND (frame, mdc_setattr_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 1471, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->setattr_cbk) tmp_cbk = mdc_setattr_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->setattr"
; _new->unwind_to = "mdc_setattr_cbk"; pthread_spin_init (
&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->setattr); (this->children->xlator
)->fops->setattr (_new, (this->children->xlator),
loc, stbuf, valid, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
1470 FIRST_CHILD(this), FIRST_CHILD(this)->fops->setattr,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 1471, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->setattr_cbk) tmp_cbk = mdc_setattr_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->setattr"
; _new->unwind_to = "mdc_setattr_cbk"; pthread_spin_init (
&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->setattr); (this->children->xlator
)->fops->setattr (_new, (this->children->xlator),
loc, stbuf, valid, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
1471 loc, stbuf, valid, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 1471, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->setattr_cbk) tmp_cbk = mdc_setattr_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->setattr"
; _new->unwind_to = "mdc_setattr_cbk"; pthread_spin_init (
&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->setattr); (this->children->xlator
)->fops->setattr (_new, (this->children->xlator),
loc, stbuf, valid, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
;
1472 return 0;
1473}
1474
1475
1476int
1477mdc_fsetattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
1478 int32_t op_ret, int32_t op_errno,
1479 struct iatt *prebuf, struct iatt *postbuf, dict_t *xdata)
1480{
1481 mdc_local_t *local = NULL((void*)0);
1482
1483 local = frame->local;
1484
1485 if (op_ret != 0)
1486 goto out;
1487
1488 if (!local)
1489 goto out;
1490
1491 mdc_inode_iatt_set_validate(this, local->fd->inode, prebuf, postbuf);
1492
1493out:
1494 MDC_STACK_UNWIND (fsetattr, frame, op_ret, op_errno, prebuf, postbuf,do { mdc_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_fsetattr_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "md-cache.c", __FUNCTION__
, 1495, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_fsetattr_cbk_t )frame->ret; _parent = frame->parent
; pthread_spin_lock (&frame->root->stack_lock); { _parent
->ref_count--; } pthread_spin_unlock (&frame->root->
stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, op_ret, op_errno, prebuf, postbuf, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0); mdc_local_wipe (__xl, __local); }
while (0)
1495 xdata)do { mdc_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_fsetattr_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "md-cache.c", __FUNCTION__
, 1495, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_fsetattr_cbk_t )frame->ret; _parent = frame->parent
; pthread_spin_lock (&frame->root->stack_lock); { _parent
->ref_count--; } pthread_spin_unlock (&frame->root->
stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, op_ret, op_errno, prebuf, postbuf, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0); mdc_local_wipe (__xl, __local); }
while (0)
;
1496
1497 return 0;
1498}
1499
1500
1501int
1502mdc_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd,
1503 struct iatt *stbuf, int valid, dict_t *xdata)
1504{
1505 mdc_local_t *local = NULL((void*)0);
1506
1507 local = mdc_local_get (frame);
1508
1509 local->fd = fd_ref (fd);
1510
1511 STACK_WIND (frame, mdc_fsetattr_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 1513, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->fsetattr_cbk) tmp_cbk = mdc_fsetattr_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->fsetattr"
; _new->unwind_to = "mdc_fsetattr_cbk"; pthread_spin_init (
&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->fsetattr); (this->children->xlator
)->fops->fsetattr (_new, (this->children->xlator)
, fd, stbuf, valid, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
1512 FIRST_CHILD(this), FIRST_CHILD(this)->fops->fsetattr,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 1513, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->fsetattr_cbk) tmp_cbk = mdc_fsetattr_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->fsetattr"
; _new->unwind_to = "mdc_fsetattr_cbk"; pthread_spin_init (
&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->fsetattr); (this->children->xlator
)->fops->fsetattr (_new, (this->children->xlator)
, fd, stbuf, valid, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
1513 fd, stbuf, valid, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 1513, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->fsetattr_cbk) tmp_cbk = mdc_fsetattr_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->fsetattr"
; _new->unwind_to = "mdc_fsetattr_cbk"; pthread_spin_init (
&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->fsetattr); (this->children->xlator
)->fops->fsetattr (_new, (this->children->xlator)
, fd, stbuf, valid, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
;
1514 return 0;
1515}
1516
1517
1518int
1519mdc_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
1520 int32_t op_ret, int32_t op_errno,
1521 struct iatt *prebuf, struct iatt *postbuf, dict_t *xdata)
1522{
1523 mdc_local_t *local = NULL((void*)0);
1524
1525 local = frame->local;
1526
1527 if (op_ret != 0)
1528 goto out;
1529
1530 if (!local)
1531 goto out;
1532
1533 mdc_inode_iatt_set_validate(this, local->fd->inode, prebuf, postbuf);
1534
1535out:
1536 MDC_STACK_UNWIND (fsync, frame, op_ret, op_errno, prebuf, postbuf,do { mdc_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_fsync_cbk_t fn
= ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *
old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf (
"!frame"); } while (0); _gf_log ("stack", "md-cache.c", __FUNCTION__
, 1537, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_fsync_cbk_t )frame->ret; _parent = frame->parent;
pthread_spin_lock (&frame->root->stack_lock); { _parent
->ref_count--; } pthread_spin_unlock (&frame->root->
stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, op_ret, op_errno, prebuf, postbuf, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0); mdc_local_wipe (__xl, __local); }
while (0)
1537 xdata)do { mdc_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_fsync_cbk_t fn
= ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *
old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf (
"!frame"); } while (0); _gf_log ("stack", "md-cache.c", __FUNCTION__
, 1537, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_fsync_cbk_t )frame->ret; _parent = frame->parent;
pthread_spin_lock (&frame->root->stack_lock); { _parent
->ref_count--; } pthread_spin_unlock (&frame->root->
stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, op_ret, op_errno, prebuf, postbuf, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0); mdc_local_wipe (__xl, __local); }
while (0)
;
1538
1539 return 0;
1540}
1541
1542
1543int
1544mdc_fsync (call_frame_t *frame, xlator_t *this, fd_t *fd, int datasync,
1545 dict_t *xdata)
1546{
1547 mdc_local_t *local = NULL((void*)0);
1548
1549 local = mdc_local_get (frame);
1550
1551 local->fd = fd_ref (fd);
1552
1553 STACK_WIND (frame, mdc_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", "md-cache.c", __FUNCTION__, 1555, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->fsync_cbk) tmp_cbk = mdc_fsync_cbk;
_new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->fsync"; _new
->unwind_to = "mdc_fsync_cbk"; pthread_spin_init (&_new
->lock, 0); pthread_spin_lock (&frame->root->stack_lock
); { _new->next = frame->root->frames.next; _new->
prev = &frame->root->frames; if (frame->root->
frames.next) frame->root->frames.next->prev = _new; frame
->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock
(&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = (this->children->
xlator); if (frame->this->ctx->measure_latency) gf_latency_begin
(_new, (this->children->xlator)->fops->fsync); (
this->children->xlator)->fops->fsync (_new, (this
->children->xlator), fd, datasync, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1554 FIRST_CHILD(this), FIRST_CHILD(this)->fops->fsync,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 1555, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->fsync_cbk) tmp_cbk = mdc_fsync_cbk;
_new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->fsync"; _new
->unwind_to = "mdc_fsync_cbk"; pthread_spin_init (&_new
->lock, 0); pthread_spin_lock (&frame->root->stack_lock
); { _new->next = frame->root->frames.next; _new->
prev = &frame->root->frames; if (frame->root->
frames.next) frame->root->frames.next->prev = _new; frame
->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock
(&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = (this->children->
xlator); if (frame->this->ctx->measure_latency) gf_latency_begin
(_new, (this->children->xlator)->fops->fsync); (
this->children->xlator)->fops->fsync (_new, (this
->children->xlator), fd, datasync, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1555 fd, datasync, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 1555, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->fsync_cbk) tmp_cbk = mdc_fsync_cbk;
_new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->fsync"; _new
->unwind_to = "mdc_fsync_cbk"; pthread_spin_init (&_new
->lock, 0); pthread_spin_lock (&frame->root->stack_lock
); { _new->next = frame->root->frames.next; _new->
prev = &frame->root->frames; if (frame->root->
frames.next) frame->root->frames.next->prev = _new; frame
->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock
(&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = (this->children->
xlator); if (frame->this->ctx->measure_latency) gf_latency_begin
(_new, (this->children->xlator)->fops->fsync); (
this->children->xlator)->fops->fsync (_new, (this
->children->xlator), fd, datasync, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0)
;
1556 return 0;
1557}
1558
1559
1560int
1561mdc_setxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
1562 int32_t op_ret, int32_t op_errno, dict_t *xdata)
1563{
1564 mdc_local_t *local = NULL((void*)0);
1565
1566 local = frame->local;
1567
1568 if (op_ret != 0)
1569 goto out;
1570
1571 if (!local)
1572 goto out;
1573
1574 mdc_inode_xatt_update (this, local->loc.inode, local->xattr);
1575
1576out:
1577 MDC_STACK_UNWIND (setxattr, frame, op_ret, op_errno, xdata)do { mdc_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_setxattr_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "md-cache.c", __FUNCTION__
, 1577, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_setxattr_cbk_t )frame->ret; _parent = frame->parent
; pthread_spin_lock (&frame->root->stack_lock); { _parent
->ref_count--; } pthread_spin_unlock (&frame->root->
stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, op_ret, op_errno, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0); mdc_local_wipe (__xl, __local); }
while (0)
;
1578
1579 return 0;
1580}
1581
1582
1583int
1584mdc_setxattr (call_frame_t *frame, xlator_t *this, loc_t *loc,
1585 dict_t *xattr, int flags, dict_t *xdata)
1586{
1587 mdc_local_t *local = NULL((void*)0);
1588
1589 local = mdc_local_get (frame);
1590
1591 loc_copy (&local->loc, loc);
1592 local->xattr = dict_ref (xattr);
1593
1594 STACK_WIND (frame, mdc_setxattr_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 1596, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->setxattr_cbk) tmp_cbk = mdc_setxattr_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->setxattr"
; _new->unwind_to = "mdc_setxattr_cbk"; pthread_spin_init (
&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->setxattr); (this->children->xlator
)->fops->setxattr (_new, (this->children->xlator)
, loc, xattr, flags, xdata); (*__glusterfs_this_location()) =
old_THIS; } while (0)
1595 FIRST_CHILD(this), FIRST_CHILD(this)->fops->setxattr,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 1596, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->setxattr_cbk) tmp_cbk = mdc_setxattr_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->setxattr"
; _new->unwind_to = "mdc_setxattr_cbk"; pthread_spin_init (
&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->setxattr); (this->children->xlator
)->fops->setxattr (_new, (this->children->xlator)
, loc, xattr, flags, xdata); (*__glusterfs_this_location()) =
old_THIS; } while (0)
1596 loc, xattr, flags, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 1596, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->setxattr_cbk) tmp_cbk = mdc_setxattr_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->setxattr"
; _new->unwind_to = "mdc_setxattr_cbk"; pthread_spin_init (
&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->setxattr); (this->children->xlator
)->fops->setxattr (_new, (this->children->xlator)
, loc, xattr, flags, xdata); (*__glusterfs_this_location()) =
old_THIS; } while (0)
;
1597 return 0;
1598}
1599
1600
1601int
1602mdc_fsetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
1603 int32_t op_ret, int32_t op_errno, dict_t *xdata)
1604{
1605 mdc_local_t *local = NULL((void*)0);
1606
1607 local = frame->local;
1608
1609 if (op_ret != 0)
1610 goto out;
1611
1612 if (!local)
1613 goto out;
1614
1615 mdc_inode_xatt_update (this, local->fd->inode, local->xattr);
1616
1617out:
1618 MDC_STACK_UNWIND (fsetxattr, frame, op_ret, op_errno, xdata)do { mdc_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_fsetxattr_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "md-cache.c", __FUNCTION__
, 1618, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_fsetxattr_cbk_t )frame->ret; _parent = frame->parent
; pthread_spin_lock (&frame->root->stack_lock); { _parent
->ref_count--; } pthread_spin_unlock (&frame->root->
stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, op_ret, op_errno, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0); mdc_local_wipe (__xl, __local); }
while (0)
;
1619
1620 return 0;
1621}
1622
1623
1624int
1625mdc_fsetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd,
1626 dict_t *xattr, int flags, dict_t *xdata)
1627{
1628 mdc_local_t *local = NULL((void*)0);
1629
1630 local = mdc_local_get (frame);
1631
1632 local->fd = fd_ref (fd);
1633 local->xattr = dict_ref (xattr);
1634
1635 STACK_WIND (frame, mdc_fsetxattr_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", "md-cache.c", __FUNCTION__, 1637, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->fsetxattr_cbk) tmp_cbk = mdc_fsetxattr_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->fsetxattr"
; _new->unwind_to = "mdc_fsetxattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->fsetxattr); (this->children->
xlator)->fops->fsetxattr (_new, (this->children->
xlator), fd, xattr, flags, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1636 FIRST_CHILD(this), FIRST_CHILD(this)->fops->fsetxattr,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 1637, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->fsetxattr_cbk) tmp_cbk = mdc_fsetxattr_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->fsetxattr"
; _new->unwind_to = "mdc_fsetxattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->fsetxattr); (this->children->
xlator)->fops->fsetxattr (_new, (this->children->
xlator), fd, xattr, flags, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0)
1637 fd, xattr, flags, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 1637, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->fsetxattr_cbk) tmp_cbk = mdc_fsetxattr_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->fsetxattr"
; _new->unwind_to = "mdc_fsetxattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->fsetxattr); (this->children->
xlator)->fops->fsetxattr (_new, (this->children->
xlator), fd, xattr, flags, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0)
;
1638 return 0;
1639}
1640
1641int
1642mdc_getxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
1643 int32_t op_ret, int32_t op_errno, dict_t *xattr,
1644 dict_t *xdata)
1645{
1646 mdc_local_t *local = NULL((void*)0);
1647
1648 if (op_ret != 0)
1649 goto out;
1650
1651 local = frame->local;
1652 if (!local)
1653 goto out;
1654
1655 mdc_inode_xatt_update (this, local->loc.inode, xattr);
1656
1657out:
1658 MDC_STACK_UNWIND (getxattr, frame, op_ret, op_errno, xattr, xdata)do { mdc_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_getxattr_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "md-cache.c", __FUNCTION__
, 1658, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_getxattr_cbk_t )frame->ret; _parent = frame->parent
; pthread_spin_lock (&frame->root->stack_lock); { _parent
->ref_count--; } pthread_spin_unlock (&frame->root->
stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, op_ret, op_errno, xattr, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0); mdc_local_wipe (__xl, __local); }
while (0)
;
1659
1660 return 0;
1661}
1662
1663
1664int
1665mdc_getxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, const char *key,
1666 dict_t *xdata)
1667{
1668 int ret;
1669 mdc_local_t *local = NULL((void*)0);
1670 dict_t *xattr = NULL((void*)0);
1671
1672 local = mdc_local_get (frame);
1673 if (!local)
1674 goto uncached;
1675
1676 loc_copy (&local->loc, loc);
1677
1678 if (!is_mdc_key_satisfied (key))
1679 goto uncached;
1680
1681 ret = mdc_inode_xatt_get (this, loc->inode, &xattr);
1682 if (ret != 0)
1683 goto uncached;
1684
1685 if (!dict_get (xattr, (char *)key))
1686 goto uncached;
1687
1688 MDC_STACK_UNWIND (getxattr, frame, 0, 0, xattr, xdata)do { mdc_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_getxattr_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "md-cache.c", __FUNCTION__
, 1688, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_getxattr_cbk_t )frame->ret; _parent = frame->parent
; pthread_spin_lock (&frame->root->stack_lock); { _parent
->ref_count--; } pthread_spin_unlock (&frame->root->
stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, 0, 0, xattr, xdata); (*__glusterfs_this_location()
) = old_THIS; } while (0); mdc_local_wipe (__xl, __local); } while
(0)
;
1689
1690 return 0;
1691
1692uncached:
1693 STACK_WIND (frame, mdc_getxattr_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 1695, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->getxattr_cbk) tmp_cbk = mdc_getxattr_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->getxattr"
; _new->unwind_to = "mdc_getxattr_cbk"; pthread_spin_init (
&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->getxattr); (this->children->xlator
)->fops->getxattr (_new, (this->children->xlator)
, loc, key, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
1694 FIRST_CHILD(this), FIRST_CHILD(this)->fops->getxattr,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 1695, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->getxattr_cbk) tmp_cbk = mdc_getxattr_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->getxattr"
; _new->unwind_to = "mdc_getxattr_cbk"; pthread_spin_init (
&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->getxattr); (this->children->xlator
)->fops->getxattr (_new, (this->children->xlator)
, loc, key, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
1695 loc, key, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 1695, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->getxattr_cbk) tmp_cbk = mdc_getxattr_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->getxattr"
; _new->unwind_to = "mdc_getxattr_cbk"; pthread_spin_init (
&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->getxattr); (this->children->xlator
)->fops->getxattr (_new, (this->children->xlator)
, loc, key, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
;
1696 return 0;
1697}
1698
1699
1700int
1701mdc_fgetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
1702 int32_t op_ret, int32_t op_errno, dict_t *xattr,
1703 dict_t *xdata)
1704{
1705 mdc_local_t *local = NULL((void*)0);
1706
1707 if (op_ret != 0)
1708 goto out;
1709
1710 local = frame->local;
1711 if (!local)
1712 goto out;
1713
1714 mdc_inode_xatt_update (this, local->fd->inode, xattr);
1715
1716out:
1717 MDC_STACK_UNWIND (fgetxattr, frame, op_ret, op_errno, xattr, xdata)do { mdc_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_fgetxattr_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "md-cache.c", __FUNCTION__
, 1717, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_fgetxattr_cbk_t )frame->ret; _parent = frame->parent
; pthread_spin_lock (&frame->root->stack_lock); { _parent
->ref_count--; } pthread_spin_unlock (&frame->root->
stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, op_ret, op_errno, xattr, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0); mdc_local_wipe (__xl, __local); }
while (0)
;
1718
1719 return 0;
1720}
1721
1722
1723int
1724mdc_fgetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd, const char *key,
1725 dict_t *xdata)
1726{
1727 int ret;
1728 mdc_local_t *local = NULL((void*)0);
1729 dict_t *xattr = NULL((void*)0);
1730
1731 local = mdc_local_get (frame);
1732 if (!local)
1733 goto uncached;
1734
1735 local->fd = fd_ref (fd);
1736
1737 if (!is_mdc_key_satisfied (key))
1738 goto uncached;
1739
1740 ret = mdc_inode_xatt_get (this, fd->inode, &xattr);
1741 if (ret != 0)
1742 goto uncached;
1743
1744 if (!dict_get (xattr, (char *)key))
1745 goto uncached;
1746
1747 MDC_STACK_UNWIND (fgetxattr, frame, 0, 0, xattr, xdata)do { mdc_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_fgetxattr_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "md-cache.c", __FUNCTION__
, 1747, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_fgetxattr_cbk_t )frame->ret; _parent = frame->parent
; pthread_spin_lock (&frame->root->stack_lock); { _parent
->ref_count--; } pthread_spin_unlock (&frame->root->
stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, 0, 0, xattr, xdata); (*__glusterfs_this_location()
) = old_THIS; } while (0); mdc_local_wipe (__xl, __local); } while
(0)
;
1748
1749 return 0;
1750
1751uncached:
1752 STACK_WIND (frame, mdc_fgetxattr_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", "md-cache.c", __FUNCTION__, 1754, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->fgetxattr_cbk) tmp_cbk = mdc_fgetxattr_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->fgetxattr"
; _new->unwind_to = "mdc_fgetxattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->fgetxattr); (this->children->
xlator)->fops->fgetxattr (_new, (this->children->
xlator), fd, key, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
1753 FIRST_CHILD(this), FIRST_CHILD(this)->fops->fgetxattr,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 1754, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->fgetxattr_cbk) tmp_cbk = mdc_fgetxattr_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->fgetxattr"
; _new->unwind_to = "mdc_fgetxattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->fgetxattr); (this->children->
xlator)->fops->fgetxattr (_new, (this->children->
xlator), fd, key, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
1754 fd, key, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 1754, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->fgetxattr_cbk) tmp_cbk = mdc_fgetxattr_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->fgetxattr"
; _new->unwind_to = "mdc_fgetxattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->fgetxattr); (this->children->
xlator)->fops->fgetxattr (_new, (this->children->
xlator), fd, key, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
;
1755 return 0;
1756}
1757
1758
1759int
1760mdc_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
1761 int op_ret, int op_errno, gf_dirent_t *entries, dict_t *xdata)
1762{
1763 gf_dirent_t *entry = NULL((void*)0);
1764
1765 if (op_ret <= 0)
1766 goto unwind;
1767
1768 list_for_each_entry (entry, &entries->list, list)for (entry = ((typeof(*entry) *)((char *)((&entries->list
)->next)-(unsigned long)(&((typeof(*entry) *)0)->list
))); &entry->list != (&entries->list); entry = (
(typeof(*entry) *)((char *)(entry->list.next)-(unsigned long
)(&((typeof(*entry) *)0)->list))))
{
1769 if (!entry->inode)
1770 continue;
1771 mdc_inode_iatt_set (this, entry->inode, &entry->d_stat);
1772 mdc_inode_xatt_set (this, entry->inode, entry->dict);
1773 }
1774
1775unwind:
1776 STACK_UNWIND_STRICT (readdirp, frame, op_ret, op_errno, entries, xdata)do { fop_readdirp_cbk_t fn = ((void*)0); call_frame_t *_parent
= ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) {
do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack"
, "md-cache.c", __FUNCTION__, 1776, GF_LOG_CRITICAL, "!frame"
); } while (0); break; } fn = (fop_readdirp_cbk_t )frame->
ret; _parent = frame->parent; pthread_spin_lock (&frame
->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock
(&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = _parent->this; frame
->complete = _gf_true; frame->unwind_from = __FUNCTION__
; if (frame->this->ctx->measure_latency) gf_latency_end
(frame); fn (_parent, frame->cookie, _parent->this, op_ret
, op_errno, entries, xdata); (*__glusterfs_this_location()) =
old_THIS; } while (0)
;
1777 return 0;
1778}
1779
1780
1781int
1782mdc_readdirp (call_frame_t *frame, xlator_t *this, fd_t *fd,
1783 size_t size, off_t offset, dict_t *xdata)
1784{
1785 STACK_WIND (frame, mdc_readdirp_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 1787, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->readdirp_cbk) tmp_cbk = mdc_readdirp_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD (this)->fops->readdirp"
; _new->unwind_to = "mdc_readdirp_cbk"; pthread_spin_init (
&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->readdirp); (this->children->xlator
)->fops->readdirp (_new, (this->children->xlator)
, fd, size, offset, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
1786 FIRST_CHILD (this), FIRST_CHILD (this)->fops->readdirp,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 1787, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->readdirp_cbk) tmp_cbk = mdc_readdirp_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD (this)->fops->readdirp"
; _new->unwind_to = "mdc_readdirp_cbk"; pthread_spin_init (
&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->readdirp); (this->children->xlator
)->fops->readdirp (_new, (this->children->xlator)
, fd, size, offset, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
1787 fd, size, offset, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 1787, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->readdirp_cbk) tmp_cbk = mdc_readdirp_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD (this)->fops->readdirp"
; _new->unwind_to = "mdc_readdirp_cbk"; pthread_spin_init (
&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->readdirp); (this->children->xlator
)->fops->readdirp (_new, (this->children->xlator)
, fd, size, offset, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
;
1788 return 0;
1789}
1790
1791int
1792mdc_readdir_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int op_ret,
1793 int op_errno, gf_dirent_t *entries, dict_t *xdata)
1794{
1795 STACK_UNWIND_STRICT (readdir, frame, op_ret, op_errno, entries, xdata)do { fop_readdir_cbk_t fn = ((void*)0); call_frame_t *_parent
= ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) {
do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack"
, "md-cache.c", __FUNCTION__, 1795, GF_LOG_CRITICAL, "!frame"
); } while (0); break; } fn = (fop_readdir_cbk_t )frame->ret
; _parent = frame->parent; pthread_spin_lock (&frame->
root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock
(&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = _parent->this; frame
->complete = _gf_true; frame->unwind_from = __FUNCTION__
; if (frame->this->ctx->measure_latency) gf_latency_end
(frame); fn (_parent, frame->cookie, _parent->this, op_ret
, op_errno, entries, xdata); (*__glusterfs_this_location()) =
old_THIS; } while (0)
;
1796 return 0;
1797}
1798
1799int
1800mdc_readdir (call_frame_t *frame, xlator_t *this, fd_t *fd,
1801 size_t size, off_t offset, dict_t *xdata)
1802{
1803 int need_unref = 0;
1804 struct mdc_conf *conf = this->private;
1805
1806 if (!conf->force_readdirp) {
1807 STACK_WIND(frame, mdc_readdir_cbk, FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 1809, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->readdir_cbk) tmp_cbk = mdc_readdir_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->readdir"
; _new->unwind_to = "mdc_readdir_cbk"; pthread_spin_init (
&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->readdir); (this->children->xlator
)->fops->readdir (_new, (this->children->xlator),
fd, size, offset, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
1808 FIRST_CHILD(this)->fops->readdir, fd, size, offset,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 1809, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->readdir_cbk) tmp_cbk = mdc_readdir_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->readdir"
; _new->unwind_to = "mdc_readdir_cbk"; pthread_spin_init (
&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->readdir); (this->children->xlator
)->fops->readdir (_new, (this->children->xlator),
fd, size, offset, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
1809 xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 1809, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->readdir_cbk) tmp_cbk = mdc_readdir_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->readdir"
; _new->unwind_to = "mdc_readdir_cbk"; pthread_spin_init (
&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->readdir); (this->children->xlator
)->fops->readdir (_new, (this->children->xlator),
fd, size, offset, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
;
1810 return 0;
1811 }
1812
1813 if (!xdata) {
1814 xdata = dict_new ();
1815 need_unref = 1;
1816 }
1817
1818 if (xdata)
1819 mdc_load_reqs (this, xdata);
1820
1821 STACK_WIND(frame, mdc_readdirp_cbk, FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 1823, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->readdirp_cbk) tmp_cbk = mdc_readdirp_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->readdirp"
; _new->unwind_to = "mdc_readdirp_cbk"; pthread_spin_init (
&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->readdirp); (this->children->xlator
)->fops->readdirp (_new, (this->children->xlator)
, fd, size, offset, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
1822 FIRST_CHILD(this)->fops->readdirp, fd, size, offset,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 1823, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->readdirp_cbk) tmp_cbk = mdc_readdirp_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->readdirp"
; _new->unwind_to = "mdc_readdirp_cbk"; pthread_spin_init (
&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->readdirp); (this->children->xlator
)->fops->readdirp (_new, (this->children->xlator)
, fd, size, offset, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
1823 xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "md-cache.c", __FUNCTION__, 1823, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->readdirp_cbk) tmp_cbk = mdc_readdirp_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->readdirp"
; _new->unwind_to = "mdc_readdirp_cbk"; pthread_spin_init (
&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->readdirp); (this->children->xlator
)->fops->readdirp (_new, (this->children->xlator)
, fd, size, offset, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
;
1824
1825 if (need_unref && xdata)
1826 dict_unref (xdata);
1827
1828 return 0;
1829}
1830
1831
1832int
1833mdc_forget (xlator_t *this, inode_t *inode)
1834{
1835 mdc_inode_wipe (this, inode);
1836
1837 return 0;
1838}
1839
1840
1841int
1842is_strpfx (const char *str1, const char *str2)
1843{
1844 /* is one of the string a prefix of the other? */
1845 int i;
1846
1847 for (i = 0; str1[i] == str2[i]; i++) {
1848 if (!str1[i] || !str2[i])
1849 break;
1850 }
1851
1852 return !(str1[i] && str2[i]);
1853}
1854
1855
1856int
1857mdc_key_load_set (struct mdc_key *keys, char *pattern, gf_boolean_t val)
1858{
1859 struct mdc_key *key = NULL((void*)0);
1860
1861 for (key = keys; key->name; key++) {
1862 if (is_strpfx (key->name, pattern))
1863 key->load = val;
1864 }
1865
1866 return 0;
1867}
1868
1869
1870int
1871reconfigure (xlator_t *this, dict_t *options)
1872{
1873 struct mdc_conf *conf = NULL((void*)0);
1874
1875 conf = this->private;
1876
1877 GF_OPTION_RECONF ("md-cache-timeout", conf->timeout, options, int32, out)do { int val_ret = 0; val_ret = xlator_option_reconf_int32 ((
*__glusterfs_this_location()), options, "md-cache-timeout", &
(conf->timeout)); if (val_ret) goto out; } while (0)
;
1878
1879 GF_OPTION_RECONF ("cache-selinux", conf->cache_selinux, options, bool, out)do { int val_ret = 0; val_ret = xlator_option_reconf_bool ((*
__glusterfs_this_location()), options, "cache-selinux", &
(conf->cache_selinux)); if (val_ret) goto out; } while (0)
;
1880 mdc_key_load_set (mdc_keys, "security.", conf->cache_selinux);
1881
1882 GF_OPTION_RECONF ("cache-posix-acl", conf->cache_posix_acl, options, bool, out)do { int val_ret = 0; val_ret = xlator_option_reconf_bool ((*
__glusterfs_this_location()), options, "cache-posix-acl", &
(conf->cache_posix_acl)); if (val_ret) goto out; } while (
0)
;
1883 mdc_key_load_set (mdc_keys, "system.posix_acl_", conf->cache_posix_acl);
1884
1885 GF_OPTION_RECONF("force-readdirp", conf->force_readdirp, options, bool, out)do { int val_ret = 0; val_ret = xlator_option_reconf_bool ((*
__glusterfs_this_location()), options, "force-readdirp", &
(conf->force_readdirp)); if (val_ret) goto out; } while (0
)
;
1886
1887out:
1888 return 0;
1889}
1890
1891int32_t
1892mem_acct_init (xlator_t *this)
1893{
1894 int ret = -1;
1895
1896 ret = xlator_mem_acct_init (this, gf_mdc_mt_end + 1);
1897 return ret;
1898}
1899
1900int
1901init (xlator_t *this)
1902{
1903 struct mdc_conf *conf = NULL((void*)0);
1904
1905 conf = GF_CALLOC (sizeof (*conf), 1, gf_mdc_mt_mdc_conf_t)__gf_calloc (sizeof (*conf), 1, gf_mdc_mt_mdc_conf_t);
1906 if (!conf) {
1907 gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("out of memory"); } while (0); _gf_log
(this->name, "md-cache.c", __FUNCTION__, 1908, GF_LOG_ERROR
, "out of memory"); } while (0)
1908 "out of memory")do { do { if (0) printf ("out of memory"); } while (0); _gf_log
(this->name, "md-cache.c", __FUNCTION__, 1908, GF_LOG_ERROR
, "out of memory"); } while (0)
;
1909 return -1;
1910 }
1911
1912 GF_OPTION_INIT ("md-cache-timeout", conf->timeout, int32, out)do { int val_ret = 0; val_ret = xlator_option_init_int32 ((*__glusterfs_this_location
()), (*__glusterfs_this_location())->options, "md-cache-timeout"
, &(conf->timeout)); if (val_ret) goto out; } while (0
)
;
1913
1914 GF_OPTION_INIT ("cache-selinux", conf->cache_selinux, bool, out)do { int val_ret = 0; val_ret = xlator_option_init_bool ((*__glusterfs_this_location
()), (*__glusterfs_this_location())->options, "cache-selinux"
, &(conf->cache_selinux)); if (val_ret) goto out; } while
(0)
;
1915 mdc_key_load_set (mdc_keys, "security.", conf->cache_selinux);
1916
1917 GF_OPTION_INIT ("cache-posix-acl", conf->cache_posix_acl, bool, out)do { int val_ret = 0; val_ret = xlator_option_init_bool ((*__glusterfs_this_location
()), (*__glusterfs_this_location())->options, "cache-posix-acl"
, &(conf->cache_posix_acl)); if (val_ret) goto out; } while
(0)
;
1918 mdc_key_load_set (mdc_keys, "system.posix_acl_", conf->cache_posix_acl);
1919
1920 GF_OPTION_INIT("force-readdirp", conf->force_readdirp, bool, out)do { int val_ret = 0; val_ret = xlator_option_init_bool ((*__glusterfs_this_location
()), (*__glusterfs_this_location())->options, "force-readdirp"
, &(conf->force_readdirp)); if (val_ret) goto out; } while
(0)
;
1921out:
1922 this->private = conf;
1923
1924 return 0;
1925}
1926
1927
1928void
1929fini (xlator_t *this)
1930{
1931 return;
1932}
1933
1934
1935struct xlator_fops fops = {
1936 .lookup = mdc_lookup,
1937 .stat = mdc_stat,
1938 .fstat = mdc_fstat,
1939 .truncate = mdc_truncate,
1940 .ftruncate = mdc_ftruncate,
1941 .mknod = mdc_mknod,
1942 .mkdir = mdc_mkdir,
1943 .unlink = mdc_unlink,
1944 .rmdir = mdc_rmdir,
1945 .symlink = mdc_symlink,
1946 .rename = mdc_rename,
1947 .link = mdc_link,
1948 .create = mdc_create,
1949 .readv = mdc_readv,
1950 .writev = mdc_writev,
1951 .setattr = mdc_setattr,
1952 .fsetattr = mdc_fsetattr,
1953 .fsync = mdc_fsync,
1954 .setxattr = mdc_setxattr,
1955 .fsetxattr = mdc_fsetxattr,
1956 .getxattr = mdc_getxattr,
1957 .fgetxattr = mdc_fgetxattr,
1958 .readdirp = mdc_readdirp,
1959 .readdir = mdc_readdir
1960};
1961
1962
1963struct xlator_cbks cbks = {
1964 .forget = mdc_forget,
1965};
1966
1967struct volume_options options[] = {
1968 { .key = {"cache-selinux"},
1969 .type = GF_OPTION_TYPE_BOOL,
1970 .default_value = "false",
1971 },
1972 { .key = {"cache-posix-acl"},
1973 .type = GF_OPTION_TYPE_BOOL,
1974 .default_value = "false",
1975 },
1976 { .key = {"md-cache-timeout"},
1977 .type = GF_OPTION_TYPE_INT,
1978 .min = 0,
1979 .max = 60,
1980 .default_value = "1",
1981 .description = "Time period after which cache has to be refreshed",
1982 },
1983 { .key = {"force-readdirp"},
1984 .type = GF_OPTION_TYPE_BOOL,
1985 .default_value = "true",
1986 .description = "Convert all readdir requests to readdirplus to "
1987 "collect stat info on each entry.",
1988 },
1989};