1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
|
/*
Copyright (c) 2016 Red Hat, Inc. <http://www.redhat.com>
This file is part of GlusterFS.
This file is licensed to you under your choice of the GNU Lesser
General Public License, version 3 or any later version (LGPLv3 or
later), or the GNU General Public License, version 2 (GPLv2), in all
cases as published by the Free Software Foundation.
*/
#include "decompounder.h"
#include <glusterfs/mem-types.h>
#include <glusterfs/compound-fop-utils.h>
void
dc_local_cleanup(dc_local_t *local)
{
compound_args_cbk_cleanup(local->compound_rsp);
return;
}
int32_t
dc_stat_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret,
int32_t op_errno, struct iatt *buf, dict_t *xdata)
{
DC_FOP_RESPONSE_STORE_AND_WIND_NEXT(stat, frame, op_ret, op_errno, buf,
xdata);
return 0;
}
int32_t
dc_readlink_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, const char *path,
struct iatt *buf, dict_t *xdata)
{
DC_FOP_RESPONSE_STORE_AND_WIND_NEXT(readlink, frame, op_ret, op_errno, path,
buf, xdata);
return 0;
}
int32_t
dc_mknod_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret,
int32_t op_errno, inode_t *inode, struct iatt *buf,
struct iatt *preparent, struct iatt *postparent, dict_t *xdata)
{
DC_FOP_RESPONSE_STORE_AND_WIND_NEXT(mknod, frame, op_ret, op_errno, inode,
buf, preparent, postparent, xdata);
return 0;
}
int32_t
dc_mkdir_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret,
int32_t op_errno, inode_t *inode, struct iatt *buf,
struct iatt *preparent, struct iatt *postparent, dict_t *xdata)
{
DC_FOP_RESPONSE_STORE_AND_WIND_NEXT(mkdir, frame, op_ret, op_errno, inode,
buf, preparent, postparent, xdata);
return 0;
}
int32_t
dc_unlink_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret,
int32_t op_errno, struct iatt *preparent, struct iatt *postparent,
dict_t *xdata)
{
DC_FOP_RESPONSE_STORE_AND_WIND_NEXT(unlink, frame, op_ret, op_errno,
preparent, postparent, xdata);
return 0;
}
int32_t
dc_rmdir_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret,
int32_t op_errno, struct iatt *preparent, struct iatt *postparent,
dict_t *xdata)
{
DC_FOP_RESPONSE_STORE_AND_WIND_NEXT(rmdir, frame, op_ret, op_errno,
preparent, postparent, xdata);
return 0;
}
int32_t
dc_symlink_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, inode_t *inode,
struct iatt *buf, struct iatt *preparent,
struct iatt *postparent, dict_t *xdata)
{
DC_FOP_RESPONSE_STORE_AND_WIND_NEXT(symlink, frame, op_ret, op_errno, inode,
buf, preparent, postparent, xdata);
return 0;
}
int32_t
dc_rename_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret,
int32_t op_errno, struct iatt *buf, struct iatt *preoldparent,
struct iatt *postoldparent, struct iatt *prenewparent,
struct iatt *postnewparent, dict_t *xdata)
{
DC_FOP_RESPONSE_STORE_AND_WIND_NEXT(rename, frame, op_ret, op_errno, buf,
preoldparent, postoldparent,
prenewparent, postnewparent, xdata);
return 0;
}
int32_t
dc_link_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret,
int32_t op_errno, inode_t *inode, struct iatt *buf,
struct iatt *preparent, struct iatt *postparent, dict_t *xdata)
{
DC_FOP_RESPONSE_STORE_AND_WIND_NEXT(link, frame, op_ret, op_errno, inode,
buf, preparent, postparent, xdata);
return 0;
}
int32_t
dc_truncate_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct iatt *prebuf,
struct iatt *postbuf, dict_t *xdata)
{
DC_FOP_RESPONSE_STORE_AND_WIND_NEXT(truncate, frame, op_ret, op_errno,
prebuf, postbuf, xdata);
return 0;
}
int32_t
dc_open_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret,
int32_t op_errno, fd_t *fd, dict_t *xdata)
{
DC_FOP_RESPONSE_STORE_AND_WIND_NEXT(open, frame, op_ret, op_errno, fd,
xdata);
return 0;
}
int32_t
dc_readv_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret,
int32_t op_errno, struct iovec *vector, int32_t count,
struct iatt *stbuf, struct iobref *iobref, dict_t *xdata)
{
DC_FOP_RESPONSE_STORE_AND_WIND_NEXT(readv, frame, op_ret, op_errno, vector,
count, stbuf, iobref, xdata);
return 0;
}
int32_t
dc_writev_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret,
int32_t op_errno, struct iatt *prebuf, struct iatt *postbuf,
dict_t *xdata)
{
DC_FOP_RESPONSE_STORE_AND_WIND_NEXT(writev, frame, op_ret, op_errno, prebuf,
postbuf, xdata);
return 0;
}
int32_t
dc_statfs_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret,
int32_t op_errno, struct statvfs *buf, dict_t *xdata)
{
DC_FOP_RESPONSE_STORE_AND_WIND_NEXT(statfs, frame, op_ret, op_errno, buf,
xdata);
return 0;
}
int32_t
dc_flush_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret,
int32_t op_errno, dict_t *xdata)
{
DC_FOP_RESPONSE_STORE_AND_WIND_NEXT(flush, frame, op_ret, op_errno, xdata);
return 0;
}
int32_t
dc_fsync_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret,
int32_t op_errno, struct iatt *prebuf, struct iatt *postbuf,
dict_t *xdata)
{
DC_FOP_RESPONSE_STORE_AND_WIND_NEXT(fsync, frame, op_ret, op_errno, prebuf,
postbuf, xdata);
return 0;
}
int32_t
dc_setxattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
DC_FOP_RESPONSE_STORE_AND_WIND_NEXT(setxattr, frame, op_ret, op_errno,
xdata);
return 0;
}
int32_t
dc_getxattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *dict, dict_t *xdata)
{
DC_FOP_RESPONSE_STORE_AND_WIND_NEXT(getxattr, frame, op_ret, op_errno, dict,
xdata);
return 0;
}
int32_t
dc_removexattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
DC_FOP_RESPONSE_STORE_AND_WIND_NEXT(removexattr, frame, op_ret, op_errno,
xdata);
return 0;
}
int32_t
dc_opendir_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, fd_t *fd, dict_t *xdata)
{
DC_FOP_RESPONSE_STORE_AND_WIND_NEXT(opendir, frame, op_ret, op_errno, fd,
xdata);
return 0;
}
int32_t
dc_fsyncdir_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
DC_FOP_RESPONSE_STORE_AND_WIND_NEXT(fsyncdir, frame, op_ret, op_errno,
xdata);
return 0;
}
int32_t
dc_access_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret,
int32_t op_errno, dict_t *xdata)
{
DC_FOP_RESPONSE_STORE_AND_WIND_NEXT(access, frame, op_ret, op_errno, xdata);
return 0;
}
int32_t
dc_create_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret,
int32_t op_errno, fd_t *fd, inode_t *inode, struct iatt *buf,
struct iatt *preparent, struct iatt *postparent, dict_t *xdata)
{
DC_FOP_RESPONSE_STORE_AND_WIND_NEXT(create, frame, op_ret, op_errno, fd,
inode, buf, preparent, postparent,
xdata);
return 0;
}
int32_t
dc_ftruncate_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct iatt *prebuf,
struct iatt *postbuf, dict_t *xdata)
{
DC_FOP_RESPONSE_STORE_AND_WIND_NEXT(ftruncate, frame, op_ret, op_errno,
prebuf, postbuf, xdata);
return 0;
}
int32_t
dc_fstat_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret,
int32_t op_errno, struct iatt *buf, dict_t *xdata)
{
DC_FOP_RESPONSE_STORE_AND_WIND_NEXT(fstat, frame, op_ret, op_errno, buf,
xdata);
return 0;
}
int32_t
dc_lk_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret,
int32_t op_errno, struct gf_flock *lock, dict_t *xdata)
{
DC_FOP_RESPONSE_STORE_AND_WIND_NEXT(lk, frame, op_ret, op_errno, lock,
xdata);
return 0;
}
int32_t
dc_lookup_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret,
int32_t op_errno, inode_t *inode, struct iatt *buf, dict_t *xdata,
struct iatt *postparent)
{
DC_FOP_RESPONSE_STORE_AND_WIND_NEXT(lookup, frame, op_ret, op_errno, inode,
buf, xdata, postparent);
return 0;
}
int32_t
dc_readdir_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, gf_dirent_t *entries,
dict_t *xdata)
{
DC_FOP_RESPONSE_STORE_AND_WIND_NEXT(readdir, frame, op_ret, op_errno,
entries, xdata);
return 0;
}
int32_t
dc_inodelk_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
DC_FOP_RESPONSE_STORE_AND_WIND_NEXT(inodelk, frame, op_ret, op_errno,
xdata);
return 0;
}
int32_t
dc_finodelk_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
DC_FOP_RESPONSE_STORE_AND_WIND_NEXT(finodelk, frame, op_ret, op_errno,
xdata);
return 0;
}
int32_t
dc_entrylk_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
DC_FOP_RESPONSE_STORE_AND_WIND_NEXT(entrylk, frame, op_ret, op_errno,
xdata);
return 0;
}
int32_t
dc_fentrylk_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
DC_FOP_RESPONSE_STORE_AND_WIND_NEXT(fentrylk, frame, op_ret, op_errno,
xdata);
return 0;
}
int32_t
dc_xattrop_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *dict, dict_t *xdata)
{
DC_FOP_RESPONSE_STORE_AND_WIND_NEXT(xattrop, frame, op_ret, op_errno, dict,
xdata);
return 0;
}
int32_t
dc_fxattrop_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *dict, dict_t *xdata)
{
DC_FOP_RESPONSE_STORE_AND_WIND_NEXT(fxattrop, frame, op_ret, op_errno, dict,
xdata);
return 0;
}
int32_t
dc_fgetxattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *dict, dict_t *xdata)
{
DC_FOP_RESPONSE_STORE_AND_WIND_NEXT(fgetxattr, frame, op_ret, op_errno,
dict, xdata);
return 0;
}
int32_t
dc_fsetxattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
DC_FOP_RESPONSE_STORE_AND_WIND_NEXT(fsetxattr, frame, op_ret, op_errno,
xdata);
return 0;
}
int32_t
dc_rchecksum_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, uint32_t weak_cksum,
uint8_t *strong_cksum, dict_t *xdata)
{
DC_FOP_RESPONSE_STORE_AND_WIND_NEXT(rchecksum, frame, op_ret, op_errno,
weak_cksum, strong_cksum, xdata);
return 0;
}
int32_t
dc_setattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct iatt *statpre,
struct iatt *statpost, dict_t *xdata)
{
DC_FOP_RESPONSE_STORE_AND_WIND_NEXT(setattr, frame, op_ret, op_errno,
statpre, statpost, xdata);
return 0;
}
int32_t
dc_fsetattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct iatt *statpre,
struct iatt *statpost, dict_t *xdata)
{
DC_FOP_RESPONSE_STORE_AND_WIND_NEXT(fsetattr, frame, op_ret, op_errno,
statpre, statpost, xdata);
return 0;
}
int32_t
dc_readdirp_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, gf_dirent_t *entries,
dict_t *xdata)
{
DC_FOP_RESPONSE_STORE_AND_WIND_NEXT(readdirp, frame, op_ret, op_errno,
entries, xdata);
return 0;
}
int32_t
dc_fremovexattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
DC_FOP_RESPONSE_STORE_AND_WIND_NEXT(fremovexattr, frame, op_ret, op_errno,
xdata);
return 0;
}
int32_t
dc_fallocate_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct iatt *pre,
struct iatt *post, dict_t *xdata)
{
DC_FOP_RESPONSE_STORE_AND_WIND_NEXT(fallocate, frame, op_ret, op_errno, pre,
post, xdata);
return 0;
}
int32_t
dc_discard_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct iatt *pre,
struct iatt *post, dict_t *xdata)
{
DC_FOP_RESPONSE_STORE_AND_WIND_NEXT(discard, frame, op_ret, op_errno, pre,
post, xdata);
return 0;
}
int32_t
dc_zerofill_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct iatt *pre,
struct iatt *post, dict_t *xdata)
{
DC_FOP_RESPONSE_STORE_AND_WIND_NEXT(zerofill, frame, op_ret, op_errno, pre,
post, xdata);
return 0;
}
int32_t
dc_ipc_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret,
int32_t op_errno, dict_t *xdata)
{
DC_FOP_RESPONSE_STORE_AND_WIND_NEXT(ipc, frame, op_ret, op_errno, xdata);
return 0;
}
int32_t
dc_seek_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret,
int32_t op_errno, off_t offset, dict_t *xdata)
{
DC_FOP_RESPONSE_STORE_AND_WIND_NEXT(seek, frame, op_ret, op_errno, offset,
xdata);
return 0;
}
int32_t
dc_compound_fop_wind(call_frame_t *frame, xlator_t *this)
{
dc_local_t *local = frame->local;
compound_args_t *c_req = local->compound_req;
compound_args_cbk_t *c_rsp = local->compound_rsp;
int counter = local->counter;
default_args_t *curr_fop = &c_req->req_list[counter];
int op_ret = 0;
int op_errno = ENOMEM;
if (local->counter == local->length)
goto done;
c_rsp->enum_list[counter] = c_req->enum_list[counter];
switch (c_req->enum_list[counter]) {
case GF_FOP_STAT:
STACK_WIND(frame, dc_stat_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->stat, &curr_fop->loc,
curr_fop->xdata);
break;
case GF_FOP_READLINK:
STACK_WIND(frame, dc_readlink_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->readlink, &curr_fop->loc,
curr_fop->size, curr_fop->xdata);
break;
case GF_FOP_MKNOD:
STACK_WIND(frame, dc_mknod_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->mknod, &curr_fop->loc,
curr_fop->mode, curr_fop->rdev, curr_fop->umask,
curr_fop->xdata);
break;
case GF_FOP_MKDIR:
STACK_WIND(frame, dc_mkdir_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->mkdir, &curr_fop->loc,
curr_fop->mode, curr_fop->umask, curr_fop->xdata);
break;
case GF_FOP_UNLINK:
STACK_WIND(frame, dc_unlink_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->unlink, &curr_fop->loc,
curr_fop->xflag, curr_fop->xdata);
break;
case GF_FOP_RMDIR:
STACK_WIND(frame, dc_rmdir_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->rmdir, &curr_fop->loc,
curr_fop->flags, curr_fop->xdata);
break;
case GF_FOP_SYMLINK:
STACK_WIND(frame, dc_symlink_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->symlink, curr_fop->linkname,
&curr_fop->loc, curr_fop->umask, curr_fop->xdata);
break;
case GF_FOP_RENAME:
STACK_WIND(frame, dc_rename_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->rename, &curr_fop->loc,
&curr_fop->loc2, curr_fop->xdata);
break;
case GF_FOP_LINK:
STACK_WIND(frame, dc_link_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->link, &curr_fop->loc,
&curr_fop->loc2, curr_fop->xdata);
break;
case GF_FOP_TRUNCATE:
STACK_WIND(frame, dc_truncate_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->truncate, &curr_fop->loc,
curr_fop->offset, curr_fop->xdata);
break;
case GF_FOP_OPEN:
STACK_WIND(frame, dc_open_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->open, &curr_fop->loc,
curr_fop->flags, curr_fop->fd, curr_fop->xdata);
break;
case GF_FOP_READ:
STACK_WIND(frame, dc_readv_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->readv, curr_fop->fd,
curr_fop->size, curr_fop->offset, curr_fop->flags,
curr_fop->xdata);
break;
case GF_FOP_WRITE:
STACK_WIND(frame, dc_writev_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->writev, curr_fop->fd,
curr_fop->vector, curr_fop->count, curr_fop->offset,
curr_fop->flags, curr_fop->iobref, curr_fop->xdata);
break;
case GF_FOP_STATFS:
STACK_WIND(frame, dc_statfs_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->statfs, &curr_fop->loc,
curr_fop->xdata);
break;
case GF_FOP_FLUSH:
STACK_WIND(frame, dc_flush_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->flush, curr_fop->fd,
curr_fop->xdata);
break;
case GF_FOP_FSYNC:
STACK_WIND(frame, dc_fsync_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->fsync, curr_fop->fd,
curr_fop->datasync, curr_fop->xdata);
break;
case GF_FOP_SETXATTR:
STACK_WIND(frame, dc_setxattr_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->setxattr, &curr_fop->loc,
curr_fop->xattr, curr_fop->flags, curr_fop->xdata);
break;
case GF_FOP_GETXATTR:
STACK_WIND(frame, dc_getxattr_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->getxattr, &curr_fop->loc,
curr_fop->name, curr_fop->xdata);
break;
case GF_FOP_REMOVEXATTR:
STACK_WIND(frame, dc_removexattr_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->removexattr, &curr_fop->loc,
curr_fop->name, curr_fop->xdata);
break;
case GF_FOP_OPENDIR:
STACK_WIND(frame, dc_opendir_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->opendir, &curr_fop->loc,
curr_fop->fd, curr_fop->xdata);
break;
case GF_FOP_FSYNCDIR:
STACK_WIND(frame, dc_fsyncdir_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->fsyncdir, curr_fop->fd,
curr_fop->datasync, curr_fop->xdata);
break;
case GF_FOP_ACCESS:
STACK_WIND(frame, dc_access_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->access, &curr_fop->loc,
curr_fop->mask, curr_fop->xdata);
break;
case GF_FOP_CREATE:
STACK_WIND(frame, dc_create_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->create, &curr_fop->loc,
curr_fop->flags, curr_fop->mode, curr_fop->umask,
curr_fop->fd, curr_fop->xdata);
break;
case GF_FOP_FTRUNCATE:
STACK_WIND(frame, dc_ftruncate_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->ftruncate, curr_fop->fd,
curr_fop->offset, curr_fop->xdata);
break;
case GF_FOP_FSTAT:
STACK_WIND(frame, dc_fstat_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->fstat, curr_fop->fd,
curr_fop->xdata);
break;
case GF_FOP_LK:
STACK_WIND(frame, dc_lk_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->lk, curr_fop->fd, curr_fop->cmd,
&curr_fop->lock, curr_fop->xdata);
break;
case GF_FOP_LOOKUP:
STACK_WIND(frame, dc_lookup_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->lookup, &curr_fop->loc,
curr_fop->xdata);
break;
case GF_FOP_READDIR:
STACK_WIND(frame, dc_readdir_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->readdir, curr_fop->fd,
curr_fop->size, curr_fop->offset, curr_fop->xdata);
break;
case GF_FOP_INODELK:
STACK_WIND(frame, dc_inodelk_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->inodelk, curr_fop->volume,
&curr_fop->loc, curr_fop->cmd, &curr_fop->lock,
curr_fop->xdata);
break;
case GF_FOP_FINODELK:
STACK_WIND(frame, dc_finodelk_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->finodelk, curr_fop->volume,
curr_fop->fd, curr_fop->cmd, &curr_fop->lock,
curr_fop->xdata);
break;
case GF_FOP_ENTRYLK:
STACK_WIND(frame, dc_entrylk_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->entrylk, curr_fop->volume,
&curr_fop->loc, curr_fop->name, curr_fop->entrylkcmd,
curr_fop->entrylktype, curr_fop->xdata);
break;
case GF_FOP_FENTRYLK:
STACK_WIND(frame, dc_fentrylk_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->fentrylk, curr_fop->volume,
curr_fop->fd, curr_fop->name, curr_fop->entrylkcmd,
curr_fop->entrylktype, curr_fop->xdata);
break;
case GF_FOP_XATTROP:
STACK_WIND(frame, dc_xattrop_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->xattrop, &curr_fop->loc,
curr_fop->optype, curr_fop->xattr, curr_fop->xdata);
break;
case GF_FOP_FXATTROP:
STACK_WIND(frame, dc_fxattrop_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->fxattrop, curr_fop->fd,
curr_fop->optype, curr_fop->xattr, curr_fop->xdata);
break;
case GF_FOP_FGETXATTR:
STACK_WIND(frame, dc_fgetxattr_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->fgetxattr, curr_fop->fd,
curr_fop->name, curr_fop->xdata);
break;
case GF_FOP_FSETXATTR:
STACK_WIND(frame, dc_fsetxattr_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->fsetxattr, curr_fop->fd,
curr_fop->xattr, curr_fop->flags, curr_fop->xdata);
break;
case GF_FOP_RCHECKSUM:
STACK_WIND(frame, dc_rchecksum_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->rchecksum, curr_fop->fd,
curr_fop->offset, curr_fop->size, curr_fop->xdata);
break;
case GF_FOP_SETATTR:
STACK_WIND(frame, dc_setattr_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->setattr, &curr_fop->loc,
&curr_fop->stat, curr_fop->valid, curr_fop->xdata);
break;
case GF_FOP_FSETATTR:
STACK_WIND(frame, dc_fsetattr_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->fsetattr, curr_fop->fd,
&curr_fop->stat, curr_fop->valid, curr_fop->xdata);
break;
case GF_FOP_READDIRP:
STACK_WIND(frame, dc_readdirp_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->readdirp, curr_fop->fd,
curr_fop->size, curr_fop->offset, curr_fop->xdata);
break;
case GF_FOP_FREMOVEXATTR:
STACK_WIND(frame, dc_fremovexattr_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->fremovexattr, curr_fop->fd,
curr_fop->name, curr_fop->xdata);
break;
case GF_FOP_FALLOCATE:
STACK_WIND(frame, dc_fallocate_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->fallocate, curr_fop->fd,
curr_fop->flags, curr_fop->offset, curr_fop->size,
curr_fop->xdata);
break;
case GF_FOP_DISCARD:
STACK_WIND(frame, dc_discard_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->discard, curr_fop->fd,
curr_fop->offset, curr_fop->size, curr_fop->xdata);
break;
case GF_FOP_ZEROFILL:
STACK_WIND(frame, dc_zerofill_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->zerofill, curr_fop->fd,
curr_fop->offset, curr_fop->size, curr_fop->xdata);
break;
case GF_FOP_IPC:
STACK_WIND(frame, dc_ipc_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->ipc, curr_fop->cmd,
curr_fop->xdata);
break;
case GF_FOP_SEEK:
STACK_WIND(frame, dc_seek_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->seek, curr_fop->fd,
curr_fop->offset, curr_fop->what, curr_fop->xdata);
break;
default:
return -ENOTSUP;
}
return 0;
done:
DC_STACK_UNWIND(frame, op_ret, op_errno, c_rsp, NULL);
return 0;
}
int32_t
dc_compound(call_frame_t *frame, xlator_t *this, void *data, dict_t *xdata)
{
compound_args_t *compound_req = NULL;
compound_args_cbk_t *compound_rsp = NULL;
int ret = 0;
int op_errno = ENOMEM;
dc_local_t *local = NULL;
compound_req = data;
GF_ASSERT_AND_GOTO_WITH_ERROR(this, compound_req, out, op_errno, EINVAL);
local = mem_get0(this->local_pool);
if (!local)
goto out;
frame->local = local;
local->compound_rsp = compound_args_cbk_alloc(compound_req->fop_length,
NULL);
if (!local->compound_rsp)
goto out;
compound_rsp = local->compound_rsp;
local->length = compound_req->fop_length;
local->counter = 0;
local->compound_req = compound_req;
if (!local->length) {
op_errno = EINVAL;
goto out;
}
ret = dc_compound_fop_wind(frame, this);
if (ret < 0) {
op_errno = -ret;
goto out;
}
return 0;
out:
DC_STACK_UNWIND(frame, -1, op_errno, compound_rsp, NULL);
return 0;
}
struct xlator_cbks cbks = {};
struct volume_options options[] = {
{.key = {NULL}},
};
struct xlator_fops fops = {
.compound = dc_compound,
};
int32_t
mem_acct_init(xlator_t *this)
{
int ret = -1;
if (!this)
return ret;
ret = xlator_mem_acct_init(this, gf_dc_mt_end + 1);
return ret;
}
int32_t
init(xlator_t *this)
{
int ret = -1;
if (!this->children) {
gf_msg(this->name, GF_LOG_WARNING, 0, DC_MSG_VOL_MISCONFIGURED,
"Decompounder must have"
" a subvol.");
goto out;
}
if (!this->parents) {
gf_msg(this->name, GF_LOG_WARNING, 0, DC_MSG_VOL_MISCONFIGURED,
"Volume is dangling.");
goto out;
}
this->local_pool = mem_pool_new(dc_local_t, 128);
if (!this->local_pool) {
goto out;
}
ret = 0;
out:
return ret;
}
void
fini(xlator_t *this)
{
if (!this)
return;
if (this->local_pool) {
mem_pool_destroy(this->local_pool);
this->local_pool = NULL;
}
return;
}
xlator_api_t xlator_api = {
.init = init,
.fini = fini,
.mem_acct_init = mem_acct_init,
.op_version = {1}, /* Present from the initial version */
.fops = &fops,
.cbks = &cbks,
.options = options,
.identifier = "decompounder",
.category = GF_TECH_PREVIEW,
};
|