46
46
char **pending_key;
48
gf_boolean_t data_self_heal; /* on/off */
48
gf_boolean_t data_self_heal; /* on/off */
49
char * data_self_heal_algorithm; /* name of algorithm */
50
unsigned int data_self_heal_window_size; /* max number of pipelined
53
unsigned int background_self_heal_count;
54
unsigned int background_self_heals_started;
49
55
gf_boolean_t metadata_self_heal; /* on/off */
50
56
gf_boolean_t entry_self_heal; /* on/off */
62
68
unsigned int entry_lock_server_count;
64
70
unsigned int wait_count; /* # of servers to wait for success */
72
uint64_t up_count; /* number of CHILD_UPs we have seen */
73
uint64_t down_count; /* number of CHILD_DOWNs we have seen */
77
/* External interface: These are variables (some optional) that
78
are set by whoever has triggered self-heal */
80
gf_boolean_t need_data_self_heal;
81
gf_boolean_t need_metadata_self_heal;
82
gf_boolean_t need_entry_self_heal;
84
gf_boolean_t forced_merge; /* Is this a self-heal triggered to
85
forcibly merge the directories? */
87
gf_boolean_t healing_fd_opened; /* true if caller has already
90
gf_boolean_t data_lock_held; /* true if caller has already
93
fd_t *healing_fd; /* set if callers has opened fd */
95
gf_boolean_t background; /* do self-heal in background
98
mode_t mode; /* st_mode of the entry we're doing
101
/* Function to call to unwind. If self-heal is being done in the
102
background, this function will be called as soon as possible. */
104
int (*unwind) (call_frame_t *frame, xlator_t *this);
106
/* End of external interface members */
68
109
/* array of stat's, one for each child */
111
struct stat parentbuf;
71
113
/* array of xattr's, one for each child */
142
call_frame_t *orig_frame;
143
gf_boolean_t unwound;
145
/* private data for the particular self-heal algorithm */
148
int (*flush_self_heal_cbk) (call_frame_t *frame, xlator_t *this);
96
150
int (*completion_cbk) (call_frame_t *frame, xlator_t *this);
151
int (*algo_completion_cbk) (call_frame_t *frame, xlator_t *this);
152
int (*algo_abort_cbk) (call_frame_t *frame, xlator_t *this);
97
154
call_frame_t *sh_frame;
98
155
} afr_self_heal_t;
197
AFR_CHILD_DOWN_FLUSH,
138
201
typedef struct _afr_local {
139
202
unsigned int call_count;
140
203
unsigned int success_count;
141
204
unsigned int enoent_count;
143
unsigned int need_metadata_self_heal;
144
unsigned int need_entry_self_heal;
145
unsigned int need_data_self_heal;
146
206
unsigned int govinda_gOvinda;
148
208
unsigned int read_child_index;
279
struct stat read_child_buf;
286
struct stat read_child_buf;
294
struct stat read_child_buf;
302
struct stat read_child_buf;
308
struct stat read_child_buf;
415
struct stat preparent;
416
struct stat postparent;
357
417
struct stat read_child_buf;
428
struct stat preparent;
429
struct stat postparent;
366
430
struct stat read_child_buf;
374
440
struct stat read_child_buf;
441
struct stat preparent;
442
struct stat postparent;
379
448
int32_t op_errno;
449
struct stat preparent;
450
struct stat postparent;
384
456
int32_t op_errno;
457
struct stat preparent;
458
struct stat postparent;
390
466
struct stat read_child_buf;
467
struct stat preoldparent;
468
struct stat prenewparent;
469
struct stat postoldparent;
470
struct stat postnewparent;
397
479
struct stat read_child_buf;
480
struct stat preparent;
481
struct stat postparent;
404
490
struct stat read_child_buf;
492
struct stat preparent;
493
struct stat postparent;
442
530
int (*resume) (call_frame_t *frame, xlator_t *this);
444
532
int (*unwind) (call_frame_t *frame, xlator_t *this);
535
int (*post_post_op) (call_frame_t *frame, xlator_t *this);
447
538
afr_self_heal_t self_heal;
452
unsigned char pre_op_done;
543
unsigned char *pre_op_done;
544
unsigned char *opened_on; /* which subvolumes the fd is open on */
453
545
unsigned char *child_failed;
548
uint64_t up_count; /* number of CHILD_UPs this fd has seen */
549
uint64_t down_count; /* number of CHILD_DOWNs this fd has seen */
507
603
afr_frame_return (call_frame_t *frame);
509
#define AFR_STACK_UNWIND(frame, params ...) \
606
afr_is_split_brain (xlator_t *this, inode_t *inode);
609
afr_set_split_brain (xlator_t *this, inode_t *inode);
612
afr_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags,
613
fd_t *fd, int32_t wbflags);
616
afr_up_down_flush (call_frame_t *frame, xlator_t *this, fd_t *fd, afr_flush_type type);
619
afr_set_opendir_done (xlator_t *this, inode_t *inode);
622
afr_is_opendir_done (xlator_t *this, inode_t *inode);
625
afr_local_transaction_cleanup (afr_local_t *local, xlator_t *this);
627
#define AFR_STACK_UNWIND(fop, frame, params ...) \
511
629
afr_local_t *__local = NULL; \
512
630
xlator_t *__this = NULL; \
513
631
__local = frame->local; \
514
632
__this = frame->this; \
515
633
frame->local = NULL; \
516
STACK_UNWIND (frame, params); \
634
STACK_UNWIND_STRICT (fop, frame, params); \
517
635
afr_local_cleanup (__local, __this); \
518
636
free (__local); \