File: | xlators/debug/io-stats/src/io-stats.c |
Location: | line 2418, column 9 |
Description: | Null pointer passed as an argument to a 'nonnull' parameter |
1 | /* | ||
2 | Copyright (c) 2006-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 | #ifndef _CONFIG_H | ||
11 | #define _CONFIG_H | ||
12 | #include "config.h" | ||
13 | #include "xlator.h" | ||
14 | #endif | ||
15 | |||
16 | /** | ||
17 | * xlators/debug/io_stats : | ||
18 | * This translator maintains statistics of all filesystem activity | ||
19 | * happening through it. The kind of statistics include: | ||
20 | * | ||
21 | * a) total read data - since process start, last interval and per fd | ||
22 | * b) total write data - since process start, last interval and per fd | ||
23 | * c) counts of read IO block size - since process start, last interval and per fd | ||
24 | * d) counts of write IO block size - since process start, last interval and per fd | ||
25 | * e) counts of all FOP types passing through it | ||
26 | * | ||
27 | * Usage: setfattr -n io-stats-dump /tmp/filename /mnt/gluster | ||
28 | * | ||
29 | */ | ||
30 | |||
31 | #include <fnmatch.h> | ||
32 | #include <errno(*__errno_location ()).h> | ||
33 | #include "glusterfs.h" | ||
34 | #include "xlator.h" | ||
35 | #include "io-stats-mem-types.h" | ||
36 | #include <stdarg.h> | ||
37 | #include "defaults.h" | ||
38 | #include "logging.h" | ||
39 | |||
40 | #define MAX_LIST_MEMBERS100 100 | ||
41 | |||
42 | typedef enum { | ||
43 | IOS_STATS_TYPE_NONE, | ||
44 | IOS_STATS_TYPE_OPEN, | ||
45 | IOS_STATS_TYPE_READ, | ||
46 | IOS_STATS_TYPE_WRITE, | ||
47 | IOS_STATS_TYPE_OPENDIR, | ||
48 | IOS_STATS_TYPE_READDIRP, | ||
49 | IOS_STATS_TYPE_READ_THROUGHPUT, | ||
50 | IOS_STATS_TYPE_WRITE_THROUGHPUT, | ||
51 | IOS_STATS_TYPE_MAX | ||
52 | }ios_stats_type_t; | ||
53 | |||
54 | typedef enum { | ||
55 | IOS_STATS_THRU_READ, | ||
56 | IOS_STATS_THRU_WRITE, | ||
57 | IOS_STATS_THRU_MAX, | ||
58 | }ios_stats_thru_t; | ||
59 | |||
60 | struct ios_stat_lat { | ||
61 | struct timeval time; | ||
62 | double throughput; | ||
63 | }; | ||
64 | |||
65 | struct ios_stat { | ||
66 | gf_lock_t lock; | ||
67 | uuid_t gfid; | ||
68 | char *filename; | ||
69 | uint64_t counters [IOS_STATS_TYPE_MAX]; | ||
70 | struct ios_stat_lat thru_counters [IOS_STATS_THRU_MAX]; | ||
71 | int refcnt; | ||
72 | }; | ||
73 | |||
74 | struct ios_stat_list { | ||
75 | struct list_head list; | ||
76 | struct ios_stat *iosstat; | ||
77 | double value; | ||
78 | }; | ||
79 | |||
80 | struct ios_stat_head { | ||
81 | gf_lock_t lock; | ||
82 | double min_cnt; | ||
83 | uint64_t members; | ||
84 | struct ios_stat_list *iosstats; | ||
85 | }; | ||
86 | |||
87 | struct ios_lat { | ||
88 | double min; | ||
89 | double max; | ||
90 | double avg; | ||
91 | }; | ||
92 | |||
93 | struct ios_global_stats { | ||
94 | uint64_t data_written; | ||
95 | uint64_t data_read; | ||
96 | uint64_t block_count_write[32]; | ||
97 | uint64_t block_count_read[32]; | ||
98 | uint64_t fop_hits[GF_FOP_MAXVALUE]; | ||
99 | struct timeval started_at; | ||
100 | struct ios_lat latency[GF_FOP_MAXVALUE]; | ||
101 | uint64_t nr_opens; | ||
102 | uint64_t max_nr_opens; | ||
103 | struct timeval max_openfd_time; | ||
104 | }; | ||
105 | |||
106 | |||
107 | struct ios_conf { | ||
108 | gf_lock_t lock; | ||
109 | struct ios_global_stats cumulative; | ||
110 | uint64_t increment; | ||
111 | struct ios_global_stats incremental; | ||
112 | gf_boolean_t dump_fd_stats; | ||
113 | gf_boolean_t count_fop_hits; | ||
114 | gf_boolean_t measure_latency; | ||
115 | struct ios_stat_head list[IOS_STATS_TYPE_MAX]; | ||
116 | struct ios_stat_head thru_list[IOS_STATS_THRU_MAX]; | ||
117 | }; | ||
118 | |||
119 | |||
120 | struct ios_fd { | ||
121 | char *filename; | ||
122 | uint64_t data_written; | ||
123 | uint64_t data_read; | ||
124 | uint64_t block_count_write[32]; | ||
125 | uint64_t block_count_read[32]; | ||
126 | struct timeval opened_at; | ||
127 | }; | ||
128 | |||
129 | typedef enum { | ||
130 | IOS_DUMP_TYPE_NONE = 0, | ||
131 | IOS_DUMP_TYPE_FILE = 1, | ||
132 | IOS_DUMP_TYPE_DICT = 2, | ||
133 | IOS_DUMP_TYPE_MAX = 3 | ||
134 | } ios_dump_type_t; | ||
135 | |||
136 | struct ios_dump_args { | ||
137 | ios_dump_type_t type; | ||
138 | union { | ||
139 | FILE *logfp; | ||
140 | dict_t *dict; | ||
141 | } u; | ||
142 | }; | ||
143 | |||
144 | typedef int (*block_dump_func) (xlator_t *, struct ios_dump_args*, | ||
145 | int , int , uint64_t ) ; | ||
146 | |||
147 | struct ios_local { | ||
148 | struct timeval wind_at; | ||
149 | struct timeval unwind_at; | ||
150 | }; | ||
151 | |||
152 | struct volume_options options[]; | ||
153 | |||
154 | inline static int | ||
155 | is_fop_latency_started (call_frame_t *frame) | ||
156 | { | ||
157 | GF_ASSERT (frame)do { if (!(frame)) { do { do { if (0) printf ("Assertion failed: " "frame"); } while (0); _gf_log_callingfn ("", "io-stats.c", __FUNCTION__ , 157, GF_LOG_ERROR, "Assertion failed: " "frame"); } while ( 0); } } while (0); | ||
158 | struct timeval epoch = {0,}; | ||
159 | return memcmp (&frame->begin, &epoch, sizeof (epoch)); | ||
160 | } | ||
161 | |||
162 | #define END_FOP_LATENCY(frame, op)do { struct ios_conf *conf = ((void*)0); conf = this->private ; if (conf && conf->measure_latency) { gettimeofday (&frame->end, ((void*)0)); update_ios_latency (conf, frame , GF_FOP_op); } } while (0) \ | ||
163 | do { \ | ||
164 | struct ios_conf *conf = NULL((void*)0); \ | ||
165 | \ | ||
166 | conf = this->private; \ | ||
167 | if (conf && conf->measure_latency) { \ | ||
168 | gettimeofday (&frame->end, NULL((void*)0)); \ | ||
169 | update_ios_latency (conf, frame, GF_FOP_##op); \ | ||
170 | } \ | ||
171 | } while (0) | ||
172 | |||
173 | #define START_FOP_LATENCY(frame)do { struct ios_conf *conf = ((void*)0); conf = this->private ; if (conf && conf->measure_latency) { gettimeofday (&frame->begin, ((void*)0)); } else { memset (&frame ->begin, 0, sizeof (frame->begin)); } } while (0) \ | ||
174 | do { \ | ||
175 | struct ios_conf *conf = NULL((void*)0); \ | ||
176 | \ | ||
177 | conf = this->private; \ | ||
178 | if (conf && conf->measure_latency) { \ | ||
179 | gettimeofday (&frame->begin, NULL((void*)0)); \ | ||
180 | } else { \ | ||
181 | memset (&frame->begin, 0, sizeof (frame->begin));\ | ||
182 | } \ | ||
183 | } while (0) | ||
184 | |||
185 | |||
186 | #define BUMP_FOP(op)do { struct ios_conf *conf = ((void*)0); conf = this->private ; if (!conf) break; conf->cumulative.fop_hits[GF_FOP_op]++ ; conf->incremental.fop_hits[GF_FOP_op]++; } while (0) \ | ||
187 | do { \ | ||
188 | struct ios_conf *conf = NULL((void*)0); \ | ||
189 | \ | ||
190 | conf = this->private; \ | ||
191 | if (!conf) \ | ||
192 | break; \ | ||
193 | conf->cumulative.fop_hits[GF_FOP_##op]++; \ | ||
194 | conf->incremental.fop_hits[GF_FOP_##op]++; \ | ||
195 | } while (0) | ||
196 | |||
197 | #define UPDATE_PROFILE_STATS(frame, op)do { struct ios_conf *conf = ((void*)0); if (!is_fop_latency_started (frame)) break; conf = this->private; pthread_spin_lock ( &conf->lock); { if (conf && conf->measure_latency && conf->count_fop_hits) { do { struct ios_conf * conf = ((void*)0); conf = this->private; if (!conf) break; conf->cumulative.fop_hits[GF_FOP_op]++; conf->incremental .fop_hits[GF_FOP_op]++; } while (0); gettimeofday (&frame ->end, ((void*)0)); update_ios_latency (conf, frame, GF_FOP_op ); } } pthread_spin_unlock (&conf->lock); } while (0) \ | ||
198 | do { \ | ||
199 | struct ios_conf *conf = NULL((void*)0); \ | ||
200 | \ | ||
201 | if (!is_fop_latency_started (frame)) \ | ||
202 | break; \ | ||
203 | conf = this->private; \ | ||
204 | LOCK (&conf->lock)pthread_spin_lock (&conf->lock); \ | ||
205 | { \ | ||
206 | if (conf && conf->measure_latency && \ | ||
207 | conf->count_fop_hits) { \ | ||
208 | BUMP_FOP(op)do { struct ios_conf *conf = ((void*)0); conf = this->private ; if (!conf) break; conf->cumulative.fop_hits[GF_FOP_op]++ ; conf->incremental.fop_hits[GF_FOP_op]++; } while (0); \ | ||
209 | gettimeofday (&frame->end, NULL((void*)0)); \ | ||
210 | update_ios_latency (conf, frame, GF_FOP_##op);\ | ||
211 | } \ | ||
212 | } \ | ||
213 | UNLOCK (&conf->lock)pthread_spin_unlock (&conf->lock); \ | ||
214 | } while (0) | ||
215 | |||
216 | #define BUMP_READ(fd, len)do { struct ios_conf *conf = ((void*)0); struct ios_fd *iosfd = ((void*)0); int lb2 = 0; conf = this->private; lb2 = log_base2 (len); ios_fd_ctx_get (fd, this, &iosfd); if (!conf) break ; pthread_spin_lock (&conf->lock); { conf->cumulative .data_read += len; conf->incremental.data_read += len; conf ->cumulative.block_count_read[lb2]++; conf->incremental .block_count_read[lb2]++; if (iosfd) { iosfd->data_read += len; iosfd->block_count_read[lb2]++; } } pthread_spin_unlock (&conf->lock); } while (0) \ | ||
217 | do { \ | ||
218 | struct ios_conf *conf = NULL((void*)0); \ | ||
219 | struct ios_fd *iosfd = NULL((void*)0); \ | ||
220 | int lb2 = 0; \ | ||
221 | \ | ||
222 | conf = this->private; \ | ||
223 | lb2 = log_base2 (len); \ | ||
224 | ios_fd_ctx_get (fd, this, &iosfd); \ | ||
225 | if (!conf) \ | ||
226 | break; \ | ||
227 | \ | ||
228 | LOCK (&conf->lock)pthread_spin_lock (&conf->lock); \ | ||
229 | { \ | ||
230 | conf->cumulative.data_read += len; \ | ||
231 | conf->incremental.data_read += len; \ | ||
232 | conf->cumulative.block_count_read[lb2]++; \ | ||
233 | conf->incremental.block_count_read[lb2]++; \ | ||
234 | \ | ||
235 | if (iosfd) { \ | ||
236 | iosfd->data_read += len; \ | ||
237 | iosfd->block_count_read[lb2]++; \ | ||
238 | } \ | ||
239 | } \ | ||
240 | UNLOCK (&conf->lock)pthread_spin_unlock (&conf->lock); \ | ||
241 | } while (0) | ||
242 | |||
243 | |||
244 | #define BUMP_WRITE(fd, len)do { struct ios_conf *conf = ((void*)0); struct ios_fd *iosfd = ((void*)0); int lb2 = 0; conf = this->private; lb2 = log_base2 (len); ios_fd_ctx_get (fd, this, &iosfd); if (!conf) break ; pthread_spin_lock (&conf->lock); { conf->cumulative .data_written += len; conf->incremental.data_written += len ; conf->cumulative.block_count_write[lb2]++; conf->incremental .block_count_write[lb2]++; if (iosfd) { iosfd->data_written += len; iosfd->block_count_write[lb2]++; } } pthread_spin_unlock (&conf->lock); } while (0) \ | ||
245 | do { \ | ||
246 | struct ios_conf *conf = NULL((void*)0); \ | ||
247 | struct ios_fd *iosfd = NULL((void*)0); \ | ||
248 | int lb2 = 0; \ | ||
249 | \ | ||
250 | conf = this->private; \ | ||
251 | lb2 = log_base2 (len); \ | ||
252 | ios_fd_ctx_get (fd, this, &iosfd); \ | ||
253 | if (!conf) \ | ||
254 | break; \ | ||
255 | \ | ||
256 | LOCK (&conf->lock)pthread_spin_lock (&conf->lock); \ | ||
257 | { \ | ||
258 | conf->cumulative.data_written += len; \ | ||
259 | conf->incremental.data_written += len; \ | ||
260 | conf->cumulative.block_count_write[lb2]++; \ | ||
261 | conf->incremental.block_count_write[lb2]++; \ | ||
262 | \ | ||
263 | if (iosfd) { \ | ||
264 | iosfd->data_written += len; \ | ||
265 | iosfd->block_count_write[lb2]++; \ | ||
266 | } \ | ||
267 | } \ | ||
268 | UNLOCK (&conf->lock)pthread_spin_unlock (&conf->lock); \ | ||
269 | } while (0) | ||
270 | |||
271 | |||
272 | #define BUMP_STATS(iosstat, type)do { struct ios_conf *conf = ((void*)0); uint64_t value = 0; conf = this->private; pthread_spin_lock (&iosstat->lock ); { iosstat->counters[type]++; value = iosstat->counters [type]; } pthread_spin_unlock (&iosstat->lock); ios_stat_add_to_list (&conf->list[type], value, iosstat); } while (0) \ | ||
273 | do { \ | ||
274 | struct ios_conf *conf = NULL((void*)0); \ | ||
275 | uint64_t value = 0; \ | ||
276 | \ | ||
277 | conf = this->private; \ | ||
278 | \ | ||
279 | LOCK(&iosstat->lock)pthread_spin_lock (&iosstat->lock); \ | ||
280 | { \ | ||
281 | iosstat->counters[type]++; \ | ||
282 | value = iosstat->counters[type]; \ | ||
283 | } \ | ||
284 | UNLOCK (&iosstat->lock)pthread_spin_unlock (&iosstat->lock); \ | ||
285 | ios_stat_add_to_list (&conf->list[type], \ | ||
286 | value, iosstat); \ | ||
287 | \ | ||
288 | } while (0) | ||
289 | |||
290 | |||
291 | #define BUMP_THROUGHPUT(iosstat, type)do { struct ios_conf *conf = ((void*)0); double elapsed; struct timeval *begin, *end; double throughput; int flag = 0; begin = &frame->begin; end = &frame->end; elapsed = ( end->tv_sec - begin->tv_sec) * 1e6 + (end->tv_usec - begin->tv_usec); throughput = op_ret / elapsed; conf = this ->private; pthread_spin_lock (&iosstat->lock); { if (iosstat->thru_counters[type].throughput <= throughput ) { iosstat->thru_counters[type].throughput = throughput; gettimeofday (&iosstat-> thru_counters[type].time, ((void*)0)); flag = 1; } } pthread_spin_unlock (&iosstat->lock); if (flag ) ios_stat_add_to_list (&conf->thru_list[type], throughput , iosstat); } while (0) \ | ||
292 | do { \ | ||
293 | struct ios_conf *conf = NULL((void*)0); \ | ||
294 | double elapsed; \ | ||
295 | struct timeval *begin, *end; \ | ||
296 | double throughput; \ | ||
297 | int flag = 0; \ | ||
298 | \ | ||
299 | begin = &frame->begin; \ | ||
300 | end = &frame->end; \ | ||
301 | \ | ||
302 | elapsed = (end->tv_sec - begin->tv_sec) * 1e6 \ | ||
303 | + (end->tv_usec - begin->tv_usec); \ | ||
304 | throughput = op_ret / elapsed; \ | ||
305 | \ | ||
306 | conf = this->private; \ | ||
307 | LOCK(&iosstat->lock)pthread_spin_lock (&iosstat->lock); \ | ||
308 | { \ | ||
309 | if (iosstat->thru_counters[type].throughput \ | ||
310 | <= throughput) { \ | ||
311 | iosstat->thru_counters[type].throughput = \ | ||
312 | throughput; \ | ||
313 | gettimeofday (&iosstat-> \ | ||
314 | thru_counters[type].time, NULL((void*)0)); \ | ||
315 | flag = 1; \ | ||
316 | } \ | ||
317 | } \ | ||
318 | UNLOCK (&iosstat->lock)pthread_spin_unlock (&iosstat->lock); \ | ||
319 | if (flag) \ | ||
320 | ios_stat_add_to_list (&conf->thru_list[type], \ | ||
321 | throughput, iosstat); \ | ||
322 | } while (0) | ||
323 | |||
324 | int | ||
325 | ios_fd_ctx_get (fd_t *fd, xlator_t *this, struct ios_fd **iosfd) | ||
326 | { | ||
327 | uint64_t iosfd64 = 0; | ||
328 | unsigned long iosfdlong = 0; | ||
329 | int ret = 0; | ||
330 | |||
331 | ret = fd_ctx_get (fd, this, &iosfd64); | ||
332 | iosfdlong = iosfd64; | ||
333 | if (ret != -1) | ||
334 | *iosfd = (void *) iosfdlong; | ||
335 | |||
336 | return ret; | ||
337 | } | ||
338 | |||
339 | |||
340 | |||
341 | int | ||
342 | ios_fd_ctx_set (fd_t *fd, xlator_t *this, struct ios_fd *iosfd) | ||
343 | { | ||
344 | uint64_t iosfd64 = 0; | ||
345 | int ret = 0; | ||
346 | |||
347 | iosfd64 = (unsigned long) iosfd; | ||
348 | ret = fd_ctx_set (fd, this, iosfd64); | ||
349 | |||
350 | return ret; | ||
351 | } | ||
352 | |||
353 | int | ||
354 | ios_stat_ref (struct ios_stat *iosstat) | ||
355 | { | ||
356 | LOCK (&iosstat->lock)pthread_spin_lock (&iosstat->lock); | ||
357 | { | ||
358 | iosstat->refcnt++; | ||
359 | } | ||
360 | UNLOCK (&iosstat->lock)pthread_spin_unlock (&iosstat->lock); | ||
361 | |||
362 | return iosstat->refcnt; | ||
363 | } | ||
364 | |||
365 | int | ||
366 | ios_stat_unref (struct ios_stat *iosstat) | ||
367 | { | ||
368 | int cleanup = 0; | ||
369 | LOCK (&iosstat->lock)pthread_spin_lock (&iosstat->lock); | ||
370 | { | ||
371 | iosstat->refcnt--; | ||
372 | if (iosstat->refcnt == 0) { | ||
373 | if (iosstat->filename) { | ||
374 | GF_FREE (iosstat->filename)__gf_free (iosstat->filename); | ||
375 | iosstat->filename = NULL((void*)0); | ||
376 | } | ||
377 | cleanup = 1; | ||
378 | } | ||
379 | } | ||
380 | UNLOCK (&iosstat->lock)pthread_spin_unlock (&iosstat->lock); | ||
381 | |||
382 | if (cleanup) { | ||
383 | GF_FREE (iosstat)__gf_free (iosstat); | ||
384 | iosstat = NULL((void*)0); | ||
385 | } | ||
386 | |||
387 | return 0; | ||
388 | } | ||
389 | |||
390 | int | ||
391 | ios_inode_ctx_set (inode_t *inode, xlator_t *this, struct ios_stat *iosstat) | ||
392 | { | ||
393 | uint64_t iosstat64 = 0; | ||
394 | int ret = 0; | ||
395 | |||
396 | ios_stat_ref (iosstat); | ||
397 | iosstat64 = (unsigned long )iosstat; | ||
398 | ret = inode_ctx_put (inode, this, iosstat64); | ||
399 | return ret; | ||
400 | } | ||
401 | |||
402 | int | ||
403 | ios_inode_ctx_get (inode_t *inode, xlator_t *this, struct ios_stat **iosstat) | ||
404 | { | ||
405 | uint64_t iosstat64 = 0; | ||
406 | unsigned long iosstatlong = 0; | ||
407 | int ret = 0; | ||
408 | |||
409 | ret = inode_ctx_get (inode, this, &iosstat64)inode_ctx_get2(inode,this,&iosstat64,0); | ||
410 | iosstatlong = iosstat64; | ||
411 | if (ret != -1) | ||
412 | *iosstat = (void *) iosstatlong; | ||
413 | |||
414 | return ret; | ||
415 | |||
416 | } | ||
417 | |||
418 | int | ||
419 | ios_stat_add_to_list (struct ios_stat_head *list_head, uint64_t value, | ||
420 | struct ios_stat *iosstat) | ||
421 | { | ||
422 | struct ios_stat_list *new = NULL((void*)0); | ||
423 | struct ios_stat_list *entry = NULL((void*)0); | ||
424 | struct ios_stat_list *t = NULL((void*)0); | ||
425 | struct ios_stat_list *list_entry = NULL((void*)0); | ||
426 | struct ios_stat_list *tmp = NULL((void*)0); | ||
427 | struct ios_stat_list *last = NULL((void*)0); | ||
428 | struct ios_stat *stat = NULL((void*)0); | ||
429 | int cnt = 0; | ||
430 | int found = 0; | ||
431 | int reposition = 0; | ||
432 | double min_count = 0; | ||
433 | |||
434 | LOCK (&list_head->lock)pthread_spin_lock (&list_head->lock); | ||
435 | { | ||
436 | |||
437 | if (list_head->min_cnt == 0) | ||
438 | list_head->min_cnt = value; | ||
439 | if ((list_head->members == MAX_LIST_MEMBERS100) && | ||
440 | (list_head->min_cnt > value)) | ||
441 | goto out; | ||
442 | |||
443 | list_for_each_entry_safe (entry, t,for (entry = ((typeof(*entry) *)((char *)((&list_head-> iosstats->list)->next)-(unsigned long)(&((typeof(*entry ) *)0)->list))), t = ((typeof(*entry) *)((char *)(entry-> list.next)-(unsigned long)(&((typeof(*entry) *)0)->list ))); &entry->list != (&list_head->iosstats-> list); entry = t, t = ((typeof(*t) *)((char *)(t->list.next )-(unsigned long)(&((typeof(*t) *)0)->list)))) | ||
444 | &list_head->iosstats->list, list)for (entry = ((typeof(*entry) *)((char *)((&list_head-> iosstats->list)->next)-(unsigned long)(&((typeof(*entry ) *)0)->list))), t = ((typeof(*entry) *)((char *)(entry-> list.next)-(unsigned long)(&((typeof(*entry) *)0)->list ))); &entry->list != (&list_head->iosstats-> list); entry = t, t = ((typeof(*t) *)((char *)(t->list.next )-(unsigned long)(&((typeof(*t) *)0)->list)))) { | ||
445 | cnt++; | ||
446 | if (cnt == list_head->members) | ||
447 | last = entry; | ||
448 | |||
449 | if (!uuid_compare (iosstat->gfid, | ||
450 | entry->iosstat->gfid)) { | ||
451 | list_entry = entry; | ||
452 | found = cnt; | ||
453 | entry->value = value; | ||
454 | if (!reposition) { | ||
455 | if (cnt == list_head->members) | ||
456 | list_head->min_cnt = value; | ||
457 | goto out; | ||
458 | } | ||
459 | break; | ||
460 | } else if (entry->value <= value && !reposition) { | ||
461 | reposition = cnt; | ||
462 | tmp = entry; | ||
463 | if (cnt == list_head->members - 1) | ||
464 | min_count = entry->value; | ||
465 | } | ||
466 | } | ||
467 | if (found) { | ||
468 | list_del (&list_entry->list); | ||
469 | list_add_tail (&list_entry->list, &tmp->list); | ||
470 | if (min_count) | ||
471 | list_head->min_cnt = min_count; | ||
472 | goto out; | ||
473 | } else if (list_head->members == MAX_LIST_MEMBERS100 && reposition) { | ||
474 | new = GF_CALLOC (1, sizeof (*new),__gf_calloc (1, sizeof (*new), gf_io_stats_mt_ios_stat_list) | ||
475 | gf_io_stats_mt_ios_stat_list)__gf_calloc (1, sizeof (*new), gf_io_stats_mt_ios_stat_list); | ||
476 | new->iosstat = iosstat; | ||
477 | new->value = value; | ||
478 | ios_stat_ref (iosstat); | ||
479 | list_add_tail (&new->list, &tmp->list); | ||
480 | stat = last->iosstat; | ||
481 | last->iosstat = NULL((void*)0); | ||
482 | ios_stat_unref (stat); | ||
483 | list_del (&last->list); | ||
484 | GF_FREE (last)__gf_free (last); | ||
485 | if (reposition == MAX_LIST_MEMBERS100) | ||
486 | list_head->min_cnt = value; | ||
487 | else if (min_count) { | ||
488 | list_head->min_cnt = min_count; | ||
489 | } | ||
490 | } else if (list_head->members < MAX_LIST_MEMBERS100) { | ||
491 | new = GF_CALLOC (1, sizeof (*new),__gf_calloc (1, sizeof (*new), gf_io_stats_mt_ios_stat_list) | ||
492 | gf_io_stats_mt_ios_stat_list)__gf_calloc (1, sizeof (*new), gf_io_stats_mt_ios_stat_list); | ||
493 | new->iosstat = iosstat; | ||
494 | new->value = value; | ||
495 | ios_stat_ref (iosstat); | ||
496 | if (reposition) { | ||
497 | list_add_tail (&new->list, &tmp->list); | ||
498 | } else { | ||
499 | list_add_tail (&new->list, &entry->list); | ||
500 | } | ||
501 | list_head->members++; | ||
502 | if (list_head->min_cnt > value) | ||
503 | list_head->min_cnt = value; | ||
504 | } | ||
505 | } | ||
506 | out: | ||
507 | UNLOCK (&list_head->lock)pthread_spin_unlock (&list_head->lock); | ||
508 | return 0; | ||
509 | } | ||
510 | |||
511 | inline int | ||
512 | ios_stats_cleanup (xlator_t *this, inode_t *inode) | ||
513 | { | ||
514 | |||
515 | struct ios_stat *iosstat = NULL((void*)0); | ||
516 | uint64_t iosstat64 = 0; | ||
517 | |||
518 | inode_ctx_del (inode, this, &iosstat64)inode_ctx_del2(inode,this,&iosstat64,0); | ||
519 | if (!iosstat64) { | ||
520 | gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("could not get inode ctx"); } while ( 0); _gf_log (this->name, "io-stats.c", __FUNCTION__, 521, GF_LOG_WARNING , "could not get inode ctx"); } while (0) | ||
521 | "could not get inode ctx")do { do { if (0) printf ("could not get inode ctx"); } while ( 0); _gf_log (this->name, "io-stats.c", __FUNCTION__, 521, GF_LOG_WARNING , "could not get inode ctx"); } while (0); | ||
522 | return 0; | ||
523 | } | ||
524 | iosstat = (void *) (long)iosstat64; | ||
525 | if (iosstat) { | ||
526 | ios_stat_unref (iosstat); | ||
527 | } | ||
528 | return 0; | ||
529 | } | ||
530 | |||
531 | #define ios_log(this, logfp, fmt ...)do { if (logfp) { fprintf (logfp, fmt ...); fprintf (logfp, "\n" ); } do { do { if (0) printf (fmt ...); } while (0); _gf_log ( this->name, "io-stats.c", __FUNCTION__, 531, GF_LOG_INFO, fmt ...); } while (0); } while (0) \ | ||
532 | do { \ | ||
533 | if (logfp) { \ | ||
534 | fprintf (logfp, fmt); \ | ||
535 | fprintf (logfp, "\n"); \ | ||
536 | } \ | ||
537 | gf_log (this->name, GF_LOG_INFO, fmt)do { do { if (0) printf (fmt); } while (0); _gf_log (this-> name, "io-stats.c", __FUNCTION__, 537, GF_LOG_INFO, fmt); } while (0); \ | ||
538 | } while (0) | ||
539 | |||
540 | int | ||
541 | ios_dump_file_stats (struct ios_stat_head *list_head, xlator_t *this, FILE* logfp) | ||
542 | { | ||
543 | struct ios_stat_list *entry = NULL((void*)0); | ||
544 | |||
545 | LOCK (&list_head->lock)pthread_spin_lock (&list_head->lock); | ||
546 | { | ||
547 | list_for_each_entry (entry, &list_head->iosstats->list, list)for (entry = ((typeof(*entry) *)((char *)((&list_head-> iosstats->list)->next)-(unsigned long)(&((typeof(*entry ) *)0)->list))); &entry->list != (&list_head-> iosstats->list); entry = ((typeof(*entry) *)((char *)(entry ->list.next)-(unsigned long)(&((typeof(*entry) *)0)-> list)))) { | ||
548 | ios_log (this, logfp, "%-12.0f %s",do { if (logfp) { fprintf (logfp, "%-12.0f %s", entry->value , entry->iosstat->filename); fprintf (logfp, "\n"); } do { do { if (0) printf ("%-12.0f %s", entry->value, entry-> iosstat->filename); } while (0); _gf_log (this->name, "io-stats.c" , __FUNCTION__, 549, GF_LOG_INFO, "%-12.0f %s", entry->value , entry->iosstat->filename); } while (0); } while (0) | ||
549 | entry->value, entry->iosstat->filename)do { if (logfp) { fprintf (logfp, "%-12.0f %s", entry->value , entry->iosstat->filename); fprintf (logfp, "\n"); } do { do { if (0) printf ("%-12.0f %s", entry->value, entry-> iosstat->filename); } while (0); _gf_log (this->name, "io-stats.c" , __FUNCTION__, 549, GF_LOG_INFO, "%-12.0f %s", entry->value , entry->iosstat->filename); } while (0); } while (0); | ||
550 | } | ||
551 | } | ||
552 | UNLOCK (&list_head->lock)pthread_spin_unlock (&list_head->lock); | ||
553 | return 0; | ||
554 | } | ||
555 | |||
556 | int | ||
557 | ios_dump_throughput_stats (struct ios_stat_head *list_head, xlator_t *this, | ||
558 | FILE* logfp, ios_stats_type_t type) | ||
559 | { | ||
560 | struct ios_stat_list *entry = NULL((void*)0); | ||
561 | struct timeval time = {0, }; | ||
562 | char timestr[256] = {0, }; | ||
563 | |||
564 | LOCK (&list_head->lock)pthread_spin_lock (&list_head->lock); | ||
565 | { | ||
566 | list_for_each_entry (entry, &list_head->iosstats->list, list)for (entry = ((typeof(*entry) *)((char *)((&list_head-> iosstats->list)->next)-(unsigned long)(&((typeof(*entry ) *)0)->list))); &entry->list != (&list_head-> iosstats->list); entry = ((typeof(*entry) *)((char *)(entry ->list.next)-(unsigned long)(&((typeof(*entry) *)0)-> list)))) { | ||
567 | gf_time_fmt (timestr, sizeof timestr, | ||
568 | entry->iosstat->thru_counters[type].time.tv_sec, | ||
569 | gf_timefmt_FT); | ||
570 | snprintf (timestr + strlen (timestr), sizeof timestr - strlen (timestr), | ||
571 | ".%"GF_PRI_SUSECONDS"06ld", time.tv_usec); | ||
572 | |||
573 | ios_log (this, logfp, "%s \t %-10.2f \t %s",do { if (logfp) { fprintf (logfp, "%s \t %-10.2f \t %s", timestr , entry->value, entry->iosstat->filename); fprintf ( logfp, "\n"); } do { do { if (0) printf ("%s \t %-10.2f \t %s" , timestr, entry->value, entry->iosstat->filename); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__ , 574, GF_LOG_INFO, "%s \t %-10.2f \t %s", timestr, entry-> value, entry->iosstat->filename); } while (0); } while ( 0) | ||
574 | timestr, entry->value, entry->iosstat->filename)do { if (logfp) { fprintf (logfp, "%s \t %-10.2f \t %s", timestr , entry->value, entry->iosstat->filename); fprintf ( logfp, "\n"); } do { do { if (0) printf ("%s \t %-10.2f \t %s" , timestr, entry->value, entry->iosstat->filename); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__ , 574, GF_LOG_INFO, "%s \t %-10.2f \t %s", timestr, entry-> value, entry->iosstat->filename); } while (0); } while ( 0); | ||
575 | } | ||
576 | } | ||
577 | UNLOCK (&list_head->lock)pthread_spin_unlock (&list_head->lock); | ||
578 | return 0; | ||
579 | } | ||
580 | |||
581 | int | ||
582 | io_stats_dump_global_to_logfp (xlator_t *this, struct ios_global_stats *stats, | ||
583 | struct timeval *now, int interval, FILE* logfp) | ||
584 | { | ||
585 | int i = 0; | ||
586 | int per_line = 0; | ||
587 | int index = 0; | ||
588 | struct ios_stat_head *list_head = NULL((void*)0); | ||
589 | struct ios_conf *conf = NULL((void*)0); | ||
590 | char timestr[256] = {0, }; | ||
591 | char str_header[128] = {0}; | ||
592 | char str_read[128] = {0}; | ||
593 | char str_write[128] = {0}; | ||
594 | |||
595 | conf = this->private; | ||
596 | |||
597 | if (interval == -1) | ||
598 | ios_log (this, logfp, "\n=== Cumulative stats ===")do { if (logfp) { fprintf (logfp, "\n=== Cumulative stats ===" ); fprintf (logfp, "\n"); } do { do { if (0) printf ("\n=== Cumulative stats ===" ); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__ , 598, GF_LOG_INFO, "\n=== Cumulative stats ==="); } while (0 ); } while (0); | ||
599 | else | ||
600 | ios_log (this, logfp, "\n=== Interval %d stats ===",do { if (logfp) { fprintf (logfp, "\n=== Interval %d stats ===" , interval); fprintf (logfp, "\n"); } do { do { if (0) printf ("\n=== Interval %d stats ===", interval); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__, 601, GF_LOG_INFO , "\n=== Interval %d stats ===", interval); } while (0); } while (0) | ||
601 | interval)do { if (logfp) { fprintf (logfp, "\n=== Interval %d stats ===" , interval); fprintf (logfp, "\n"); } do { do { if (0) printf ("\n=== Interval %d stats ===", interval); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__, 601, GF_LOG_INFO , "\n=== Interval %d stats ===", interval); } while (0); } while (0); | ||
602 | ios_log (this, logfp, " Duration : %"PRId64" secs",do { if (logfp) { fprintf (logfp, " Duration : %""ll" "d" " secs", (uint64_t) (now->tv_sec - stats->started_at.tv_sec )); fprintf (logfp, "\n"); } do { do { if (0) printf (" Duration : %" "ll" "d"" secs", (uint64_t) (now->tv_sec - stats->started_at .tv_sec)); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__, 603, GF_LOG_INFO, " Duration : %""ll" "d" " secs", (uint64_t) (now->tv_sec - stats->started_at.tv_sec )); } while (0); } while (0) | ||
603 | (uint64_t) (now->tv_sec - stats->started_at.tv_sec))do { if (logfp) { fprintf (logfp, " Duration : %""ll" "d" " secs", (uint64_t) (now->tv_sec - stats->started_at.tv_sec )); fprintf (logfp, "\n"); } do { do { if (0) printf (" Duration : %" "ll" "d"" secs", (uint64_t) (now->tv_sec - stats->started_at .tv_sec)); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__, 603, GF_LOG_INFO, " Duration : %""ll" "d" " secs", (uint64_t) (now->tv_sec - stats->started_at.tv_sec )); } while (0); } while (0); | ||
604 | ios_log (this, logfp, " BytesRead : %"PRId64,do { if (logfp) { fprintf (logfp, " BytesRead : %""ll" "d" , stats->data_read); fprintf (logfp, "\n"); } do { do { if (0) printf (" BytesRead : %""ll" "d", stats->data_read ); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__ , 605, GF_LOG_INFO, " BytesRead : %""ll" "d", stats->data_read ); } while (0); } while (0) | ||
605 | stats->data_read)do { if (logfp) { fprintf (logfp, " BytesRead : %""ll" "d" , stats->data_read); fprintf (logfp, "\n"); } do { do { if (0) printf (" BytesRead : %""ll" "d", stats->data_read ); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__ , 605, GF_LOG_INFO, " BytesRead : %""ll" "d", stats->data_read ); } while (0); } while (0); | ||
606 | ios_log (this, logfp, " BytesWritten : %"PRId64"\n",do { if (logfp) { fprintf (logfp, " BytesWritten : %""ll" "d" "\n", stats->data_written); fprintf (logfp, "\n"); } do { do { if (0) printf (" BytesWritten : %""ll" "d""\n", stats-> data_written); } while (0); _gf_log (this->name, "io-stats.c" , __FUNCTION__, 607, GF_LOG_INFO, " BytesWritten : %""ll" "d" "\n", stats->data_written); } while (0); } while (0) | ||
607 | stats->data_written)do { if (logfp) { fprintf (logfp, " BytesWritten : %""ll" "d" "\n", stats->data_written); fprintf (logfp, "\n"); } do { do { if (0) printf (" BytesWritten : %""ll" "d""\n", stats-> data_written); } while (0); _gf_log (this->name, "io-stats.c" , __FUNCTION__, 607, GF_LOG_INFO, " BytesWritten : %""ll" "d" "\n", stats->data_written); } while (0); } while (0); | ||
608 | |||
609 | snprintf (str_header, sizeof (str_header), "%-12s %c", "Block Size", ':'); | ||
610 | snprintf (str_read, sizeof (str_read), "%-12s %c", "Read Count", ':'); | ||
611 | snprintf (str_write, sizeof (str_write), "%-12s %c", "Write Count", ':'); | ||
612 | index = 14; | ||
613 | for (i = 0; i < 32; i++) { | ||
614 | if ((stats->block_count_read[i] == 0) && | ||
615 | (stats->block_count_write[i] == 0)) | ||
616 | continue; | ||
617 | per_line++; | ||
618 | |||
619 | snprintf (str_header+index, sizeof (str_header)-index, | ||
620 | "%16dB+", (1<<i)); | ||
621 | if (stats->block_count_read[i]) | ||
622 | snprintf (str_read+index, sizeof (str_read)-index, | ||
623 | "%18"PRId64"ll" "d", stats->block_count_read[i]); | ||
624 | else snprintf (str_read+index, sizeof (str_read)-index, | ||
625 | "%18s", "0"); | ||
626 | if (stats->block_count_write[i]) | ||
627 | snprintf (str_write+index, sizeof (str_write)-index, | ||
628 | "%18"PRId64"ll" "d", stats->block_count_write[i]); | ||
629 | else snprintf (str_write+index, sizeof (str_write)-index, | ||
630 | "%18s", "0"); | ||
631 | |||
632 | index += 18; | ||
633 | if (per_line == 3) { | ||
634 | ios_log (this, logfp, "%s", str_header)do { if (logfp) { fprintf (logfp, "%s", str_header); fprintf ( logfp, "\n"); } do { do { if (0) printf ("%s", str_header); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__ , 634, GF_LOG_INFO, "%s", str_header); } while (0); } while ( 0); | ||
635 | ios_log (this, logfp, "%s", str_read)do { if (logfp) { fprintf (logfp, "%s", str_read); fprintf (logfp , "\n"); } do { do { if (0) printf ("%s", str_read); } while ( 0); _gf_log (this->name, "io-stats.c", __FUNCTION__, 635, GF_LOG_INFO , "%s", str_read); } while (0); } while (0); | ||
636 | ios_log (this, logfp, "%s\n", str_write)do { if (logfp) { fprintf (logfp, "%s\n", str_write); fprintf (logfp, "\n"); } do { do { if (0) printf ("%s\n", str_write) ; } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__ , 636, GF_LOG_INFO, "%s\n", str_write); } while (0); } while ( 0); | ||
637 | |||
638 | memset (str_header, 0, sizeof (str_header)); | ||
639 | memset (str_read, 0, sizeof (str_read)); | ||
640 | memset (str_write, 0, sizeof (str_write)); | ||
641 | |||
642 | snprintf (str_header, sizeof (str_header), "%-12s %c", | ||
643 | "Block Size", ':'); | ||
644 | snprintf (str_read, sizeof (str_read), "%-12s %c", | ||
645 | "Read Count", ':'); | ||
646 | snprintf (str_write, sizeof (str_write), "%-12s %c", | ||
647 | "Write Count", ':'); | ||
648 | |||
649 | index = 14; | ||
650 | per_line = 0; | ||
651 | } | ||
652 | } | ||
653 | |||
654 | if (per_line != 0) { | ||
655 | ios_log (this, logfp, "%s", str_header)do { if (logfp) { fprintf (logfp, "%s", str_header); fprintf ( logfp, "\n"); } do { do { if (0) printf ("%s", str_header); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__ , 655, GF_LOG_INFO, "%s", str_header); } while (0); } while ( 0); | ||
656 | ios_log (this, logfp, "%s", str_read)do { if (logfp) { fprintf (logfp, "%s", str_read); fprintf (logfp , "\n"); } do { do { if (0) printf ("%s", str_read); } while ( 0); _gf_log (this->name, "io-stats.c", __FUNCTION__, 656, GF_LOG_INFO , "%s", str_read); } while (0); } while (0); | ||
657 | ios_log (this, logfp, "%s\n", str_write)do { if (logfp) { fprintf (logfp, "%s\n", str_write); fprintf (logfp, "\n"); } do { do { if (0) printf ("%s\n", str_write) ; } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__ , 657, GF_LOG_INFO, "%s\n", str_write); } while (0); } while ( 0); | ||
658 | } | ||
659 | |||
660 | ios_log (this, logfp, "%-13s %10s %14s %14s %14s", "Fop",do { if (logfp) { fprintf (logfp, "%-13s %10s %14s %14s %14s" , "Fop", "Call Count", "Avg-Latency", "Min-Latency", "Max-Latency" ); fprintf (logfp, "\n"); } do { do { if (0) printf ("%-13s %10s %14s %14s %14s" , "Fop", "Call Count", "Avg-Latency", "Min-Latency", "Max-Latency" ); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__ , 662, GF_LOG_INFO, "%-13s %10s %14s %14s %14s", "Fop", "Call Count" , "Avg-Latency", "Min-Latency", "Max-Latency"); } while (0); } while (0) | ||
661 | "Call Count", "Avg-Latency", "Min-Latency",do { if (logfp) { fprintf (logfp, "%-13s %10s %14s %14s %14s" , "Fop", "Call Count", "Avg-Latency", "Min-Latency", "Max-Latency" ); fprintf (logfp, "\n"); } do { do { if (0) printf ("%-13s %10s %14s %14s %14s" , "Fop", "Call Count", "Avg-Latency", "Min-Latency", "Max-Latency" ); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__ , 662, GF_LOG_INFO, "%-13s %10s %14s %14s %14s", "Fop", "Call Count" , "Avg-Latency", "Min-Latency", "Max-Latency"); } while (0); } while (0) | ||
662 | "Max-Latency")do { if (logfp) { fprintf (logfp, "%-13s %10s %14s %14s %14s" , "Fop", "Call Count", "Avg-Latency", "Min-Latency", "Max-Latency" ); fprintf (logfp, "\n"); } do { do { if (0) printf ("%-13s %10s %14s %14s %14s" , "Fop", "Call Count", "Avg-Latency", "Min-Latency", "Max-Latency" ); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__ , 662, GF_LOG_INFO, "%-13s %10s %14s %14s %14s", "Fop", "Call Count" , "Avg-Latency", "Min-Latency", "Max-Latency"); } while (0); } while (0); | ||
663 | ios_log (this, logfp, "%-13s %10s %14s %14s %14s", "---", "----------",do { if (logfp) { fprintf (logfp, "%-13s %10s %14s %14s %14s" , "---", "----------", "-----------", "-----------", "-----------" ); fprintf (logfp, "\n"); } do { do { if (0) printf ("%-13s %10s %14s %14s %14s" , "---", "----------", "-----------", "-----------", "-----------" ); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__ , 664, GF_LOG_INFO, "%-13s %10s %14s %14s %14s", "---", "----------" , "-----------", "-----------", "-----------"); } while (0); } while (0) | ||
664 | "-----------", "-----------", "-----------")do { if (logfp) { fprintf (logfp, "%-13s %10s %14s %14s %14s" , "---", "----------", "-----------", "-----------", "-----------" ); fprintf (logfp, "\n"); } do { do { if (0) printf ("%-13s %10s %14s %14s %14s" , "---", "----------", "-----------", "-----------", "-----------" ); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__ , 664, GF_LOG_INFO, "%-13s %10s %14s %14s %14s", "---", "----------" , "-----------", "-----------", "-----------"); } while (0); } while (0); | ||
665 | |||
666 | for (i = 0; i < GF_FOP_MAXVALUE; i++) { | ||
667 | if (stats->fop_hits[i] && !stats->latency[i].avg) | ||
668 | ios_log (this, logfp, "%-13s %10"PRId64" %11s "do { if (logfp) { fprintf (logfp, "%-13s %10""ll" "d"" %11s " "us %11s us %11s us", gf_fop_list[i], stats->fop_hits[i], "0", "0", "0"); fprintf (logfp, "\n"); } do { do { if (0) printf ("%-13s %10""ll" "d"" %11s " "us %11s us %11s us", gf_fop_list [i], stats->fop_hits[i], "0", "0", "0"); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__, 670, GF_LOG_INFO , "%-13s %10""ll" "d"" %11s " "us %11s us %11s us", gf_fop_list [i], stats->fop_hits[i], "0", "0", "0"); } while (0); } while (0) | ||
669 | "us %11s us %11s us", gf_fop_list[i],do { if (logfp) { fprintf (logfp, "%-13s %10""ll" "d"" %11s " "us %11s us %11s us", gf_fop_list[i], stats->fop_hits[i], "0", "0", "0"); fprintf (logfp, "\n"); } do { do { if (0) printf ("%-13s %10""ll" "d"" %11s " "us %11s us %11s us", gf_fop_list [i], stats->fop_hits[i], "0", "0", "0"); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__, 670, GF_LOG_INFO , "%-13s %10""ll" "d"" %11s " "us %11s us %11s us", gf_fop_list [i], stats->fop_hits[i], "0", "0", "0"); } while (0); } while (0) | ||
670 | stats->fop_hits[i], "0", "0", "0")do { if (logfp) { fprintf (logfp, "%-13s %10""ll" "d"" %11s " "us %11s us %11s us", gf_fop_list[i], stats->fop_hits[i], "0", "0", "0"); fprintf (logfp, "\n"); } do { do { if (0) printf ("%-13s %10""ll" "d"" %11s " "us %11s us %11s us", gf_fop_list [i], stats->fop_hits[i], "0", "0", "0"); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__, 670, GF_LOG_INFO , "%-13s %10""ll" "d"" %11s " "us %11s us %11s us", gf_fop_list [i], stats->fop_hits[i], "0", "0", "0"); } while (0); } while (0); | ||
671 | else if (stats->fop_hits[i] && stats->latency[i].avg) | ||
672 | ios_log (this, logfp, "%-13s %10"PRId64" %11.2lf us "do { if (logfp) { fprintf (logfp, "%-13s %10""ll" "d"" %11.2lf us " "%11.2lf us %11.2lf us", gf_fop_list[i], stats->fop_hits[ i], stats->latency[i].avg, stats->latency[i].min, stats ->latency[i].max); fprintf (logfp, "\n"); } do { do { if ( 0) printf ("%-13s %10""ll" "d"" %11.2lf us " "%11.2lf us %11.2lf us" , gf_fop_list[i], stats->fop_hits[i], stats->latency[i] .avg, stats->latency[i].min, stats->latency[i].max); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__, 675 , GF_LOG_INFO, "%-13s %10""ll" "d"" %11.2lf us " "%11.2lf us %11.2lf us" , gf_fop_list[i], stats->fop_hits[i], stats->latency[i] .avg, stats->latency[i].min, stats->latency[i].max); } while (0); } while (0) | ||
673 | "%11.2lf us %11.2lf us", gf_fop_list[i],do { if (logfp) { fprintf (logfp, "%-13s %10""ll" "d"" %11.2lf us " "%11.2lf us %11.2lf us", gf_fop_list[i], stats->fop_hits[ i], stats->latency[i].avg, stats->latency[i].min, stats ->latency[i].max); fprintf (logfp, "\n"); } do { do { if ( 0) printf ("%-13s %10""ll" "d"" %11.2lf us " "%11.2lf us %11.2lf us" , gf_fop_list[i], stats->fop_hits[i], stats->latency[i] .avg, stats->latency[i].min, stats->latency[i].max); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__, 675 , GF_LOG_INFO, "%-13s %10""ll" "d"" %11.2lf us " "%11.2lf us %11.2lf us" , gf_fop_list[i], stats->fop_hits[i], stats->latency[i] .avg, stats->latency[i].min, stats->latency[i].max); } while (0); } while (0) | ||
674 | stats->fop_hits[i], stats->latency[i].avg,do { if (logfp) { fprintf (logfp, "%-13s %10""ll" "d"" %11.2lf us " "%11.2lf us %11.2lf us", gf_fop_list[i], stats->fop_hits[ i], stats->latency[i].avg, stats->latency[i].min, stats ->latency[i].max); fprintf (logfp, "\n"); } do { do { if ( 0) printf ("%-13s %10""ll" "d"" %11.2lf us " "%11.2lf us %11.2lf us" , gf_fop_list[i], stats->fop_hits[i], stats->latency[i] .avg, stats->latency[i].min, stats->latency[i].max); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__, 675 , GF_LOG_INFO, "%-13s %10""ll" "d"" %11.2lf us " "%11.2lf us %11.2lf us" , gf_fop_list[i], stats->fop_hits[i], stats->latency[i] .avg, stats->latency[i].min, stats->latency[i].max); } while (0); } while (0) | ||
675 | stats->latency[i].min, stats->latency[i].max)do { if (logfp) { fprintf (logfp, "%-13s %10""ll" "d"" %11.2lf us " "%11.2lf us %11.2lf us", gf_fop_list[i], stats->fop_hits[ i], stats->latency[i].avg, stats->latency[i].min, stats ->latency[i].max); fprintf (logfp, "\n"); } do { do { if ( 0) printf ("%-13s %10""ll" "d"" %11.2lf us " "%11.2lf us %11.2lf us" , gf_fop_list[i], stats->fop_hits[i], stats->latency[i] .avg, stats->latency[i].min, stats->latency[i].max); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__, 675 , GF_LOG_INFO, "%-13s %10""ll" "d"" %11.2lf us " "%11.2lf us %11.2lf us" , gf_fop_list[i], stats->fop_hits[i], stats->latency[i] .avg, stats->latency[i].min, stats->latency[i].max); } while (0); } while (0); | ||
676 | } | ||
677 | ios_log (this, logfp, "------ ----- ----- ----- ----- ----- ----- ----- "do { if (logfp) { fprintf (logfp, "------ ----- ----- ----- ----- ----- ----- ----- " " ----- ----- ----- -----\n"); fprintf (logfp, "\n"); } do { do { if (0) printf ("------ ----- ----- ----- ----- ----- ----- ----- " " ----- ----- ----- -----\n"); } while (0); _gf_log (this-> name, "io-stats.c", __FUNCTION__, 678, GF_LOG_INFO, "------ ----- ----- ----- ----- ----- ----- ----- " " ----- ----- ----- -----\n"); } while (0); } while (0) | ||
678 | " ----- ----- ----- -----\n")do { if (logfp) { fprintf (logfp, "------ ----- ----- ----- ----- ----- ----- ----- " " ----- ----- ----- -----\n"); fprintf (logfp, "\n"); } do { do { if (0) printf ("------ ----- ----- ----- ----- ----- ----- ----- " " ----- ----- ----- -----\n"); } while (0); _gf_log (this-> name, "io-stats.c", __FUNCTION__, 678, GF_LOG_INFO, "------ ----- ----- ----- ----- ----- ----- ----- " " ----- ----- ----- -----\n"); } while (0); } while (0); | ||
679 | |||
680 | if (interval == -1) { | ||
681 | LOCK (&conf->lock)pthread_spin_lock (&conf->lock); | ||
682 | { | ||
683 | gf_time_fmt (timestr, sizeof timestr, | ||
684 | conf->cumulative.max_openfd_time.tv_sec, | ||
685 | gf_timefmt_FT); | ||
686 | snprintf (timestr + strlen (timestr), sizeof timestr - strlen (timestr), | ||
687 | ".%"GF_PRI_SUSECONDS"06ld", | ||
688 | conf->cumulative.max_openfd_time.tv_usec); | ||
689 | ios_log (this, logfp, "Current open fd's: %"PRId64do { if (logfp) { fprintf (logfp, "Current open fd's: %""ll" "d" " Max open fd's: %""ll" "d"" time %s", conf->cumulative.nr_opens , conf->cumulative.max_nr_opens, timestr); fprintf (logfp, "\n"); } do { do { if (0) printf ("Current open fd's: %""ll" "d" " Max open fd's: %""ll" "d"" time %s", conf->cumulative .nr_opens, conf->cumulative.max_nr_opens, timestr); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__, 692 , GF_LOG_INFO, "Current open fd's: %""ll" "d" " Max open fd's: %" "ll" "d"" time %s", conf->cumulative.nr_opens, conf->cumulative .max_nr_opens, timestr); } while (0); } while (0) | ||
690 | " Max open fd's: %"PRId64" time %s",do { if (logfp) { fprintf (logfp, "Current open fd's: %""ll" "d" " Max open fd's: %""ll" "d"" time %s", conf->cumulative.nr_opens , conf->cumulative.max_nr_opens, timestr); fprintf (logfp, "\n"); } do { do { if (0) printf ("Current open fd's: %""ll" "d" " Max open fd's: %""ll" "d"" time %s", conf->cumulative .nr_opens, conf->cumulative.max_nr_opens, timestr); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__, 692 , GF_LOG_INFO, "Current open fd's: %""ll" "d" " Max open fd's: %" "ll" "d"" time %s", conf->cumulative.nr_opens, conf->cumulative .max_nr_opens, timestr); } while (0); } while (0) | ||
691 | conf->cumulative.nr_opens,do { if (logfp) { fprintf (logfp, "Current open fd's: %""ll" "d" " Max open fd's: %""ll" "d"" time %s", conf->cumulative.nr_opens , conf->cumulative.max_nr_opens, timestr); fprintf (logfp, "\n"); } do { do { if (0) printf ("Current open fd's: %""ll" "d" " Max open fd's: %""ll" "d"" time %s", conf->cumulative .nr_opens, conf->cumulative.max_nr_opens, timestr); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__, 692 , GF_LOG_INFO, "Current open fd's: %""ll" "d" " Max open fd's: %" "ll" "d"" time %s", conf->cumulative.nr_opens, conf->cumulative .max_nr_opens, timestr); } while (0); } while (0) | ||
692 | conf->cumulative.max_nr_opens, timestr)do { if (logfp) { fprintf (logfp, "Current open fd's: %""ll" "d" " Max open fd's: %""ll" "d"" time %s", conf->cumulative.nr_opens , conf->cumulative.max_nr_opens, timestr); fprintf (logfp, "\n"); } do { do { if (0) printf ("Current open fd's: %""ll" "d" " Max open fd's: %""ll" "d"" time %s", conf->cumulative .nr_opens, conf->cumulative.max_nr_opens, timestr); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__, 692 , GF_LOG_INFO, "Current open fd's: %""ll" "d" " Max open fd's: %" "ll" "d"" time %s", conf->cumulative.nr_opens, conf->cumulative .max_nr_opens, timestr); } while (0); } while (0); | ||
693 | } | ||
694 | UNLOCK (&conf->lock)pthread_spin_unlock (&conf->lock); | ||
695 | ios_log (this, logfp, "\n==========Open File Stats========")do { if (logfp) { fprintf (logfp, "\n==========Open File Stats========" ); fprintf (logfp, "\n"); } do { do { if (0) printf ("\n==========Open File Stats========" ); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__ , 695, GF_LOG_INFO, "\n==========Open File Stats========"); } while (0); } while (0); | ||
696 | ios_log (this, logfp, "\nCOUNT: \t FILE NAME")do { if (logfp) { fprintf (logfp, "\nCOUNT: \t FILE NAME"); fprintf (logfp, "\n"); } do { do { if (0) printf ("\nCOUNT: \t FILE NAME" ); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__ , 696, GF_LOG_INFO, "\nCOUNT: \t FILE NAME"); } while (0); } while (0); | ||
697 | list_head = &conf->list[IOS_STATS_TYPE_OPEN]; | ||
698 | ios_dump_file_stats (list_head, this, logfp); | ||
699 | |||
700 | |||
701 | ios_log (this, logfp, "\n==========Read File Stats========")do { if (logfp) { fprintf (logfp, "\n==========Read File Stats========" ); fprintf (logfp, "\n"); } do { do { if (0) printf ("\n==========Read File Stats========" ); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__ , 701, GF_LOG_INFO, "\n==========Read File Stats========"); } while (0); } while (0); | ||
702 | ios_log (this, logfp, "\nCOUNT: \t FILE NAME")do { if (logfp) { fprintf (logfp, "\nCOUNT: \t FILE NAME"); fprintf (logfp, "\n"); } do { do { if (0) printf ("\nCOUNT: \t FILE NAME" ); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__ , 702, GF_LOG_INFO, "\nCOUNT: \t FILE NAME"); } while (0); } while (0); | ||
703 | list_head = &conf->list[IOS_STATS_TYPE_READ]; | ||
704 | ios_dump_file_stats (list_head, this, logfp); | ||
705 | |||
706 | ios_log (this, logfp, "\n==========Write File Stats========")do { if (logfp) { fprintf (logfp, "\n==========Write File Stats========" ); fprintf (logfp, "\n"); } do { do { if (0) printf ("\n==========Write File Stats========" ); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__ , 706, GF_LOG_INFO, "\n==========Write File Stats========"); } while (0); } while (0); | ||
707 | ios_log (this, logfp, "\nCOUNT: \t FILE NAME")do { if (logfp) { fprintf (logfp, "\nCOUNT: \t FILE NAME"); fprintf (logfp, "\n"); } do { do { if (0) printf ("\nCOUNT: \t FILE NAME" ); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__ , 707, GF_LOG_INFO, "\nCOUNT: \t FILE NAME"); } while (0); } while (0); | ||
708 | list_head = &conf->list[IOS_STATS_TYPE_WRITE]; | ||
709 | ios_dump_file_stats (list_head, this, logfp); | ||
710 | |||
711 | ios_log (this, logfp, "\n==========Directory open stats========")do { if (logfp) { fprintf (logfp, "\n==========Directory open stats========" ); fprintf (logfp, "\n"); } do { do { if (0) printf ("\n==========Directory open stats========" ); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__ , 711, GF_LOG_INFO, "\n==========Directory open stats========" ); } while (0); } while (0); | ||
712 | ios_log (this, logfp, "\nCOUNT: \t DIRECTORY NAME")do { if (logfp) { fprintf (logfp, "\nCOUNT: \t DIRECTORY NAME" ); fprintf (logfp, "\n"); } do { do { if (0) printf ("\nCOUNT: \t DIRECTORY NAME" ); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__ , 712, GF_LOG_INFO, "\nCOUNT: \t DIRECTORY NAME"); } while ( 0); } while (0); | ||
713 | list_head = &conf->list[IOS_STATS_TYPE_OPENDIR]; | ||
714 | ios_dump_file_stats (list_head, this, logfp); | ||
715 | |||
716 | ios_log (this, logfp, "\n========Directory readdirp Stats=======")do { if (logfp) { fprintf (logfp, "\n========Directory readdirp Stats=======" ); fprintf (logfp, "\n"); } do { do { if (0) printf ("\n========Directory readdirp Stats=======" ); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__ , 716, GF_LOG_INFO, "\n========Directory readdirp Stats=======" ); } while (0); } while (0); | ||
717 | ios_log (this, logfp, "\nCOUNT: \t DIRECTORY NAME")do { if (logfp) { fprintf (logfp, "\nCOUNT: \t DIRECTORY NAME" ); fprintf (logfp, "\n"); } do { do { if (0) printf ("\nCOUNT: \t DIRECTORY NAME" ); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__ , 717, GF_LOG_INFO, "\nCOUNT: \t DIRECTORY NAME"); } while ( 0); } while (0); | ||
718 | list_head = &conf->list[IOS_STATS_TYPE_READDIRP]; | ||
719 | ios_dump_file_stats (list_head, this, logfp); | ||
720 | |||
721 | ios_log (this, logfp, "\n========Read Throughput File Stats=====")do { if (logfp) { fprintf (logfp, "\n========Read Throughput File Stats=====" ); fprintf (logfp, "\n"); } do { do { if (0) printf ("\n========Read Throughput File Stats=====" ); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__ , 721, GF_LOG_INFO, "\n========Read Throughput File Stats=====" ); } while (0); } while (0); | ||
722 | ios_log (this, logfp, "\nTIMESTAMP \t\t\t THROUGHPUT(KBPS)"do { if (logfp) { fprintf (logfp, "\nTIMESTAMP \t\t\t THROUGHPUT(KBPS)" "\tFILE NAME"); fprintf (logfp, "\n"); } do { do { if (0) printf ("\nTIMESTAMP \t\t\t THROUGHPUT(KBPS)" "\tFILE NAME"); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__, 723 , GF_LOG_INFO, "\nTIMESTAMP \t\t\t THROUGHPUT(KBPS)" "\tFILE NAME" ); } while (0); } while (0) | ||
723 | "\tFILE NAME")do { if (logfp) { fprintf (logfp, "\nTIMESTAMP \t\t\t THROUGHPUT(KBPS)" "\tFILE NAME"); fprintf (logfp, "\n"); } do { do { if (0) printf ("\nTIMESTAMP \t\t\t THROUGHPUT(KBPS)" "\tFILE NAME"); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__, 723 , GF_LOG_INFO, "\nTIMESTAMP \t\t\t THROUGHPUT(KBPS)" "\tFILE NAME" ); } while (0); } while (0); | ||
724 | list_head = &conf->thru_list[IOS_STATS_THRU_READ]; | ||
725 | ios_dump_throughput_stats(list_head, this, logfp, IOS_STATS_THRU_READ); | ||
726 | |||
727 | ios_log (this, logfp, "\n======Write Throughput File Stats======")do { if (logfp) { fprintf (logfp, "\n======Write Throughput File Stats======" ); fprintf (logfp, "\n"); } do { do { if (0) printf ("\n======Write Throughput File Stats======" ); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__ , 727, GF_LOG_INFO, "\n======Write Throughput File Stats======" ); } while (0); } while (0); | ||
728 | ios_log (this, logfp, "\nTIMESTAMP \t\t\t THROUGHPUT(KBPS)"do { if (logfp) { fprintf (logfp, "\nTIMESTAMP \t\t\t THROUGHPUT(KBPS)" "\tFILE NAME"); fprintf (logfp, "\n"); } do { do { if (0) printf ("\nTIMESTAMP \t\t\t THROUGHPUT(KBPS)" "\tFILE NAME"); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__, 729 , GF_LOG_INFO, "\nTIMESTAMP \t\t\t THROUGHPUT(KBPS)" "\tFILE NAME" ); } while (0); } while (0) | ||
729 | "\tFILE NAME")do { if (logfp) { fprintf (logfp, "\nTIMESTAMP \t\t\t THROUGHPUT(KBPS)" "\tFILE NAME"); fprintf (logfp, "\n"); } do { do { if (0) printf ("\nTIMESTAMP \t\t\t THROUGHPUT(KBPS)" "\tFILE NAME"); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__, 729 , GF_LOG_INFO, "\nTIMESTAMP \t\t\t THROUGHPUT(KBPS)" "\tFILE NAME" ); } while (0); } while (0); | ||
730 | list_head = &conf->thru_list[IOS_STATS_THRU_WRITE]; | ||
731 | ios_dump_throughput_stats (list_head, this, logfp, IOS_STATS_THRU_WRITE); | ||
732 | } | ||
733 | return 0; | ||
734 | } | ||
735 | |||
736 | int | ||
737 | io_stats_dump_global_to_dict (xlator_t *this, struct ios_global_stats *stats, | ||
738 | struct timeval *now, int interval, dict_t *dict) | ||
739 | { | ||
740 | int ret = 0; | ||
741 | char key[256] = {0}; | ||
742 | uint64_t sec = 0; | ||
743 | int i = 0; | ||
744 | uint64_t count = 0; | ||
745 | |||
746 | GF_ASSERT (stats)do { if (!(stats)) { do { do { if (0) printf ("Assertion failed: " "stats"); } while (0); _gf_log_callingfn ("", "io-stats.c", __FUNCTION__ , 746, GF_LOG_ERROR, "Assertion failed: " "stats"); } while ( 0); } } while (0); | ||
747 | GF_ASSERT (now)do { if (!(now)) { do { do { if (0) printf ("Assertion failed: " "now"); } while (0); _gf_log_callingfn ("", "io-stats.c", __FUNCTION__ , 747, GF_LOG_ERROR, "Assertion failed: " "now"); } while (0) ; } } while (0); | ||
748 | GF_ASSERT (dict)do { if (!(dict)) { do { do { if (0) printf ("Assertion failed: " "dict"); } while (0); _gf_log_callingfn ("", "io-stats.c", __FUNCTION__ , 748, GF_LOG_ERROR, "Assertion failed: " "dict"); } while (0 ); } } while (0); | ||
749 | GF_ASSERT (this)do { if (!(this)) { do { do { if (0) printf ("Assertion failed: " "this"); } while (0); _gf_log_callingfn ("", "io-stats.c", __FUNCTION__ , 749, GF_LOG_ERROR, "Assertion failed: " "this"); } while (0 ); } } while (0); | ||
750 | |||
751 | if (interval == -1) | ||
752 | snprintf (key, sizeof (key), "cumulative"); | ||
753 | else | ||
754 | snprintf (key, sizeof (key), "interval"); | ||
755 | ret = dict_set_int32 (dict, key, interval); | ||
756 | if (ret) | ||
757 | gf_log (this->name, GF_LOG_ERROR, "failed to set "do { do { if (0) printf ("failed to set " "interval %d", interval ); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__ , 758, GF_LOG_ERROR, "failed to set " "interval %d", interval ); } while (0) | ||
758 | "interval %d", interval)do { do { if (0) printf ("failed to set " "interval %d", interval ); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__ , 758, GF_LOG_ERROR, "failed to set " "interval %d", interval ); } while (0); | ||
759 | |||
760 | memset (key, 0, sizeof (key)); | ||
761 | snprintf (key, sizeof (key), "%d-duration", interval); | ||
762 | sec = (uint64_t) (now->tv_sec - stats->started_at.tv_sec); | ||
763 | ret = dict_set_uint64 (dict, key, sec); | ||
764 | if (ret) { | ||
765 | gf_log (this->name, GF_LOG_ERROR, "failed to set "do { do { if (0) printf ("failed to set " "duration(%d) - %""ll" "d", interval, sec); } while (0); _gf_log (this->name, "io-stats.c" , __FUNCTION__, 766, GF_LOG_ERROR, "failed to set " "duration(%d) - %" "ll" "d", interval, sec); } while (0) | ||
766 | "duration(%d) - %"PRId64, interval, sec)do { do { if (0) printf ("failed to set " "duration(%d) - %""ll" "d", interval, sec); } while (0); _gf_log (this->name, "io-stats.c" , __FUNCTION__, 766, GF_LOG_ERROR, "failed to set " "duration(%d) - %" "ll" "d", interval, sec); } while (0); | ||
767 | goto out; | ||
768 | } | ||
769 | |||
770 | memset (key, 0, sizeof (key)); | ||
771 | snprintf (key, sizeof (key), "%d-total-read", interval); | ||
772 | ret = dict_set_uint64 (dict, key, stats->data_read); | ||
773 | if (ret) { | ||
774 | gf_log (this->name, GF_LOG_ERROR, "failed to set total "do { do { if (0) printf ("failed to set total " "read(%d) - %" "ll" "d", interval, stats->data_read); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__, 775, GF_LOG_ERROR , "failed to set total " "read(%d) - %""ll" "d", interval, stats ->data_read); } while (0) | ||
775 | "read(%d) - %"PRId64, interval, stats->data_read)do { do { if (0) printf ("failed to set total " "read(%d) - %" "ll" "d", interval, stats->data_read); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__, 775, GF_LOG_ERROR , "failed to set total " "read(%d) - %""ll" "d", interval, stats ->data_read); } while (0); | ||
776 | goto out; | ||
777 | } | ||
778 | |||
779 | memset (key, 0, sizeof (key)); | ||
780 | snprintf (key, sizeof (key), "%d-total-write", interval); | ||
781 | ret = dict_set_uint64 (dict, key, stats->data_written); | ||
782 | if (ret) { | ||
783 | gf_log (this->name, GF_LOG_ERROR, "failed to set total "do { do { if (0) printf ("failed to set total " "write(%d) - %" "ll" "d", interval, stats->data_written); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__, 784, GF_LOG_ERROR , "failed to set total " "write(%d) - %""ll" "d", interval, stats ->data_written); } while (0) | ||
784 | "write(%d) - %"PRId64, interval, stats->data_written)do { do { if (0) printf ("failed to set total " "write(%d) - %" "ll" "d", interval, stats->data_written); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__, 784, GF_LOG_ERROR , "failed to set total " "write(%d) - %""ll" "d", interval, stats ->data_written); } while (0); | ||
785 | goto out; | ||
786 | } | ||
787 | for (i = 0; i < 32; i++) { | ||
788 | if (stats->block_count_read[i]) { | ||
789 | memset (key, 0, sizeof (key)); | ||
790 | snprintf (key, sizeof (key), "%d-read-%d", interval, | ||
791 | (1 << i)); | ||
792 | count = stats->block_count_read[i]; | ||
793 | ret = dict_set_uint64 (dict, key, count); | ||
794 | if (ret) { | ||
795 | gf_log (this->name, GF_LOG_ERROR, "failed to "do { do { if (0) printf ("failed to " "set read-%db+, with: %" "ll" "d", (1<<i), count); } while (0); _gf_log (this-> name, "io-stats.c", __FUNCTION__, 797, GF_LOG_ERROR, "failed to " "set read-%db+, with: %""ll" "d", (1<<i), count); } while (0) | ||
796 | "set read-%db+, with: %"PRId64,do { do { if (0) printf ("failed to " "set read-%db+, with: %" "ll" "d", (1<<i), count); } while (0); _gf_log (this-> name, "io-stats.c", __FUNCTION__, 797, GF_LOG_ERROR, "failed to " "set read-%db+, with: %""ll" "d", (1<<i), count); } while (0) | ||
797 | (1<<i), count)do { do { if (0) printf ("failed to " "set read-%db+, with: %" "ll" "d", (1<<i), count); } while (0); _gf_log (this-> name, "io-stats.c", __FUNCTION__, 797, GF_LOG_ERROR, "failed to " "set read-%db+, with: %""ll" "d", (1<<i), count); } while (0); | ||
798 | goto out; | ||
799 | } | ||
800 | } | ||
801 | } | ||
802 | |||
803 | for (i = 0; i < 32; i++) { | ||
804 | if (stats->block_count_write[i]) { | ||
805 | snprintf (key, sizeof (key), "%d-write-%d", interval, | ||
806 | (1<<i)); | ||
807 | count = stats->block_count_write[i]; | ||
808 | ret = dict_set_uint64 (dict, key, count); | ||
809 | if (ret) { | ||
810 | gf_log (this->name, GF_LOG_ERROR, "failed to "do { do { if (0) printf ("failed to " "set write-%db+, with: %" "ll" "d", (1<<i), count); } while (0); _gf_log (this-> name, "io-stats.c", __FUNCTION__, 812, GF_LOG_ERROR, "failed to " "set write-%db+, with: %""ll" "d", (1<<i), count); } while (0) | ||
811 | "set write-%db+, with: %"PRId64,do { do { if (0) printf ("failed to " "set write-%db+, with: %" "ll" "d", (1<<i), count); } while (0); _gf_log (this-> name, "io-stats.c", __FUNCTION__, 812, GF_LOG_ERROR, "failed to " "set write-%db+, with: %""ll" "d", (1<<i), count); } while (0) | ||
812 | (1<<i), count)do { do { if (0) printf ("failed to " "set write-%db+, with: %" "ll" "d", (1<<i), count); } while (0); _gf_log (this-> name, "io-stats.c", __FUNCTION__, 812, GF_LOG_ERROR, "failed to " "set write-%db+, with: %""ll" "d", (1<<i), count); } while (0); | ||
813 | goto out; | ||
814 | } | ||
815 | } | ||
816 | } | ||
817 | |||
818 | for (i = 0; i < GF_FOP_MAXVALUE; i++) { | ||
819 | if (stats->fop_hits[i] == 0) | ||
820 | continue; | ||
821 | snprintf (key, sizeof (key), "%d-%d-hits", interval, i); | ||
822 | ret = dict_set_uint64 (dict, key, stats->fop_hits[i]); | ||
823 | if (ret) { | ||
824 | gf_log (this->name, GF_LOG_ERROR, "failed to "do { do { if (0) printf ("failed to " "set %s-fop-hits: %""ll" "u", gf_fop_list[i], stats->fop_hits[i]); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__, 826, GF_LOG_ERROR , "failed to " "set %s-fop-hits: %""ll" "u", gf_fop_list[i], stats ->fop_hits[i]); } while (0) | ||
825 | "set %s-fop-hits: %"PRIu64, gf_fop_list[i],do { do { if (0) printf ("failed to " "set %s-fop-hits: %""ll" "u", gf_fop_list[i], stats->fop_hits[i]); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__, 826, GF_LOG_ERROR , "failed to " "set %s-fop-hits: %""ll" "u", gf_fop_list[i], stats ->fop_hits[i]); } while (0) | ||
826 | stats->fop_hits[i])do { do { if (0) printf ("failed to " "set %s-fop-hits: %""ll" "u", gf_fop_list[i], stats->fop_hits[i]); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__, 826, GF_LOG_ERROR , "failed to " "set %s-fop-hits: %""ll" "u", gf_fop_list[i], stats ->fop_hits[i]); } while (0); | ||
827 | goto out; | ||
828 | } | ||
829 | |||
830 | if (stats->latency[i].avg == 0) | ||
831 | continue; | ||
832 | snprintf (key, sizeof (key), "%d-%d-avglatency", interval, i); | ||
833 | ret = dict_set_double (dict, key, stats->latency[i].avg); | ||
834 | if (ret) { | ||
835 | gf_log (this->name, GF_LOG_ERROR, "failed to set %s "do { do { if (0) printf ("failed to set %s " "avglatency(%d) with %f" , gf_fop_list[i], interval, stats->latency[i].avg); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__, 837 , GF_LOG_ERROR, "failed to set %s " "avglatency(%d) with %f", gf_fop_list[i], interval, stats->latency[i].avg); } while (0) | ||
836 | "avglatency(%d) with %f", gf_fop_list[i],do { do { if (0) printf ("failed to set %s " "avglatency(%d) with %f" , gf_fop_list[i], interval, stats->latency[i].avg); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__, 837 , GF_LOG_ERROR, "failed to set %s " "avglatency(%d) with %f", gf_fop_list[i], interval, stats->latency[i].avg); } while (0) | ||
837 | interval, stats->latency[i].avg)do { do { if (0) printf ("failed to set %s " "avglatency(%d) with %f" , gf_fop_list[i], interval, stats->latency[i].avg); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__, 837 , GF_LOG_ERROR, "failed to set %s " "avglatency(%d) with %f", gf_fop_list[i], interval, stats->latency[i].avg); } while (0); | ||
838 | goto out; | ||
839 | } | ||
840 | snprintf (key, sizeof (key), "%d-%d-minlatency", interval, i); | ||
841 | ret = dict_set_double (dict, key, stats->latency[i].min); | ||
842 | if (ret) { | ||
843 | gf_log (this->name, GF_LOG_ERROR, "failed to set %s "do { do { if (0) printf ("failed to set %s " "minlatency(%d) with %f" , gf_fop_list[i], interval, stats->latency[i].min); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__, 845 , GF_LOG_ERROR, "failed to set %s " "minlatency(%d) with %f", gf_fop_list[i], interval, stats->latency[i].min); } while (0) | ||
844 | "minlatency(%d) with %f", gf_fop_list[i],do { do { if (0) printf ("failed to set %s " "minlatency(%d) with %f" , gf_fop_list[i], interval, stats->latency[i].min); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__, 845 , GF_LOG_ERROR, "failed to set %s " "minlatency(%d) with %f", gf_fop_list[i], interval, stats->latency[i].min); } while (0) | ||
845 | interval, stats->latency[i].min)do { do { if (0) printf ("failed to set %s " "minlatency(%d) with %f" , gf_fop_list[i], interval, stats->latency[i].min); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__, 845 , GF_LOG_ERROR, "failed to set %s " "minlatency(%d) with %f", gf_fop_list[i], interval, stats->latency[i].min); } while (0); | ||
846 | goto out; | ||
847 | } | ||
848 | snprintf (key, sizeof (key), "%d-%d-maxlatency", interval, i); | ||
849 | ret = dict_set_double (dict, key, stats->latency[i].max); | ||
850 | if (ret) { | ||
851 | gf_log (this->name, GF_LOG_ERROR, "failed to set %s "do { do { if (0) printf ("failed to set %s " "maxlatency(%d) with %f" , gf_fop_list[i], interval, stats->latency[i].max); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__, 853 , GF_LOG_ERROR, "failed to set %s " "maxlatency(%d) with %f", gf_fop_list[i], interval, stats->latency[i].max); } while (0) | ||
852 | "maxlatency(%d) with %f", gf_fop_list[i],do { do { if (0) printf ("failed to set %s " "maxlatency(%d) with %f" , gf_fop_list[i], interval, stats->latency[i].max); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__, 853 , GF_LOG_ERROR, "failed to set %s " "maxlatency(%d) with %f", gf_fop_list[i], interval, stats->latency[i].max); } while (0) | ||
853 | interval, stats->latency[i].max)do { do { if (0) printf ("failed to set %s " "maxlatency(%d) with %f" , gf_fop_list[i], interval, stats->latency[i].max); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__, 853 , GF_LOG_ERROR, "failed to set %s " "maxlatency(%d) with %f", gf_fop_list[i], interval, stats->latency[i].max); } while (0); | ||
854 | goto out; | ||
855 | } | ||
856 | } | ||
857 | out: | ||
858 | gf_log (this->name, GF_LOG_DEBUG, "returning %d", ret)do { do { if (0) printf ("returning %d", ret); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__, 858, GF_LOG_DEBUG , "returning %d", ret); } while (0); | ||
859 | return ret; | ||
860 | } | ||
861 | |||
862 | int | ||
863 | io_stats_dump_global (xlator_t *this, struct ios_global_stats *stats, | ||
864 | struct timeval *now, int interval, | ||
865 | struct ios_dump_args *args) | ||
866 | { | ||
867 | int ret = -1; | ||
868 | |||
869 | GF_ASSERT (args)do { if (!(args)) { do { do { if (0) printf ("Assertion failed: " "args"); } while (0); _gf_log_callingfn ("", "io-stats.c", __FUNCTION__ , 869, GF_LOG_ERROR, "Assertion failed: " "args"); } while (0 ); } } while (0); | ||
870 | GF_ASSERT (now)do { if (!(now)) { do { do { if (0) printf ("Assertion failed: " "now"); } while (0); _gf_log_callingfn ("", "io-stats.c", __FUNCTION__ , 870, GF_LOG_ERROR, "Assertion failed: " "now"); } while (0) ; } } while (0); | ||
871 | GF_ASSERT (stats)do { if (!(stats)) { do { do { if (0) printf ("Assertion failed: " "stats"); } while (0); _gf_log_callingfn ("", "io-stats.c", __FUNCTION__ , 871, GF_LOG_ERROR, "Assertion failed: " "stats"); } while ( 0); } } while (0); | ||
872 | GF_ASSERT (this)do { if (!(this)) { do { do { if (0) printf ("Assertion failed: " "this"); } while (0); _gf_log_callingfn ("", "io-stats.c", __FUNCTION__ , 872, GF_LOG_ERROR, "Assertion failed: " "this"); } while (0 ); } } while (0); | ||
873 | |||
874 | |||
875 | |||
876 | switch (args->type) { | ||
877 | case IOS_DUMP_TYPE_FILE: | ||
878 | ret = io_stats_dump_global_to_logfp (this, stats, now, | ||
879 | interval, args->u.logfp); | ||
880 | break; | ||
881 | case IOS_DUMP_TYPE_DICT: | ||
882 | ret = io_stats_dump_global_to_dict (this, stats, now, | ||
883 | interval, args->u.dict); | ||
884 | break; | ||
885 | default: | ||
886 | GF_ASSERT (0)do { if (!(0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "io-stats.c", __FUNCTION__ , 886, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); | ||
887 | ret = -1; | ||
888 | break; | ||
889 | } | ||
890 | return ret; | ||
891 | } | ||
892 | |||
893 | int | ||
894 | ios_dump_args_init (struct ios_dump_args *args, ios_dump_type_t type, | ||
895 | void *output) | ||
896 | { | ||
897 | int ret = 0; | ||
898 | |||
899 | GF_ASSERT (args)do { if (!(args)) { do { do { if (0) printf ("Assertion failed: " "args"); } while (0); _gf_log_callingfn ("", "io-stats.c", __FUNCTION__ , 899, GF_LOG_ERROR, "Assertion failed: " "args"); } while (0 ); } } while (0); | ||
900 | GF_ASSERT (type > IOS_DUMP_TYPE_NONE && type < IOS_DUMP_TYPE_MAX)do { if (!(type > IOS_DUMP_TYPE_NONE && type < IOS_DUMP_TYPE_MAX )) { do { do { if (0) printf ("Assertion failed: " "type > IOS_DUMP_TYPE_NONE && type < IOS_DUMP_TYPE_MAX" ); } while (0); _gf_log_callingfn ("", "io-stats.c", __FUNCTION__ , 900, GF_LOG_ERROR, "Assertion failed: " "type > IOS_DUMP_TYPE_NONE && type < IOS_DUMP_TYPE_MAX" ); } while (0); } } while (0); | ||
901 | GF_ASSERT (output)do { if (!(output)) { do { do { if (0) printf ("Assertion failed: " "output"); } while (0); _gf_log_callingfn ("", "io-stats.c", __FUNCTION__, 901, GF_LOG_ERROR, "Assertion failed: " "output" ); } while (0); } } while (0); | ||
902 | |||
903 | args->type = type; | ||
904 | switch (args->type) { | ||
905 | case IOS_DUMP_TYPE_FILE: | ||
906 | args->u.logfp = output; | ||
907 | break; | ||
908 | case IOS_DUMP_TYPE_DICT: | ||
909 | args->u.dict = output; | ||
910 | break; | ||
911 | default: | ||
912 | GF_ASSERT (0)do { if (!(0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "io-stats.c", __FUNCTION__ , 912, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); | ||
913 | ret = -1; | ||
914 | } | ||
915 | |||
916 | return ret; | ||
917 | } | ||
918 | |||
919 | int | ||
920 | io_stats_dump (xlator_t *this, struct ios_dump_args *args) | ||
921 | { | ||
922 | struct ios_conf *conf = NULL((void*)0); | ||
923 | struct ios_global_stats cumulative = {0, }; | ||
924 | struct ios_global_stats incremental = {0, }; | ||
925 | int increment = 0; | ||
926 | struct timeval now; | ||
927 | |||
928 | GF_ASSERT (this)do { if (!(this)) { do { do { if (0) printf ("Assertion failed: " "this"); } while (0); _gf_log_callingfn ("", "io-stats.c", __FUNCTION__ , 928, GF_LOG_ERROR, "Assertion failed: " "this"); } while (0 ); } } while (0); | ||
929 | GF_ASSERT (args)do { if (!(args)) { do { do { if (0) printf ("Assertion failed: " "args"); } while (0); _gf_log_callingfn ("", "io-stats.c", __FUNCTION__ , 929, GF_LOG_ERROR, "Assertion failed: " "args"); } while (0 ); } } while (0); | ||
930 | GF_ASSERT (args->type > IOS_DUMP_TYPE_NONE)do { if (!(args->type > IOS_DUMP_TYPE_NONE)) { do { do { if (0) printf ("Assertion failed: " "args->type > IOS_DUMP_TYPE_NONE" ); } while (0); _gf_log_callingfn ("", "io-stats.c", __FUNCTION__ , 930, GF_LOG_ERROR, "Assertion failed: " "args->type > IOS_DUMP_TYPE_NONE" ); } while (0); } } while (0); | ||
931 | GF_ASSERT (args->type < IOS_DUMP_TYPE_MAX)do { if (!(args->type < IOS_DUMP_TYPE_MAX)) { do { do { if (0) printf ("Assertion failed: " "args->type < IOS_DUMP_TYPE_MAX" ); } while (0); _gf_log_callingfn ("", "io-stats.c", __FUNCTION__ , 931, GF_LOG_ERROR, "Assertion failed: " "args->type < IOS_DUMP_TYPE_MAX" ); } while (0); } } while (0); | ||
932 | |||
933 | conf = this->private; | ||
934 | |||
935 | gettimeofday (&now, NULL((void*)0)); | ||
936 | LOCK (&conf->lock)pthread_spin_lock (&conf->lock); | ||
937 | { | ||
938 | cumulative = conf->cumulative; | ||
939 | incremental = conf->incremental; | ||
940 | |||
941 | increment = conf->increment++; | ||
942 | |||
943 | memset (&conf->incremental, 0, sizeof (conf->incremental)); | ||
944 | conf->incremental.started_at = now; | ||
945 | } | ||
946 | UNLOCK (&conf->lock)pthread_spin_unlock (&conf->lock); | ||
947 | |||
948 | io_stats_dump_global (this, &cumulative, &now, -1, args); | ||
949 | io_stats_dump_global (this, &incremental, &now, increment, args); | ||
950 | |||
951 | return 0; | ||
952 | } | ||
953 | |||
954 | |||
955 | int | ||
956 | io_stats_dump_fd (xlator_t *this, struct ios_fd *iosfd) | ||
957 | { | ||
958 | struct ios_conf *conf = NULL((void*)0); | ||
959 | struct timeval now; | ||
960 | uint64_t sec = 0; | ||
961 | uint64_t usec = 0; | ||
962 | int i = 0; | ||
963 | |||
964 | conf = this->private; | ||
965 | |||
966 | if (!conf->dump_fd_stats) | ||
967 | return 0; | ||
968 | |||
969 | if (!iosfd) | ||
970 | return 0; | ||
971 | |||
972 | gettimeofday (&now, NULL((void*)0)); | ||
973 | |||
974 | if (iosfd->opened_at.tv_usec > now.tv_usec) { | ||
975 | now.tv_usec += 1000000; | ||
976 | now.tv_usec--; | ||
977 | } | ||
978 | |||
979 | sec = now.tv_sec - iosfd->opened_at.tv_sec; | ||
980 | usec = now.tv_usec - iosfd->opened_at.tv_usec; | ||
981 | |||
982 | gf_log (this->name, GF_LOG_INFO,do { do { if (0) printf ("--- fd stats ---"); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__, 983, GF_LOG_INFO , "--- fd stats ---"); } while (0) | ||
983 | "--- fd stats ---")do { do { if (0) printf ("--- fd stats ---"); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__, 983, GF_LOG_INFO , "--- fd stats ---"); } while (0); | ||
984 | |||
985 | if (iosfd->filename) | ||
986 | gf_log (this->name, GF_LOG_INFO,do { do { if (0) printf (" Filename : %s", iosfd->filename ); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__ , 988, GF_LOG_INFO, " Filename : %s", iosfd->filename ); } while (0) | ||
987 | " Filename : %s",do { do { if (0) printf (" Filename : %s", iosfd->filename ); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__ , 988, GF_LOG_INFO, " Filename : %s", iosfd->filename ); } while (0) | ||
988 | iosfd->filename)do { do { if (0) printf (" Filename : %s", iosfd->filename ); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__ , 988, GF_LOG_INFO, " Filename : %s", iosfd->filename ); } while (0); | ||
989 | |||
990 | if (sec) | ||
991 | gf_log (this->name, GF_LOG_INFO,do { do { if (0) printf (" Lifetime : %""ll" "d""secs, %" "ll" "d""usecs", sec, usec); } while (0); _gf_log (this->name , "io-stats.c", __FUNCTION__, 993, GF_LOG_INFO, " Lifetime : %" "ll" "d""secs, %""ll" "d""usecs", sec, usec); } while (0) | ||
992 | " Lifetime : %"PRId64"secs, %"PRId64"usecs",do { do { if (0) printf (" Lifetime : %""ll" "d""secs, %" "ll" "d""usecs", sec, usec); } while (0); _gf_log (this->name , "io-stats.c", __FUNCTION__, 993, GF_LOG_INFO, " Lifetime : %" "ll" "d""secs, %""ll" "d""usecs", sec, usec); } while (0) | ||
993 | sec, usec)do { do { if (0) printf (" Lifetime : %""ll" "d""secs, %" "ll" "d""usecs", sec, usec); } while (0); _gf_log (this->name , "io-stats.c", __FUNCTION__, 993, GF_LOG_INFO, " Lifetime : %" "ll" "d""secs, %""ll" "d""usecs", sec, usec); } while (0); | ||
994 | |||
995 | if (iosfd->data_read) | ||
996 | gf_log (this->name, GF_LOG_INFO,do { do { if (0) printf (" BytesRead : %""ll" "d"" bytes" , iosfd->data_read); } while (0); _gf_log (this->name, "io-stats.c" , __FUNCTION__, 998, GF_LOG_INFO, " BytesRead : %""ll" "d" " bytes", iosfd->data_read); } while (0) | ||
997 | " BytesRead : %"PRId64" bytes",do { do { if (0) printf (" BytesRead : %""ll" "d"" bytes" , iosfd->data_read); } while (0); _gf_log (this->name, "io-stats.c" , __FUNCTION__, 998, GF_LOG_INFO, " BytesRead : %""ll" "d" " bytes", iosfd->data_read); } while (0) | ||
998 | iosfd->data_read)do { do { if (0) printf (" BytesRead : %""ll" "d"" bytes" , iosfd->data_read); } while (0); _gf_log (this->name, "io-stats.c" , __FUNCTION__, 998, GF_LOG_INFO, " BytesRead : %""ll" "d" " bytes", iosfd->data_read); } while (0); | ||
999 | |||
1000 | if (iosfd->data_written) | ||
1001 | gf_log (this->name, GF_LOG_INFO,do { do { if (0) printf (" BytesWritten : %""ll" "d"" bytes" , iosfd->data_written); } while (0); _gf_log (this->name , "io-stats.c", __FUNCTION__, 1003, GF_LOG_INFO, " BytesWritten : %" "ll" "d"" bytes", iosfd->data_written); } while (0) | ||
1002 | " BytesWritten : %"PRId64" bytes",do { do { if (0) printf (" BytesWritten : %""ll" "d"" bytes" , iosfd->data_written); } while (0); _gf_log (this->name , "io-stats.c", __FUNCTION__, 1003, GF_LOG_INFO, " BytesWritten : %" "ll" "d"" bytes", iosfd->data_written); } while (0) | ||
1003 | iosfd->data_written)do { do { if (0) printf (" BytesWritten : %""ll" "d"" bytes" , iosfd->data_written); } while (0); _gf_log (this->name , "io-stats.c", __FUNCTION__, 1003, GF_LOG_INFO, " BytesWritten : %" "ll" "d"" bytes", iosfd->data_written); } while (0); | ||
1004 | |||
1005 | for (i = 0; i < 32; i++) { | ||
1006 | if (iosfd->block_count_read[i]) | ||
1007 | gf_log (this->name, GF_LOG_INFO,do { do { if (0) printf (" Read %06db+ : %""ll" "d", (1 << i), iosfd->block_count_read[i]); } while (0); _gf_log (this ->name, "io-stats.c", __FUNCTION__, 1009, GF_LOG_INFO, " Read %06db+ : %" "ll" "d", (1 << i), iosfd->block_count_read[i]); } while (0) | ||
1008 | " Read %06db+ : %"PRId64,do { do { if (0) printf (" Read %06db+ : %""ll" "d", (1 << i), iosfd->block_count_read[i]); } while (0); _gf_log (this ->name, "io-stats.c", __FUNCTION__, 1009, GF_LOG_INFO, " Read %06db+ : %" "ll" "d", (1 << i), iosfd->block_count_read[i]); } while (0) | ||
1009 | (1 << i), iosfd->block_count_read[i])do { do { if (0) printf (" Read %06db+ : %""ll" "d", (1 << i), iosfd->block_count_read[i]); } while (0); _gf_log (this ->name, "io-stats.c", __FUNCTION__, 1009, GF_LOG_INFO, " Read %06db+ : %" "ll" "d", (1 << i), iosfd->block_count_read[i]); } while (0); | ||
1010 | } | ||
1011 | for (i = 0; i < 32; i++) { | ||
1012 | if (iosfd->block_count_write[i]) | ||
1013 | gf_log (this->name, GF_LOG_INFO,do { do { if (0) printf ("Write %06db+ : %""ll" "d", (1 << i), iosfd->block_count_write[i]); } while (0); _gf_log (this ->name, "io-stats.c", __FUNCTION__, 1015, GF_LOG_INFO, "Write %06db+ : %" "ll" "d", (1 << i), iosfd->block_count_write[i]); } while (0) | ||
1014 | "Write %06db+ : %"PRId64,do { do { if (0) printf ("Write %06db+ : %""ll" "d", (1 << i), iosfd->block_count_write[i]); } while (0); _gf_log (this ->name, "io-stats.c", __FUNCTION__, 1015, GF_LOG_INFO, "Write %06db+ : %" "ll" "d", (1 << i), iosfd->block_count_write[i]); } while (0) | ||
1015 | (1 << i), iosfd->block_count_write[i])do { do { if (0) printf ("Write %06db+ : %""ll" "d", (1 << i), iosfd->block_count_write[i]); } while (0); _gf_log (this ->name, "io-stats.c", __FUNCTION__, 1015, GF_LOG_INFO, "Write %06db+ : %" "ll" "d", (1 << i), iosfd->block_count_write[i]); } while (0); | ||
1016 | } | ||
1017 | return 0; | ||
1018 | } | ||
1019 | |||
1020 | static void | ||
1021 | update_ios_latency_stats (struct ios_global_stats *stats, double elapsed, | ||
1022 | glusterfs_fop_t op) | ||
1023 | { | ||
1024 | double avg; | ||
1025 | |||
1026 | GF_ASSERT (stats)do { if (!(stats)) { do { do { if (0) printf ("Assertion failed: " "stats"); } while (0); _gf_log_callingfn ("", "io-stats.c", __FUNCTION__ , 1026, GF_LOG_ERROR, "Assertion failed: " "stats"); } while ( 0); } } while (0); | ||
1027 | |||
1028 | if (!stats->latency[op].min) | ||
1029 | stats->latency[op].min = elapsed; | ||
1030 | if (stats->latency[op].min > elapsed) | ||
1031 | stats->latency[op].min = elapsed; | ||
1032 | if (stats->latency[op].max < elapsed) | ||
1033 | stats->latency[op].max = elapsed; | ||
1034 | |||
1035 | avg = stats->latency[op].avg; | ||
1036 | |||
1037 | stats->latency[op].avg = avg + (elapsed - avg) / stats->fop_hits[op]; | ||
1038 | } | ||
1039 | |||
1040 | int | ||
1041 | update_ios_latency (struct ios_conf *conf, call_frame_t *frame, | ||
1042 | glusterfs_fop_t op) | ||
1043 | { | ||
1044 | double elapsed; | ||
1045 | struct timeval *begin, *end; | ||
1046 | |||
1047 | begin = &frame->begin; | ||
1048 | end = &frame->end; | ||
1049 | |||
1050 | elapsed = (end->tv_sec - begin->tv_sec) * 1e6 | ||
1051 | + (end->tv_usec - begin->tv_usec); | ||
1052 | |||
1053 | update_ios_latency_stats (&conf->cumulative, elapsed, op); | ||
1054 | update_ios_latency_stats (&conf->incremental, elapsed, op); | ||
1055 | |||
1056 | return 0; | ||
1057 | } | ||
1058 | |||
1059 | int32_t | ||
1060 | io_stats_dump_stats_to_dict (xlator_t *this, dict_t *resp, | ||
1061 | ios_stats_type_t flags, int32_t list_cnt) | ||
1062 | { | ||
1063 | struct ios_conf *conf = NULL((void*)0); | ||
1064 | int cnt = 0; | ||
1065 | char key[256]; | ||
1066 | struct ios_stat_head *list_head = NULL((void*)0); | ||
1067 | struct ios_stat_list *entry = NULL((void*)0); | ||
1068 | int ret = -1; | ||
1069 | ios_stats_thru_t index = IOS_STATS_THRU_MAX; | ||
1070 | char timestr[256] = {0, }; | ||
1071 | char *dict_timestr = NULL((void*)0); | ||
1072 | |||
1073 | conf = this->private; | ||
1074 | |||
1075 | switch (flags) { | ||
1076 | case IOS_STATS_TYPE_OPEN: | ||
1077 | list_head = &conf->list[IOS_STATS_TYPE_OPEN]; | ||
1078 | LOCK (&conf->lock)pthread_spin_lock (&conf->lock); | ||
1079 | { | ||
1080 | ret = dict_set_uint64 (resp, "current-open", | ||
1081 | conf->cumulative.nr_opens); | ||
1082 | if (ret) | ||
1083 | goto unlock; | ||
1084 | ret = dict_set_uint64 (resp, "max-open", | ||
1085 | conf->cumulative.max_nr_opens); | ||
1086 | |||
1087 | gf_time_fmt (timestr, sizeof timestr, | ||
1088 | conf->cumulative.max_openfd_time.tv_sec, | ||
1089 | gf_timefmt_FT); | ||
1090 | if (conf->cumulative.max_openfd_time.tv_sec) | ||
1091 | snprintf (timestr + strlen (timestr), sizeof timestr - strlen (timestr), | ||
1092 | ".%"GF_PRI_SUSECONDS"06ld", | ||
1093 | conf->cumulative.max_openfd_time.tv_usec); | ||
1094 | |||
1095 | dict_timestr = gf_strdup (timestr); | ||
1096 | if (!dict_timestr) | ||
1097 | goto unlock; | ||
1098 | ret = dict_set_dynstr (resp, "max-openfd-time", | ||
1099 | dict_timestr); | ||
1100 | if (ret) | ||
1101 | goto unlock; | ||
1102 | } | ||
1103 | unlock: | ||
1104 | UNLOCK (&conf->lock)pthread_spin_unlock (&conf->lock); | ||
1105 | /* Do not proceed if we came here because of some error | ||
1106 | * during the dict operation */ | ||
1107 | if (ret) | ||
1108 | goto out; | ||
1109 | break; | ||
1110 | case IOS_STATS_TYPE_READ: | ||
1111 | list_head = &conf->list[IOS_STATS_TYPE_READ]; | ||
1112 | break; | ||
1113 | case IOS_STATS_TYPE_WRITE: | ||
1114 | list_head = &conf->list[IOS_STATS_TYPE_WRITE]; | ||
1115 | break; | ||
1116 | case IOS_STATS_TYPE_OPENDIR: | ||
1117 | list_head = &conf->list[IOS_STATS_TYPE_OPENDIR]; | ||
1118 | break; | ||
1119 | case IOS_STATS_TYPE_READDIRP: | ||
1120 | list_head = &conf->list[IOS_STATS_TYPE_READDIRP]; | ||
1121 | break; | ||
1122 | case IOS_STATS_TYPE_READ_THROUGHPUT: | ||
1123 | list_head = &conf->thru_list[IOS_STATS_THRU_READ]; | ||
1124 | index = IOS_STATS_THRU_READ; | ||
1125 | break; | ||
1126 | case IOS_STATS_TYPE_WRITE_THROUGHPUT: | ||
1127 | list_head = &conf->thru_list[IOS_STATS_THRU_WRITE]; | ||
1128 | index = IOS_STATS_THRU_WRITE; | ||
1129 | break; | ||
1130 | |||
1131 | default: | ||
1132 | goto out; | ||
1133 | } | ||
1134 | ret = dict_set_int32 (resp, "top-op", flags); | ||
1135 | if (!list_cnt) | ||
1136 | goto out; | ||
1137 | LOCK (&list_head->lock)pthread_spin_lock (&list_head->lock); | ||
1138 | { | ||
1139 | list_for_each_entry (entry, &list_head->iosstats->list, list)for (entry = ((typeof(*entry) *)((char *)((&list_head-> iosstats->list)->next)-(unsigned long)(&((typeof(*entry ) *)0)->list))); &entry->list != (&list_head-> iosstats->list); entry = ((typeof(*entry) *)((char *)(entry ->list.next)-(unsigned long)(&((typeof(*entry) *)0)-> list)))) { | ||
1140 | |||
1141 | cnt++; | ||
1142 | snprintf (key, 256, "%s-%d", "filename", cnt); | ||
1143 | ret = dict_set_str (resp, key, entry->iosstat->filename); | ||
1144 | if (ret) | ||
1145 | goto unlock_list_head; | ||
1146 | snprintf (key, 256, "%s-%d", "value",cnt); | ||
1147 | ret = dict_set_uint64 (resp, key, entry->value); | ||
1148 | if (ret) | ||
1149 | goto unlock_list_head; | ||
1150 | if (index != IOS_STATS_THRU_MAX) { | ||
1151 | snprintf (key, 256, "%s-%d", "time-sec", cnt); | ||
1152 | ret = dict_set_int32 (resp, key, | ||
1153 | entry->iosstat->thru_counters[index].time.tv_sec); | ||
1154 | if (ret) | ||
1155 | goto unlock_list_head; | ||
1156 | snprintf (key, 256, "%s-%d", "time-usec", cnt); | ||
1157 | ret = dict_set_int32 (resp, key, | ||
1158 | entry->iosstat->thru_counters[index].time.tv_usec); | ||
1159 | if (ret) | ||
1160 | goto unlock_list_head; | ||
1161 | } | ||
1162 | if (cnt == list_cnt) | ||
1163 | break; | ||
1164 | |||
1165 | } | ||
1166 | } | ||
1167 | unlock_list_head: | ||
1168 | UNLOCK (&list_head->lock)pthread_spin_unlock (&list_head->lock); | ||
1169 | /* ret is !=0 if some dict operation in the above critical region | ||
1170 | * failed. */ | ||
1171 | if (ret) | ||
1172 | goto out; | ||
1173 | ret = dict_set_int32 (resp, "members", cnt); | ||
1174 | out: | ||
1175 | return ret; | ||
1176 | } | ||
1177 | |||
1178 | int | ||
1179 | io_stats_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | ||
1180 | int32_t op_ret, int32_t op_errno, fd_t *fd, | ||
1181 | inode_t *inode, struct iatt *buf, | ||
1182 | struct iatt *preparent, struct iatt *postparent, dict_t *xdata) | ||
1183 | { | ||
1184 | struct ios_fd *iosfd = NULL((void*)0); | ||
1185 | char *path = NULL((void*)0); | ||
1186 | struct ios_stat *iosstat = NULL((void*)0); | ||
1187 | struct ios_conf *conf = NULL((void*)0); | ||
1188 | |||
1189 | conf = this->private; | ||
1190 | |||
1191 | path = frame->local; | ||
1192 | frame->local = NULL((void*)0); | ||
1193 | |||
1194 | if (!path) | ||
1195 | goto unwind; | ||
1196 | |||
1197 | if (op_ret < 0) { | ||
1198 | GF_FREE (path)__gf_free (path); | ||
1199 | goto unwind; | ||
1200 | } | ||
1201 | |||
1202 | iosfd = GF_CALLOC (1, sizeof (*iosfd), gf_io_stats_mt_ios_fd)__gf_calloc (1, sizeof (*iosfd), gf_io_stats_mt_ios_fd); | ||
1203 | if (!iosfd) { | ||
1204 | GF_FREE (path)__gf_free (path); | ||
1205 | goto unwind; | ||
1206 | } | ||
1207 | |||
1208 | iosfd->filename = path; | ||
1209 | gettimeofday (&iosfd->opened_at, NULL((void*)0)); | ||
1210 | |||
1211 | ios_fd_ctx_set (fd, this, iosfd); | ||
1212 | LOCK (&conf->lock)pthread_spin_lock (&conf->lock); | ||
1213 | { | ||
1214 | conf->cumulative.nr_opens++; | ||
1215 | if (conf->cumulative.nr_opens > conf->cumulative.max_nr_opens) { | ||
1216 | conf->cumulative.max_nr_opens = conf->cumulative.nr_opens; | ||
1217 | conf->cumulative.max_openfd_time = iosfd->opened_at; | ||
1218 | } | ||
1219 | } | ||
1220 | UNLOCK (&conf->lock)pthread_spin_unlock (&conf->lock); | ||
1221 | |||
1222 | iosstat = GF_CALLOC (1, sizeof (*iosstat), gf_io_stats_mt_ios_stat)__gf_calloc (1, sizeof (*iosstat), gf_io_stats_mt_ios_stat); | ||
1223 | if (!iosstat) { | ||
1224 | GF_FREE (path)__gf_free (path); | ||
1225 | goto unwind; | ||
1226 | } | ||
1227 | iosstat->filename = gf_strdup (path); | ||
1228 | uuid_copy (iosstat->gfid, buf->ia_gfid); | ||
1229 | LOCK_INIT (&iosstat->lock)pthread_spin_init (&iosstat->lock, 0); | ||
1230 | ios_inode_ctx_set (fd->inode, this, iosstat); | ||
1231 | |||
1232 | unwind: | ||
1233 | UPDATE_PROFILE_STATS (frame, CREATE)do { struct ios_conf *conf = ((void*)0); if (!is_fop_latency_started (frame)) break; conf = this->private; pthread_spin_lock ( &conf->lock); { if (conf && conf->measure_latency && conf->count_fop_hits) { do { struct ios_conf * conf = ((void*)0); conf = this->private; if (!conf) break; conf->cumulative.fop_hits[GF_FOP_CREATE]++; conf->incremental .fop_hits[GF_FOP_CREATE]++; } while (0); gettimeofday (&frame ->end, ((void*)0)); update_ios_latency (conf, frame, GF_FOP_CREATE ); } } pthread_spin_unlock (&conf->lock); } while (0); | ||
1234 | STACK_UNWIND_STRICT (create, frame, op_ret, op_errno, fd, inode, buf,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" , "io-stats.c", __FUNCTION__, 1235, 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) | ||
1235 | preparent, postparent, xdata)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" , "io-stats.c", __FUNCTION__, 1235, 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); | ||
1236 | return 0; | ||
1237 | } | ||
1238 | |||
1239 | |||
1240 | int | ||
1241 | io_stats_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | ||
1242 | int32_t op_ret, int32_t op_errno, fd_t *fd, dict_t *xdata) | ||
1243 | { | ||
1244 | struct ios_fd *iosfd = NULL((void*)0); | ||
1245 | char *path = NULL((void*)0); | ||
1246 | struct ios_stat *iosstat = NULL((void*)0); | ||
1247 | struct ios_conf *conf = NULL((void*)0); | ||
1248 | |||
1249 | conf = this->private; | ||
1250 | path = frame->local; | ||
1251 | frame->local = NULL((void*)0); | ||
1252 | |||
1253 | if (!path) | ||
1254 | goto unwind; | ||
1255 | |||
1256 | if (op_ret < 0) { | ||
1257 | GF_FREE (path)__gf_free (path); | ||
1258 | goto unwind; | ||
1259 | } | ||
1260 | |||
1261 | iosfd = GF_CALLOC (1, sizeof (*iosfd), gf_io_stats_mt_ios_fd)__gf_calloc (1, sizeof (*iosfd), gf_io_stats_mt_ios_fd); | ||
1262 | if (!iosfd) { | ||
1263 | GF_FREE (path)__gf_free (path); | ||
1264 | goto unwind; | ||
1265 | } | ||
1266 | |||
1267 | iosfd->filename = path; | ||
1268 | gettimeofday (&iosfd->opened_at, NULL((void*)0)); | ||
1269 | |||
1270 | ios_fd_ctx_set (fd, this, iosfd); | ||
1271 | |||
1272 | ios_inode_ctx_get (fd->inode, this, &iosstat); | ||
1273 | if (!iosstat) { | ||
1274 | iosstat = GF_CALLOC (1, sizeof (*iosstat),__gf_calloc (1, sizeof (*iosstat), gf_io_stats_mt_ios_stat) | ||
1275 | gf_io_stats_mt_ios_stat)__gf_calloc (1, sizeof (*iosstat), gf_io_stats_mt_ios_stat); | ||
1276 | if (iosstat) { | ||
1277 | iosstat->filename = gf_strdup (path); | ||
1278 | uuid_copy (iosstat->gfid, fd->inode->gfid); | ||
1279 | LOCK_INIT (&iosstat->lock)pthread_spin_init (&iosstat->lock, 0); | ||
1280 | ios_inode_ctx_set (fd->inode, this, iosstat); | ||
1281 | } | ||
1282 | } | ||
1283 | |||
1284 | LOCK (&conf->lock)pthread_spin_lock (&conf->lock); | ||
1285 | { | ||
1286 | conf->cumulative.nr_opens++; | ||
1287 | if (conf->cumulative.nr_opens > conf->cumulative.max_nr_opens) { | ||
1288 | conf->cumulative.max_nr_opens = conf->cumulative.nr_opens; | ||
1289 | conf->cumulative.max_openfd_time = iosfd->opened_at; | ||
1290 | } | ||
1291 | } | ||
1292 | UNLOCK (&conf->lock)pthread_spin_unlock (&conf->lock); | ||
1293 | if (iosstat) { | ||
1294 | BUMP_STATS (iosstat, IOS_STATS_TYPE_OPEN)do { struct ios_conf *conf = ((void*)0); uint64_t value = 0; conf = this->private; pthread_spin_lock (&iosstat->lock ); { iosstat->counters[IOS_STATS_TYPE_OPEN]++; value = iosstat ->counters[IOS_STATS_TYPE_OPEN]; } pthread_spin_unlock (& iosstat->lock); ios_stat_add_to_list (&conf->list[IOS_STATS_TYPE_OPEN ], value, iosstat); } while (0); | ||
1295 | iosstat = NULL((void*)0); | ||
1296 | } | ||
1297 | unwind: | ||
1298 | UPDATE_PROFILE_STATS (frame, OPEN)do { struct ios_conf *conf = ((void*)0); if (!is_fop_latency_started (frame)) break; conf = this->private; pthread_spin_lock ( &conf->lock); { if (conf && conf->measure_latency && conf->count_fop_hits) { do { struct ios_conf * conf = ((void*)0); conf = this->private; if (!conf) break; conf->cumulative.fop_hits[GF_FOP_OPEN]++; conf->incremental .fop_hits[GF_FOP_OPEN]++; } while (0); gettimeofday (&frame ->end, ((void*)0)); update_ios_latency (conf, frame, GF_FOP_OPEN ); } } pthread_spin_unlock (&conf->lock); } while (0); | ||
1299 | |||
1300 | STACK_UNWIND_STRICT (open, frame, op_ret, op_errno, fd, xdata)do { fop_open_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" , "io-stats.c", __FUNCTION__, 1300, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_open_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, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | ||
1301 | return 0; | ||
1302 | |||
1303 | } | ||
1304 | |||
1305 | |||
1306 | int | ||
1307 | io_stats_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | ||
1308 | int32_t op_ret, int32_t op_errno, struct iatt *buf, dict_t *xdata) | ||
1309 | { | ||
1310 | UPDATE_PROFILE_STATS (frame, STAT)do { struct ios_conf *conf = ((void*)0); if (!is_fop_latency_started (frame)) break; conf = this->private; pthread_spin_lock ( &conf->lock); { if (conf && conf->measure_latency && conf->count_fop_hits) { do { struct ios_conf * conf = ((void*)0); conf = this->private; if (!conf) break; conf->cumulative.fop_hits[GF_FOP_STAT]++; conf->incremental .fop_hits[GF_FOP_STAT]++; } while (0); gettimeofday (&frame ->end, ((void*)0)); update_ios_latency (conf, frame, GF_FOP_STAT ); } } pthread_spin_unlock (&conf->lock); } while (0); | ||
1311 | STACK_UNWIND_STRICT (stat, frame, op_ret, op_errno, buf, xdata)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" , "io-stats.c", __FUNCTION__, 1311, 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); | ||
1312 | return 0; | ||
1313 | } | ||
1314 | |||
1315 | |||
1316 | int | ||
1317 | io_stats_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | ||
1318 | int32_t op_ret, int32_t op_errno, | ||
1319 | struct iovec *vector, int32_t count, | ||
1320 | struct iatt *buf, struct iobref *iobref, dict_t *xdata) | ||
1321 | { | ||
1322 | int len = 0; | ||
1323 | fd_t *fd = NULL((void*)0); | ||
1324 | struct ios_stat *iosstat = NULL((void*)0); | ||
1325 | |||
1326 | fd = frame->local; | ||
1327 | frame->local = NULL((void*)0); | ||
1328 | |||
1329 | if (op_ret > 0) { | ||
1330 | len = iov_length (vector, count); | ||
1331 | BUMP_READ (fd, len)do { struct ios_conf *conf = ((void*)0); struct ios_fd *iosfd = ((void*)0); int lb2 = 0; conf = this->private; lb2 = log_base2 (len); ios_fd_ctx_get (fd, this, &iosfd); if (!conf) break ; pthread_spin_lock (&conf->lock); { conf->cumulative .data_read += len; conf->incremental.data_read += len; conf ->cumulative.block_count_read[lb2]++; conf->incremental .block_count_read[lb2]++; if (iosfd) { iosfd->data_read += len; iosfd->block_count_read[lb2]++; } } pthread_spin_unlock (&conf->lock); } while (0); | ||
1332 | } | ||
1333 | |||
1334 | UPDATE_PROFILE_STATS (frame, READ)do { struct ios_conf *conf = ((void*)0); if (!is_fop_latency_started (frame)) break; conf = this->private; pthread_spin_lock ( &conf->lock); { if (conf && conf->measure_latency && conf->count_fop_hits) { do { struct ios_conf * conf = ((void*)0); conf = this->private; if (!conf) break; conf->cumulative.fop_hits[GF_FOP_READ]++; conf->incremental .fop_hits[GF_FOP_READ]++; } while (0); gettimeofday (&frame ->end, ((void*)0)); update_ios_latency (conf, frame, GF_FOP_READ ); } } pthread_spin_unlock (&conf->lock); } while (0); | ||
1335 | ios_inode_ctx_get (fd->inode, this, &iosstat); | ||
1336 | |||
1337 | if (iosstat) { | ||
1338 | BUMP_STATS (iosstat, IOS_STATS_TYPE_READ)do { struct ios_conf *conf = ((void*)0); uint64_t value = 0; conf = this->private; pthread_spin_lock (&iosstat->lock ); { iosstat->counters[IOS_STATS_TYPE_READ]++; value = iosstat ->counters[IOS_STATS_TYPE_READ]; } pthread_spin_unlock (& iosstat->lock); ios_stat_add_to_list (&conf->list[IOS_STATS_TYPE_READ ], value, iosstat); } while (0); | ||
1339 | BUMP_THROUGHPUT (iosstat, IOS_STATS_THRU_READ)do { struct ios_conf *conf = ((void*)0); double elapsed; struct timeval *begin, *end; double throughput; int flag = 0; begin = &frame->begin; end = &frame->end; elapsed = ( end->tv_sec - begin->tv_sec) * 1e6 + (end->tv_usec - begin->tv_usec); throughput = op_ret / elapsed; conf = this ->private; pthread_spin_lock (&iosstat->lock); { if (iosstat->thru_counters[IOS_STATS_THRU_READ].throughput <= throughput) { iosstat->thru_counters[IOS_STATS_THRU_READ] .throughput = throughput; gettimeofday (&iosstat-> thru_counters [IOS_STATS_THRU_READ].time, ((void*)0)); flag = 1; } } pthread_spin_unlock (&iosstat->lock); if (flag) ios_stat_add_to_list (& conf->thru_list[IOS_STATS_THRU_READ], throughput, iosstat) ; } while (0); | ||
1340 | iosstat = NULL((void*)0); | ||
1341 | } | ||
1342 | |||
1343 | STACK_UNWIND_STRICT (readv, frame, op_ret, op_errno,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" , "io-stats.c", __FUNCTION__, 1344, 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, buf, iobref, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | ||
1344 | vector, count, buf, iobref, xdata)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" , "io-stats.c", __FUNCTION__, 1344, 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, buf, iobref, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); | ||
1345 | return 0; | ||
1346 | |||
1347 | } | ||
1348 | |||
1349 | |||
1350 | int | ||
1351 | io_stats_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | ||
1352 | int32_t op_ret, int32_t op_errno, | ||
1353 | struct iatt *prebuf, struct iatt *postbuf, dict_t *xdata) | ||
1354 | { | ||
1355 | struct ios_stat *iosstat = NULL((void*)0); | ||
1356 | inode_t *inode = NULL((void*)0); | ||
1357 | |||
1358 | UPDATE_PROFILE_STATS (frame, WRITE)do { struct ios_conf *conf = ((void*)0); if (!is_fop_latency_started (frame)) break; conf = this->private; pthread_spin_lock ( &conf->lock); { if (conf && conf->measure_latency && conf->count_fop_hits) { do { struct ios_conf * conf = ((void*)0); conf = this->private; if (!conf) break; conf->cumulative.fop_hits[GF_FOP_WRITE]++; conf->incremental .fop_hits[GF_FOP_WRITE]++; } while (0); gettimeofday (&frame ->end, ((void*)0)); update_ios_latency (conf, frame, GF_FOP_WRITE ); } } pthread_spin_unlock (&conf->lock); } while (0); | ||
1359 | if (frame->local){ | ||
1360 | inode = frame->local; | ||
1361 | frame->local = NULL((void*)0); | ||
1362 | ios_inode_ctx_get (inode, this, &iosstat); | ||
1363 | if (iosstat) { | ||
1364 | BUMP_STATS (iosstat, IOS_STATS_TYPE_WRITE)do { struct ios_conf *conf = ((void*)0); uint64_t value = 0; conf = this->private; pthread_spin_lock (&iosstat->lock ); { iosstat->counters[IOS_STATS_TYPE_WRITE]++; value = iosstat ->counters[IOS_STATS_TYPE_WRITE]; } pthread_spin_unlock (& iosstat->lock); ios_stat_add_to_list (&conf->list[IOS_STATS_TYPE_WRITE ], value, iosstat); } while (0); | ||
1365 | BUMP_THROUGHPUT (iosstat, IOS_STATS_THRU_WRITE)do { struct ios_conf *conf = ((void*)0); double elapsed; struct timeval *begin, *end; double throughput; int flag = 0; begin = &frame->begin; end = &frame->end; elapsed = ( end->tv_sec - begin->tv_sec) * 1e6 + (end->tv_usec - begin->tv_usec); throughput = op_ret / elapsed; conf = this ->private; pthread_spin_lock (&iosstat->lock); { if (iosstat->thru_counters[IOS_STATS_THRU_WRITE].throughput <= throughput) { iosstat->thru_counters[IOS_STATS_THRU_WRITE ].throughput = throughput; gettimeofday (&iosstat-> thru_counters [IOS_STATS_THRU_WRITE].time, ((void*)0)); flag = 1; } } pthread_spin_unlock (&iosstat->lock); if (flag) ios_stat_add_to_list (& conf->thru_list[IOS_STATS_THRU_WRITE], throughput, iosstat ); } while (0); | ||
1366 | inode = NULL((void*)0); | ||
1367 | iosstat = NULL((void*)0); | ||
1368 | } | ||
1369 | } | ||
1370 | |||
1371 | STACK_UNWIND_STRICT (writev, frame, op_ret, op_errno, prebuf, postbuf, xdata)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" , "io-stats.c", __FUNCTION__, 1371, 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); | ||
1372 | return 0; | ||
1373 | |||
1374 | } | ||
1375 | |||
1376 | |||
1377 | |||
1378 | |||
1379 | int | ||
1380 | io_stats_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | ||
1381 | int32_t op_ret, int32_t op_errno, gf_dirent_t *buf, dict_t *xdata) | ||
1382 | { | ||
1383 | struct ios_stat *iosstat = NULL((void*)0); | ||
1384 | inode_t *inode = frame->local; | ||
1385 | |||
1386 | frame->local = NULL((void*)0); | ||
1387 | |||
1388 | UPDATE_PROFILE_STATS (frame, READDIRP)do { struct ios_conf *conf = ((void*)0); if (!is_fop_latency_started (frame)) break; conf = this->private; pthread_spin_lock ( &conf->lock); { if (conf && conf->measure_latency && conf->count_fop_hits) { do { struct ios_conf * conf = ((void*)0); conf = this->private; if (!conf) break; conf->cumulative.fop_hits[GF_FOP_READDIRP]++; conf->incremental .fop_hits[GF_FOP_READDIRP]++; } while (0); gettimeofday (& frame->end, ((void*)0)); update_ios_latency (conf, frame, GF_FOP_READDIRP ); } } pthread_spin_unlock (&conf->lock); } while (0); | ||
1389 | |||
1390 | ios_inode_ctx_get (inode, this, &iosstat); | ||
1391 | |||
1392 | if (iosstat) { | ||
1393 | BUMP_STATS (iosstat, IOS_STATS_TYPE_READDIRP)do { struct ios_conf *conf = ((void*)0); uint64_t value = 0; conf = this->private; pthread_spin_lock (&iosstat->lock ); { iosstat->counters[IOS_STATS_TYPE_READDIRP]++; value = iosstat->counters[IOS_STATS_TYPE_READDIRP]; } pthread_spin_unlock (&iosstat->lock); ios_stat_add_to_list (&conf-> list[IOS_STATS_TYPE_READDIRP], value, iosstat); } while (0); | ||
1394 | iosstat = NULL((void*)0); | ||
1395 | } | ||
1396 | |||
1397 | STACK_UNWIND_STRICT (readdirp, frame, op_ret, op_errno, buf, 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" , "io-stats.c", __FUNCTION__, 1397, 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, buf, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | ||
1398 | return 0; | ||
1399 | } | ||
1400 | |||
1401 | |||
1402 | int | ||
1403 | io_stats_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | ||
1404 | int32_t op_ret, int32_t op_errno, gf_dirent_t *buf, dict_t *xdata) | ||
1405 | { | ||
1406 | UPDATE_PROFILE_STATS (frame, READDIR)do { struct ios_conf *conf = ((void*)0); if (!is_fop_latency_started (frame)) break; conf = this->private; pthread_spin_lock ( &conf->lock); { if (conf && conf->measure_latency && conf->count_fop_hits) { do { struct ios_conf * conf = ((void*)0); conf = this->private; if (!conf) break; conf->cumulative.fop_hits[GF_FOP_READDIR]++; conf->incremental .fop_hits[GF_FOP_READDIR]++; } while (0); gettimeofday (& frame->end, ((void*)0)); update_ios_latency (conf, frame, GF_FOP_READDIR ); } } pthread_spin_unlock (&conf->lock); } while (0); | ||
1407 | STACK_UNWIND_STRICT (readdir, frame, op_ret, op_errno, buf, 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" , "io-stats.c", __FUNCTION__, 1407, 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, buf, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | ||
1408 | return 0; | ||
1409 | } | ||
1410 | |||
1411 | |||
1412 | int | ||
1413 | io_stats_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | ||
1414 | int32_t op_ret, int32_t op_errno, | ||
1415 | struct iatt *prebuf, struct iatt *postbuf, dict_t *xdata) | ||
1416 | { | ||
1417 | UPDATE_PROFILE_STATS (frame, FSYNC)do { struct ios_conf *conf = ((void*)0); if (!is_fop_latency_started (frame)) break; conf = this->private; pthread_spin_lock ( &conf->lock); { if (conf && conf->measure_latency && conf->count_fop_hits) { do { struct ios_conf * conf = ((void*)0); conf = this->private; if (!conf) break; conf->cumulative.fop_hits[GF_FOP_FSYNC]++; conf->incremental .fop_hits[GF_FOP_FSYNC]++; } while (0); gettimeofday (&frame ->end, ((void*)0)); update_ios_latency (conf, frame, GF_FOP_FSYNC ); } } pthread_spin_unlock (&conf->lock); } while (0); | ||
1418 | STACK_UNWIND_STRICT (fsync, frame, op_ret, op_errno, prebuf, postbuf, xdata)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" , "io-stats.c", __FUNCTION__, 1418, 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); | ||
1419 | return 0; | ||
1420 | } | ||
1421 | |||
1422 | |||
1423 | int | ||
1424 | io_stats_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | ||
1425 | int32_t op_ret, int32_t op_errno, | ||
1426 | struct iatt *preop, struct iatt *postop, dict_t *xdata) | ||
1427 | { | ||
1428 | UPDATE_PROFILE_STATS (frame, SETATTR)do { struct ios_conf *conf = ((void*)0); if (!is_fop_latency_started (frame)) break; conf = this->private; pthread_spin_lock ( &conf->lock); { if (conf && conf->measure_latency && conf->count_fop_hits) { do { struct ios_conf * conf = ((void*)0); conf = this->private; if (!conf) break; conf->cumulative.fop_hits[GF_FOP_SETATTR]++; conf->incremental .fop_hits[GF_FOP_SETATTR]++; } while (0); gettimeofday (& frame->end, ((void*)0)); update_ios_latency (conf, frame, GF_FOP_SETATTR ); } } pthread_spin_unlock (&conf->lock); } while (0); | ||
1429 | STACK_UNWIND_STRICT (setattr, frame, op_ret, op_errno, preop, postop, xdata)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" , "io-stats.c", __FUNCTION__, 1429, 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, preop, postop, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); | ||
1430 | return 0; | ||
1431 | } | ||
1432 | |||
1433 | |||
1434 | int | ||
1435 | io_stats_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | ||
1436 | int32_t op_ret, int32_t op_errno, | ||
1437 | struct iatt *preparent, struct iatt *postparent, dict_t *xdata) | ||
1438 | { | ||
1439 | UPDATE_PROFILE_STATS (frame, UNLINK)do { struct ios_conf *conf = ((void*)0); if (!is_fop_latency_started (frame)) break; conf = this->private; pthread_spin_lock ( &conf->lock); { if (conf && conf->measure_latency && conf->count_fop_hits) { do { struct ios_conf * conf = ((void*)0); conf = this->private; if (!conf) break; conf->cumulative.fop_hits[GF_FOP_UNLINK]++; conf->incremental .fop_hits[GF_FOP_UNLINK]++; } while (0); gettimeofday (&frame ->end, ((void*)0)); update_ios_latency (conf, frame, GF_FOP_UNLINK ); } } pthread_spin_unlock (&conf->lock); } while (0); | ||
1440 | STACK_UNWIND_STRICT (unlink, frame, op_ret, op_errno,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" , "io-stats.c", __FUNCTION__, 1441, 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) | ||
1441 | preparent, postparent, xdata)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" , "io-stats.c", __FUNCTION__, 1441, 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); | ||
1442 | return 0; | ||
1443 | |||
1444 | } | ||
1445 | |||
1446 | |||
1447 | int | ||
1448 | io_stats_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | ||
1449 | int32_t op_ret, int32_t op_errno, struct iatt *buf, | ||
1450 | struct iatt *preoldparent, struct iatt *postoldparent, | ||
1451 | struct iatt *prenewparent, struct iatt *postnewparent, dict_t *xdata) | ||
1452 | { | ||
1453 | UPDATE_PROFILE_STATS (frame, RENAME)do { struct ios_conf *conf = ((void*)0); if (!is_fop_latency_started (frame)) break; conf = this->private; pthread_spin_lock ( &conf->lock); { if (conf && conf->measure_latency && conf->count_fop_hits) { do { struct ios_conf * conf = ((void*)0); conf = this->private; if (!conf) break; conf->cumulative.fop_hits[GF_FOP_RENAME]++; conf->incremental .fop_hits[GF_FOP_RENAME]++; } while (0); gettimeofday (&frame ->end, ((void*)0)); update_ios_latency (conf, frame, GF_FOP_RENAME ); } } pthread_spin_unlock (&conf->lock); } while (0); | ||
1454 | STACK_UNWIND_STRICT (rename, frame, op_ret, op_errno, buf,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" , "io-stats.c", __FUNCTION__, 1456, 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) | ||
1455 | preoldparent, postoldparent,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" , "io-stats.c", __FUNCTION__, 1456, 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) | ||
1456 | prenewparent, postnewparent, xdata)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" , "io-stats.c", __FUNCTION__, 1456, 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); | ||
1457 | return 0; | ||
1458 | } | ||
1459 | |||
1460 | |||
1461 | int | ||
1462 | io_stats_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | ||
1463 | int32_t op_ret, int32_t op_errno, const char *buf, | ||
1464 | struct iatt *sbuf, dict_t *xdata) | ||
1465 | { | ||
1466 | UPDATE_PROFILE_STATS (frame, READLINK)do { struct ios_conf *conf = ((void*)0); if (!is_fop_latency_started (frame)) break; conf = this->private; pthread_spin_lock ( &conf->lock); { if (conf && conf->measure_latency && conf->count_fop_hits) { do { struct ios_conf * conf = ((void*)0); conf = this->private; if (!conf) break; conf->cumulative.fop_hits[GF_FOP_READLINK]++; conf->incremental .fop_hits[GF_FOP_READLINK]++; } while (0); gettimeofday (& frame->end, ((void*)0)); update_ios_latency (conf, frame, GF_FOP_READLINK ); } } pthread_spin_unlock (&conf->lock); } while (0); | ||
1467 | STACK_UNWIND_STRICT (readlink, frame, op_ret, op_errno, buf, sbuf, xdata)do { fop_readlink_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" , "io-stats.c", __FUNCTION__, 1467, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_readlink_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, sbuf, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); | ||
1468 | return 0; | ||
1469 | } | ||
1470 | |||
1471 | |||
1472 | int | ||
1473 | io_stats_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | ||
1474 | int32_t op_ret, int32_t op_errno, | ||
1475 | inode_t *inode, struct iatt *buf, | ||
1476 | dict_t *xdata, struct iatt *postparent) | ||
1477 | { | ||
1478 | UPDATE_PROFILE_STATS (frame, LOOKUP)do { struct ios_conf *conf = ((void*)0); if (!is_fop_latency_started (frame)) break; conf = this->private; pthread_spin_lock ( &conf->lock); { if (conf && conf->measure_latency && conf->count_fop_hits) { do { struct ios_conf * conf = ((void*)0); conf = this->private; if (!conf) break; conf->cumulative.fop_hits[GF_FOP_LOOKUP]++; conf->incremental .fop_hits[GF_FOP_LOOKUP]++; } while (0); gettimeofday (&frame ->end, ((void*)0)); update_ios_latency (conf, frame, GF_FOP_LOOKUP ); } } pthread_spin_unlock (&conf->lock); } while (0); | ||
1479 | STACK_UNWIND_STRICT (lookup, frame, op_ret, op_errno, inode, buf, xdata,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" , "io-stats.c", __FUNCTION__, 1480, 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, buf, xdata, postparent); (*__glusterfs_this_location ()) = old_THIS; } while (0) | ||
1480 | postparent)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" , "io-stats.c", __FUNCTION__, 1480, 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, buf, xdata, postparent); (*__glusterfs_this_location ()) = old_THIS; } while (0); | ||
1481 | return 0; | ||
1482 | } | ||
1483 | |||
1484 | |||
1485 | int | ||
1486 | io_stats_symlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | ||
1487 | int32_t op_ret, int32_t op_errno, | ||
1488 | inode_t *inode, struct iatt *buf, | ||
1489 | struct iatt *preparent, struct iatt *postparent, dict_t *xdata) | ||
1490 | { | ||
1491 | UPDATE_PROFILE_STATS (frame, SYMLINK)do { struct ios_conf *conf = ((void*)0); if (!is_fop_latency_started (frame)) break; conf = this->private; pthread_spin_lock ( &conf->lock); { if (conf && conf->measure_latency && conf->count_fop_hits) { do { struct ios_conf * conf = ((void*)0); conf = this->private; if (!conf) break; conf->cumulative.fop_hits[GF_FOP_SYMLINK]++; conf->incremental .fop_hits[GF_FOP_SYMLINK]++; } while (0); gettimeofday (& frame->end, ((void*)0)); update_ios_latency (conf, frame, GF_FOP_SYMLINK ); } } pthread_spin_unlock (&conf->lock); } while (0); | ||
1492 | STACK_UNWIND_STRICT (symlink, frame, op_ret, op_errno, inode, buf,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" , "io-stats.c", __FUNCTION__, 1493, 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) | ||
1493 | preparent, postparent, xdata)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" , "io-stats.c", __FUNCTION__, 1493, 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); | ||
1494 | return 0; | ||
1495 | } | ||
1496 | |||
1497 | |||
1498 | int | ||
1499 | io_stats_mknod_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | ||
1500 | int32_t op_ret, int32_t op_errno, | ||
1501 | inode_t *inode, struct iatt *buf, | ||
1502 | struct iatt *preparent, struct iatt *postparent, dict_t *xdata) | ||
1503 | { | ||
1504 | UPDATE_PROFILE_STATS (frame, MKNOD)do { struct ios_conf *conf = ((void*)0); if (!is_fop_latency_started (frame)) break; conf = this->private; pthread_spin_lock ( &conf->lock); { if (conf && conf->measure_latency && conf->count_fop_hits) { do { struct ios_conf * conf = ((void*)0); conf = this->private; if (!conf) break; conf->cumulative.fop_hits[GF_FOP_MKNOD]++; conf->incremental .fop_hits[GF_FOP_MKNOD]++; } while (0); gettimeofday (&frame ->end, ((void*)0)); update_ios_latency (conf, frame, GF_FOP_MKNOD ); } } pthread_spin_unlock (&conf->lock); } while (0); | ||
1505 | STACK_UNWIND_STRICT (mknod, frame, op_ret, op_errno, inode, buf,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" , "io-stats.c", __FUNCTION__, 1506, 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) | ||
1506 | preparent, postparent, xdata)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" , "io-stats.c", __FUNCTION__, 1506, 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); | ||
1507 | return 0; | ||
1508 | } | ||
1509 | |||
1510 | |||
1511 | int | ||
1512 | io_stats_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | ||
1513 | int32_t op_ret, int32_t op_errno, | ||
1514 | inode_t *inode, struct iatt *buf, | ||
1515 | struct iatt *preparent, struct iatt *postparent, | ||
1516 | dict_t *xdata) | ||
1517 | { | ||
1518 | struct ios_stat *iosstat = NULL((void*)0); | ||
1519 | char *path = frame->local; | ||
1520 | |||
1521 | UPDATE_PROFILE_STATS (frame, MKDIR)do { struct ios_conf *conf = ((void*)0); if (!is_fop_latency_started (frame)) break; conf = this->private; pthread_spin_lock ( &conf->lock); { if (conf && conf->measure_latency && conf->count_fop_hits) { do { struct ios_conf * conf = ((void*)0); conf = this->private; if (!conf) break; conf->cumulative.fop_hits[GF_FOP_MKDIR]++; conf->incremental .fop_hits[GF_FOP_MKDIR]++; } while (0); gettimeofday (&frame ->end, ((void*)0)); update_ios_latency (conf, frame, GF_FOP_MKDIR ); } } pthread_spin_unlock (&conf->lock); } while (0); | ||
1522 | if (op_ret < 0) | ||
1523 | goto unwind; | ||
1524 | |||
1525 | iosstat = GF_CALLOC (1, sizeof (*iosstat), gf_io_stats_mt_ios_stat)__gf_calloc (1, sizeof (*iosstat), gf_io_stats_mt_ios_stat); | ||
1526 | if (iosstat) { | ||
1527 | LOCK_INIT (&iosstat->lock)pthread_spin_init (&iosstat->lock, 0); | ||
1528 | iosstat->filename = gf_strdup(path); | ||
1529 | uuid_copy (iosstat->gfid, buf->ia_gfid); | ||
1530 | ios_inode_ctx_set (inode, this, iosstat); | ||
1531 | } | ||
1532 | |||
1533 | unwind: | ||
1534 | /* local is assigned with path */ | ||
1535 | GF_FREE (frame->local)__gf_free (frame->local); | ||
1536 | frame->local = NULL((void*)0); | ||
1537 | STACK_UNWIND_STRICT (mkdir, frame, op_ret, op_errno, inode, buf,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" , "io-stats.c", __FUNCTION__, 1538, 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) | ||
1538 | preparent, postparent, xdata)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" , "io-stats.c", __FUNCTION__, 1538, 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); | ||
1539 | return 0; | ||
1540 | } | ||
1541 | |||
1542 | |||
1543 | int | ||
1544 | io_stats_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | ||
1545 | int32_t op_ret, int32_t op_errno, | ||
1546 | inode_t *inode, struct iatt *buf, | ||
1547 | struct iatt *preparent, struct iatt *postparent, dict_t *xdata) | ||
1548 | { | ||
1549 | UPDATE_PROFILE_STATS (frame, LINK)do { struct ios_conf *conf = ((void*)0); if (!is_fop_latency_started (frame)) break; conf = this->private; pthread_spin_lock ( &conf->lock); { if (conf && conf->measure_latency && conf->count_fop_hits) { do { struct ios_conf * conf = ((void*)0); conf = this->private; if (!conf) break; conf->cumulative.fop_hits[GF_FOP_LINK]++; conf->incremental .fop_hits[GF_FOP_LINK]++; } while (0); gettimeofday (&frame ->end, ((void*)0)); update_ios_latency (conf, frame, GF_FOP_LINK ); } } pthread_spin_unlock (&conf->lock); } while (0); | ||
1550 | STACK_UNWIND_STRICT (link, frame, op_ret, op_errno, inode, buf,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" , "io-stats.c", __FUNCTION__, 1551, 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) | ||
1551 | preparent, postparent, xdata)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" , "io-stats.c", __FUNCTION__, 1551, 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); | ||
1552 | return 0; | ||
1553 | } | ||
1554 | |||
1555 | |||
1556 | int | ||
1557 | io_stats_flush_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | ||
1558 | int32_t op_ret, int32_t op_errno, dict_t *xdata) | ||
1559 | { | ||
1560 | UPDATE_PROFILE_STATS (frame, FLUSH)do { struct ios_conf *conf = ((void*)0); if (!is_fop_latency_started (frame)) break; conf = this->private; pthread_spin_lock ( &conf->lock); { if (conf && conf->measure_latency && conf->count_fop_hits) { do { struct ios_conf * conf = ((void*)0); conf = this->private; if (!conf) break; conf->cumulative.fop_hits[GF_FOP_FLUSH]++; conf->incremental .fop_hits[GF_FOP_FLUSH]++; } while (0); gettimeofday (&frame ->end, ((void*)0)); update_ios_latency (conf, frame, GF_FOP_FLUSH ); } } pthread_spin_unlock (&conf->lock); } while (0); | ||
1561 | STACK_UNWIND_STRICT (flush, frame, op_ret, op_errno, xdata)do { fop_flush_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" , "io-stats.c", __FUNCTION__, 1561, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_flush_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); | ||
1562 | return 0; | ||
1563 | } | ||
1564 | |||
1565 | |||
1566 | int | ||
1567 | io_stats_opendir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | ||
1568 | int32_t op_ret, int32_t op_errno, fd_t *fd, dict_t *xdata) | ||
1569 | { | ||
1570 | struct ios_stat *iosstat = NULL((void*)0); | ||
1571 | int ret = -1; | ||
1572 | |||
1573 | UPDATE_PROFILE_STATS (frame, OPENDIR)do { struct ios_conf *conf = ((void*)0); if (!is_fop_latency_started (frame)) break; conf = this->private; pthread_spin_lock ( &conf->lock); { if (conf && conf->measure_latency && conf->count_fop_hits) { do { struct ios_conf * conf = ((void*)0); conf = this->private; if (!conf) break; conf->cumulative.fop_hits[GF_FOP_OPENDIR]++; conf->incremental .fop_hits[GF_FOP_OPENDIR]++; } while (0); gettimeofday (& frame->end, ((void*)0)); update_ios_latency (conf, frame, GF_FOP_OPENDIR ); } } pthread_spin_unlock (&conf->lock); } while (0); | ||
1574 | if (op_ret < 0) | ||
1575 | goto unwind; | ||
1576 | |||
1577 | ios_fd_ctx_set (fd, this, 0); | ||
1578 | |||
1579 | ret = ios_inode_ctx_get (fd->inode, this, &iosstat); | ||
1580 | if (!ret) | ||
1581 | BUMP_STATS (iosstat, IOS_STATS_TYPE_OPENDIR)do { struct ios_conf *conf = ((void*)0); uint64_t value = 0; conf = this->private; pthread_spin_lock (&iosstat->lock ); { iosstat->counters[IOS_STATS_TYPE_OPENDIR]++; value = iosstat ->counters[IOS_STATS_TYPE_OPENDIR]; } pthread_spin_unlock ( &iosstat->lock); ios_stat_add_to_list (&conf->list [IOS_STATS_TYPE_OPENDIR], value, iosstat); } while (0); | ||
1582 | |||
1583 | unwind: | ||
1584 | STACK_UNWIND_STRICT (opendir, frame, op_ret, op_errno, fd, xdata)do { fop_opendir_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" , "io-stats.c", __FUNCTION__, 1584, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_opendir_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, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | ||
1585 | return 0; | ||
1586 | } | ||
1587 | |||
1588 | |||
1589 | int | ||
1590 | io_stats_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | ||
1591 | int32_t op_ret, int32_t op_errno, | ||
1592 | struct iatt *preparent, struct iatt *postparent, dict_t *xdata) | ||
1593 | { | ||
1594 | |||
1595 | UPDATE_PROFILE_STATS (frame, RMDIR)do { struct ios_conf *conf = ((void*)0); if (!is_fop_latency_started (frame)) break; conf = this->private; pthread_spin_lock ( &conf->lock); { if (conf && conf->measure_latency && conf->count_fop_hits) { do { struct ios_conf * conf = ((void*)0); conf = this->private; if (!conf) break; conf->cumulative.fop_hits[GF_FOP_RMDIR]++; conf->incremental .fop_hits[GF_FOP_RMDIR]++; } while (0); gettimeofday (&frame ->end, ((void*)0)); update_ios_latency (conf, frame, GF_FOP_RMDIR ); } } pthread_spin_unlock (&conf->lock); } while (0); | ||
1596 | |||
1597 | STACK_UNWIND_STRICT (rmdir, frame, op_ret, op_errno,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" , "io-stats.c", __FUNCTION__, 1598, 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) | ||
1598 | preparent, postparent, xdata)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" , "io-stats.c", __FUNCTION__, 1598, 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); | ||
1599 | return 0; | ||
1600 | } | ||
1601 | |||
1602 | |||
1603 | int | ||
1604 | io_stats_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | ||
1605 | int32_t op_ret, int32_t op_errno, | ||
1606 | struct iatt *prebuf, struct iatt *postbuf, dict_t *xdata) | ||
1607 | { | ||
1608 | UPDATE_PROFILE_STATS (frame, TRUNCATE)do { struct ios_conf *conf = ((void*)0); if (!is_fop_latency_started (frame)) break; conf = this->private; pthread_spin_lock ( &conf->lock); { if (conf && conf->measure_latency && conf->count_fop_hits) { do { struct ios_conf * conf = ((void*)0); conf = this->private; if (!conf) break; conf->cumulative.fop_hits[GF_FOP_TRUNCATE]++; conf->incremental .fop_hits[GF_FOP_TRUNCATE]++; } while (0); gettimeofday (& frame->end, ((void*)0)); update_ios_latency (conf, frame, GF_FOP_TRUNCATE ); } } pthread_spin_unlock (&conf->lock); } while (0); | ||
1609 | STACK_UNWIND_STRICT (truncate, frame, op_ret, op_errno,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" , "io-stats.c", __FUNCTION__, 1610, 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) | ||
1610 | prebuf, postbuf, xdata)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" , "io-stats.c", __FUNCTION__, 1610, 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); | ||
1611 | return 0; | ||
1612 | } | ||
1613 | |||
1614 | |||
1615 | int | ||
1616 | io_stats_statfs_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | ||
1617 | int32_t op_ret, int32_t op_errno, struct statvfs *buf, dict_t *xdata) | ||
1618 | { | ||
1619 | UPDATE_PROFILE_STATS (frame, STATFS)do { struct ios_conf *conf = ((void*)0); if (!is_fop_latency_started (frame)) break; conf = this->private; pthread_spin_lock ( &conf->lock); { if (conf && conf->measure_latency && conf->count_fop_hits) { do { struct ios_conf * conf = ((void*)0); conf = this->private; if (!conf) break; conf->cumulative.fop_hits[GF_FOP_STATFS]++; conf->incremental .fop_hits[GF_FOP_STATFS]++; } while (0); gettimeofday (&frame ->end, ((void*)0)); update_ios_latency (conf, frame, GF_FOP_STATFS ); } } pthread_spin_unlock (&conf->lock); } while (0); | ||
1620 | STACK_UNWIND_STRICT (statfs, frame, op_ret, op_errno, buf, xdata)do { fop_statfs_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" , "io-stats.c", __FUNCTION__, 1620, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_statfs_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); | ||
1621 | return 0; | ||
1622 | } | ||
1623 | |||
1624 | |||
1625 | int | ||
1626 | io_stats_setxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | ||
1627 | int32_t op_ret, int32_t op_errno, dict_t *xdata) | ||
1628 | { | ||
1629 | UPDATE_PROFILE_STATS (frame, SETXATTR)do { struct ios_conf *conf = ((void*)0); if (!is_fop_latency_started (frame)) break; conf = this->private; pthread_spin_lock ( &conf->lock); { if (conf && conf->measure_latency && conf->count_fop_hits) { do { struct ios_conf * conf = ((void*)0); conf = this->private; if (!conf) break; conf->cumulative.fop_hits[GF_FOP_SETXATTR]++; conf->incremental .fop_hits[GF_FOP_SETXATTR]++; } while (0); gettimeofday (& frame->end, ((void*)0)); update_ios_latency (conf, frame, GF_FOP_SETXATTR ); } } pthread_spin_unlock (&conf->lock); } while (0); | ||
1630 | STACK_UNWIND_STRICT (setxattr, frame, op_ret, op_errno, xdata)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" , "io-stats.c", __FUNCTION__, 1630, 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); | ||
1631 | return 0; | ||
1632 | } | ||
1633 | |||
1634 | |||
1635 | int | ||
1636 | io_stats_getxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | ||
1637 | int32_t op_ret, int32_t op_errno, dict_t *dict, dict_t *xdata) | ||
1638 | { | ||
1639 | UPDATE_PROFILE_STATS (frame, GETXATTR)do { struct ios_conf *conf = ((void*)0); if (!is_fop_latency_started (frame)) break; conf = this->private; pthread_spin_lock ( &conf->lock); { if (conf && conf->measure_latency && conf->count_fop_hits) { do { struct ios_conf * conf = ((void*)0); conf = this->private; if (!conf) break; conf->cumulative.fop_hits[GF_FOP_GETXATTR]++; conf->incremental .fop_hits[GF_FOP_GETXATTR]++; } while (0); gettimeofday (& frame->end, ((void*)0)); update_ios_latency (conf, frame, GF_FOP_GETXATTR ); } } pthread_spin_unlock (&conf->lock); } while (0); | ||
1640 | STACK_UNWIND_STRICT (getxattr, frame, op_ret, op_errno, dict, xdata)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" , "io-stats.c", __FUNCTION__, 1640, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_getxattr_cbk_t )frame-> ret; _parent = frame->parent; pthread_spin_lock (&frame ->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, dict, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | ||
1641 | return 0; | ||
1642 | } | ||
1643 | |||
1644 | |||
1645 | int | ||
1646 | io_stats_removexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | ||
1647 | int32_t op_ret, int32_t op_errno, dict_t *xdata) | ||
1648 | { | ||
1649 | UPDATE_PROFILE_STATS (frame, REMOVEXATTR)do { struct ios_conf *conf = ((void*)0); if (!is_fop_latency_started (frame)) break; conf = this->private; pthread_spin_lock ( &conf->lock); { if (conf && conf->measure_latency && conf->count_fop_hits) { do { struct ios_conf * conf = ((void*)0); conf = this->private; if (!conf) break; conf->cumulative.fop_hits[GF_FOP_REMOVEXATTR]++; conf-> incremental.fop_hits[GF_FOP_REMOVEXATTR]++; } while (0); gettimeofday (&frame->end, ((void*)0)); update_ios_latency (conf, frame , GF_FOP_REMOVEXATTR); } } pthread_spin_unlock (&conf-> lock); } while (0); | ||
1650 | STACK_UNWIND_STRICT (removexattr, frame, op_ret, op_errno, xdata)do { fop_removexattr_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "io-stats.c", __FUNCTION__, 1650, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_removexattr_cbk_t )frame-> ret; _parent = frame->parent; pthread_spin_lock (&frame ->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | ||
1651 | return 0; | ||
1652 | } | ||
1653 | |||
1654 | int | ||
1655 | io_stats_fsetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | ||
1656 | int32_t op_ret, int32_t op_errno, dict_t *xdata) | ||
1657 | { | ||
1658 | UPDATE_PROFILE_STATS (frame, FSETXATTR)do { struct ios_conf *conf = ((void*)0); if (!is_fop_latency_started (frame)) break; conf = this->private; pthread_spin_lock ( &conf->lock); { if (conf && conf->measure_latency && conf->count_fop_hits) { do { struct ios_conf * conf = ((void*)0); conf = this->private; if (!conf) break; conf->cumulative.fop_hits[GF_FOP_FSETXATTR]++; conf->incremental .fop_hits[GF_FOP_FSETXATTR]++; } while (0); gettimeofday (& frame->end, ((void*)0)); update_ios_latency (conf, frame, GF_FOP_FSETXATTR ); } } pthread_spin_unlock (&conf->lock); } while (0); | ||
1659 | STACK_UNWIND_STRICT (fsetxattr, frame, op_ret, op_errno, xdata)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" , "io-stats.c", __FUNCTION__, 1659, 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); | ||
1660 | return 0; | ||
1661 | } | ||
1662 | |||
1663 | |||
1664 | int | ||
1665 | io_stats_fgetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | ||
1666 | int32_t op_ret, int32_t op_errno, dict_t *dict, dict_t *xdata) | ||
1667 | { | ||
1668 | UPDATE_PROFILE_STATS (frame, FGETXATTR)do { struct ios_conf *conf = ((void*)0); if (!is_fop_latency_started (frame)) break; conf = this->private; pthread_spin_lock ( &conf->lock); { if (conf && conf->measure_latency && conf->count_fop_hits) { do { struct ios_conf * conf = ((void*)0); conf = this->private; if (!conf) break; conf->cumulative.fop_hits[GF_FOP_FGETXATTR]++; conf->incremental .fop_hits[GF_FOP_FGETXATTR]++; } while (0); gettimeofday (& frame->end, ((void*)0)); update_ios_latency (conf, frame, GF_FOP_FGETXATTR ); } } pthread_spin_unlock (&conf->lock); } while (0); | ||
1669 | STACK_UNWIND_STRICT (fgetxattr, frame, op_ret, op_errno, dict, xdata)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" , "io-stats.c", __FUNCTION__, 1669, 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, dict, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | ||
1670 | return 0; | ||
1671 | } | ||
1672 | |||
1673 | |||
1674 | int | ||
1675 | io_stats_fremovexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | ||
1676 | int32_t op_ret, int32_t op_errno, dict_t *xdata) | ||
1677 | { | ||
1678 | UPDATE_PROFILE_STATS (frame, FREMOVEXATTR)do { struct ios_conf *conf = ((void*)0); if (!is_fop_latency_started (frame)) break; conf = this->private; pthread_spin_lock ( &conf->lock); { if (conf && conf->measure_latency && conf->count_fop_hits) { do { struct ios_conf * conf = ((void*)0); conf = this->private; if (!conf) break; conf->cumulative.fop_hits[GF_FOP_FREMOVEXATTR]++; conf-> incremental.fop_hits[GF_FOP_FREMOVEXATTR]++; } while (0); gettimeofday (&frame->end, ((void*)0)); update_ios_latency (conf, frame , GF_FOP_FREMOVEXATTR); } } pthread_spin_unlock (&conf-> lock); } while (0); | ||
1679 | STACK_UNWIND_STRICT (fremovexattr, frame, op_ret, op_errno, xdata)do { fop_fremovexattr_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" , "io-stats.c", __FUNCTION__, 1679, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_fremovexattr_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); | ||
1680 | return 0; | ||
1681 | } | ||
1682 | |||
1683 | |||
1684 | int | ||
1685 | io_stats_fsyncdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | ||
1686 | int32_t op_ret, int32_t op_errno, dict_t *xdata) | ||
1687 | { | ||
1688 | UPDATE_PROFILE_STATS (frame, FSYNCDIR)do { struct ios_conf *conf = ((void*)0); if (!is_fop_latency_started (frame)) break; conf = this->private; pthread_spin_lock ( &conf->lock); { if (conf && conf->measure_latency && conf->count_fop_hits) { do { struct ios_conf * conf = ((void*)0); conf = this->private; if (!conf) break; conf->cumulative.fop_hits[GF_FOP_FSYNCDIR]++; conf->incremental .fop_hits[GF_FOP_FSYNCDIR]++; } while (0); gettimeofday (& frame->end, ((void*)0)); update_ios_latency (conf, frame, GF_FOP_FSYNCDIR ); } } pthread_spin_unlock (&conf->lock); } while (0); | ||
1689 | STACK_UNWIND_STRICT (fsyncdir, frame, op_ret, op_errno, xdata)do { fop_fsyncdir_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" , "io-stats.c", __FUNCTION__, 1689, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_fsyncdir_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); | ||
1690 | return 0; | ||
1691 | } | ||
1692 | |||
1693 | |||
1694 | int | ||
1695 | io_stats_access_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | ||
1696 | int32_t op_ret, int32_t op_errno, dict_t *xdata) | ||
1697 | { | ||
1698 | UPDATE_PROFILE_STATS (frame, ACCESS)do { struct ios_conf *conf = ((void*)0); if (!is_fop_latency_started (frame)) break; conf = this->private; pthread_spin_lock ( &conf->lock); { if (conf && conf->measure_latency && conf->count_fop_hits) { do { struct ios_conf * conf = ((void*)0); conf = this->private; if (!conf) break; conf->cumulative.fop_hits[GF_FOP_ACCESS]++; conf->incremental .fop_hits[GF_FOP_ACCESS]++; } while (0); gettimeofday (&frame ->end, ((void*)0)); update_ios_latency (conf, frame, GF_FOP_ACCESS ); } } pthread_spin_unlock (&conf->lock); } while (0); | ||
1699 | STACK_UNWIND_STRICT (access, frame, op_ret, op_errno, xdata)do { fop_access_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" , "io-stats.c", __FUNCTION__, 1699, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_access_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); | ||
1700 | return 0; | ||
1701 | } | ||
1702 | |||
1703 | |||
1704 | int | ||
1705 | io_stats_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | ||
1706 | int32_t op_ret, int32_t op_errno, | ||
1707 | struct iatt *prebuf, struct iatt *postbuf, dict_t *xdata) | ||
1708 | { | ||
1709 | UPDATE_PROFILE_STATS (frame, FTRUNCATE)do { struct ios_conf *conf = ((void*)0); if (!is_fop_latency_started (frame)) break; conf = this->private; pthread_spin_lock ( &conf->lock); { if (conf && conf->measure_latency && conf->count_fop_hits) { do { struct ios_conf * conf = ((void*)0); conf = this->private; if (!conf) break; conf->cumulative.fop_hits[GF_FOP_FTRUNCATE]++; conf->incremental .fop_hits[GF_FOP_FTRUNCATE]++; } while (0); gettimeofday (& frame->end, ((void*)0)); update_ios_latency (conf, frame, GF_FOP_FTRUNCATE ); } } pthread_spin_unlock (&conf->lock); } while (0); | ||
1710 | STACK_UNWIND_STRICT (ftruncate, frame, op_ret, op_errno,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" , "io-stats.c", __FUNCTION__, 1711, 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) | ||
1711 | prebuf, postbuf, xdata)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" , "io-stats.c", __FUNCTION__, 1711, 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); | ||
1712 | return 0; | ||
1713 | } | ||
1714 | |||
1715 | |||
1716 | int | ||
1717 | io_stats_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | ||
1718 | int32_t op_ret, int32_t op_errno, struct iatt *buf, dict_t *xdata) | ||
1719 | { | ||
1720 | UPDATE_PROFILE_STATS (frame, FSTAT)do { struct ios_conf *conf = ((void*)0); if (!is_fop_latency_started (frame)) break; conf = this->private; pthread_spin_lock ( &conf->lock); { if (conf && conf->measure_latency && conf->count_fop_hits) { do { struct ios_conf * conf = ((void*)0); conf = this->private; if (!conf) break; conf->cumulative.fop_hits[GF_FOP_FSTAT]++; conf->incremental .fop_hits[GF_FOP_FSTAT]++; } while (0); gettimeofday (&frame ->end, ((void*)0)); update_ios_latency (conf, frame, GF_FOP_FSTAT ); } } pthread_spin_unlock (&conf->lock); } while (0); | ||
1721 | STACK_UNWIND_STRICT (fstat, frame, op_ret, op_errno, buf, xdata)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" , "io-stats.c", __FUNCTION__, 1721, 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); | ||
1722 | return 0; | ||
1723 | } | ||
1724 | |||
1725 | |||
1726 | int | ||
1727 | io_stats_lk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | ||
1728 | int32_t op_ret, int32_t op_errno, struct gf_flock *lock, dict_t *xdata) | ||
1729 | { | ||
1730 | UPDATE_PROFILE_STATS (frame, LK)do { struct ios_conf *conf = ((void*)0); if (!is_fop_latency_started (frame)) break; conf = this->private; pthread_spin_lock ( &conf->lock); { if (conf && conf->measure_latency && conf->count_fop_hits) { do { struct ios_conf * conf = ((void*)0); conf = this->private; if (!conf) break; conf->cumulative.fop_hits[GF_FOP_LK]++; conf->incremental .fop_hits[GF_FOP_LK]++; } while (0); gettimeofday (&frame ->end, ((void*)0)); update_ios_latency (conf, frame, GF_FOP_LK ); } } pthread_spin_unlock (&conf->lock); } while (0); | ||
1731 | STACK_UNWIND_STRICT (lk, frame, op_ret, op_errno, lock, xdata)do { fop_lk_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" , "io-stats.c", __FUNCTION__, 1731, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_lk_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, lock, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | ||
1732 | return 0; | ||
1733 | } | ||
1734 | |||
1735 | |||
1736 | int | ||
1737 | io_stats_entrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | ||
1738 | int32_t op_ret, int32_t op_errno, dict_t *xdata) | ||
1739 | { | ||
1740 | UPDATE_PROFILE_STATS (frame, ENTRYLK)do { struct ios_conf *conf = ((void*)0); if (!is_fop_latency_started (frame)) break; conf = this->private; pthread_spin_lock ( &conf->lock); { if (conf && conf->measure_latency && conf->count_fop_hits) { do { struct ios_conf * conf = ((void*)0); conf = this->private; if (!conf) break; conf->cumulative.fop_hits[GF_FOP_ENTRYLK]++; conf->incremental .fop_hits[GF_FOP_ENTRYLK]++; } while (0); gettimeofday (& frame->end, ((void*)0)); update_ios_latency (conf, frame, GF_FOP_ENTRYLK ); } } pthread_spin_unlock (&conf->lock); } while (0); | ||
1741 | STACK_UNWIND_STRICT (entrylk, frame, op_ret, op_errno, xdata)do { fop_entrylk_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" , "io-stats.c", __FUNCTION__, 1741, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_entrylk_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); | ||
1742 | return 0; | ||
1743 | } | ||
1744 | |||
1745 | |||
1746 | int | ||
1747 | io_stats_xattrop_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | ||
1748 | int32_t op_ret, int32_t op_errno, dict_t *dict, dict_t *xdata) | ||
1749 | { | ||
1750 | UPDATE_PROFILE_STATS (frame, XATTROP)do { struct ios_conf *conf = ((void*)0); if (!is_fop_latency_started (frame)) break; conf = this->private; pthread_spin_lock ( &conf->lock); { if (conf && conf->measure_latency && conf->count_fop_hits) { do { struct ios_conf * conf = ((void*)0); conf = this->private; if (!conf) break; conf->cumulative.fop_hits[GF_FOP_XATTROP]++; conf->incremental .fop_hits[GF_FOP_XATTROP]++; } while (0); gettimeofday (& frame->end, ((void*)0)); update_ios_latency (conf, frame, GF_FOP_XATTROP ); } } pthread_spin_unlock (&conf->lock); } while (0); | ||
1751 | STACK_UNWIND_STRICT (xattrop, frame, op_ret, op_errno, dict, xdata)do { fop_xattrop_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" , "io-stats.c", __FUNCTION__, 1751, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_xattrop_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, dict, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | ||
1752 | return 0; | ||
1753 | } | ||
1754 | |||
1755 | |||
1756 | int | ||
1757 | io_stats_fxattrop_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | ||
1758 | int32_t op_ret, int32_t op_errno, dict_t *dict, dict_t *xdata) | ||
1759 | { | ||
1760 | UPDATE_PROFILE_STATS (frame, FXATTROP)do { struct ios_conf *conf = ((void*)0); if (!is_fop_latency_started (frame)) break; conf = this->private; pthread_spin_lock ( &conf->lock); { if (conf && conf->measure_latency && conf->count_fop_hits) { do { struct ios_conf * conf = ((void*)0); conf = this->private; if (!conf) break; conf->cumulative.fop_hits[GF_FOP_FXATTROP]++; conf->incremental .fop_hits[GF_FOP_FXATTROP]++; } while (0); gettimeofday (& frame->end, ((void*)0)); update_ios_latency (conf, frame, GF_FOP_FXATTROP ); } } pthread_spin_unlock (&conf->lock); } while (0); | ||
1761 | STACK_UNWIND_STRICT (fxattrop, frame, op_ret, op_errno, dict, xdata)do { fop_fxattrop_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" , "io-stats.c", __FUNCTION__, 1761, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_fxattrop_cbk_t )frame-> ret; _parent = frame->parent; pthread_spin_lock (&frame ->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, dict, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | ||
1762 | return 0; | ||
1763 | } | ||
1764 | |||
1765 | |||
1766 | int | ||
1767 | io_stats_inodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | ||
1768 | int32_t op_ret, int32_t op_errno, dict_t *xdata) | ||
1769 | { | ||
1770 | UPDATE_PROFILE_STATS (frame, INODELK)do { struct ios_conf *conf = ((void*)0); if (!is_fop_latency_started (frame)) break; conf = this->private; pthread_spin_lock ( &conf->lock); { if (conf && conf->measure_latency && conf->count_fop_hits) { do { struct ios_conf * conf = ((void*)0); conf = this->private; if (!conf) break; conf->cumulative.fop_hits[GF_FOP_INODELK]++; conf->incremental .fop_hits[GF_FOP_INODELK]++; } while (0); gettimeofday (& frame->end, ((void*)0)); update_ios_latency (conf, frame, GF_FOP_INODELK ); } } pthread_spin_unlock (&conf->lock); } while (0); | ||
1771 | STACK_UNWIND_STRICT (inodelk, frame, op_ret, op_errno, xdata)do { fop_inodelk_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" , "io-stats.c", __FUNCTION__, 1771, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_inodelk_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); | ||
1772 | return 0; | ||
1773 | } | ||
1774 | |||
1775 | int | ||
1776 | io_stats_entrylk (call_frame_t *frame, xlator_t *this, | ||
1777 | const char *volume, loc_t *loc, const char *basename, | ||
1778 | entrylk_cmd cmd, entrylk_type type, dict_t *xdata) | ||
1779 | { | ||
1780 | START_FOP_LATENCY (frame)do { struct ios_conf *conf = ((void*)0); conf = this->private ; if (conf && conf->measure_latency) { gettimeofday (&frame->begin, ((void*)0)); } else { memset (&frame ->begin, 0, sizeof (frame->begin)); } } while (0); | ||
1781 | |||
1782 | STACK_WIND (frame, io_stats_entrylk_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", "io-stats.c", __FUNCTION__, 1785, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->entrylk_cbk) tmp_cbk = io_stats_entrylk_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->entrylk" ; _new->unwind_to = "io_stats_entrylk_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->entrylk); (this->children->xlator )->fops->entrylk (_new, (this->children->xlator), volume, loc, basename, cmd, type, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | ||
1783 | 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", "io-stats.c", __FUNCTION__, 1785, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->entrylk_cbk) tmp_cbk = io_stats_entrylk_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->entrylk" ; _new->unwind_to = "io_stats_entrylk_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->entrylk); (this->children->xlator )->fops->entrylk (_new, (this->children->xlator), volume, loc, basename, cmd, type, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | ||
1784 | FIRST_CHILD (this)->fops->entrylk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "io-stats.c", __FUNCTION__, 1785, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->entrylk_cbk) tmp_cbk = io_stats_entrylk_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->entrylk" ; _new->unwind_to = "io_stats_entrylk_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->entrylk); (this->children->xlator )->fops->entrylk (_new, (this->children->xlator), volume, loc, basename, cmd, type, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | ||
1785 | volume, loc, basename, cmd, type, 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", "io-stats.c", __FUNCTION__, 1785, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->entrylk_cbk) tmp_cbk = io_stats_entrylk_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->entrylk" ; _new->unwind_to = "io_stats_entrylk_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->entrylk); (this->children->xlator )->fops->entrylk (_new, (this->children->xlator), volume, loc, basename, cmd, type, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); | ||
1786 | return 0; | ||
1787 | } | ||
1788 | |||
1789 | |||
1790 | int | ||
1791 | io_stats_inodelk (call_frame_t *frame, xlator_t *this, | ||
1792 | const char *volume, loc_t *loc, int32_t cmd, struct gf_flock *flock, dict_t *xdata) | ||
1793 | { | ||
1794 | |||
1795 | START_FOP_LATENCY (frame)do { struct ios_conf *conf = ((void*)0); conf = this->private ; if (conf && conf->measure_latency) { gettimeofday (&frame->begin, ((void*)0)); } else { memset (&frame ->begin, 0, sizeof (frame->begin)); } } while (0); | ||
1796 | |||
1797 | STACK_WIND (frame, io_stats_inodelk_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", "io-stats.c", __FUNCTION__, 1800, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->inodelk_cbk) tmp_cbk = io_stats_inodelk_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->inodelk" ; _new->unwind_to = "io_stats_inodelk_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->inodelk); (this->children->xlator )->fops->inodelk (_new, (this->children->xlator), volume, loc, cmd, flock, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | ||
1798 | 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", "io-stats.c", __FUNCTION__, 1800, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->inodelk_cbk) tmp_cbk = io_stats_inodelk_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->inodelk" ; _new->unwind_to = "io_stats_inodelk_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->inodelk); (this->children->xlator )->fops->inodelk (_new, (this->children->xlator), volume, loc, cmd, flock, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | ||
1799 | FIRST_CHILD (this)->fops->inodelk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "io-stats.c", __FUNCTION__, 1800, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->inodelk_cbk) tmp_cbk = io_stats_inodelk_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->inodelk" ; _new->unwind_to = "io_stats_inodelk_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->inodelk); (this->children->xlator )->fops->inodelk (_new, (this->children->xlator), volume, loc, cmd, flock, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | ||
1800 | volume, loc, cmd, flock, 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", "io-stats.c", __FUNCTION__, 1800, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->inodelk_cbk) tmp_cbk = io_stats_inodelk_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->inodelk" ; _new->unwind_to = "io_stats_inodelk_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->inodelk); (this->children->xlator )->fops->inodelk (_new, (this->children->xlator), volume, loc, cmd, flock, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); | ||
1801 | return 0; | ||
1802 | } | ||
1803 | |||
1804 | |||
1805 | int | ||
1806 | io_stats_finodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, | ||
1807 | int32_t op_ret, int32_t op_errno, dict_t *xdata) | ||
1808 | { | ||
1809 | |||
1810 | UPDATE_PROFILE_STATS (frame, FINODELK)do { struct ios_conf *conf = ((void*)0); if (!is_fop_latency_started (frame)) break; conf = this->private; pthread_spin_lock ( &conf->lock); { if (conf && conf->measure_latency && conf->count_fop_hits) { do { struct ios_conf * conf = ((void*)0); conf = this->private; if (!conf) break; conf->cumulative.fop_hits[GF_FOP_FINODELK]++; conf->incremental .fop_hits[GF_FOP_FINODELK]++; } while (0); gettimeofday (& frame->end, ((void*)0)); update_ios_latency (conf, frame, GF_FOP_FINODELK ); } } pthread_spin_unlock (&conf->lock); } while (0); | ||
1811 | STACK_UNWIND_STRICT (finodelk, frame, op_ret, op_errno, xdata)do { fop_finodelk_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" , "io-stats.c", __FUNCTION__, 1811, GF_LOG_CRITICAL, "!frame" ); } while (0); break; } fn = (fop_finodelk_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); | ||
1812 | return 0; | ||
1813 | } | ||
1814 | |||
1815 | |||
1816 | int | ||
1817 | io_stats_finodelk (call_frame_t *frame, xlator_t *this, const char *volume, | ||
1818 | fd_t *fd, int32_t cmd, struct gf_flock *flock, dict_t *xdata) | ||
1819 | { | ||
1820 | START_FOP_LATENCY (frame)do { struct ios_conf *conf = ((void*)0); conf = this->private ; if (conf && conf->measure_latency) { gettimeofday (&frame->begin, ((void*)0)); } else { memset (&frame ->begin, 0, sizeof (frame->begin)); } } while (0); | ||
1821 | |||
1822 | STACK_WIND (frame, io_stats_finodelk_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", "io-stats.c", __FUNCTION__, 1825, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->finodelk_cbk) tmp_cbk = io_stats_finodelk_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->finodelk" ; _new->unwind_to = "io_stats_finodelk_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->finodelk); (this->children->xlator )->fops->finodelk (_new, (this->children->xlator) , volume, fd, cmd, flock, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | ||
1823 | 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", "io-stats.c", __FUNCTION__, 1825, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->finodelk_cbk) tmp_cbk = io_stats_finodelk_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->finodelk" ; _new->unwind_to = "io_stats_finodelk_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->finodelk); (this->children->xlator )->fops->finodelk (_new, (this->children->xlator) , volume, fd, cmd, flock, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | ||
1824 | FIRST_CHILD (this)->fops->finodelk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "io-stats.c", __FUNCTION__, 1825, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->finodelk_cbk) tmp_cbk = io_stats_finodelk_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->finodelk" ; _new->unwind_to = "io_stats_finodelk_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->finodelk); (this->children->xlator )->fops->finodelk (_new, (this->children->xlator) , volume, fd, cmd, flock, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | ||
1825 | volume, fd, cmd, flock, 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", "io-stats.c", __FUNCTION__, 1825, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->finodelk_cbk) tmp_cbk = io_stats_finodelk_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->finodelk" ; _new->unwind_to = "io_stats_finodelk_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->finodelk); (this->children->xlator )->fops->finodelk (_new, (this->children->xlator) , volume, fd, cmd, flock, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); | ||
1826 | return 0; | ||
1827 | } | ||
1828 | |||
1829 | |||
1830 | int | ||
1831 | io_stats_xattrop (call_frame_t *frame, xlator_t *this, loc_t *loc, | ||
1832 | gf_xattrop_flags_t flags, dict_t *dict, dict_t *xdata) | ||
1833 | { | ||
1834 | START_FOP_LATENCY (frame)do { struct ios_conf *conf = ((void*)0); conf = this->private ; if (conf && conf->measure_latency) { gettimeofday (&frame->begin, ((void*)0)); } else { memset (&frame ->begin, 0, sizeof (frame->begin)); } } while (0); | ||
1835 | |||
1836 | STACK_WIND (frame, io_stats_xattrop_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "io-stats.c", __FUNCTION__, 1839, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->xattrop_cbk) tmp_cbk = io_stats_xattrop_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->xattrop" ; _new->unwind_to = "io_stats_xattrop_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->xattrop); (this->children->xlator )->fops->xattrop (_new, (this->children->xlator), loc, flags, dict, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | ||
1837 | 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", "io-stats.c", __FUNCTION__, 1839, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->xattrop_cbk) tmp_cbk = io_stats_xattrop_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->xattrop" ; _new->unwind_to = "io_stats_xattrop_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->xattrop); (this->children->xlator )->fops->xattrop (_new, (this->children->xlator), loc, flags, dict, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | ||
1838 | FIRST_CHILD(this)->fops->xattrop,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "io-stats.c", __FUNCTION__, 1839, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->xattrop_cbk) tmp_cbk = io_stats_xattrop_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->xattrop" ; _new->unwind_to = "io_stats_xattrop_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->xattrop); (this->children->xlator )->fops->xattrop (_new, (this->children->xlator), loc, flags, dict, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | ||
1839 | loc, flags, dict, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "io-stats.c", __FUNCTION__, 1839, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->xattrop_cbk) tmp_cbk = io_stats_xattrop_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->xattrop" ; _new->unwind_to = "io_stats_xattrop_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->xattrop); (this->children->xlator )->fops->xattrop (_new, (this->children->xlator), loc, flags, dict, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | ||
1840 | return 0; | ||
1841 | } | ||
1842 | |||
1843 | |||
1844 | int | ||
1845 | io_stats_fxattrop (call_frame_t *frame, xlator_t *this, fd_t *fd, | ||
1846 | gf_xattrop_flags_t flags, dict_t *dict, dict_t *xdata) | ||
1847 | { | ||
1848 | START_FOP_LATENCY (frame)do { struct ios_conf *conf = ((void*)0); conf = this->private ; if (conf && conf->measure_latency) { gettimeofday (&frame->begin, ((void*)0)); } else { memset (&frame ->begin, 0, sizeof (frame->begin)); } } while (0); | ||
1849 | |||
1850 | STACK_WIND (frame, io_stats_fxattrop_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "io-stats.c", __FUNCTION__, 1853, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fxattrop_cbk) tmp_cbk = io_stats_fxattrop_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->fxattrop" ; _new->unwind_to = "io_stats_fxattrop_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->fxattrop); (this->children->xlator )->fops->fxattrop (_new, (this->children->xlator) , fd, flags, dict, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | ||
1851 | 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", "io-stats.c", __FUNCTION__, 1853, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fxattrop_cbk) tmp_cbk = io_stats_fxattrop_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->fxattrop" ; _new->unwind_to = "io_stats_fxattrop_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->fxattrop); (this->children->xlator )->fops->fxattrop (_new, (this->children->xlator) , fd, flags, dict, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | ||
1852 | FIRST_CHILD(this)->fops->fxattrop,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "io-stats.c", __FUNCTION__, 1853, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fxattrop_cbk) tmp_cbk = io_stats_fxattrop_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->fxattrop" ; _new->unwind_to = "io_stats_fxattrop_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->fxattrop); (this->children->xlator )->fops->fxattrop (_new, (this->children->xlator) , fd, flags, dict, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | ||
1853 | fd, flags, dict, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "io-stats.c", __FUNCTION__, 1853, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fxattrop_cbk) tmp_cbk = io_stats_fxattrop_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->fxattrop" ; _new->unwind_to = "io_stats_fxattrop_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->fxattrop); (this->children->xlator )->fops->fxattrop (_new, (this->children->xlator) , fd, flags, dict, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | ||
1854 | return 0; | ||
1855 | } | ||
1856 | |||
1857 | |||
1858 | int | ||
1859 | io_stats_lookup (call_frame_t *frame, xlator_t *this, | ||
1860 | loc_t *loc, dict_t *xdata) | ||
1861 | { | ||
1862 | START_FOP_LATENCY (frame)do { struct ios_conf *conf = ((void*)0); conf = this->private ; if (conf && conf->measure_latency) { gettimeofday (&frame->begin, ((void*)0)); } else { memset (&frame ->begin, 0, sizeof (frame->begin)); } } while (0); | ||
1863 | |||
1864 | STACK_WIND (frame, io_stats_lookup_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "io-stats.c", __FUNCTION__, 1867, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->lookup_cbk) tmp_cbk = io_stats_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 = "io_stats_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) | ||
1865 | 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", "io-stats.c", __FUNCTION__, 1867, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->lookup_cbk) tmp_cbk = io_stats_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 = "io_stats_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) | ||
1866 | FIRST_CHILD(this)->fops->lookup,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "io-stats.c", __FUNCTION__, 1867, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->lookup_cbk) tmp_cbk = io_stats_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 = "io_stats_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) | ||
1867 | 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", "io-stats.c", __FUNCTION__, 1867, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->lookup_cbk) tmp_cbk = io_stats_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 = "io_stats_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); | ||
1868 | return 0; | ||
1869 | } | ||
1870 | |||
1871 | |||
1872 | int | ||
1873 | io_stats_stat (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata) | ||
1874 | { | ||
1875 | START_FOP_LATENCY (frame)do { struct ios_conf *conf = ((void*)0); conf = this->private ; if (conf && conf->measure_latency) { gettimeofday (&frame->begin, ((void*)0)); } else { memset (&frame ->begin, 0, sizeof (frame->begin)); } } while (0); | ||
1876 | |||
1877 | STACK_WIND (frame, io_stats_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", "io-stats.c", __FUNCTION__, 1880, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->stat_cbk) tmp_cbk = io_stats_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 = "io_stats_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) | ||
1878 | 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", "io-stats.c", __FUNCTION__, 1880, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->stat_cbk) tmp_cbk = io_stats_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 = "io_stats_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) | ||
1879 | 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", "io-stats.c", __FUNCTION__, 1880, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->stat_cbk) tmp_cbk = io_stats_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 = "io_stats_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) | ||
1880 | 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", "io-stats.c", __FUNCTION__, 1880, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->stat_cbk) tmp_cbk = io_stats_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 = "io_stats_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); | ||
1881 | return 0; | ||
1882 | } | ||
1883 | |||
1884 | |||
1885 | int | ||
1886 | io_stats_readlink (call_frame_t *frame, xlator_t *this, | ||
1887 | loc_t *loc, size_t size, dict_t *xdata) | ||
1888 | { | ||
1889 | START_FOP_LATENCY (frame)do { struct ios_conf *conf = ((void*)0); conf = this->private ; if (conf && conf->measure_latency) { gettimeofday (&frame->begin, ((void*)0)); } else { memset (&frame ->begin, 0, sizeof (frame->begin)); } } while (0); | ||
1890 | |||
1891 | STACK_WIND (frame, io_stats_readlink_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", "io-stats.c", __FUNCTION__, 1894, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->readlink_cbk) tmp_cbk = io_stats_readlink_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->readlink" ; _new->unwind_to = "io_stats_readlink_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->readlink); (this->children->xlator )->fops->readlink (_new, (this->children->xlator) , loc, size, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | ||
1892 | FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "io-stats.c", __FUNCTION__, 1894, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->readlink_cbk) tmp_cbk = io_stats_readlink_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->readlink" ; _new->unwind_to = "io_stats_readlink_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->readlink); (this->children->xlator )->fops->readlink (_new, (this->children->xlator) , loc, size, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | ||
1893 | FIRST_CHILD(this)->fops->readlink,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "io-stats.c", __FUNCTION__, 1894, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->readlink_cbk) tmp_cbk = io_stats_readlink_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->readlink" ; _new->unwind_to = "io_stats_readlink_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->readlink); (this->children->xlator )->fops->readlink (_new, (this->children->xlator) , loc, size, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | ||
1894 | loc, size, 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", "io-stats.c", __FUNCTION__, 1894, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->readlink_cbk) tmp_cbk = io_stats_readlink_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->readlink" ; _new->unwind_to = "io_stats_readlink_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->readlink); (this->children->xlator )->fops->readlink (_new, (this->children->xlator) , loc, size, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | ||
1895 | return 0; | ||
1896 | } | ||
1897 | |||
1898 | |||
1899 | int | ||
1900 | io_stats_mknod (call_frame_t *frame, xlator_t *this, loc_t *loc, | ||
1901 | mode_t mode, dev_t dev, mode_t umask, dict_t *xdata) | ||
1902 | { | ||
1903 | START_FOP_LATENCY (frame)do { struct ios_conf *conf = ((void*)0); conf = this->private ; if (conf && conf->measure_latency) { gettimeofday (&frame->begin, ((void*)0)); } else { memset (&frame ->begin, 0, sizeof (frame->begin)); } } while (0); | ||
1904 | |||
1905 | STACK_WIND (frame, io_stats_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", "io-stats.c", __FUNCTION__, 1908, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->mknod_cbk) tmp_cbk = io_stats_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 = "io_stats_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, dev, umask, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | ||
1906 | 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", "io-stats.c", __FUNCTION__, 1908, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->mknod_cbk) tmp_cbk = io_stats_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 = "io_stats_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, dev, umask, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | ||
1907 | 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", "io-stats.c", __FUNCTION__, 1908, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->mknod_cbk) tmp_cbk = io_stats_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 = "io_stats_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, dev, umask, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | ||
1908 | loc, mode, dev, 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", "io-stats.c", __FUNCTION__, 1908, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->mknod_cbk) tmp_cbk = io_stats_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 = "io_stats_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, dev, umask, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | ||
1909 | return 0; | ||
1910 | } | ||
1911 | |||
1912 | |||
1913 | int | ||
1914 | io_stats_mkdir (call_frame_t *frame, xlator_t *this, | ||
1915 | loc_t *loc, mode_t mode, mode_t umask, dict_t *xdata) | ||
1916 | { | ||
1917 | frame->local = gf_strdup (loc->path); | ||
1918 | |||
1919 | START_FOP_LATENCY (frame)do { struct ios_conf *conf = ((void*)0); conf = this->private ; if (conf && conf->measure_latency) { gettimeofday (&frame->begin, ((void*)0)); } else { memset (&frame ->begin, 0, sizeof (frame->begin)); } } while (0); | ||
1920 | |||
1921 | STACK_WIND (frame, io_stats_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", "io-stats.c", __FUNCTION__, 1924, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->mkdir_cbk) tmp_cbk = io_stats_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 = "io_stats_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) | ||
1922 | 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", "io-stats.c", __FUNCTION__, 1924, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->mkdir_cbk) tmp_cbk = io_stats_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 = "io_stats_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) | ||
1923 | 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", "io-stats.c", __FUNCTION__, 1924, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->mkdir_cbk) tmp_cbk = io_stats_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 = "io_stats_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) | ||
1924 | 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", "io-stats.c", __FUNCTION__, 1924, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->mkdir_cbk) tmp_cbk = io_stats_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 = "io_stats_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); | ||
1925 | return 0; | ||
1926 | } | ||
1927 | |||
1928 | |||
1929 | int | ||
1930 | io_stats_unlink (call_frame_t *frame, xlator_t *this, | ||
1931 | loc_t *loc, int xflag, dict_t *xdata) | ||
1932 | { | ||
1933 | START_FOP_LATENCY (frame)do { struct ios_conf *conf = ((void*)0); conf = this->private ; if (conf && conf->measure_latency) { gettimeofday (&frame->begin, ((void*)0)); } else { memset (&frame ->begin, 0, sizeof (frame->begin)); } } while (0); | ||
1934 | |||
1935 | STACK_WIND (frame, io_stats_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", "io-stats.c", __FUNCTION__, 1938, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->unlink_cbk) tmp_cbk = io_stats_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 = "io_stats_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) | ||
1936 | FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "io-stats.c", __FUNCTION__, 1938, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->unlink_cbk) tmp_cbk = io_stats_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 = "io_stats_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) | ||
1937 | 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", "io-stats.c", __FUNCTION__, 1938, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->unlink_cbk) tmp_cbk = io_stats_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 = "io_stats_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) | ||
1938 | 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", "io-stats.c", __FUNCTION__, 1938, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->unlink_cbk) tmp_cbk = io_stats_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 = "io_stats_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); | ||
1939 | return 0; | ||
1940 | } | ||
1941 | |||
1942 | |||
1943 | int | ||
1944 | io_stats_rmdir (call_frame_t *frame, xlator_t *this, | ||
1945 | loc_t *loc, int flags, dict_t *xdata) | ||
1946 | { | ||
1947 | START_FOP_LATENCY (frame)do { struct ios_conf *conf = ((void*)0); conf = this->private ; if (conf && conf->measure_latency) { gettimeofday (&frame->begin, ((void*)0)); } else { memset (&frame ->begin, 0, sizeof (frame->begin)); } } while (0); | ||
1948 | |||
1949 | STACK_WIND (frame, io_stats_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", "io-stats.c", __FUNCTION__, 1952, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->rmdir_cbk) tmp_cbk = io_stats_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 = "io_stats_rmdir_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->rmdir); (this->children->xlator )->fops->rmdir (_new, (this->children->xlator), loc , flags, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | ||
1950 | 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", "io-stats.c", __FUNCTION__, 1952, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->rmdir_cbk) tmp_cbk = io_stats_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 = "io_stats_rmdir_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->rmdir); (this->children->xlator )->fops->rmdir (_new, (this->children->xlator), loc , flags, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | ||
1951 | 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", "io-stats.c", __FUNCTION__, 1952, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->rmdir_cbk) tmp_cbk = io_stats_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 = "io_stats_rmdir_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->rmdir); (this->children->xlator )->fops->rmdir (_new, (this->children->xlator), loc , flags, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | ||
1952 | loc, flags, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "io-stats.c", __FUNCTION__, 1952, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->rmdir_cbk) tmp_cbk = io_stats_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 = "io_stats_rmdir_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->rmdir); (this->children->xlator )->fops->rmdir (_new, (this->children->xlator), loc , flags, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); | ||
1953 | return 0; | ||
1954 | } | ||
1955 | |||
1956 | |||
1957 | int | ||
1958 | io_stats_symlink (call_frame_t *frame, xlator_t *this, const char *linkpath, | ||
1959 | loc_t *loc, mode_t umask, dict_t *xdata) | ||
1960 | { | ||
1961 | START_FOP_LATENCY (frame)do { struct ios_conf *conf = ((void*)0); conf = this->private ; if (conf && conf->measure_latency) { gettimeofday (&frame->begin, ((void*)0)); } else { memset (&frame ->begin, 0, sizeof (frame->begin)); } } while (0); | ||
1962 | |||
1963 | STACK_WIND (frame, io_stats_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", "io-stats.c", __FUNCTION__, 1966, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->symlink_cbk) tmp_cbk = io_stats_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 = "io_stats_symlink_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->symlink); (this->children->xlator )->fops->symlink (_new, (this->children->xlator), linkpath, loc, umask, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | ||
1964 | 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", "io-stats.c", __FUNCTION__, 1966, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->symlink_cbk) tmp_cbk = io_stats_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 = "io_stats_symlink_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->symlink); (this->children->xlator )->fops->symlink (_new, (this->children->xlator), linkpath, loc, umask, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | ||
1965 | 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", "io-stats.c", __FUNCTION__, 1966, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->symlink_cbk) tmp_cbk = io_stats_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 = "io_stats_symlink_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->symlink); (this->children->xlator )->fops->symlink (_new, (this->children->xlator), linkpath, loc, umask, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | ||
1966 | linkpath, loc, umask, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "io-stats.c", __FUNCTION__, 1966, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->symlink_cbk) tmp_cbk = io_stats_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 = "io_stats_symlink_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->symlink); (this->children->xlator )->fops->symlink (_new, (this->children->xlator), linkpath, loc, umask, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); | ||
1967 | return 0; | ||
1968 | } | ||
1969 | |||
1970 | |||
1971 | int | ||
1972 | io_stats_rename (call_frame_t *frame, xlator_t *this, | ||
1973 | loc_t *oldloc, loc_t *newloc, dict_t *xdata) | ||
1974 | { | ||
1975 | START_FOP_LATENCY (frame)do { struct ios_conf *conf = ((void*)0); conf = this->private ; if (conf && conf->measure_latency) { gettimeofday (&frame->begin, ((void*)0)); } else { memset (&frame ->begin, 0, sizeof (frame->begin)); } } while (0); | ||
1976 | |||
1977 | STACK_WIND (frame, io_stats_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", "io-stats.c", __FUNCTION__, 1980, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->rename_cbk) tmp_cbk = io_stats_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 = "io_stats_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) | ||
1978 | FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "io-stats.c", __FUNCTION__, 1980, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->rename_cbk) tmp_cbk = io_stats_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 = "io_stats_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) | ||
1979 | 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", "io-stats.c", __FUNCTION__, 1980, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->rename_cbk) tmp_cbk = io_stats_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 = "io_stats_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) | ||
1980 | 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", "io-stats.c", __FUNCTION__, 1980, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->rename_cbk) tmp_cbk = io_stats_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 = "io_stats_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); | ||
1981 | return 0; | ||
1982 | } | ||
1983 | |||
1984 | |||
1985 | int | ||
1986 | io_stats_link (call_frame_t *frame, xlator_t *this, | ||
1987 | loc_t *oldloc, loc_t *newloc, dict_t *xdata) | ||
1988 | { | ||
1989 | START_FOP_LATENCY (frame)do { struct ios_conf *conf = ((void*)0); conf = this->private ; if (conf && conf->measure_latency) { gettimeofday (&frame->begin, ((void*)0)); } else { memset (&frame ->begin, 0, sizeof (frame->begin)); } } while (0); | ||
1990 | |||
1991 | STACK_WIND (frame, io_stats_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", "io-stats.c", __FUNCTION__, 1994, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->link_cbk) tmp_cbk = io_stats_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 = "io_stats_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) | ||
1992 | 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", "io-stats.c", __FUNCTION__, 1994, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->link_cbk) tmp_cbk = io_stats_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 = "io_stats_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) | ||
1993 | 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", "io-stats.c", __FUNCTION__, 1994, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->link_cbk) tmp_cbk = io_stats_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 = "io_stats_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) | ||
1994 | 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", "io-stats.c", __FUNCTION__, 1994, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->link_cbk) tmp_cbk = io_stats_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 = "io_stats_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); | ||
1995 | return 0; | ||
1996 | } | ||
1997 | |||
1998 | |||
1999 | int | ||
2000 | io_stats_setattr (call_frame_t *frame, xlator_t *this, | ||
2001 | loc_t *loc, struct iatt *stbuf, int32_t valid, dict_t *xdata) | ||
2002 | { | ||
2003 | START_FOP_LATENCY (frame)do { struct ios_conf *conf = ((void*)0); conf = this->private ; if (conf && conf->measure_latency) { gettimeofday (&frame->begin, ((void*)0)); } else { memset (&frame ->begin, 0, sizeof (frame->begin)); } } while (0); | ||
2004 | |||
2005 | STACK_WIND (frame, io_stats_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", "io-stats.c", __FUNCTION__, 2008, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->setattr_cbk) tmp_cbk = io_stats_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 = "io_stats_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) | ||
2006 | 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", "io-stats.c", __FUNCTION__, 2008, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->setattr_cbk) tmp_cbk = io_stats_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 = "io_stats_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) | ||
2007 | 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", "io-stats.c", __FUNCTION__, 2008, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->setattr_cbk) tmp_cbk = io_stats_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 = "io_stats_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) | ||
2008 | 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", "io-stats.c", __FUNCTION__, 2008, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->setattr_cbk) tmp_cbk = io_stats_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 = "io_stats_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); | ||
2009 | return 0; | ||
2010 | } | ||
2011 | |||
2012 | |||
2013 | int | ||
2014 | io_stats_truncate (call_frame_t *frame, xlator_t *this, | ||
2015 | loc_t *loc, off_t offset, dict_t *xdata) | ||
2016 | { | ||
2017 | START_FOP_LATENCY (frame)do { struct ios_conf *conf = ((void*)0); conf = this->private ; if (conf && conf->measure_latency) { gettimeofday (&frame->begin, ((void*)0)); } else { memset (&frame ->begin, 0, sizeof (frame->begin)); } } while (0); | ||
2018 | |||
2019 | STACK_WIND (frame, io_stats_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", "io-stats.c", __FUNCTION__, 2022, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->truncate_cbk) tmp_cbk = io_stats_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 = "io_stats_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) | ||
2020 | 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", "io-stats.c", __FUNCTION__, 2022, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->truncate_cbk) tmp_cbk = io_stats_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 = "io_stats_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) | ||
2021 | 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", "io-stats.c", __FUNCTION__, 2022, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->truncate_cbk) tmp_cbk = io_stats_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 = "io_stats_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) | ||
2022 | 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", "io-stats.c", __FUNCTION__, 2022, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->truncate_cbk) tmp_cbk = io_stats_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 = "io_stats_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); | ||
2023 | return 0; | ||
2024 | } | ||
2025 | |||
2026 | |||
2027 | int | ||
2028 | io_stats_open (call_frame_t *frame, xlator_t *this, loc_t *loc, | ||
2029 | int32_t flags, fd_t *fd, dict_t *xdata) | ||
2030 | { | ||
2031 | frame->local = gf_strdup (loc->path); | ||
2032 | |||
2033 | START_FOP_LATENCY (frame)do { struct ios_conf *conf = ((void*)0); conf = this->private ; if (conf && conf->measure_latency) { gettimeofday (&frame->begin, ((void*)0)); } else { memset (&frame ->begin, 0, sizeof (frame->begin)); } } while (0); | ||
2034 | |||
2035 | STACK_WIND (frame, io_stats_open_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "io-stats.c", __FUNCTION__, 2038, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->open_cbk) tmp_cbk = io_stats_open_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->open"; _new ->unwind_to = "io_stats_open_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->open); (this->children->xlator )->fops->open (_new, (this->children->xlator), loc , flags, fd, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | ||
2036 | 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", "io-stats.c", __FUNCTION__, 2038, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->open_cbk) tmp_cbk = io_stats_open_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->open"; _new ->unwind_to = "io_stats_open_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->open); (this->children->xlator )->fops->open (_new, (this->children->xlator), loc , flags, fd, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | ||
2037 | FIRST_CHILD(this)->fops->open,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "io-stats.c", __FUNCTION__, 2038, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->open_cbk) tmp_cbk = io_stats_open_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->open"; _new ->unwind_to = "io_stats_open_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->open); (this->children->xlator )->fops->open (_new, (this->children->xlator), loc , flags, fd, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | ||
2038 | loc, flags, fd, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "io-stats.c", __FUNCTION__, 2038, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->open_cbk) tmp_cbk = io_stats_open_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->open"; _new ->unwind_to = "io_stats_open_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->open); (this->children->xlator )->fops->open (_new, (this->children->xlator), loc , flags, fd, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | ||
2039 | return 0; | ||
2040 | } | ||
2041 | |||
2042 | |||
2043 | int | ||
2044 | io_stats_create (call_frame_t *frame, xlator_t *this, | ||
2045 | loc_t *loc, int32_t flags, mode_t mode, | ||
2046 | mode_t umask, fd_t *fd, dict_t *xdata) | ||
2047 | { | ||
2048 | frame->local = gf_strdup (loc->path); | ||
2049 | |||
2050 | START_FOP_LATENCY (frame)do { struct ios_conf *conf = ((void*)0); conf = this->private ; if (conf && conf->measure_latency) { gettimeofday (&frame->begin, ((void*)0)); } else { memset (&frame ->begin, 0, sizeof (frame->begin)); } } while (0); | ||
2051 | |||
2052 | STACK_WIND (frame, io_stats_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", "io-stats.c", __FUNCTION__, 2055, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->create_cbk) tmp_cbk = io_stats_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 = "io_stats_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) | ||
2053 | 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", "io-stats.c", __FUNCTION__, 2055, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->create_cbk) tmp_cbk = io_stats_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 = "io_stats_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) | ||
2054 | 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", "io-stats.c", __FUNCTION__, 2055, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->create_cbk) tmp_cbk = io_stats_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 = "io_stats_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) | ||
2055 | 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", "io-stats.c", __FUNCTION__, 2055, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->create_cbk) tmp_cbk = io_stats_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 = "io_stats_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); | ||
2056 | return 0; | ||
2057 | } | ||
2058 | |||
2059 | |||
2060 | int | ||
2061 | io_stats_readv (call_frame_t *frame, xlator_t *this, | ||
2062 | fd_t *fd, size_t size, off_t offset, uint32_t flags, dict_t *xdata) | ||
2063 | { | ||
2064 | frame->local = fd; | ||
2065 | |||
2066 | START_FOP_LATENCY (frame)do { struct ios_conf *conf = ((void*)0); conf = this->private ; if (conf && conf->measure_latency) { gettimeofday (&frame->begin, ((void*)0)); } else { memset (&frame ->begin, 0, sizeof (frame->begin)); } } while (0); | ||
2067 | |||
2068 | STACK_WIND (frame, io_stats_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", "io-stats.c", __FUNCTION__, 2071, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->readv_cbk) tmp_cbk = io_stats_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 = "io_stats_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) | ||
2069 | 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", "io-stats.c", __FUNCTION__, 2071, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->readv_cbk) tmp_cbk = io_stats_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 = "io_stats_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) | ||
2070 | 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", "io-stats.c", __FUNCTION__, 2071, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->readv_cbk) tmp_cbk = io_stats_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 = "io_stats_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) | ||
2071 | 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", "io-stats.c", __FUNCTION__, 2071, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->readv_cbk) tmp_cbk = io_stats_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 = "io_stats_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); | ||
2072 | return 0; | ||
2073 | } | ||
2074 | |||
2075 | |||
2076 | int | ||
2077 | io_stats_writev (call_frame_t *frame, xlator_t *this, | ||
2078 | fd_t *fd, struct iovec *vector, | ||
2079 | int32_t count, off_t offset, | ||
2080 | uint32_t flags, struct iobref *iobref, dict_t *xdata) | ||
2081 | { | ||
2082 | int len = 0; | ||
2083 | |||
2084 | if (fd->inode) | ||
2085 | frame->local = fd->inode; | ||
2086 | len = iov_length (vector, count); | ||
2087 | |||
2088 | BUMP_WRITE (fd, len)do { struct ios_conf *conf = ((void*)0); struct ios_fd *iosfd = ((void*)0); int lb2 = 0; conf = this->private; lb2 = log_base2 (len); ios_fd_ctx_get (fd, this, &iosfd); if (!conf) break ; pthread_spin_lock (&conf->lock); { conf->cumulative .data_written += len; conf->incremental.data_written += len ; conf->cumulative.block_count_write[lb2]++; conf->incremental .block_count_write[lb2]++; if (iosfd) { iosfd->data_written += len; iosfd->block_count_write[lb2]++; } } pthread_spin_unlock (&conf->lock); } while (0); | ||
2089 | START_FOP_LATENCY (frame)do { struct ios_conf *conf = ((void*)0); conf = this->private ; if (conf && conf->measure_latency) { gettimeofday (&frame->begin, ((void*)0)); } else { memset (&frame ->begin, 0, sizeof (frame->begin)); } } while (0); | ||
2090 | |||
2091 | STACK_WIND (frame, io_stats_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", "io-stats.c", __FUNCTION__, 2094, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->writev_cbk) tmp_cbk = io_stats_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 = "io_stats_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) | ||
2092 | 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", "io-stats.c", __FUNCTION__, 2094, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->writev_cbk) tmp_cbk = io_stats_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 = "io_stats_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) | ||
2093 | 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", "io-stats.c", __FUNCTION__, 2094, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->writev_cbk) tmp_cbk = io_stats_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 = "io_stats_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) | ||
2094 | 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", "io-stats.c", __FUNCTION__, 2094, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->writev_cbk) tmp_cbk = io_stats_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 = "io_stats_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); | ||
2095 | return 0; | ||
2096 | |||
2097 | } | ||
2098 | |||
2099 | |||
2100 | int | ||
2101 | io_stats_statfs (call_frame_t *frame, xlator_t *this, | ||
2102 | loc_t *loc, dict_t *xdata) | ||
2103 | { | ||
2104 | START_FOP_LATENCY (frame)do { struct ios_conf *conf = ((void*)0); conf = this->private ; if (conf && conf->measure_latency) { gettimeofday (&frame->begin, ((void*)0)); } else { memset (&frame ->begin, 0, sizeof (frame->begin)); } } while (0); | ||
2105 | |||
2106 | STACK_WIND (frame, io_stats_statfs_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", "io-stats.c", __FUNCTION__, 2109, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->statfs_cbk) tmp_cbk = io_stats_statfs_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->statfs"; _new->unwind_to = "io_stats_statfs_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->statfs); (this->children->xlator )->fops->statfs (_new, (this->children->xlator), loc , xdata); (*__glusterfs_this_location()) = old_THIS; } while ( 0) | ||
2107 | 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", "io-stats.c", __FUNCTION__, 2109, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->statfs_cbk) tmp_cbk = io_stats_statfs_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->statfs"; _new->unwind_to = "io_stats_statfs_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->statfs); (this->children->xlator )->fops->statfs (_new, (this->children->xlator), loc , xdata); (*__glusterfs_this_location()) = old_THIS; } while ( 0) | ||
2108 | FIRST_CHILD(this)->fops->statfs,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "io-stats.c", __FUNCTION__, 2109, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->statfs_cbk) tmp_cbk = io_stats_statfs_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->statfs"; _new->unwind_to = "io_stats_statfs_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->statfs); (this->children->xlator )->fops->statfs (_new, (this->children->xlator), loc , xdata); (*__glusterfs_this_location()) = old_THIS; } while ( 0) | ||
2109 | 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", "io-stats.c", __FUNCTION__, 2109, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->statfs_cbk) tmp_cbk = io_stats_statfs_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->statfs"; _new->unwind_to = "io_stats_statfs_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->statfs); (this->children->xlator )->fops->statfs (_new, (this->children->xlator), loc , xdata); (*__glusterfs_this_location()) = old_THIS; } while ( 0); | ||
2110 | return 0; | ||
2111 | } | ||
2112 | |||
2113 | |||
2114 | int | ||
2115 | io_stats_flush (call_frame_t *frame, xlator_t *this, | ||
2116 | fd_t *fd, dict_t *xdata) | ||
2117 | { | ||
2118 | START_FOP_LATENCY (frame)do { struct ios_conf *conf = ((void*)0); conf = this->private ; if (conf && conf->measure_latency) { gettimeofday (&frame->begin, ((void*)0)); } else { memset (&frame ->begin, 0, sizeof (frame->begin)); } } while (0); | ||
2119 | |||
2120 | STACK_WIND (frame, io_stats_flush_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "io-stats.c", __FUNCTION__, 2123, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->flush_cbk) tmp_cbk = io_stats_flush_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->flush"; _new ->unwind_to = "io_stats_flush_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->flush); (this->children->xlator )->fops->flush (_new, (this->children->xlator), fd , xdata); (*__glusterfs_this_location()) = old_THIS; } while ( 0) | ||
2121 | 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", "io-stats.c", __FUNCTION__, 2123, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->flush_cbk) tmp_cbk = io_stats_flush_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->flush"; _new ->unwind_to = "io_stats_flush_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->flush); (this->children->xlator )->fops->flush (_new, (this->children->xlator), fd , xdata); (*__glusterfs_this_location()) = old_THIS; } while ( 0) | ||
2122 | FIRST_CHILD(this)->fops->flush,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "io-stats.c", __FUNCTION__, 2123, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->flush_cbk) tmp_cbk = io_stats_flush_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->flush"; _new ->unwind_to = "io_stats_flush_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->flush); (this->children->xlator )->fops->flush (_new, (this->children->xlator), fd , xdata); (*__glusterfs_this_location()) = old_THIS; } while ( 0) | ||
2123 | 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", "io-stats.c", __FUNCTION__, 2123, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->flush_cbk) tmp_cbk = io_stats_flush_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->flush"; _new ->unwind_to = "io_stats_flush_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->flush); (this->children->xlator )->fops->flush (_new, (this->children->xlator), fd , xdata); (*__glusterfs_this_location()) = old_THIS; } while ( 0); | ||
2124 | return 0; | ||
2125 | } | ||
2126 | |||
2127 | |||
2128 | int | ||
2129 | io_stats_fsync (call_frame_t *frame, xlator_t *this, | ||
2130 | fd_t *fd, int32_t flags, dict_t *xdata) | ||
2131 | { | ||
2132 | START_FOP_LATENCY (frame)do { struct ios_conf *conf = ((void*)0); conf = this->private ; if (conf && conf->measure_latency) { gettimeofday (&frame->begin, ((void*)0)); } else { memset (&frame ->begin, 0, sizeof (frame->begin)); } } while (0); | ||
2133 | |||
2134 | STACK_WIND (frame, io_stats_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", "io-stats.c", __FUNCTION__, 2137, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fsync_cbk) tmp_cbk = io_stats_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 = "io_stats_fsync_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->fsync); (this->children->xlator )->fops->fsync (_new, (this->children->xlator), fd , flags, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | ||
2135 | 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", "io-stats.c", __FUNCTION__, 2137, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fsync_cbk) tmp_cbk = io_stats_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 = "io_stats_fsync_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->fsync); (this->children->xlator )->fops->fsync (_new, (this->children->xlator), fd , flags, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | ||
2136 | 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", "io-stats.c", __FUNCTION__, 2137, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fsync_cbk) tmp_cbk = io_stats_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 = "io_stats_fsync_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->fsync); (this->children->xlator )->fops->fsync (_new, (this->children->xlator), fd , flags, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | ||
2137 | fd, 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", "io-stats.c", __FUNCTION__, 2137, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fsync_cbk) tmp_cbk = io_stats_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 = "io_stats_fsync_cbk"; pthread_spin_init (& _new->lock, 0); pthread_spin_lock (&frame->root-> stack_lock); { _new->next = frame->root->frames.next ; _new->prev = &frame->root->frames; if (frame-> root->frames.next) frame->root->frames.next->prev = _new; frame->root->frames.next = _new; frame->ref_count ++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->fsync); (this->children->xlator )->fops->fsync (_new, (this->children->xlator), fd , flags, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); | ||
2138 | return 0; | ||
2139 | } | ||
2140 | |||
2141 | |||
2142 | int | ||
2143 | conditional_dump (dict_t *dict, char *key, data_t *value, void *data) | ||
2144 | { | ||
2145 | struct { | ||
2146 | xlator_t *this; | ||
2147 | inode_t *inode; | ||
2148 | const char *path; | ||
2149 | } *stub; | ||
2150 | xlator_t *this = NULL((void*)0); | ||
2151 | char *filename = NULL((void*)0); | ||
2152 | FILE *logfp = NULL((void*)0); | ||
2153 | struct ios_dump_args args = {0}; | ||
2154 | |||
2155 | stub = data; | ||
2156 | this = stub->this; | ||
2157 | |||
2158 | filename = alloca (value->len + 1)__builtin_alloca (value->len + 1); | ||
2159 | memset (filename, 0, value->len + 1); | ||
2160 | memcpy (filename, data_to_str (value), value->len); | ||
2161 | |||
2162 | if (fnmatch ("*io*stat*dump", key, 0) == 0) { | ||
2163 | |||
2164 | if (!strncmp (filename, "", 1)) { | ||
2165 | gf_log (this->name, GF_LOG_ERROR, "No filename given")do { do { if (0) printf ("No filename given"); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__, 2165, GF_LOG_ERROR , "No filename given"); } while (0); | ||
2166 | return -1; | ||
2167 | } | ||
2168 | logfp = fopen (filename, "w+"); | ||
2169 | if (!logfp) { | ||
2170 | gf_log (this->name, GF_LOG_ERROR, "failed to open %s "do { do { if (0) printf ("failed to open %s " "for writing", filename ); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__ , 2171, GF_LOG_ERROR, "failed to open %s " "for writing", filename ); } while (0) | ||
2171 | "for writing", filename)do { do { if (0) printf ("failed to open %s " "for writing", filename ); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__ , 2171, GF_LOG_ERROR, "failed to open %s " "for writing", filename ); } while (0); | ||
2172 | return -1; | ||
2173 | } | ||
2174 | (void) ios_dump_args_init (&args, IOS_DUMP_TYPE_FILE, | ||
2175 | logfp); | ||
2176 | io_stats_dump (this, &args); | ||
2177 | fclose (logfp); | ||
2178 | } | ||
2179 | return 0; | ||
2180 | } | ||
2181 | |||
2182 | |||
2183 | int | ||
2184 | io_stats_setxattr (call_frame_t *frame, xlator_t *this, | ||
2185 | loc_t *loc, dict_t *dict, | ||
2186 | int32_t flags, dict_t *xdata) | ||
2187 | { | ||
2188 | struct { | ||
2189 | xlator_t *this; | ||
2190 | inode_t *inode; | ||
2191 | const char *path; | ||
2192 | } stub; | ||
2193 | |||
2194 | stub.this = this; | ||
2195 | stub.inode = loc->inode; | ||
2196 | stub.path = loc->path; | ||
2197 | |||
2198 | dict_foreach (dict, conditional_dump, &stub); | ||
2199 | |||
2200 | START_FOP_LATENCY (frame)do { struct ios_conf *conf = ((void*)0); conf = this->private ; if (conf && conf->measure_latency) { gettimeofday (&frame->begin, ((void*)0)); } else { memset (&frame ->begin, 0, sizeof (frame->begin)); } } while (0); | ||
2201 | |||
2202 | STACK_WIND (frame, io_stats_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", "io-stats.c", __FUNCTION__, 2205, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->setxattr_cbk) tmp_cbk = io_stats_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 = "io_stats_setxattr_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->setxattr); (this->children->xlator )->fops->setxattr (_new, (this->children->xlator) , loc, dict, flags, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | ||
2203 | FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "io-stats.c", __FUNCTION__, 2205, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->setxattr_cbk) tmp_cbk = io_stats_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 = "io_stats_setxattr_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->setxattr); (this->children->xlator )->fops->setxattr (_new, (this->children->xlator) , loc, dict, flags, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | ||
2204 | 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", "io-stats.c", __FUNCTION__, 2205, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->setxattr_cbk) tmp_cbk = io_stats_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 = "io_stats_setxattr_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->setxattr); (this->children->xlator )->fops->setxattr (_new, (this->children->xlator) , loc, dict, flags, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | ||
2205 | loc, dict, flags, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "io-stats.c", __FUNCTION__, 2205, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->setxattr_cbk) tmp_cbk = io_stats_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 = "io_stats_setxattr_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->setxattr); (this->children->xlator )->fops->setxattr (_new, (this->children->xlator) , loc, dict, flags, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | ||
2206 | return 0; | ||
2207 | } | ||
2208 | |||
2209 | |||
2210 | int | ||
2211 | io_stats_getxattr (call_frame_t *frame, xlator_t *this, | ||
2212 | loc_t *loc, const char *name, dict_t *xdata) | ||
2213 | { | ||
2214 | START_FOP_LATENCY (frame)do { struct ios_conf *conf = ((void*)0); conf = this->private ; if (conf && conf->measure_latency) { gettimeofday (&frame->begin, ((void*)0)); } else { memset (&frame ->begin, 0, sizeof (frame->begin)); } } while (0); | ||
2215 | |||
2216 | STACK_WIND (frame, io_stats_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", "io-stats.c", __FUNCTION__, 2219, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->getxattr_cbk) tmp_cbk = io_stats_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 = "io_stats_getxattr_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->getxattr); (this->children->xlator )->fops->getxattr (_new, (this->children->xlator) , loc, name, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | ||
2217 | 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", "io-stats.c", __FUNCTION__, 2219, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->getxattr_cbk) tmp_cbk = io_stats_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 = "io_stats_getxattr_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->getxattr); (this->children->xlator )->fops->getxattr (_new, (this->children->xlator) , loc, name, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | ||
2218 | 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", "io-stats.c", __FUNCTION__, 2219, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->getxattr_cbk) tmp_cbk = io_stats_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 = "io_stats_getxattr_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->getxattr); (this->children->xlator )->fops->getxattr (_new, (this->children->xlator) , loc, name, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | ||
2219 | loc, name, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "io-stats.c", __FUNCTION__, 2219, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->getxattr_cbk) tmp_cbk = io_stats_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 = "io_stats_getxattr_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->getxattr); (this->children->xlator )->fops->getxattr (_new, (this->children->xlator) , loc, name, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | ||
2220 | return 0; | ||
2221 | } | ||
2222 | |||
2223 | |||
2224 | int | ||
2225 | io_stats_removexattr (call_frame_t *frame, xlator_t *this, | ||
2226 | loc_t *loc, const char *name, dict_t *xdata) | ||
2227 | { | ||
2228 | START_FOP_LATENCY (frame)do { struct ios_conf *conf = ((void*)0); conf = this->private ; if (conf && conf->measure_latency) { gettimeofday (&frame->begin, ((void*)0)); } else { memset (&frame ->begin, 0, sizeof (frame->begin)); } } while (0); | ||
2229 | |||
2230 | STACK_WIND (frame, io_stats_removexattr_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "io-stats.c", __FUNCTION__, 2233, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->removexattr_cbk) tmp_cbk = io_stats_removexattr_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->removexattr" ; _new->unwind_to = "io_stats_removexattr_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->removexattr); (this->children-> xlator)->fops->removexattr (_new, (this->children-> xlator), loc, name, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | ||
2231 | 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", "io-stats.c", __FUNCTION__, 2233, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->removexattr_cbk) tmp_cbk = io_stats_removexattr_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->removexattr" ; _new->unwind_to = "io_stats_removexattr_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->removexattr); (this->children-> xlator)->fops->removexattr (_new, (this->children-> xlator), loc, name, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | ||
2232 | FIRST_CHILD(this)->fops->removexattr,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "io-stats.c", __FUNCTION__, 2233, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->removexattr_cbk) tmp_cbk = io_stats_removexattr_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->removexattr" ; _new->unwind_to = "io_stats_removexattr_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->removexattr); (this->children-> xlator)->fops->removexattr (_new, (this->children-> xlator), loc, name, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | ||
2233 | loc, name, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "io-stats.c", __FUNCTION__, 2233, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->removexattr_cbk) tmp_cbk = io_stats_removexattr_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->removexattr" ; _new->unwind_to = "io_stats_removexattr_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->removexattr); (this->children-> xlator)->fops->removexattr (_new, (this->children-> xlator), loc, name, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | ||
2234 | return 0; | ||
2235 | } | ||
2236 | |||
2237 | |||
2238 | int | ||
2239 | io_stats_fsetxattr (call_frame_t *frame, xlator_t *this, | ||
2240 | fd_t *fd, dict_t *dict, | ||
2241 | int32_t flags, dict_t *xdata) | ||
2242 | { | ||
2243 | START_FOP_LATENCY (frame)do { struct ios_conf *conf = ((void*)0); conf = this->private ; if (conf && conf->measure_latency) { gettimeofday (&frame->begin, ((void*)0)); } else { memset (&frame ->begin, 0, sizeof (frame->begin)); } } while (0); | ||
2244 | |||
2245 | STACK_WIND (frame, io_stats_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", "io-stats.c", __FUNCTION__, 2248, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fsetxattr_cbk) tmp_cbk = io_stats_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 = "io_stats_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, dict, flags, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | ||
2246 | 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", "io-stats.c", __FUNCTION__, 2248, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fsetxattr_cbk) tmp_cbk = io_stats_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 = "io_stats_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, dict, flags, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | ||
2247 | 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", "io-stats.c", __FUNCTION__, 2248, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fsetxattr_cbk) tmp_cbk = io_stats_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 = "io_stats_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, dict, flags, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | ||
2248 | fd, dict, flags, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "io-stats.c", __FUNCTION__, 2248, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fsetxattr_cbk) tmp_cbk = io_stats_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 = "io_stats_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, dict, flags, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); | ||
2249 | return 0; | ||
2250 | } | ||
2251 | |||
2252 | |||
2253 | int | ||
2254 | io_stats_fgetxattr (call_frame_t *frame, xlator_t *this, | ||
2255 | fd_t *fd, const char *name, dict_t *xdata) | ||
2256 | { | ||
2257 | START_FOP_LATENCY (frame)do { struct ios_conf *conf = ((void*)0); conf = this->private ; if (conf && conf->measure_latency) { gettimeofday (&frame->begin, ((void*)0)); } else { memset (&frame ->begin, 0, sizeof (frame->begin)); } } while (0); | ||
2258 | |||
2259 | STACK_WIND (frame, io_stats_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", "io-stats.c", __FUNCTION__, 2262, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fgetxattr_cbk) tmp_cbk = io_stats_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 = "io_stats_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, name, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | ||
2260 | 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", "io-stats.c", __FUNCTION__, 2262, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fgetxattr_cbk) tmp_cbk = io_stats_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 = "io_stats_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, name, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | ||
2261 | 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", "io-stats.c", __FUNCTION__, 2262, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fgetxattr_cbk) tmp_cbk = io_stats_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 = "io_stats_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, name, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | ||
2262 | fd, name, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "io-stats.c", __FUNCTION__, 2262, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fgetxattr_cbk) tmp_cbk = io_stats_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 = "io_stats_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, name, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | ||
2263 | return 0; | ||
2264 | } | ||
2265 | |||
2266 | |||
2267 | int | ||
2268 | io_stats_fremovexattr (call_frame_t *frame, xlator_t *this, | ||
2269 | fd_t *fd, const char *name, dict_t *xdata) | ||
2270 | { | ||
2271 | START_FOP_LATENCY (frame)do { struct ios_conf *conf = ((void*)0); conf = this->private ; if (conf && conf->measure_latency) { gettimeofday (&frame->begin, ((void*)0)); } else { memset (&frame ->begin, 0, sizeof (frame->begin)); } } while (0); | ||
2272 | |||
2273 | STACK_WIND (frame, io_stats_fremovexattr_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", "io-stats.c", __FUNCTION__, 2276, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fremovexattr_cbk) tmp_cbk = io_stats_fremovexattr_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->fremovexattr" ; _new->unwind_to = "io_stats_fremovexattr_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->fremovexattr); (this->children-> xlator)->fops->fremovexattr (_new, (this->children-> xlator), fd, name, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | ||
2274 | 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", "io-stats.c", __FUNCTION__, 2276, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fremovexattr_cbk) tmp_cbk = io_stats_fremovexattr_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->fremovexattr" ; _new->unwind_to = "io_stats_fremovexattr_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->fremovexattr); (this->children-> xlator)->fops->fremovexattr (_new, (this->children-> xlator), fd, name, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | ||
2275 | FIRST_CHILD(this)->fops->fremovexattr,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "io-stats.c", __FUNCTION__, 2276, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fremovexattr_cbk) tmp_cbk = io_stats_fremovexattr_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->fremovexattr" ; _new->unwind_to = "io_stats_fremovexattr_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->fremovexattr); (this->children-> xlator)->fops->fremovexattr (_new, (this->children-> xlator), fd, name, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | ||
2276 | fd, name, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "io-stats.c", __FUNCTION__, 2276, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fremovexattr_cbk) tmp_cbk = io_stats_fremovexattr_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->fremovexattr" ; _new->unwind_to = "io_stats_fremovexattr_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->fremovexattr); (this->children-> xlator)->fops->fremovexattr (_new, (this->children-> xlator), fd, name, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | ||
2277 | return 0; | ||
2278 | } | ||
2279 | |||
2280 | |||
2281 | int | ||
2282 | io_stats_opendir (call_frame_t *frame, xlator_t *this, | ||
2283 | loc_t *loc, fd_t *fd, dict_t *xdata) | ||
2284 | { | ||
2285 | |||
2286 | START_FOP_LATENCY (frame)do { struct ios_conf *conf = ((void*)0); conf = this->private ; if (conf && conf->measure_latency) { gettimeofday (&frame->begin, ((void*)0)); } else { memset (&frame ->begin, 0, sizeof (frame->begin)); } } while (0); | ||
2287 | |||
2288 | STACK_WIND (frame, io_stats_opendir_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "io-stats.c", __FUNCTION__, 2291, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->opendir_cbk) tmp_cbk = io_stats_opendir_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->opendir" ; _new->unwind_to = "io_stats_opendir_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->opendir); (this->children->xlator )->fops->opendir (_new, (this->children->xlator), loc, fd, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | ||
2289 | 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", "io-stats.c", __FUNCTION__, 2291, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->opendir_cbk) tmp_cbk = io_stats_opendir_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->opendir" ; _new->unwind_to = "io_stats_opendir_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->opendir); (this->children->xlator )->fops->opendir (_new, (this->children->xlator), loc, fd, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | ||
2290 | FIRST_CHILD(this)->fops->opendir,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "io-stats.c", __FUNCTION__, 2291, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->opendir_cbk) tmp_cbk = io_stats_opendir_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->opendir" ; _new->unwind_to = "io_stats_opendir_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->opendir); (this->children->xlator )->fops->opendir (_new, (this->children->xlator), loc, fd, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | ||
2291 | loc, fd, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "io-stats.c", __FUNCTION__, 2291, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->opendir_cbk) tmp_cbk = io_stats_opendir_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->opendir" ; _new->unwind_to = "io_stats_opendir_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->opendir); (this->children->xlator )->fops->opendir (_new, (this->children->xlator), loc, fd, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); | ||
2292 | return 0; | ||
2293 | } | ||
2294 | |||
2295 | int | ||
2296 | io_stats_readdirp (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, | ||
2297 | off_t offset, dict_t *dict) | ||
2298 | { | ||
2299 | frame->local = fd->inode; | ||
2300 | START_FOP_LATENCY (frame)do { struct ios_conf *conf = ((void*)0); conf = this->private ; if (conf && conf->measure_latency) { gettimeofday (&frame->begin, ((void*)0)); } else { memset (&frame ->begin, 0, sizeof (frame->begin)); } } while (0); | ||
2301 | |||
2302 | STACK_WIND (frame, io_stats_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", "io-stats.c", __FUNCTION__, 2305, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->readdirp_cbk) tmp_cbk = io_stats_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 = "io_stats_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, dict); (*__glusterfs_this_location()) = old_THIS ; } while (0) | ||
2303 | 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", "io-stats.c", __FUNCTION__, 2305, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->readdirp_cbk) tmp_cbk = io_stats_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 = "io_stats_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, dict); (*__glusterfs_this_location()) = old_THIS ; } while (0) | ||
2304 | 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", "io-stats.c", __FUNCTION__, 2305, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->readdirp_cbk) tmp_cbk = io_stats_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 = "io_stats_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, dict); (*__glusterfs_this_location()) = old_THIS ; } while (0) | ||
2305 | fd, size, offset, dict)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "io-stats.c", __FUNCTION__, 2305, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->readdirp_cbk) tmp_cbk = io_stats_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 = "io_stats_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, dict); (*__glusterfs_this_location()) = old_THIS ; } while (0); | ||
2306 | return 0; | ||
2307 | } | ||
2308 | |||
2309 | |||
2310 | int | ||
2311 | io_stats_readdir (call_frame_t *frame, xlator_t *this, | ||
2312 | fd_t *fd, size_t size, off_t offset, dict_t *xdata) | ||
2313 | { | ||
2314 | START_FOP_LATENCY (frame)do { struct ios_conf *conf = ((void*)0); conf = this->private ; if (conf && conf->measure_latency) { gettimeofday (&frame->begin, ((void*)0)); } else { memset (&frame ->begin, 0, sizeof (frame->begin)); } } while (0); | ||
2315 | |||
2316 | STACK_WIND (frame, io_stats_readdir_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "io-stats.c", __FUNCTION__, 2319, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->readdir_cbk) tmp_cbk = io_stats_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 = "io_stats_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) | ||
2317 | 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", "io-stats.c", __FUNCTION__, 2319, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->readdir_cbk) tmp_cbk = io_stats_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 = "io_stats_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) | ||
2318 | FIRST_CHILD(this)->fops->readdir,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "io-stats.c", __FUNCTION__, 2319, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->readdir_cbk) tmp_cbk = io_stats_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 = "io_stats_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) | ||
2319 | 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", "io-stats.c", __FUNCTION__, 2319, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->readdir_cbk) tmp_cbk = io_stats_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 = "io_stats_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); | ||
2320 | return 0; | ||
2321 | } | ||
2322 | |||
2323 | |||
2324 | int | ||
2325 | io_stats_fsyncdir (call_frame_t *frame, xlator_t *this, | ||
2326 | fd_t *fd, int32_t datasync, dict_t *xdata) | ||
2327 | { | ||
2328 | START_FOP_LATENCY (frame)do { struct ios_conf *conf = ((void*)0); conf = this->private ; if (conf && conf->measure_latency) { gettimeofday (&frame->begin, ((void*)0)); } else { memset (&frame ->begin, 0, sizeof (frame->begin)); } } while (0); | ||
2329 | |||
2330 | STACK_WIND (frame, io_stats_fsyncdir_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "io-stats.c", __FUNCTION__, 2333, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fsyncdir_cbk) tmp_cbk = io_stats_fsyncdir_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->fsyncdir" ; _new->unwind_to = "io_stats_fsyncdir_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->fsyncdir); (this->children->xlator )->fops->fsyncdir (_new, (this->children->xlator) , fd, datasync, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | ||
2331 | 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", "io-stats.c", __FUNCTION__, 2333, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fsyncdir_cbk) tmp_cbk = io_stats_fsyncdir_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->fsyncdir" ; _new->unwind_to = "io_stats_fsyncdir_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->fsyncdir); (this->children->xlator )->fops->fsyncdir (_new, (this->children->xlator) , fd, datasync, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | ||
2332 | FIRST_CHILD(this)->fops->fsyncdir,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "io-stats.c", __FUNCTION__, 2333, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fsyncdir_cbk) tmp_cbk = io_stats_fsyncdir_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->fsyncdir" ; _new->unwind_to = "io_stats_fsyncdir_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->fsyncdir); (this->children->xlator )->fops->fsyncdir (_new, (this->children->xlator) , fd, datasync, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | ||
2333 | 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", "io-stats.c", __FUNCTION__, 2333, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fsyncdir_cbk) tmp_cbk = io_stats_fsyncdir_cbk ; _new->root = frame->root; _new->this = (this->children ->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie = _new; _new->wind_from = __FUNCTION__ ; _new->wind_to = "FIRST_CHILD(this)->fops->fsyncdir" ; _new->unwind_to = "io_stats_fsyncdir_cbk"; pthread_spin_init (&_new->lock, 0); pthread_spin_lock (&frame->root ->stack_lock); { _new->next = frame->root->frames .next; _new->prev = &frame->root->frames; if (frame ->root->frames.next) frame->root->frames.next-> prev = _new; frame->root->frames.next = _new; frame-> ref_count++; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = (this->children->xlator); if (frame->this-> ctx->measure_latency) gf_latency_begin (_new, (this->children ->xlator)->fops->fsyncdir); (this->children->xlator )->fops->fsyncdir (_new, (this->children->xlator) , fd, datasync, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | ||
2334 | return 0; | ||
2335 | } | ||
2336 | |||
2337 | |||
2338 | int | ||
2339 | io_stats_access (call_frame_t *frame, xlator_t *this, | ||
2340 | loc_t *loc, int32_t mask, dict_t *xdata) | ||
2341 | { | ||
2342 | START_FOP_LATENCY (frame)do { struct ios_conf *conf = ((void*)0); conf = this->private ; if (conf && conf->measure_latency) { gettimeofday (&frame->begin, ((void*)0)); } else { memset (&frame ->begin, 0, sizeof (frame->begin)); } } while (0); | ||
2343 | |||
2344 | STACK_WIND (frame, io_stats_access_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", "io-stats.c", __FUNCTION__, 2347, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->access_cbk) tmp_cbk = io_stats_access_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->access"; _new->unwind_to = "io_stats_access_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->access); (this->children->xlator )->fops->access (_new, (this->children->xlator), loc , mask, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | ||
2345 | 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", "io-stats.c", __FUNCTION__, 2347, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->access_cbk) tmp_cbk = io_stats_access_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->access"; _new->unwind_to = "io_stats_access_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->access); (this->children->xlator )->fops->access (_new, (this->children->xlator), loc , mask, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | ||
2346 | FIRST_CHILD(this)->fops->access,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "io-stats.c", __FUNCTION__, 2347, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->access_cbk) tmp_cbk = io_stats_access_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->access"; _new->unwind_to = "io_stats_access_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->access); (this->children->xlator )->fops->access (_new, (this->children->xlator), loc , mask, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0) | ||
2347 | loc, mask, 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", "io-stats.c", __FUNCTION__, 2347, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->access_cbk) tmp_cbk = io_stats_access_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->access"; _new->unwind_to = "io_stats_access_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->access); (this->children->xlator )->fops->access (_new, (this->children->xlator), loc , mask, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); | ||
2348 | return 0; | ||
2349 | } | ||
2350 | |||
2351 | |||
2352 | int | ||
2353 | io_stats_ftruncate (call_frame_t *frame, xlator_t *this, | ||
2354 | fd_t *fd, off_t offset, dict_t *xdata) | ||
2355 | { | ||
2356 | START_FOP_LATENCY (frame)do { struct ios_conf *conf = ((void*)0); conf = this->private ; if (conf && conf->measure_latency) { gettimeofday (&frame->begin, ((void*)0)); } else { memset (&frame ->begin, 0, sizeof (frame->begin)); } } while (0); | ||
2357 | |||
2358 | STACK_WIND (frame, io_stats_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", "io-stats.c", __FUNCTION__, 2361, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->ftruncate_cbk) tmp_cbk = io_stats_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 = "io_stats_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) | ||
2359 | 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", "io-stats.c", __FUNCTION__, 2361, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->ftruncate_cbk) tmp_cbk = io_stats_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 = "io_stats_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) | ||
2360 | 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", "io-stats.c", __FUNCTION__, 2361, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->ftruncate_cbk) tmp_cbk = io_stats_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 = "io_stats_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) | ||
2361 | 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", "io-stats.c", __FUNCTION__, 2361, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->ftruncate_cbk) tmp_cbk = io_stats_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 = "io_stats_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); | ||
2362 | return 0; | ||
2363 | } | ||
2364 | |||
2365 | |||
2366 | int | ||
2367 | io_stats_fsetattr (call_frame_t *frame, xlator_t *this, | ||
2368 | fd_t *fd, struct iatt *stbuf, int32_t valid, dict_t *xdata) | ||
2369 | { | ||
2370 | START_FOP_LATENCY (frame)do { struct ios_conf *conf = ((void*)0); conf = this->private ; if (conf && conf->measure_latency) { gettimeofday (&frame->begin, ((void*)0)); } else { memset (&frame ->begin, 0, sizeof (frame->begin)); } } while (0); | ||
2371 | |||
2372 | STACK_WIND (frame, io_stats_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", "io-stats.c", __FUNCTION__, 2375, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fsetattr_cbk) tmp_cbk = io_stats_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->fsetattr" ; _new->unwind_to = "io_stats_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->fsetattr); (this->children->xlator )->fops->fsetattr (_new, (this->children->xlator) , fd, stbuf, valid, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | ||
2373 | 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", "io-stats.c", __FUNCTION__, 2375, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fsetattr_cbk) tmp_cbk = io_stats_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->fsetattr" ; _new->unwind_to = "io_stats_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->fsetattr); (this->children->xlator )->fops->fsetattr (_new, (this->children->xlator) , fd, stbuf, valid, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | ||
2374 | 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", "io-stats.c", __FUNCTION__, 2375, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fsetattr_cbk) tmp_cbk = io_stats_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->fsetattr" ; _new->unwind_to = "io_stats_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->fsetattr); (this->children->xlator )->fops->fsetattr (_new, (this->children->xlator) , fd, stbuf, valid, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0) | ||
2375 | 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", "io-stats.c", __FUNCTION__, 2375, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fsetattr_cbk) tmp_cbk = io_stats_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->fsetattr" ; _new->unwind_to = "io_stats_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->fsetattr); (this->children->xlator )->fops->fsetattr (_new, (this->children->xlator) , fd, stbuf, valid, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); | ||
2376 | return 0; | ||
2377 | } | ||
2378 | |||
2379 | |||
2380 | int | ||
2381 | io_stats_fstat (call_frame_t *frame, xlator_t *this, | ||
2382 | fd_t *fd, dict_t *xdata) | ||
2383 | { | ||
2384 | START_FOP_LATENCY (frame)do { struct ios_conf *conf = ((void*)0); conf = this->private ; if (conf && conf->measure_latency) { gettimeofday (&frame->begin, ((void*)0)); } else { memset (&frame ->begin, 0, sizeof (frame->begin)); } } while (0); | ||
2385 | |||
2386 | STACK_WIND (frame, io_stats_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", "io-stats.c", __FUNCTION__, 2389, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fstat_cbk) tmp_cbk = io_stats_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 = "io_stats_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) | ||
2387 | 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", "io-stats.c", __FUNCTION__, 2389, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fstat_cbk) tmp_cbk = io_stats_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 = "io_stats_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) | ||
2388 | 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", "io-stats.c", __FUNCTION__, 2389, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fstat_cbk) tmp_cbk = io_stats_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 = "io_stats_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) | ||
2389 | 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", "io-stats.c", __FUNCTION__, 2389, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->fstat_cbk) tmp_cbk = io_stats_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 = "io_stats_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); | ||
2390 | return 0; | ||
2391 | } | ||
2392 | |||
2393 | |||
2394 | int | ||
2395 | io_stats_lk (call_frame_t *frame, xlator_t *this, | ||
2396 | fd_t *fd, int32_t cmd, struct gf_flock *lock, dict_t *xdata) | ||
2397 | { | ||
2398 | START_FOP_LATENCY (frame)do { struct ios_conf *conf = ((void*)0); conf = this->private ; if (conf && conf->measure_latency) { gettimeofday (&frame->begin, ((void*)0)); } else { memset (&frame ->begin, 0, sizeof (frame->begin)); } } while (0); | ||
2399 | |||
2400 | STACK_WIND (frame, io_stats_lk_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", "io-stats.c", __FUNCTION__, 2403, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->lk_cbk) tmp_cbk = io_stats_lk_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->lk"; _new ->unwind_to = "io_stats_lk_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->lk); (this ->children->xlator)->fops->lk (_new, (this->children ->xlator), fd, cmd, lock, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | ||
2401 | 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", "io-stats.c", __FUNCTION__, 2403, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->lk_cbk) tmp_cbk = io_stats_lk_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->lk"; _new ->unwind_to = "io_stats_lk_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->lk); (this ->children->xlator)->fops->lk (_new, (this->children ->xlator), fd, cmd, lock, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | ||
2402 | FIRST_CHILD(this)->fops->lk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = (( void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool ); if (!_new) { do { do { if (0) printf ("alloc failed"); } while (0); _gf_log ("stack", "io-stats.c", __FUNCTION__, 2403, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->lk_cbk) tmp_cbk = io_stats_lk_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->lk"; _new ->unwind_to = "io_stats_lk_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->lk); (this ->children->xlator)->fops->lk (_new, (this->children ->xlator), fd, cmd, lock, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0) | ||
2403 | fd, cmd, lock, 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", "io-stats.c", __FUNCTION__, 2403, GF_LOG_ERROR , "alloc failed"); } while (0); break; } typeof( (this->children ->xlator)->fops->lk_cbk) tmp_cbk = io_stats_lk_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->lk"; _new ->unwind_to = "io_stats_lk_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->lk); (this ->children->xlator)->fops->lk (_new, (this->children ->xlator), fd, cmd, lock, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); | ||
2404 | return 0; | ||
2405 | } | ||
2406 | |||
2407 | |||
2408 | int | ||
2409 | io_stats_release (xlator_t *this, fd_t *fd) | ||
2410 | { | ||
2411 | struct ios_fd *iosfd = NULL((void*)0); | ||
2412 | struct ios_conf *conf = NULL((void*)0); | ||
2413 | |||
2414 | BUMP_FOP (RELEASE)do { struct ios_conf *conf = ((void*)0); conf = this->private ; if (!conf) break; conf->cumulative.fop_hits[GF_FOP_RELEASE ]++; conf->incremental.fop_hits[GF_FOP_RELEASE]++; } while (0); | ||
2415 | |||
2416 | conf = this->private; | ||
2417 | |||
2418 | LOCK (&conf->lock)pthread_spin_lock (&conf->lock); | ||
Within the expansion of the macro 'LOCK':
| |||
2419 | { | ||
2420 | conf->cumulative.nr_opens--; | ||
2421 | } | ||
2422 | UNLOCK (&conf->lock)pthread_spin_unlock (&conf->lock); | ||
2423 | |||
2424 | ios_fd_ctx_get (fd, this, &iosfd); | ||
2425 | if (iosfd) { | ||
2426 | io_stats_dump_fd (this, iosfd); | ||
2427 | |||
2428 | GF_FREE (iosfd->filename)__gf_free (iosfd->filename); | ||
2429 | GF_FREE (iosfd)__gf_free (iosfd); | ||
2430 | } | ||
2431 | |||
2432 | return 0; | ||
2433 | } | ||
2434 | |||
2435 | |||
2436 | int | ||
2437 | io_stats_releasedir (xlator_t *this, fd_t *fd) | ||
2438 | { | ||
2439 | BUMP_FOP (RELEASEDIR)do { struct ios_conf *conf = ((void*)0); conf = this->private ; if (!conf) break; conf->cumulative.fop_hits[GF_FOP_RELEASEDIR ]++; conf->incremental.fop_hits[GF_FOP_RELEASEDIR]++; } while (0); | ||
2440 | |||
2441 | return 0; | ||
2442 | } | ||
2443 | |||
2444 | |||
2445 | int | ||
2446 | io_stats_forget (xlator_t *this, inode_t *inode) | ||
2447 | { | ||
2448 | BUMP_FOP (FORGET)do { struct ios_conf *conf = ((void*)0); conf = this->private ; if (!conf) break; conf->cumulative.fop_hits[GF_FOP_FORGET ]++; conf->incremental.fop_hits[GF_FOP_FORGET]++; } while ( 0); | ||
2449 | ios_stats_cleanup (this, inode); | ||
2450 | return 0; | ||
2451 | } | ||
2452 | |||
2453 | static int | ||
2454 | ios_init_top_stats (struct ios_conf *conf) | ||
2455 | { | ||
2456 | int i = 0; | ||
2457 | |||
2458 | GF_ASSERT (conf)do { if (!(conf)) { do { do { if (0) printf ("Assertion failed: " "conf"); } while (0); _gf_log_callingfn ("", "io-stats.c", __FUNCTION__ , 2458, GF_LOG_ERROR, "Assertion failed: " "conf"); } while ( 0); } } while (0); | ||
2459 | |||
2460 | for (i = 0; i <IOS_STATS_TYPE_MAX; i++) { | ||
2461 | conf->list[i].iosstats = GF_CALLOC (1,__gf_calloc (1, sizeof(*conf->list[i].iosstats), gf_io_stats_mt_ios_stat ) | ||
2462 | sizeof(*conf->list[i].iosstats),__gf_calloc (1, sizeof(*conf->list[i].iosstats), gf_io_stats_mt_ios_stat ) | ||
2463 | gf_io_stats_mt_ios_stat)__gf_calloc (1, sizeof(*conf->list[i].iosstats), gf_io_stats_mt_ios_stat ); | ||
2464 | |||
2465 | if (!conf->list[i].iosstats) | ||
2466 | return -1; | ||
2467 | |||
2468 | INIT_LIST_HEAD(&conf->list[i].iosstats->list)do { (&conf->list[i].iosstats->list)->next = (& conf->list[i].iosstats->list)->prev = &conf-> list[i].iosstats->list; } while (0); | ||
2469 | LOCK_INIT (&conf->list[i].lock)pthread_spin_init (&conf->list[i].lock, 0); | ||
2470 | } | ||
2471 | |||
2472 | for (i = 0; i < IOS_STATS_THRU_MAX; i ++) { | ||
2473 | conf->thru_list[i].iosstats = GF_CALLOC (1,__gf_calloc (1, sizeof (*conf->thru_list[i].iosstats), gf_io_stats_mt_ios_stat ) | ||
2474 | sizeof (*conf->thru_list[i].iosstats),__gf_calloc (1, sizeof (*conf->thru_list[i].iosstats), gf_io_stats_mt_ios_stat ) | ||
2475 | gf_io_stats_mt_ios_stat)__gf_calloc (1, sizeof (*conf->thru_list[i].iosstats), gf_io_stats_mt_ios_stat ); | ||
2476 | |||
2477 | if (!conf->thru_list[i].iosstats) | ||
2478 | return -1; | ||
2479 | |||
2480 | INIT_LIST_HEAD(&conf->thru_list[i].iosstats->list)do { (&conf->thru_list[i].iosstats->list)->next = (&conf->thru_list[i].iosstats->list)->prev = & conf->thru_list[i].iosstats->list; } while (0); | ||
2481 | LOCK_INIT (&conf->thru_list[i].lock)pthread_spin_init (&conf->thru_list[i].lock, 0); | ||
2482 | } | ||
2483 | |||
2484 | return 0; | ||
2485 | } | ||
2486 | |||
2487 | static void | ||
2488 | ios_destroy_top_stats (struct ios_conf *conf) | ||
2489 | { | ||
2490 | int i = 0; | ||
2491 | struct ios_stat_head *list_head = NULL((void*)0); | ||
2492 | struct ios_stat_list *entry = NULL((void*)0); | ||
2493 | struct ios_stat_list *tmp = NULL((void*)0); | ||
2494 | struct ios_stat_list *list = NULL((void*)0); | ||
2495 | struct ios_stat *stat = NULL((void*)0); | ||
2496 | |||
2497 | GF_ASSERT (conf)do { if (!(conf)) { do { do { if (0) printf ("Assertion failed: " "conf"); } while (0); _gf_log_callingfn ("", "io-stats.c", __FUNCTION__ , 2497, GF_LOG_ERROR, "Assertion failed: " "conf"); } while ( 0); } } while (0); | ||
2498 | |||
2499 | LOCK (&conf->lock)pthread_spin_lock (&conf->lock); | ||
2500 | |||
2501 | conf->cumulative.nr_opens = 0; | ||
2502 | conf->cumulative.max_nr_opens = 0; | ||
2503 | conf->cumulative.max_openfd_time.tv_sec = 0; | ||
2504 | conf->cumulative.max_openfd_time.tv_usec = 0; | ||
2505 | |||
2506 | for (i = 0; i < IOS_STATS_TYPE_MAX; i++) { | ||
2507 | list_head = &conf->list[i]; | ||
2508 | if (!list_head) | ||
2509 | continue; | ||
2510 | list_for_each_entry_safe (entry, tmp,for (entry = ((typeof(*entry) *)((char *)((&list_head-> iosstats->list)->next)-(unsigned long)(&((typeof(*entry ) *)0)->list))), tmp = ((typeof(*entry) *)((char *)(entry-> list.next)-(unsigned long)(&((typeof(*entry) *)0)->list ))); &entry->list != (&list_head->iosstats-> list); entry = tmp, tmp = ((typeof(*tmp) *)((char *)(tmp-> list.next)-(unsigned long)(&((typeof(*tmp) *)0)->list) ))) | ||
2511 | &list_head->iosstats->list, list)for (entry = ((typeof(*entry) *)((char *)((&list_head-> iosstats->list)->next)-(unsigned long)(&((typeof(*entry ) *)0)->list))), tmp = ((typeof(*entry) *)((char *)(entry-> list.next)-(unsigned long)(&((typeof(*entry) *)0)->list ))); &entry->list != (&list_head->iosstats-> list); entry = tmp, tmp = ((typeof(*tmp) *)((char *)(tmp-> list.next)-(unsigned long)(&((typeof(*tmp) *)0)->list) ))) { | ||
2512 | list = entry; | ||
2513 | stat = list->iosstat; | ||
2514 | ios_stat_unref (stat); | ||
2515 | list_del (&list->list); | ||
2516 | GF_FREE (list)__gf_free (list); | ||
2517 | list_head->members--; | ||
2518 | } | ||
2519 | } | ||
2520 | |||
2521 | for (i = 0; i < IOS_STATS_THRU_MAX; i++) { | ||
2522 | list_head = &conf->thru_list[i]; | ||
2523 | if (!list_head) | ||
2524 | continue; | ||
2525 | list_for_each_entry_safe (entry, tmp,for (entry = ((typeof(*entry) *)((char *)((&list_head-> iosstats->list)->next)-(unsigned long)(&((typeof(*entry ) *)0)->list))), tmp = ((typeof(*entry) *)((char *)(entry-> list.next)-(unsigned long)(&((typeof(*entry) *)0)->list ))); &entry->list != (&list_head->iosstats-> list); entry = tmp, tmp = ((typeof(*tmp) *)((char *)(tmp-> list.next)-(unsigned long)(&((typeof(*tmp) *)0)->list) ))) | ||
2526 | &list_head->iosstats->list, list)for (entry = ((typeof(*entry) *)((char *)((&list_head-> iosstats->list)->next)-(unsigned long)(&((typeof(*entry ) *)0)->list))), tmp = ((typeof(*entry) *)((char *)(entry-> list.next)-(unsigned long)(&((typeof(*entry) *)0)->list ))); &entry->list != (&list_head->iosstats-> list); entry = tmp, tmp = ((typeof(*tmp) *)((char *)(tmp-> list.next)-(unsigned long)(&((typeof(*tmp) *)0)->list) ))) { | ||
2527 | list = entry; | ||
2528 | stat = list->iosstat; | ||
2529 | ios_stat_unref (stat); | ||
2530 | list_del (&list->list); | ||
2531 | GF_FREE (list)__gf_free (list); | ||
2532 | list_head->members--; | ||
2533 | } | ||
2534 | } | ||
2535 | |||
2536 | UNLOCK (&conf->lock)pthread_spin_unlock (&conf->lock); | ||
2537 | |||
2538 | return; | ||
2539 | } | ||
2540 | |||
2541 | int | ||
2542 | reconfigure (xlator_t *this, dict_t *options) | ||
2543 | { | ||
2544 | struct ios_conf *conf = NULL((void*)0); | ||
2545 | int ret = -1; | ||
2546 | char *sys_log_str = NULL((void*)0); | ||
2547 | int sys_log_level = -1; | ||
2548 | char *log_str = NULL((void*)0); | ||
2549 | int log_level = -1; | ||
2550 | |||
2551 | if (!this || !this->private) | ||
2552 | goto out; | ||
2553 | |||
2554 | conf = this->private; | ||
2555 | |||
2556 | GF_OPTION_RECONF ("dump-fd-stats", conf->dump_fd_stats, options, bool,do { int val_ret = 0; val_ret = xlator_option_reconf_bool ((* __glusterfs_this_location()), options, "dump-fd-stats", & (conf->dump_fd_stats)); if (val_ret) goto out; } while (0) | ||
2557 | out)do { int val_ret = 0; val_ret = xlator_option_reconf_bool ((* __glusterfs_this_location()), options, "dump-fd-stats", & (conf->dump_fd_stats)); if (val_ret) goto out; } while (0); | ||
2558 | |||
2559 | GF_OPTION_RECONF ("count-fop-hits", conf->count_fop_hits, options, bool,do { int val_ret = 0; val_ret = xlator_option_reconf_bool ((* __glusterfs_this_location()), options, "count-fop-hits", & (conf->count_fop_hits)); if (val_ret) goto out; } while (0 ) | ||
2560 | out)do { int val_ret = 0; val_ret = xlator_option_reconf_bool ((* __glusterfs_this_location()), options, "count-fop-hits", & (conf->count_fop_hits)); if (val_ret) goto out; } while (0 ); | ||
2561 | |||
2562 | GF_OPTION_RECONF ("latency-measurement", conf->measure_latency,do { int val_ret = 0; val_ret = xlator_option_reconf_bool ((* __glusterfs_this_location()), options, "latency-measurement", &(conf->measure_latency)); if (val_ret) goto out; } while (0) | ||
2563 | options, bool, out)do { int val_ret = 0; val_ret = xlator_option_reconf_bool ((* __glusterfs_this_location()), options, "latency-measurement", &(conf->measure_latency)); if (val_ret) goto out; } while (0); | ||
2564 | |||
2565 | GF_OPTION_RECONF ("sys-log-level", sys_log_str, options, str, out)do { int val_ret = 0; val_ret = xlator_option_reconf_str ((*__glusterfs_this_location ()), options, "sys-log-level", &(sys_log_str)); if (val_ret ) goto out; } while (0); | ||
2566 | if (sys_log_str) { | ||
2567 | sys_log_level = glusterd_check_log_level (sys_log_str); | ||
2568 | set_sys_log_level (sys_log_level); | ||
2569 | } | ||
2570 | |||
2571 | GF_OPTION_RECONF ("log-level", log_str, options, str, out)do { int val_ret = 0; val_ret = xlator_option_reconf_str ((*__glusterfs_this_location ()), options, "log-level", &(log_str)); if (val_ret) goto out; } while (0); | ||
2572 | if (log_str) { | ||
2573 | log_level = glusterd_check_log_level (log_str); | ||
2574 | gf_log_set_loglevel (log_level); | ||
2575 | } | ||
2576 | |||
2577 | ret = 0; | ||
2578 | out: | ||
2579 | gf_log (this->name, GF_LOG_DEBUG, "reconfigure returning %d", ret)do { do { if (0) printf ("reconfigure returning %d", ret); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__, 2579 , GF_LOG_DEBUG, "reconfigure returning %d", ret); } while (0); | ||
2580 | return ret; | ||
2581 | } | ||
2582 | |||
2583 | |||
2584 | int32_t | ||
2585 | mem_acct_init (xlator_t *this) | ||
2586 | { | ||
2587 | int ret = -1; | ||
2588 | |||
2589 | if (!this) | ||
2590 | return ret; | ||
2591 | |||
2592 | ret = xlator_mem_acct_init (this, gf_io_stats_mt_end + 1); | ||
2593 | |||
2594 | if (ret != 0) { | ||
2595 | gf_log (this->name, GF_LOG_ERROR, "Memory accounting init"do { do { if (0) printf ("Memory accounting init" " failed"); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__ , 2596, GF_LOG_ERROR, "Memory accounting init" " failed"); } while (0) | ||
2596 | " failed")do { do { if (0) printf ("Memory accounting init" " failed"); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__ , 2596, GF_LOG_ERROR, "Memory accounting init" " failed"); } while (0); | ||
2597 | return ret; | ||
2598 | } | ||
2599 | |||
2600 | return ret; | ||
2601 | } | ||
2602 | |||
2603 | int | ||
2604 | init (xlator_t *this) | ||
2605 | { | ||
2606 | struct ios_conf *conf = NULL((void*)0); | ||
2607 | char *sys_log_str = NULL((void*)0); | ||
2608 | int sys_log_level = -1; | ||
2609 | char *log_str = NULL((void*)0); | ||
2610 | int log_level = -1; | ||
2611 | int ret = -1; | ||
2612 | |||
2613 | if (!this) | ||
2614 | return -1; | ||
2615 | |||
2616 | if (!this->children) { | ||
2617 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("io_stats translator requires atleast one subvolume" ); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__ , 2618, GF_LOG_ERROR, "io_stats translator requires atleast one subvolume" ); } while (0) | ||
2618 | "io_stats translator requires atleast one subvolume")do { do { if (0) printf ("io_stats translator requires atleast one subvolume" ); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__ , 2618, GF_LOG_ERROR, "io_stats translator requires atleast one subvolume" ); } while (0); | ||
2619 | return -1; | ||
2620 | } | ||
2621 | |||
2622 | if (!this->parents) { | ||
2623 | /* This is very much valid as io-stats currently is loaded | ||
2624 | * on top of volumes on both client and server, hence this is | ||
2625 | * not an warning message */ | ||
2626 | gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("dangling volume. check volfile "); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__ , 2627, GF_LOG_DEBUG, "dangling volume. check volfile "); } while (0) | ||
2627 | "dangling volume. check volfile ")do { do { if (0) printf ("dangling volume. check volfile "); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__ , 2627, GF_LOG_DEBUG, "dangling volume. check volfile "); } while (0); | ||
2628 | } | ||
2629 | |||
2630 | conf = GF_CALLOC (1, sizeof(*conf), gf_io_stats_mt_ios_conf)__gf_calloc (1, sizeof(*conf), gf_io_stats_mt_ios_conf); | ||
2631 | |||
2632 | if (!conf) { | ||
2633 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("Out of memory."); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__, 2634, GF_LOG_ERROR , "Out of memory."); } while (0) | ||
2634 | "Out of memory.")do { do { if (0) printf ("Out of memory."); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__, 2634, GF_LOG_ERROR , "Out of memory."); } while (0); | ||
2635 | return -1; | ||
2636 | } | ||
2637 | |||
2638 | LOCK_INIT (&conf->lock)pthread_spin_init (&conf->lock, 0); | ||
2639 | |||
2640 | gettimeofday (&conf->cumulative.started_at, NULL((void*)0)); | ||
2641 | gettimeofday (&conf->incremental.started_at, NULL((void*)0)); | ||
2642 | |||
2643 | ret = ios_init_top_stats (conf); | ||
2644 | if (ret) | ||
2645 | return -1; | ||
2646 | |||
2647 | GF_OPTION_INIT ("dump-fd-stats", conf->dump_fd_stats, bool, out)do { int val_ret = 0; val_ret = xlator_option_init_bool ((*__glusterfs_this_location ()), (*__glusterfs_this_location())->options, "dump-fd-stats" , &(conf->dump_fd_stats)); if (val_ret) goto out; } while (0); | ||
2648 | |||
2649 | GF_OPTION_INIT ("count-fop-hits", conf->count_fop_hits, bool, out)do { int val_ret = 0; val_ret = xlator_option_init_bool ((*__glusterfs_this_location ()), (*__glusterfs_this_location())->options, "count-fop-hits" , &(conf->count_fop_hits)); if (val_ret) goto out; } while (0); | ||
2650 | |||
2651 | GF_OPTION_INIT ("latency-measurement", conf->measure_latency,do { int val_ret = 0; val_ret = xlator_option_init_bool ((*__glusterfs_this_location ()), (*__glusterfs_this_location())->options, "latency-measurement" , &(conf->measure_latency)); if (val_ret) goto out; } while (0) | ||
2652 | bool, out)do { int val_ret = 0; val_ret = xlator_option_init_bool ((*__glusterfs_this_location ()), (*__glusterfs_this_location())->options, "latency-measurement" , &(conf->measure_latency)); if (val_ret) goto out; } while (0); | ||
2653 | |||
2654 | GF_OPTION_INIT ("sys-log-level", sys_log_str, str, out)do { int val_ret = 0; val_ret = xlator_option_init_str ((*__glusterfs_this_location ()), (*__glusterfs_this_location())->options, "sys-log-level" , &(sys_log_str)); if (val_ret) goto out; } while (0); | ||
2655 | if (sys_log_str) { | ||
2656 | sys_log_level = glusterd_check_log_level (sys_log_str); | ||
2657 | set_sys_log_level (sys_log_level); | ||
2658 | } | ||
2659 | |||
2660 | GF_OPTION_INIT ("log-level", log_str, str, out)do { int val_ret = 0; val_ret = xlator_option_init_str ((*__glusterfs_this_location ()), (*__glusterfs_this_location())->options, "log-level", &(log_str)); if (val_ret) goto out; } while (0); | ||
2661 | if (log_str) { | ||
2662 | log_level = glusterd_check_log_level (log_str); | ||
2663 | gf_log_set_loglevel (log_level); | ||
2664 | } | ||
2665 | |||
2666 | this->private = conf; | ||
2667 | ret = 0; | ||
2668 | out: | ||
2669 | return ret; | ||
2670 | } | ||
2671 | |||
2672 | |||
2673 | void | ||
2674 | fini (xlator_t *this) | ||
2675 | { | ||
2676 | struct ios_conf *conf = NULL((void*)0); | ||
2677 | |||
2678 | if (!this) | ||
2679 | return; | ||
2680 | |||
2681 | conf = this->private; | ||
2682 | |||
2683 | if (!conf) | ||
2684 | return; | ||
2685 | this->private = NULL((void*)0); | ||
2686 | |||
2687 | ios_destroy_top_stats (conf); | ||
2688 | |||
2689 | GF_FREE(conf)__gf_free (conf); | ||
2690 | |||
2691 | gf_log (this->name, GF_LOG_INFO,do { do { if (0) printf ("io-stats translator unloaded"); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__, 2692 , GF_LOG_INFO, "io-stats translator unloaded"); } while (0) | ||
2692 | "io-stats translator unloaded")do { do { if (0) printf ("io-stats translator unloaded"); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__, 2692 , GF_LOG_INFO, "io-stats translator unloaded"); } while (0); | ||
2693 | return; | ||
2694 | } | ||
2695 | |||
2696 | int | ||
2697 | notify (xlator_t *this, int32_t event, void *data, ...) | ||
2698 | { | ||
2699 | int ret = 0; | ||
2700 | struct ios_dump_args args = {0}; | ||
2701 | dict_t *output = NULL((void*)0); | ||
2702 | dict_t *dict = NULL((void*)0); | ||
2703 | int32_t top_op = 0; | ||
2704 | int32_t list_cnt = 0; | ||
2705 | double throughput = 0; | ||
2706 | double time = 0; | ||
2707 | va_list ap; | ||
2708 | |||
2709 | dict = data; | ||
2710 | va_start (ap, data)__builtin_va_start(ap, data); | ||
2711 | output = va_arg (ap, dict_t*)__builtin_va_arg(ap, dict_t*); | ||
2712 | va_end (ap)__builtin_va_end(ap); | ||
2713 | switch (event) { | ||
2714 | case GF_EVENT_TRANSLATOR_INFO: | ||
2715 | ret = dict_get_str_boolean (dict, "clear-stats", _gf_false); | ||
2716 | if (ret) { | ||
2717 | ret = dict_set_int32 (output, "top-op", top_op); | ||
2718 | if (ret) { | ||
2719 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("Failed to set top-op in dict"); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__, 2720 , GF_LOG_ERROR, "Failed to set top-op in dict"); } while (0) | ||
2720 | "Failed to set top-op in dict")do { do { if (0) printf ("Failed to set top-op in dict"); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__, 2720 , GF_LOG_ERROR, "Failed to set top-op in dict"); } while (0); | ||
2721 | goto out; | ||
2722 | } | ||
2723 | ios_destroy_top_stats (this->private); | ||
2724 | ret = ios_init_top_stats (this->private); | ||
2725 | if (ret) | ||
2726 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("Failed to reset top stats"); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__, 2727 , GF_LOG_ERROR, "Failed to reset top stats"); } while (0) | ||
2727 | "Failed to reset top stats")do { do { if (0) printf ("Failed to reset top stats"); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__, 2727 , GF_LOG_ERROR, "Failed to reset top stats"); } while (0); | ||
2728 | ret = dict_set_int32 (output, "stats-cleared", | ||
2729 | ret ? 0 : 1); | ||
2730 | if (ret) | ||
2731 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("Failed to set stats-cleared" " in dict" ); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__ , 2733, GF_LOG_ERROR, "Failed to set stats-cleared" " in dict" ); } while (0) | ||
2732 | "Failed to set stats-cleared"do { do { if (0) printf ("Failed to set stats-cleared" " in dict" ); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__ , 2733, GF_LOG_ERROR, "Failed to set stats-cleared" " in dict" ); } while (0) | ||
2733 | " in dict")do { do { if (0) printf ("Failed to set stats-cleared" " in dict" ); } while (0); _gf_log (this->name, "io-stats.c", __FUNCTION__ , 2733, GF_LOG_ERROR, "Failed to set stats-cleared" " in dict" ); } while (0); | ||
2734 | goto out; | ||
2735 | } | ||
2736 | |||
2737 | ret = dict_get_int32 (dict, "top-op", &top_op); | ||
2738 | if (!ret) { | ||
2739 | ret = dict_get_int32 (dict, "list-cnt", &list_cnt); | ||
2740 | if (top_op > IOS_STATS_TYPE_NONE && | ||
2741 | top_op < IOS_STATS_TYPE_MAX) | ||
2742 | ret = io_stats_dump_stats_to_dict (this, output, | ||
2743 | top_op, list_cnt); | ||
2744 | if (top_op == IOS_STATS_TYPE_READ_THROUGHPUT || | ||
2745 | top_op == IOS_STATS_TYPE_WRITE_THROUGHPUT) { | ||
2746 | ret = dict_get_double (dict, "throughput", | ||
2747 | &throughput); | ||
2748 | if (!ret) { | ||
2749 | ret = dict_get_double (dict, "time", | ||
2750 | &time); | ||
2751 | if (ret) | ||
2752 | goto out; | ||
2753 | ret = dict_set_double (output, | ||
2754 | "throughput", throughput); | ||
2755 | if (ret) | ||
2756 | goto out; | ||
2757 | ret = dict_set_double (output, "time", | ||
2758 | time); | ||
2759 | if (ret) | ||
2760 | goto out; | ||
2761 | } | ||
2762 | ret = 0; | ||
2763 | |||
2764 | } | ||
2765 | } else { | ||
2766 | (void) ios_dump_args_init (&args, IOS_DUMP_TYPE_DICT, | ||
2767 | output); | ||
2768 | ret = io_stats_dump (this, &args); | ||
2769 | } | ||
2770 | break; | ||
2771 | default: | ||
2772 | default_notify (this, event, data); | ||
2773 | break; | ||
2774 | |||
2775 | } | ||
2776 | out: | ||
2777 | return ret; | ||
2778 | } | ||
2779 | |||
2780 | struct xlator_fops fops = { | ||
2781 | .stat = io_stats_stat, | ||
2782 | .readlink = io_stats_readlink, | ||
2783 | .mknod = io_stats_mknod, | ||
2784 | .mkdir = io_stats_mkdir, | ||
2785 | .unlink = io_stats_unlink, | ||
2786 | .rmdir = io_stats_rmdir, | ||
2787 | .symlink = io_stats_symlink, | ||
2788 | .rename = io_stats_rename, | ||
2789 | .link = io_stats_link, | ||
2790 | .truncate = io_stats_truncate, | ||
2791 | .open = io_stats_open, | ||
2792 | .readv = io_stats_readv, | ||
2793 | .writev = io_stats_writev, | ||
2794 | .statfs = io_stats_statfs, | ||
2795 | .flush = io_stats_flush, | ||
2796 | .fsync = io_stats_fsync, | ||
2797 | .setxattr = io_stats_setxattr, | ||
2798 | .getxattr = io_stats_getxattr, | ||
2799 | .removexattr = io_stats_removexattr, | ||
2800 | .fsetxattr = io_stats_fsetxattr, | ||
2801 | .fgetxattr = io_stats_fgetxattr, | ||
2802 | .fremovexattr = io_stats_fremovexattr, | ||
2803 | .opendir = io_stats_opendir, | ||
2804 | .readdir = io_stats_readdir, | ||
2805 | .readdirp = io_stats_readdirp, | ||
2806 | .fsyncdir = io_stats_fsyncdir, | ||
2807 | .access = io_stats_access, | ||
2808 | .ftruncate = io_stats_ftruncate, | ||
2809 | .fstat = io_stats_fstat, | ||
2810 | .create = io_stats_create, | ||
2811 | .lk = io_stats_lk, | ||
2812 | .inodelk = io_stats_inodelk, | ||
2813 | .finodelk = io_stats_finodelk, | ||
2814 | .entrylk = io_stats_entrylk, | ||
2815 | .lookup = io_stats_lookup, | ||
2816 | .xattrop = io_stats_xattrop, | ||
2817 | .fxattrop = io_stats_fxattrop, | ||
2818 | .setattr = io_stats_setattr, | ||
2819 | .fsetattr = io_stats_fsetattr, | ||
2820 | }; | ||
2821 | |||
2822 | struct xlator_cbks cbks = { | ||
2823 | .release = io_stats_release, | ||
2824 | .releasedir = io_stats_releasedir, | ||
2825 | .forget = io_stats_forget, | ||
2826 | }; | ||
2827 | |||
2828 | struct volume_options options[] = { | ||
2829 | { .key = {"dump-fd-stats"}, | ||
2830 | .type = GF_OPTION_TYPE_BOOL, | ||
2831 | .default_value = "off", | ||
2832 | .description = "If on stats related to file-operations would be " | ||
2833 | "tracked inside GlusterFS data-structures." | ||
2834 | }, | ||
2835 | { .key = { "latency-measurement" }, | ||
2836 | .type = GF_OPTION_TYPE_BOOL, | ||
2837 | .default_value = "off", | ||
2838 | .description = "If on stats related to the latency of each operation " | ||
2839 | "would be tracked inside GlusterFS data-structures. " | ||
2840 | }, | ||
2841 | { .key = {"count-fop-hits"}, | ||
2842 | .type = GF_OPTION_TYPE_BOOL, | ||
2843 | }, | ||
2844 | { .key = {"log-level"}, | ||
2845 | .type = GF_OPTION_TYPE_STR, | ||
2846 | .value = { "DEBUG", "WARNING", "ERROR", "INFO", | ||
2847 | "CRITICAL", "NONE", "TRACE"} | ||
2848 | }, | ||
2849 | |||
2850 | /* These are synthetic entries to assist validation of CLI's * | ||
2851 | * volume set command */ | ||
2852 | { .key = {"client-log-level"}, | ||
2853 | .type = GF_OPTION_TYPE_STR, | ||
2854 | .default_value = "INFO", | ||
2855 | .description = "Changes the log-level of the clients", | ||
2856 | .value = { "DEBUG", "WARNING", "ERROR", "INFO", | ||
2857 | "CRITICAL", "NONE", "TRACE"} | ||
2858 | }, | ||
2859 | { .key = {"sys-log-level"}, | ||
2860 | .type = GF_OPTION_TYPE_STR, | ||
2861 | .default_value = "CRITICAL", | ||
2862 | .description = "Gluster's syslog log-level", | ||
2863 | .value = { "WARNING", "ERROR", "INFO", "CRITICAL"} | ||
2864 | }, | ||
2865 | { .key = {"brick-log-level"}, | ||
2866 | .type = GF_OPTION_TYPE_STR, | ||
2867 | .default_value = "INFO", | ||
2868 | .description = "Changes the log-level of the bricks", | ||
2869 | .value = { "DEBUG", "WARNING", "ERROR", "INFO", | ||
2870 | "CRITICAL", "NONE", "TRACE"} | ||
2871 | }, | ||
2872 | { .key = {NULL((void*)0)} }, | ||
2873 | |||
2874 | }; |