Bug Summary

File:xlators/features/quota/src/quota.c
Location:line 923, column 9
Description:Value stored to 'ret' is never read

Annotated Source Code

1/*
2 Copyright (c) 2008-2012 Red Hat, Inc. <http://www.redhat.com>
3 This file is part of GlusterFS.
4
5 This file is licensed to you under your choice of the GNU Lesser
6 General Public License, version 3 or any later version (LGPLv3 or
7 later), or the GNU General Public License, version 2 (GPLv2), in all
8 cases as published by the Free Software Foundation.
9*/
10#include <fnmatch.h>
11
12#include "quota.h"
13#include "common-utils.h"
14#include "defaults.h"
15
16int32_t
17quota_check_limit (call_frame_t *frame, inode_t *inode, xlator_t *this,
18 char *name, uuid_t par);
19struct volume_options options[];
20
21int
22quota_loc_fill (loc_t *loc, inode_t *inode, inode_t *parent, char *path)
23{
24 int ret = -1;
25
26 if (!loc) {
27 return ret;
28 }
29
30 if (inode) {
31 loc->inode = inode_ref (inode);
32 }
33
34 if (parent) {
35 loc->parent = inode_ref (parent);
36 }
37
38 loc->path = gf_strdup (path);
39 if (!loc->path) {
40 goto loc_wipe;
41 }
42
43 loc->name = strrchr (loc->path, '/');
44 if (loc->name) {
45 loc->name++;
46 } else {
47 goto loc_wipe;
48 }
49
50 ret = 0;
51
52loc_wipe:
53 if (ret < 0) {
54 loc_wipe (loc);
55 }
56
57 return ret;
58}
59
60
61int
62quota_inode_loc_fill (inode_t *inode, loc_t *loc)
63{
64 char *resolvedpath = NULL((void*)0);
65 inode_t *parent = NULL((void*)0);
66 int ret = -1;
67 xlator_t *this = NULL((void*)0);
68
69 if ((!inode) || (!loc)) {
70 return ret;
71 }
72
73 this = THIS(*__glusterfs_this_location());
74
75 if ((inode) && __is_root_gfid (inode->gfid)) {
76 loc->parent = NULL((void*)0);
77 goto ignore_parent;
78 }
79
80 parent = inode_parent (inode, 0, NULL((void*)0));
81 if (!parent) {
82 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("cannot find parent for inode (gfid:%s)"
, uuid_utoa (inode->gfid)); } while (0); _gf_log (this->
name, "quota.c", __FUNCTION__, 84, GF_LOG_DEBUG, "cannot find parent for inode (gfid:%s)"
, uuid_utoa (inode->gfid)); } while (0)
83 "cannot find parent for inode (gfid:%s)",do { do { if (0) printf ("cannot find parent for inode (gfid:%s)"
, uuid_utoa (inode->gfid)); } while (0); _gf_log (this->
name, "quota.c", __FUNCTION__, 84, GF_LOG_DEBUG, "cannot find parent for inode (gfid:%s)"
, uuid_utoa (inode->gfid)); } while (0)
84 uuid_utoa (inode->gfid))do { do { if (0) printf ("cannot find parent for inode (gfid:%s)"
, uuid_utoa (inode->gfid)); } while (0); _gf_log (this->
name, "quota.c", __FUNCTION__, 84, GF_LOG_DEBUG, "cannot find parent for inode (gfid:%s)"
, uuid_utoa (inode->gfid)); } while (0)
;
85 goto err;
86 }
87
88ignore_parent:
89 ret = inode_path (inode, NULL((void*)0), &resolvedpath);
90 if (ret < 0) {
91 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("cannot construct path for inode (gfid:%s)"
, uuid_utoa (inode->gfid)); } while (0); _gf_log (this->
name, "quota.c", __FUNCTION__, 93, GF_LOG_DEBUG, "cannot construct path for inode (gfid:%s)"
, uuid_utoa (inode->gfid)); } while (0)
92 "cannot construct path for inode (gfid:%s)",do { do { if (0) printf ("cannot construct path for inode (gfid:%s)"
, uuid_utoa (inode->gfid)); } while (0); _gf_log (this->
name, "quota.c", __FUNCTION__, 93, GF_LOG_DEBUG, "cannot construct path for inode (gfid:%s)"
, uuid_utoa (inode->gfid)); } while (0)
93 uuid_utoa (inode->gfid))do { do { if (0) printf ("cannot construct path for inode (gfid:%s)"
, uuid_utoa (inode->gfid)); } while (0); _gf_log (this->
name, "quota.c", __FUNCTION__, 93, GF_LOG_DEBUG, "cannot construct path for inode (gfid:%s)"
, uuid_utoa (inode->gfid)); } while (0)
;
94 goto err;
95 }
96
97 ret = quota_loc_fill (loc, inode, parent, resolvedpath);
98 if (ret < 0) {
99 gf_log (this->name, GF_LOG_WARNING, "cannot fill loc")do { do { if (0) printf ("cannot fill loc"); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 99, GF_LOG_WARNING,
"cannot fill loc"); } while (0)
;
100 goto err;
101 }
102
103err:
104 if (parent) {
105 inode_unref (parent);
106 }
107
108 GF_FREE (resolvedpath)__gf_free (resolvedpath);
109
110 return ret;
111}
112
113
114int32_t
115quota_local_cleanup (xlator_t *this, quota_local_t *local)
116{
117 if (local == NULL((void*)0)) {
118 goto out;
119 }
120
121 loc_wipe (&local->loc);
122 loc_wipe (&local->newloc);
123 loc_wipe (&local->oldloc);
124 loc_wipe (&local->validate_loc);
125
126 inode_unref (local->inode);
127 LOCK_DESTROY (&local->lock)pthread_spin_destroy (&local->lock);
128
129 mem_put (local);
130out:
131 return 0;
132}
133
134
135static inline quota_local_t *
136quota_local_new ()
137{
138 quota_local_t *local = NULL((void*)0);
139 local = mem_get0 (THIS(*__glusterfs_this_location())->local_pool);
140 if (local)
141 LOCK_INIT (&local->lock)pthread_spin_init (&local->lock, 0);
142 return local;
143}
144
145
146quota_dentry_t *
147__quota_dentry_new (quota_inode_ctx_t *ctx, char *name, uuid_t par)
148{
149 quota_dentry_t *dentry = NULL((void*)0);
150 GF_UNUSED__attribute__((unused)) int32_t ret = 0;
151
152 QUOTA_ALLOC_OR_GOTO (dentry, quota_dentry_t, err)do { dentry = __gf_calloc (sizeof (quota_dentry_t), 1, gf_quota_mt_quota_dentry_t
); if (!dentry) { do { do { if (0) printf ("out of memory :("
); } while (0); _gf_log ("", "quota.c", __FUNCTION__, 152, GF_LOG_ERROR
, "out of memory :("); } while (0); ret = -1; goto err; } } while
(0);
;
153
154 INIT_LIST_HEAD (&dentry->next)do { (&dentry->next)->next = (&dentry->next)
->prev = &dentry->next; } while (0)
;
155
156 dentry->name = gf_strdup (name);
157 if (dentry->name == NULL((void*)0)) {
158 GF_FREE (dentry)__gf_free (dentry);
159 goto err;
160 }
161
162 uuid_copy (dentry->par, par);
163
164 list_add_tail (&dentry->next, &ctx->parents);
165err:
166 return dentry;
167}
168
169
170void
171__quota_dentry_free (quota_dentry_t *dentry)
172{
173 if (dentry == NULL((void*)0)) {
174 goto out;
175 }
176
177 list_del_init (&dentry->next);
178
179 GF_FREE (dentry->name)__gf_free (dentry->name);
180 GF_FREE (dentry)__gf_free (dentry);
181out:
182 return;
183}
184
185
186int32_t
187quota_validate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
188 int32_t op_ret, int32_t op_errno, dict_t *dict,
189 dict_t *xdata)
190{
191 quota_local_t *local = NULL((void*)0);
192 uint32_t validate_count = 0, link_count = 0;
193 int32_t ret = 0;
194 quota_inode_ctx_t *ctx = NULL((void*)0);
195 int64_t *size = 0;
196 uint64_t value = 0;
197 call_stub_t *stub = NULL((void*)0);
198
199 local = frame->local;
200
201 if (op_ret < 0) {
202 goto unwind;
203 }
204
205 GF_ASSERT (local)do { if (!(local)) { do { do { if (0) printf ("Assertion failed: "
"local"); } while (0); _gf_log_callingfn ("", "quota.c", __FUNCTION__
, 205, GF_LOG_ERROR, "Assertion failed: " "local"); } while (
0); } } while (0)
;
206 GF_ASSERT (frame)do { if (!(frame)) { do { do { if (0) printf ("Assertion failed: "
"frame"); } while (0); _gf_log_callingfn ("", "quota.c", __FUNCTION__
, 206, GF_LOG_ERROR, "Assertion failed: " "frame"); } while (
0); } } while (0)
;
207 GF_VALIDATE_OR_GOTO_WITH_ERROR ("quota", this, unwind, op_errno,do { if (!this) { op_errno = 22; do { do { if (0) printf ("invalid argument: "
"this"); } while (0); _gf_log_callingfn ("quota", "quota.c",
__FUNCTION__, 208, GF_LOG_ERROR, "invalid argument: " "this"
); } while (0); goto unwind; } }while (0)
208 EINVAL)do { if (!this) { op_errno = 22; do { do { if (0) printf ("invalid argument: "
"this"); } while (0); _gf_log_callingfn ("quota", "quota.c",
__FUNCTION__, 208, GF_LOG_ERROR, "invalid argument: " "this"
); } while (0); goto unwind; } }while (0)
;
209 GF_VALIDATE_OR_GOTO_WITH_ERROR (this->name, dict, unwind, op_errno,do { if (!dict) { op_errno = 22; do { do { if (0) printf ("invalid argument: "
"dict"); } while (0); _gf_log_callingfn (this->name, "quota.c"
, __FUNCTION__, 210, GF_LOG_ERROR, "invalid argument: " "dict"
); } while (0); goto unwind; } }while (0)
210 EINVAL)do { if (!dict) { op_errno = 22; do { do { if (0) printf ("invalid argument: "
"dict"); } while (0); _gf_log_callingfn (this->name, "quota.c"
, __FUNCTION__, 210, GF_LOG_ERROR, "invalid argument: " "dict"
); } while (0); goto unwind; } }while (0)
;
211
212 ret = inode_ctx_get (local->validate_loc.inode, this, &value)inode_ctx_get2(local->validate_loc.inode,this,&value,0
)
;
213
214 ctx = (quota_inode_ctx_t *)(unsigned long)value;
215 if ((ret == -1) || (ctx == NULL((void*)0))) {
216 gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("quota context is not present in inode (gfid:%s)"
, uuid_utoa (local->validate_loc.inode->gfid)); } while
(0); _gf_log (this->name, "quota.c", __FUNCTION__, 218, GF_LOG_WARNING
, "quota context is not present in inode (gfid:%s)", uuid_utoa
(local->validate_loc.inode->gfid)); } while (0)
217 "quota context is not present in inode (gfid:%s)",do { do { if (0) printf ("quota context is not present in inode (gfid:%s)"
, uuid_utoa (local->validate_loc.inode->gfid)); } while
(0); _gf_log (this->name, "quota.c", __FUNCTION__, 218, GF_LOG_WARNING
, "quota context is not present in inode (gfid:%s)", uuid_utoa
(local->validate_loc.inode->gfid)); } while (0)
218 uuid_utoa (local->validate_loc.inode->gfid))do { do { if (0) printf ("quota context is not present in inode (gfid:%s)"
, uuid_utoa (local->validate_loc.inode->gfid)); } while
(0); _gf_log (this->name, "quota.c", __FUNCTION__, 218, GF_LOG_WARNING
, "quota context is not present in inode (gfid:%s)", uuid_utoa
(local->validate_loc.inode->gfid)); } while (0)
;
219 op_errno = EINVAL22;
220 goto unwind;
221 }
222
223 ret = dict_get_bin (dict, QUOTA_SIZE_KEY"trusted.glusterfs.quota.size", (void **) &size);
224 if (ret < 0) {
225 gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("size key not present in dict"); } while
(0); _gf_log (this->name, "quota.c", __FUNCTION__, 226, GF_LOG_WARNING
, "size key not present in dict"); } while (0)
226 "size key not present in dict")do { do { if (0) printf ("size key not present in dict"); } while
(0); _gf_log (this->name, "quota.c", __FUNCTION__, 226, GF_LOG_WARNING
, "size key not present in dict"); } while (0)
;
227 op_errno = EINVAL22;
228 goto unwind;
229 }
230
231 local->just_validated = 1; /* so that we don't go into infinite
232 * loop of validation and checking
233 * limit when timeout is zero.
234 */
235 LOCK (&ctx->lock)pthread_spin_lock (&ctx->lock);
236 {
237 ctx->size = ntoh64hton64 (*size);
238 gettimeofday (&ctx->tv, NULL((void*)0));
239 }
240 UNLOCK (&ctx->lock)pthread_spin_unlock (&ctx->lock);
241
242 quota_check_limit (frame, local->validate_loc.inode, this, NULL((void*)0), NULL((void*)0));
243 return 0;
244
245unwind:
246 LOCK (&local->lock)pthread_spin_lock (&local->lock);
247 {
248 local->op_ret = -1;
249 local->op_errno = op_errno;
250
251 validate_count = --local->validate_count;
252 link_count = local->link_count;
253
254 if ((validate_count == 0) && (link_count == 0)) {
255 stub = local->stub;
256 local->stub = NULL((void*)0);
257 }
258 }
259 UNLOCK (&local->lock)pthread_spin_unlock (&local->lock);
260
261 if (stub != NULL((void*)0)) {
262 call_resume (stub);
263 }
264
265 return 0;
266}
267
268
269static inline uint64_t
270quota_time_elapsed (struct timeval *now, struct timeval *then)
271{
272 return (now->tv_sec - then->tv_sec);
273}
274
275
276int32_t
277quota_timeout (struct timeval *tv, int32_t timeout)
278{
279 struct timeval now = {0,};
280 int32_t timed_out = 0;
281
282 gettimeofday (&now, NULL((void*)0));
283
284 if (quota_time_elapsed (&now, tv) >= timeout) {
285 timed_out = 1;
286 }
287
288 return timed_out;
289}
290
291
292int32_t
293quota_check_limit (call_frame_t *frame, inode_t *inode, xlator_t *this,
294 char *name, uuid_t par)
295{
296 int32_t ret = -1;
297 inode_t *_inode = NULL((void*)0), *parent = NULL((void*)0);
298 quota_inode_ctx_t *ctx = NULL((void*)0);
299 quota_priv_t *priv = NULL((void*)0);
300 quota_local_t *local = NULL((void*)0);
301 char need_validate = 0, need_unwind = 0;
302 int64_t delta = 0;
303 call_stub_t *stub = NULL((void*)0);
304 int32_t validate_count = 0, link_count = 0;
305 uint64_t value = 0;
306 char just_validated = 0;
307 uuid_t trav_uuid = {0,};
308
309 GF_VALIDATE_OR_GOTO ("quota", this, out)do { if (!this) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "this"); } while (0); _gf_log_callingfn
("quota", "quota.c", __FUNCTION__, 309, GF_LOG_ERROR, "invalid argument: "
"this"); } while (0); goto out; } } while (0)
;
310 GF_VALIDATE_OR_GOTO (this->name, frame, out)do { if (!frame) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "frame"); } while (0); _gf_log_callingfn
(this->name, "quota.c", __FUNCTION__, 310, GF_LOG_ERROR, "invalid argument: "
"frame"); } while (0); goto out; } } while (0)
;
311 GF_VALIDATE_OR_GOTO (this->name, inode, out)do { if (!inode) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "inode"); } while (0); _gf_log_callingfn
(this->name, "quota.c", __FUNCTION__, 311, GF_LOG_ERROR, "invalid argument: "
"inode"); } while (0); goto out; } } while (0)
;
312
313 local = frame->local;
314 GF_VALIDATE_OR_GOTO (this->name, local, out)do { if (!local) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "local"); } while (0); _gf_log_callingfn
(this->name, "quota.c", __FUNCTION__, 314, GF_LOG_ERROR, "invalid argument: "
"local"); } while (0); goto out; } } while (0)
;
315
316 delta = local->delta;
317
318 GF_VALIDATE_OR_GOTO (this->name, local->stub, out)do { if (!local->stub) { (*__errno_location ()) = 22; do {
do { if (0) printf ("invalid argument: " "local->stub"); }
while (0); _gf_log_callingfn (this->name, "quota.c", __FUNCTION__
, 318, GF_LOG_ERROR, "invalid argument: " "local->stub"); }
while (0); goto out; } } while (0)
;
319
320 priv = this->private;
321
322 inode_ctx_get (inode, this, &value)inode_ctx_get2(inode,this,&value,0);
323 ctx = (quota_inode_ctx_t *)(unsigned long)value;
324
325 _inode = inode_ref (inode);
326
327 LOCK (&local->lock)pthread_spin_lock (&local->lock);
328 {
329 just_validated = local->just_validated;
330 local->just_validated = 0;
331
332 if (just_validated) {
333 local->validate_count--;
334 }
335 }
336 UNLOCK (&local->lock)pthread_spin_unlock (&local->lock);
337
338 if ( par != NULL((void*)0) ) {
339 uuid_copy (trav_uuid, par);
340 }
341
342 do {
343 if (ctx != NULL((void*)0)) {
344 LOCK (&ctx->lock)pthread_spin_lock (&ctx->lock);
345 {
346 if (ctx->limit >= 0) {
347 if (!just_validated
348 && quota_timeout (&ctx->tv,
349 priv->timeout)) {
350 need_validate = 1;
351 } else if ((ctx->size + delta)
352 >= ctx->limit) {
353 local->op_ret = -1;
354 local->op_errno = EDQUOT122;
355 need_unwind = 1;
356 }
357 }
358 }
359 UNLOCK (&ctx->lock)pthread_spin_unlock (&ctx->lock);
360
361 if (need_validate) {
362 goto validate;
363 }
364
365 if (need_unwind) {
366 break;
367 }
368 }
369
370 if (__is_root_gfid (_inode->gfid)) {
371 break;
372 }
373
374 parent = inode_parent (_inode, trav_uuid, name);
375
376 if (name != NULL((void*)0)) {
377 name = NULL((void*)0);
378 uuid_clear (trav_uuid);
379 }
380
381 if (parent == NULL((void*)0)) {
382 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("cannot find parent for inode (gfid:%s), hence "
"aborting enforcing quota-limits and continuing" " with the fop"
, uuid_utoa (_inode->gfid)); } while (0); _gf_log (this->
name, "quota.c", __FUNCTION__, 385, GF_LOG_DEBUG, "cannot find parent for inode (gfid:%s), hence "
"aborting enforcing quota-limits and continuing" " with the fop"
, uuid_utoa (_inode->gfid)); } while (0)
383 "cannot find parent for inode (gfid:%s), hence "do { do { if (0) printf ("cannot find parent for inode (gfid:%s), hence "
"aborting enforcing quota-limits and continuing" " with the fop"
, uuid_utoa (_inode->gfid)); } while (0); _gf_log (this->
name, "quota.c", __FUNCTION__, 385, GF_LOG_DEBUG, "cannot find parent for inode (gfid:%s), hence "
"aborting enforcing quota-limits and continuing" " with the fop"
, uuid_utoa (_inode->gfid)); } while (0)
384 "aborting enforcing quota-limits and continuing"do { do { if (0) printf ("cannot find parent for inode (gfid:%s), hence "
"aborting enforcing quota-limits and continuing" " with the fop"
, uuid_utoa (_inode->gfid)); } while (0); _gf_log (this->
name, "quota.c", __FUNCTION__, 385, GF_LOG_DEBUG, "cannot find parent for inode (gfid:%s), hence "
"aborting enforcing quota-limits and continuing" " with the fop"
, uuid_utoa (_inode->gfid)); } while (0)
385 " with the fop", uuid_utoa (_inode->gfid))do { do { if (0) printf ("cannot find parent for inode (gfid:%s), hence "
"aborting enforcing quota-limits and continuing" " with the fop"
, uuid_utoa (_inode->gfid)); } while (0); _gf_log (this->
name, "quota.c", __FUNCTION__, 385, GF_LOG_DEBUG, "cannot find parent for inode (gfid:%s), hence "
"aborting enforcing quota-limits and continuing" " with the fop"
, uuid_utoa (_inode->gfid)); } while (0)
;
386 }
387
388 inode_unref (_inode);
389 _inode = parent;
390 just_validated = 0;
391
392 if (_inode == NULL((void*)0)) {
393 break;
394 }
395
396 value = 0;
397 inode_ctx_get (_inode, this, &value)inode_ctx_get2(_inode,this,&value,0);
398 ctx = (quota_inode_ctx_t *)(unsigned long)value;
399 } while (1);
400
401 ret = 0;
402
403 if (_inode != NULL((void*)0)) {
404 inode_unref (_inode);
405 }
406
407 LOCK (&local->lock)pthread_spin_lock (&local->lock);
408 {
409 validate_count = local->validate_count;
410 link_count = local->link_count;
411 if ((validate_count == 0) && (link_count == 0)) {
412 stub = local->stub;
413 local->stub = NULL((void*)0);
414 }
415 }
416 UNLOCK (&local->lock)pthread_spin_unlock (&local->lock);
417
418 if (stub != NULL((void*)0)) {
419 call_resume (stub);
420 }
421
422out:
423 return ret;
424
425validate:
426 LOCK (&local->lock)pthread_spin_lock (&local->lock);
427 {
428 loc_wipe (&local->validate_loc);
429
430 if (just_validated) {
431 local->validate_count--;
432 }
433
434 local->validate_count++;
435 ret = quota_inode_loc_fill (_inode, &local->validate_loc);
436 if (ret < 0) {
437 gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("cannot fill loc for inode (gfid:%s), hence "
"aborting quota-checks and continuing with fop", uuid_utoa (
_inode->gfid)); } while (0); _gf_log (this->name, "quota.c"
, __FUNCTION__, 440, GF_LOG_WARNING, "cannot fill loc for inode (gfid:%s), hence "
"aborting quota-checks and continuing with fop", uuid_utoa (
_inode->gfid)); } while (0)
438 "cannot fill loc for inode (gfid:%s), hence "do { do { if (0) printf ("cannot fill loc for inode (gfid:%s), hence "
"aborting quota-checks and continuing with fop", uuid_utoa (
_inode->gfid)); } while (0); _gf_log (this->name, "quota.c"
, __FUNCTION__, 440, GF_LOG_WARNING, "cannot fill loc for inode (gfid:%s), hence "
"aborting quota-checks and continuing with fop", uuid_utoa (
_inode->gfid)); } while (0)
439 "aborting quota-checks and continuing with fop",do { do { if (0) printf ("cannot fill loc for inode (gfid:%s), hence "
"aborting quota-checks and continuing with fop", uuid_utoa (
_inode->gfid)); } while (0); _gf_log (this->name, "quota.c"
, __FUNCTION__, 440, GF_LOG_WARNING, "cannot fill loc for inode (gfid:%s), hence "
"aborting quota-checks and continuing with fop", uuid_utoa (
_inode->gfid)); } while (0)
440 uuid_utoa (_inode->gfid))do { do { if (0) printf ("cannot fill loc for inode (gfid:%s), hence "
"aborting quota-checks and continuing with fop", uuid_utoa (
_inode->gfid)); } while (0); _gf_log (this->name, "quota.c"
, __FUNCTION__, 440, GF_LOG_WARNING, "cannot fill loc for inode (gfid:%s), hence "
"aborting quota-checks and continuing with fop", uuid_utoa (
_inode->gfid)); } while (0)
;
441 local->validate_count--;
442 }
443 }
444 UNLOCK (&local->lock)pthread_spin_unlock (&local->lock);
445
446 if (ret < 0) {
447 goto loc_fill_failed;
448 }
449
450 STACK_WIND (frame, quota_validate_cbk, FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "quota.c", __FUNCTION__, 452, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->getxattr_cbk) tmp_cbk = quota_validate_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 = "quota_validate_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _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)
, &local->validate_loc, "trusted.glusterfs.quota.size"
, ((void*)0)); (*__glusterfs_this_location()) = old_THIS; } while
(0)
451 FIRST_CHILD(this)->fops->getxattr, &local->validate_loc,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "quota.c", __FUNCTION__, 452, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->getxattr_cbk) tmp_cbk = quota_validate_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 = "quota_validate_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _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)
, &local->validate_loc, "trusted.glusterfs.quota.size"
, ((void*)0)); (*__glusterfs_this_location()) = old_THIS; } while
(0)
452 QUOTA_SIZE_KEY, NULL)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "quota.c", __FUNCTION__, 452, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->getxattr_cbk) tmp_cbk = quota_validate_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 = "quota_validate_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _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)
, &local->validate_loc, "trusted.glusterfs.quota.size"
, ((void*)0)); (*__glusterfs_this_location()) = old_THIS; } while
(0)
;
453
454loc_fill_failed:
455 inode_unref (_inode);
456 return 0;
457}
458
459
460int32_t
461quota_get_limit_value (inode_t *inode, xlator_t *this, int64_t *n)
462{
463 int32_t ret = 0;
464 char *path = NULL((void*)0);
465 limits_t *limit_node = NULL((void*)0);
466 quota_priv_t *priv = NULL((void*)0);
467
468 if (inode == NULL((void*)0) || n == NULL((void*)0)) {
469 ret = -1;
470 goto out;
471 }
472
473 *n = 0;
474
475 ret = inode_path (inode, NULL((void*)0), &path);
476 if (ret < 0) {
477 ret = -1;
478 goto out;
479 }
480
481 priv = this->private;
482
483 list_for_each_entry (limit_node, &priv->limit_head, limit_list)for (limit_node = ((typeof(*limit_node) *)((char *)((&priv
->limit_head)->next)-(unsigned long)(&((typeof(*limit_node
) *)0)->limit_list))); &limit_node->limit_list != (
&priv->limit_head); limit_node = ((typeof(*limit_node)
*)((char *)(limit_node->limit_list.next)-(unsigned long)(
&((typeof(*limit_node) *)0)->limit_list))))
{
484 if (strcmp (limit_node->path, path) == 0) {
485 *n = limit_node->value;
486 break;
487 }
488 }
489
490out:
491 GF_FREE (path)__gf_free (path);
492
493 return ret;
494}
495
496
497static int32_t
498__quota_init_inode_ctx (inode_t *inode, int64_t limit, xlator_t *this,
499 dict_t *dict, struct iatt *buf,
500 quota_inode_ctx_t **context)
501{
502 int32_t ret = -1;
503 int64_t *size = 0;
504 quota_inode_ctx_t *ctx = NULL((void*)0);
505
506 if (inode == NULL((void*)0)) {
507 goto out;
508 }
509
510 QUOTA_ALLOC_OR_GOTO (ctx, quota_inode_ctx_t, out)do { ctx = __gf_calloc (sizeof (quota_inode_ctx_t), 1, gf_quota_mt_quota_inode_ctx_t
); if (!ctx) { do { do { if (0) printf ("out of memory :("); }
while (0); _gf_log ("", "quota.c", __FUNCTION__, 510, GF_LOG_ERROR
, "out of memory :("); } while (0); ret = -1; goto out; } } while
(0);
;
511
512 ctx->limit = limit;
513 if (buf)
514 ctx->buf = *buf;
515
516 LOCK_INIT(&ctx->lock)pthread_spin_init (&ctx->lock, 0);
517
518 if (context != NULL((void*)0)) {
519 *context = ctx;
520 }
521
522 INIT_LIST_HEAD (&ctx->parents)do { (&ctx->parents)->next = (&ctx->parents)
->prev = &ctx->parents; } while (0)
;
523
524 if (dict != NULL((void*)0)) {
525 ret = dict_get_bin (dict, QUOTA_SIZE_KEY"trusted.glusterfs.quota.size", (void **) &size);
526 if (ret == 0) {
527 ctx->size = ntoh64hton64 (*size);
528 gettimeofday (&ctx->tv, NULL((void*)0));
529 }
530 }
531
532 ret = __inode_ctx_put (inode, this, (uint64_t )(long)ctx);
533 if (ret == -1) {
534 gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("cannot set quota context in inode (gfid:%s)"
, uuid_utoa (inode->gfid)); } while (0); _gf_log (this->
name, "quota.c", __FUNCTION__, 536, GF_LOG_WARNING, "cannot set quota context in inode (gfid:%s)"
, uuid_utoa (inode->gfid)); } while (0)
535 "cannot set quota context in inode (gfid:%s)",do { do { if (0) printf ("cannot set quota context in inode (gfid:%s)"
, uuid_utoa (inode->gfid)); } while (0); _gf_log (this->
name, "quota.c", __FUNCTION__, 536, GF_LOG_WARNING, "cannot set quota context in inode (gfid:%s)"
, uuid_utoa (inode->gfid)); } while (0)
536 uuid_utoa (inode->gfid))do { do { if (0) printf ("cannot set quota context in inode (gfid:%s)"
, uuid_utoa (inode->gfid)); } while (0); _gf_log (this->
name, "quota.c", __FUNCTION__, 536, GF_LOG_WARNING, "cannot set quota context in inode (gfid:%s)"
, uuid_utoa (inode->gfid)); } while (0)
;
537 }
538out:
539 return ret;
540}
541
542
543static int32_t
544quota_inode_ctx_get (inode_t *inode, int64_t limit, xlator_t *this,
545 dict_t *dict, struct iatt *buf, quota_inode_ctx_t **ctx,
546 char create_if_absent)
547{
548 int32_t ret = 0;
549 uint64_t ctx_int;
550
551 LOCK (&inode->lock)pthread_spin_lock (&inode->lock);
552 {
553 ret = __inode_ctx_get (inode, this, &ctx_int)__inode_ctx_get2(inode,this,&ctx_int,0);
554
555 if ((ret == 0) && (ctx != NULL((void*)0))) {
556 *ctx = (quota_inode_ctx_t *) (unsigned long)ctx_int;
557 } else if (create_if_absent) {
558 ret = __quota_init_inode_ctx (inode, limit, this, dict,
559 buf, ctx);
560 }
561 }
562 UNLOCK (&inode->lock)pthread_spin_unlock (&inode->lock);
563
564 return ret;
565}
566
567
568int32_t
569quota_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
570 int32_t op_ret, int32_t op_errno, inode_t *inode,
571 struct iatt *buf, dict_t *dict, struct iatt *postparent)
572{
573 int32_t ret = -1;
574 char found = 0;
575 quota_local_t *local = NULL((void*)0);
576 quota_inode_ctx_t *ctx = NULL((void*)0);
577 quota_dentry_t *dentry = NULL((void*)0);
578 int64_t *size = 0;
579 uint64_t value = 0;
580 limits_t *limit_node = NULL((void*)0);
581 quota_priv_t *priv = NULL((void*)0);
582
583 local = frame->local;
584
585 priv = this->private;
586
587 inode_ctx_get (inode, this, &value)inode_ctx_get2(inode,this,&value,0);
588 ctx = (quota_inode_ctx_t *)(unsigned long)value;
589
590 if ((op_ret < 0) || (local == NULL((void*)0))
591 || (((ctx == NULL((void*)0)) || (ctx->limit == local->limit))
592 && (local->limit < 0) && !((IA_ISREG (buf->ia_type)(buf->ia_type == IA_IFREG))
593 || (IA_ISLNK (buf->ia_type)(buf->ia_type == IA_IFLNK))))) {
594 goto unwind;
595 }
596
597 LOCK (&priv->lock)pthread_spin_lock (&priv->lock);
598 {
599 list_for_each_entry (limit_node, &priv->limit_head,for (limit_node = ((typeof(*limit_node) *)((char *)((&priv
->limit_head)->next)-(unsigned long)(&((typeof(*limit_node
) *)0)->limit_list))); &limit_node->limit_list != (
&priv->limit_head); limit_node = ((typeof(*limit_node)
*)((char *)(limit_node->limit_list.next)-(unsigned long)(
&((typeof(*limit_node) *)0)->limit_list))))
600 limit_list)for (limit_node = ((typeof(*limit_node) *)((char *)((&priv
->limit_head)->next)-(unsigned long)(&((typeof(*limit_node
) *)0)->limit_list))); &limit_node->limit_list != (
&priv->limit_head); limit_node = ((typeof(*limit_node)
*)((char *)(limit_node->limit_list.next)-(unsigned long)(
&((typeof(*limit_node) *)0)->limit_list))))
{
601 if (strcmp (local->loc.path, limit_node->path) == 0) {
602 uuid_copy (limit_node->gfid, buf->ia_gfid);
603 break;
604 }
605 }
606 }
607 UNLOCK (&priv->lock)pthread_spin_unlock (&priv->lock);
608
609 ret = quota_inode_ctx_get (local->loc.inode, local->limit, this, dict,
610 buf, &ctx, 1);
611 if ((ret == -1) || (ctx == NULL((void*)0))) {
612 gf_log (this->name, GF_LOG_WARNING, "cannot create quota "do { do { if (0) printf ("cannot create quota " "context in inode(gfid:%s)"
, uuid_utoa (local->loc.inode->gfid)); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 614, GF_LOG_WARNING
, "cannot create quota " "context in inode(gfid:%s)", uuid_utoa
(local->loc.inode->gfid)); } while (0)
613 "context in inode(gfid:%s)",do { do { if (0) printf ("cannot create quota " "context in inode(gfid:%s)"
, uuid_utoa (local->loc.inode->gfid)); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 614, GF_LOG_WARNING
, "cannot create quota " "context in inode(gfid:%s)", uuid_utoa
(local->loc.inode->gfid)); } while (0)
614 uuid_utoa (local->loc.inode->gfid))do { do { if (0) printf ("cannot create quota " "context in inode(gfid:%s)"
, uuid_utoa (local->loc.inode->gfid)); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 614, GF_LOG_WARNING
, "cannot create quota " "context in inode(gfid:%s)", uuid_utoa
(local->loc.inode->gfid)); } while (0)
;
615 op_ret = -1;
616 op_errno = ENOMEM12;
617 goto unwind;
618 }
619
620 LOCK (&ctx->lock)pthread_spin_lock (&ctx->lock);
621 {
622
623 if (dict != NULL((void*)0)) {
624 ret = dict_get_bin (dict, QUOTA_SIZE_KEY"trusted.glusterfs.quota.size",
625 (void **) &size);
626 if (ret == 0) {
627 ctx->size = ntoh64hton64 (*size);
628 gettimeofday (&ctx->tv, NULL((void*)0));
629 }
630 }
631
632 if (local->limit != ctx->limit) {
633 ctx->limit = local->limit;
634 }
635
636 ctx->buf = *buf;
637
638 if (!(IA_ISREG (buf->ia_type)(buf->ia_type == IA_IFREG) || IA_ISLNK (buf->ia_type)(buf->ia_type == IA_IFLNK))) {
639 goto unlock;
640 }
641
642 if (local->loc.name == NULL((void*)0))
643 goto unlock;
644
645 list_for_each_entry (dentry, &ctx->parents, next)for (dentry = ((typeof(*dentry) *)((char *)((&ctx->parents
)->next)-(unsigned long)(&((typeof(*dentry) *)0)->next
))); &dentry->next != (&ctx->parents); dentry =
((typeof(*dentry) *)((char *)(dentry->next.next)-(unsigned
long)(&((typeof(*dentry) *)0)->next))))
{
646 if ((strcmp (dentry->name, local->loc.name) == 0) &&
647 (uuid_compare (local->loc.parent->gfid,
648 dentry->par) == 0)) {
649 found = 1;
650 break;
651 }
652 }
653
654 if (!found) {
655 dentry = __quota_dentry_new (ctx,
656 (char *)local->loc.name,
657 local->loc.parent->gfid);
658 if (dentry == NULL((void*)0)) {
659 /*
660 gf_log (this->name, GF_LOG_WARNING,
661 "cannot create a new dentry (par:%"
662 PRId64", name:%s) for inode(ino:%"
663 PRId64", gfid:%s)",
664 uuid_utoa (local->loc.inode->gfid));
665 */
666 op_ret = -1;
667 op_errno = ENOMEM12;
668 goto unlock;
669 }
670 }
671 }
672unlock:
673 UNLOCK (&ctx->lock)pthread_spin_unlock (&ctx->lock);
674
675unwind:
676 QUOTA_STACK_UNWIND (lookup, frame, op_ret, op_errno, inode, buf,do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_lookup_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 677, 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, dict, postparent); (
*__glusterfs_this_location()) = old_THIS; } while (0); quota_local_cleanup
(_this, _local); } while (0)
677 dict, postparent)do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_lookup_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 677, 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, dict, postparent); (
*__glusterfs_this_location()) = old_THIS; } while (0); quota_local_cleanup
(_this, _local); } while (0)
;
678 return 0;
679}
680
681
682int32_t
683quota_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc,
684 dict_t *xattr_req)
685{
686 int32_t ret = -1;
687 int64_t limit = -1;
688 limits_t *limit_node = NULL((void*)0);
689 gf_boolean_t dict_newed = _gf_false;
690 quota_priv_t *priv = NULL((void*)0);
691 quota_local_t *local = NULL((void*)0);
692
693 priv = this->private;
694
695 list_for_each_entry (limit_node, &priv->limit_head, limit_list)for (limit_node = ((typeof(*limit_node) *)((char *)((&priv
->limit_head)->next)-(unsigned long)(&((typeof(*limit_node
) *)0)->limit_list))); &limit_node->limit_list != (
&priv->limit_head); limit_node = ((typeof(*limit_node)
*)((char *)(limit_node->limit_list.next)-(unsigned long)(
&((typeof(*limit_node) *)0)->limit_list))))
{
696 if (strcmp (limit_node->path, loc->path) == 0) {
697 limit = limit_node->value;
698 }
699 }
700
701 local = quota_local_new ();
702 if (local == NULL((void*)0)) {
703 goto err;
704 }
705
706 ret = loc_copy (&local->loc, loc);
707 if (ret == -1) {
708 goto err;
709 }
710
711 frame->local = local;
712
713 local->limit = limit;
714
715 if (limit < 0) {
716 goto wind;
717 }
718
719 if (xattr_req == NULL((void*)0)) {
720 xattr_req = dict_new ();
721 dict_newed = _gf_true;
722 }
723
724 ret = dict_set_uint64 (xattr_req, QUOTA_SIZE_KEY"trusted.glusterfs.quota.size", 0);
725 if (ret < 0) {
726 goto err;
727 }
728
729wind:
730 STACK_WIND (frame, quota_lookup_cbk, FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "quota.c", __FUNCTION__, 731, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->lookup_cbk) tmp_cbk = quota_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 = "quota_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
, xattr_req); (*__glusterfs_this_location()) = old_THIS; } while
(0)
731 FIRST_CHILD(this)->fops->lookup, loc, xattr_req)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "quota.c", __FUNCTION__, 731, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->lookup_cbk) tmp_cbk = quota_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 = "quota_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
, xattr_req); (*__glusterfs_this_location()) = old_THIS; } while
(0)
;
732
733 ret = 0;
734
735err:
736 if (ret < 0) {
737 QUOTA_STACK_UNWIND (lookup, frame, -1, ENOMEM,do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_lookup_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 738, 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, -1, 12, ((void*)0), ((void*)0), ((void*)0), ((void
*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0)
; quota_local_cleanup (_this, _local); } while (0)
738 NULL, NULL, NULL, NULL)do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_lookup_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 738, 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, -1, 12, ((void*)0), ((void*)0), ((void*)0), ((void
*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0)
; quota_local_cleanup (_this, _local); } while (0)
;
739 }
740
741 if (dict_newed == _gf_true) {
742 dict_unref (xattr_req);
743 }
744
745 return 0;
746}
747
748
749void
750quota_update_size (xlator_t *this, inode_t *inode, char *name, uuid_t par,
751 int64_t delta)
752{
753 inode_t *_inode = NULL((void*)0);
754 inode_t *parent = NULL((void*)0);
755 uint64_t value = 0;
756 quota_inode_ctx_t *ctx = NULL((void*)0);
757 uuid_t trav_uuid = {0,};
758
759 GF_VALIDATE_OR_GOTO ("quota", this, out)do { if (!this) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "this"); } while (0); _gf_log_callingfn
("quota", "quota.c", __FUNCTION__, 759, GF_LOG_ERROR, "invalid argument: "
"this"); } while (0); goto out; } } while (0)
;
760 GF_VALIDATE_OR_GOTO (this->name, inode, out)do { if (!inode) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "inode"); } while (0); _gf_log_callingfn
(this->name, "quota.c", __FUNCTION__, 760, GF_LOG_ERROR, "invalid argument: "
"inode"); } while (0); goto out; } } while (0)
;
761
762 inode_ctx_get (inode, this, &value)inode_ctx_get2(inode,this,&value,0);
763 ctx = (quota_inode_ctx_t *)(unsigned long)value;
764
765 _inode = inode_ref (inode);
766
767 if ( par != NULL((void*)0) ) {
768 uuid_copy (trav_uuid, par);
769 }
770
771 do {
772 if ((ctx != NULL((void*)0)) && (ctx->limit >= 0)) {
773 LOCK (&ctx->lock)pthread_spin_lock (&ctx->lock);
774 {
775 ctx->size += delta;
776 }
777 UNLOCK (&ctx->lock)pthread_spin_unlock (&ctx->lock);
778 }
779
780 if (__is_root_gfid (_inode->gfid)) {
781 break;
782 }
783
784 parent = inode_parent (_inode, trav_uuid, name);
785 if (parent == NULL((void*)0)) {
786 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("cannot find parent for inode (gfid:%s), hence "
"aborting size updation of parents", uuid_utoa (_inode->gfid
)); } while (0); _gf_log (this->name, "quota.c", __FUNCTION__
, 789, GF_LOG_DEBUG, "cannot find parent for inode (gfid:%s), hence "
"aborting size updation of parents", uuid_utoa (_inode->gfid
)); } while (0)
787 "cannot find parent for inode (gfid:%s), hence "do { do { if (0) printf ("cannot find parent for inode (gfid:%s), hence "
"aborting size updation of parents", uuid_utoa (_inode->gfid
)); } while (0); _gf_log (this->name, "quota.c", __FUNCTION__
, 789, GF_LOG_DEBUG, "cannot find parent for inode (gfid:%s), hence "
"aborting size updation of parents", uuid_utoa (_inode->gfid
)); } while (0)
788 "aborting size updation of parents",do { do { if (0) printf ("cannot find parent for inode (gfid:%s), hence "
"aborting size updation of parents", uuid_utoa (_inode->gfid
)); } while (0); _gf_log (this->name, "quota.c", __FUNCTION__
, 789, GF_LOG_DEBUG, "cannot find parent for inode (gfid:%s), hence "
"aborting size updation of parents", uuid_utoa (_inode->gfid
)); } while (0)
789 uuid_utoa (_inode->gfid))do { do { if (0) printf ("cannot find parent for inode (gfid:%s), hence "
"aborting size updation of parents", uuid_utoa (_inode->gfid
)); } while (0); _gf_log (this->name, "quota.c", __FUNCTION__
, 789, GF_LOG_DEBUG, "cannot find parent for inode (gfid:%s), hence "
"aborting size updation of parents", uuid_utoa (_inode->gfid
)); } while (0)
;
790 }
791
792 if (name != NULL((void*)0)) {
793 name = NULL((void*)0);
794 uuid_clear (trav_uuid);
795 }
796
797 inode_unref (_inode);
798 _inode = parent;
799
800 if (_inode == NULL((void*)0)) {
801 break;
802 }
803
804 inode_ctx_get (_inode, this, &value)inode_ctx_get2(_inode,this,&value,0);
805 ctx = (quota_inode_ctx_t *)(unsigned long)value;
806 } while (1);
807
808out:
809 return;
810}
811
812
813int32_t
814quota_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
815 int32_t op_ret, int32_t op_errno, struct iatt *prebuf,
816 struct iatt *postbuf, dict_t *xdata)
817{
818 int32_t ret = 0;
819 uint64_t ctx_int = 0;
820 quota_inode_ctx_t *ctx = NULL((void*)0);
821 quota_local_t *local = NULL((void*)0);
822 quota_dentry_t *dentry = NULL((void*)0);
823 int64_t delta = 0;
824
825 local = frame->local;
826
827 if ((op_ret < 0) || (local == NULL((void*)0))) {
828 goto out;
829 }
830
831 ret = inode_ctx_get (local->loc.inode, this, &ctx_int)inode_ctx_get2(local->loc.inode,this,&ctx_int,0);
832 if (ret) {
833 gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("%s: failed to get the context", local
->loc.path); } while (0); _gf_log (this->name, "quota.c"
, __FUNCTION__, 834, GF_LOG_WARNING, "%s: failed to get the context"
, local->loc.path); } while (0)
834 "%s: failed to get the context", local->loc.path)do { do { if (0) printf ("%s: failed to get the context", local
->loc.path); } while (0); _gf_log (this->name, "quota.c"
, __FUNCTION__, 834, GF_LOG_WARNING, "%s: failed to get the context"
, local->loc.path); } while (0)
;
835 goto out;
836 }
837
838 ctx = (quota_inode_ctx_t *)(unsigned long) ctx_int;
839
840 if (ctx == NULL((void*)0)) {
841 gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("quota context not set in %s (gfid:%s)"
, local->loc.path, uuid_utoa (local->loc.inode->gfid
)); } while (0); _gf_log (this->name, "quota.c", __FUNCTION__
, 843, GF_LOG_WARNING, "quota context not set in %s (gfid:%s)"
, local->loc.path, uuid_utoa (local->loc.inode->gfid
)); } while (0)
842 "quota context not set in %s (gfid:%s)",do { do { if (0) printf ("quota context not set in %s (gfid:%s)"
, local->loc.path, uuid_utoa (local->loc.inode->gfid
)); } while (0); _gf_log (this->name, "quota.c", __FUNCTION__
, 843, GF_LOG_WARNING, "quota context not set in %s (gfid:%s)"
, local->loc.path, uuid_utoa (local->loc.inode->gfid
)); } while (0)
843 local->loc.path, uuid_utoa (local->loc.inode->gfid))do { do { if (0) printf ("quota context not set in %s (gfid:%s)"
, local->loc.path, uuid_utoa (local->loc.inode->gfid
)); } while (0); _gf_log (this->name, "quota.c", __FUNCTION__
, 843, GF_LOG_WARNING, "quota context not set in %s (gfid:%s)"
, local->loc.path, uuid_utoa (local->loc.inode->gfid
)); } while (0)
;
844 goto out;
845 }
846
847 LOCK (&ctx->lock)pthread_spin_lock (&ctx->lock);
848 {
849 ctx->buf = *postbuf;
850 }
851 UNLOCK (&ctx->lock)pthread_spin_unlock (&ctx->lock);
852
853 list_for_each_entry (dentry, &ctx->parents, next)for (dentry = ((typeof(*dentry) *)((char *)((&ctx->parents
)->next)-(unsigned long)(&((typeof(*dentry) *)0)->next
))); &dentry->next != (&ctx->parents); dentry =
((typeof(*dentry) *)((char *)(dentry->next.next)-(unsigned
long)(&((typeof(*dentry) *)0)->next))))
{
854 delta = (postbuf->ia_blocks - prebuf->ia_blocks) * 512;
855 quota_update_size (this, local->loc.inode,
856 dentry->name, dentry->par, delta);
857 }
858
859out:
860 QUOTA_STACK_UNWIND (writev, frame, op_ret, op_errno, prebuf, postbuf,do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_writev_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 861, 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); quota_local_cleanup (_this, _local
); } while (0)
861 xdata)do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_writev_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 861, 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); quota_local_cleanup (_this, _local
); } while (0)
;
862
863 return 0;
864}
865
866
867int32_t
868quota_writev_helper (call_frame_t *frame, xlator_t *this, fd_t *fd,
869 struct iovec *vector, int32_t count, off_t off,
870 uint32_t flags, struct iobref *iobref, dict_t *xdata)
871{
872 quota_local_t *local = NULL((void*)0);
873 int32_t op_errno = EINVAL22;
874
875 local = frame->local;
876 if (local == NULL((void*)0)) {
877 gf_log (this->name, GF_LOG_WARNING, "local is NULL")do { do { if (0) printf ("local is NULL"); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 877, GF_LOG_WARNING
, "local is NULL"); } while (0)
;
878 goto unwind;
879 }
880
881 if (local->op_ret == -1) {
882 op_errno = local->op_errno;
883 goto unwind;
884 }
885
886 STACK_WIND (frame, quota_writev_cbk, FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "quota.c", __FUNCTION__, 888, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->writev_cbk) tmp_cbk = quota_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 = "quota_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, off, flags, iobref, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0)
887 FIRST_CHILD(this)->fops->writev, fd, vector, count, off,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "quota.c", __FUNCTION__, 888, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->writev_cbk) tmp_cbk = quota_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 = "quota_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, off, flags, iobref, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0)
888 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", "quota.c", __FUNCTION__, 888, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->writev_cbk) tmp_cbk = quota_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 = "quota_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, off, flags, iobref, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0)
;
889 return 0;
890
891unwind:
892 QUOTA_STACK_UNWIND (writev, frame, -1, op_errno, NULL, NULL, NULL)do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_writev_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 892, 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, -1, op_errno, ((void*)0), ((void*)0), ((void*)0));
(*__glusterfs_this_location()) = old_THIS; } while (0); quota_local_cleanup
(_this, _local); } while (0)
;
893 return 0;
894}
895
896
897int32_t
898quota_writev (call_frame_t *frame, xlator_t *this, fd_t *fd,
899 struct iovec *vector, int32_t count, off_t off,
900 uint32_t flags, struct iobref *iobref, dict_t *xdata)
901{
902 int32_t ret = -1, op_errno = EINVAL22;
903 int32_t parents = 0;
904 uint64_t size = 0;
905 quota_local_t *local = NULL((void*)0);
906 quota_inode_ctx_t *ctx = NULL((void*)0);
907 quota_priv_t *priv = NULL((void*)0);
908 call_stub_t *stub = NULL((void*)0);
909 quota_dentry_t *dentry = NULL((void*)0);
910
911 GF_ASSERT (frame)do { if (!(frame)) { do { do { if (0) printf ("Assertion failed: "
"frame"); } while (0); _gf_log_callingfn ("", "quota.c", __FUNCTION__
, 911, GF_LOG_ERROR, "Assertion failed: " "frame"); } while (
0); } } while (0)
;
912 GF_VALIDATE_OR_GOTO ("quota", this, unwind)do { if (!this) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "this"); } while (0); _gf_log_callingfn
("quota", "quota.c", __FUNCTION__, 912, GF_LOG_ERROR, "invalid argument: "
"this"); } while (0); goto unwind; } } while (0)
;
913 GF_VALIDATE_OR_GOTO (this->name, fd, unwind)do { if (!fd) { (*__errno_location ()) = 22; do { do { if (0)
printf ("invalid argument: " "fd"); } while (0); _gf_log_callingfn
(this->name, "quota.c", __FUNCTION__, 913, GF_LOG_ERROR, "invalid argument: "
"fd"); } while (0); goto unwind; } } while (0)
;
914
915 local = quota_local_new ();
916 if (local == NULL((void*)0)) {
917 goto unwind;
918 }
919
920 frame->local = local;
921 local->loc.inode = inode_ref (fd->inode);
922
923 ret = quota_inode_ctx_get (fd->inode, -1, this, NULL((void*)0), NULL((void*)0), &ctx, 0);
Value stored to 'ret' is never read
924 if (ctx == NULL((void*)0)) {
925 gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("quota context not set in inode (gfid:%s)"
, uuid_utoa (fd->inode->gfid)); } while (0); _gf_log (this
->name, "quota.c", __FUNCTION__, 927, GF_LOG_WARNING, "quota context not set in inode (gfid:%s)"
, uuid_utoa (fd->inode->gfid)); } while (0)
926 "quota context not set in inode (gfid:%s)",do { do { if (0) printf ("quota context not set in inode (gfid:%s)"
, uuid_utoa (fd->inode->gfid)); } while (0); _gf_log (this
->name, "quota.c", __FUNCTION__, 927, GF_LOG_WARNING, "quota context not set in inode (gfid:%s)"
, uuid_utoa (fd->inode->gfid)); } while (0)
927 uuid_utoa (fd->inode->gfid))do { do { if (0) printf ("quota context not set in inode (gfid:%s)"
, uuid_utoa (fd->inode->gfid)); } while (0); _gf_log (this
->name, "quota.c", __FUNCTION__, 927, GF_LOG_WARNING, "quota context not set in inode (gfid:%s)"
, uuid_utoa (fd->inode->gfid)); } while (0)
;
928 goto unwind;
929 }
930
931 stub = fop_writev_stub (frame, quota_writev_helper, fd, vector, count,
932 off, flags, iobref, xdata);
933 if (stub == NULL((void*)0)) {
934 op_errno = ENOMEM12;
935 goto unwind;
936 }
937
938 priv = this->private;
939 GF_VALIDATE_OR_GOTO (this->name, priv, unwind)do { if (!priv) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "priv"); } while (0); _gf_log_callingfn
(this->name, "quota.c", __FUNCTION__, 939, GF_LOG_ERROR, "invalid argument: "
"priv"); } while (0); goto unwind; } } while (0)
;
940
941 size = iov_length (vector, count);
942 LOCK (&ctx->lock)pthread_spin_lock (&ctx->lock);
943 {
944 list_for_each_entry (dentry, &ctx->parents, next)for (dentry = ((typeof(*dentry) *)((char *)((&ctx->parents
)->next)-(unsigned long)(&((typeof(*dentry) *)0)->next
))); &dentry->next != (&ctx->parents); dentry =
((typeof(*dentry) *)((char *)(dentry->next.next)-(unsigned
long)(&((typeof(*dentry) *)0)->next))))
{
945 parents++;
946 }
947 }
948 UNLOCK (&ctx->lock)pthread_spin_unlock (&ctx->lock);
949
950 local->delta = size;
951 local->stub = stub;
952 local->link_count = parents;
953
954 list_for_each_entry (dentry, &ctx->parents, next)for (dentry = ((typeof(*dentry) *)((char *)((&ctx->parents
)->next)-(unsigned long)(&((typeof(*dentry) *)0)->next
))); &dentry->next != (&ctx->parents); dentry =
((typeof(*dentry) *)((char *)(dentry->next.next)-(unsigned
long)(&((typeof(*dentry) *)0)->next))))
{
955 ret = quota_check_limit (frame, fd->inode, this, dentry->name,
956 dentry->par);
957 if (ret == -1) {
958 break;
959 }
960 }
961
962 stub = NULL((void*)0);
963
964 LOCK (&local->lock)pthread_spin_lock (&local->lock);
965 {
966 local->link_count = 0;
967 if (local->validate_count == 0) {
968 stub = local->stub;
969 local->stub = NULL((void*)0);
970 }
971 }
972 UNLOCK (&local->lock)pthread_spin_unlock (&local->lock);
973
974 if (stub != NULL((void*)0)) {
975 call_resume (stub);
976 }
977
978 return 0;
979
980unwind:
981 QUOTA_STACK_UNWIND (writev, frame, -1, op_errno, NULL, NULL, NULL)do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_writev_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 981, 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, -1, op_errno, ((void*)0), ((void*)0), ((void*)0));
(*__glusterfs_this_location()) = old_THIS; } while (0); quota_local_cleanup
(_this, _local); } while (0)
;
982 return 0;
983}
984
985
986int32_t
987quota_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
988 int32_t op_ret, int32_t op_errno, inode_t *inode,
989 struct iatt *buf, struct iatt *preparent,
990 struct iatt *postparent, dict_t *xdata)
991{
992 QUOTA_STACK_UNWIND (mkdir, frame, op_ret, op_errno, inode,do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_mkdir_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 993, 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); quota_local_cleanup (_this, _local); } while (0)
993 buf, preparent, postparent, xdata)do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_mkdir_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 993, 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); quota_local_cleanup (_this, _local); } while (0)
;
994 return 0;
995}
996
997
998int32_t
999quota_mkdir_helper (call_frame_t *frame, xlator_t *this, loc_t *loc,
1000 mode_t mode, mode_t umask, dict_t *xdata)
1001{
1002 quota_local_t *local = NULL((void*)0);
1003 int32_t op_errno = EINVAL22;
1004
1005 local = frame->local;
1006 if (local == NULL((void*)0)) {
1007 gf_log (this->name, GF_LOG_WARNING, "local is NULL")do { do { if (0) printf ("local is NULL"); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 1007, GF_LOG_WARNING
, "local is NULL"); } while (0)
;
1008 goto unwind;
1009 }
1010
1011 op_errno = local->op_errno;
1012
1013 if (local->op_ret == -1) {
1014 goto unwind;
1015 }
1016
1017 STACK_WIND (frame, quota_mkdir_cbk, FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "quota.c", __FUNCTION__, 1018, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->mkdir_cbk) tmp_cbk = quota_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 = "quota_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)
1018 FIRST_CHILD(this)->fops->mkdir, 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", "quota.c", __FUNCTION__, 1018, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->mkdir_cbk) tmp_cbk = quota_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 = "quota_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)
;
1019 return 0;
1020
1021unwind:
1022 QUOTA_STACK_UNWIND (mkdir, frame, -1, op_errno, NULL, NULL,do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_mkdir_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 1023, 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, -1, op_errno, ((void*)0), ((void*)0), ((void*)0), (
(void*)0), ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0); quota_local_cleanup (_this, _local); } while (
0)
1023 NULL, NULL, NULL)do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_mkdir_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 1023, 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, -1, op_errno, ((void*)0), ((void*)0), ((void*)0), (
(void*)0), ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0); quota_local_cleanup (_this, _local); } while (
0)
;
1024 return 0;
1025}
1026
1027
1028int32_t
1029quota_mkdir (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode,
1030 mode_t umask, dict_t *xdata)
1031{
1032 int32_t ret = 0, op_errno = 0;
1033 quota_local_t *local = NULL((void*)0);
1034 call_stub_t *stub = NULL((void*)0);
1035
1036 local = quota_local_new ();
1037 if (local == NULL((void*)0)) {
1038 op_errno = ENOMEM12;
1039 goto err;
1040 }
1041
1042 frame->local = local;
1043
1044 local->link_count = 1;
1045
1046 ret = loc_copy (&local->loc, loc);
1047 if (ret) {
1048 op_errno = ENOMEM12;
1049 gf_log (this->name, GF_LOG_WARNING, "loc_copy failed")do { do { if (0) printf ("loc_copy failed"); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 1049, GF_LOG_WARNING
, "loc_copy failed"); } while (0)
;
1050 goto err;
1051 }
1052
1053 stub = fop_mkdir_stub (frame, quota_mkdir_helper, loc, mode, umask,
1054 xdata);
1055 if (stub == NULL((void*)0)) {
1056 op_errno = ENOMEM12;
1057 goto err;
1058 }
1059
1060 local->stub = stub;
1061 local->delta = 0;
1062
1063 quota_check_limit (frame, loc->parent, this, NULL((void*)0), NULL((void*)0));
1064
1065 stub = NULL((void*)0);
1066
1067 LOCK (&local->lock)pthread_spin_lock (&local->lock);
1068 {
1069 if (local->validate_count == 0) {
1070 stub = local->stub;
1071 local->stub = NULL((void*)0);
1072 }
1073
1074 local->link_count = 0;
1075 }
1076 UNLOCK (&local->lock)pthread_spin_unlock (&local->lock);
1077
1078 if (stub != NULL((void*)0)) {
1079 call_resume (stub);
1080 }
1081
1082 return 0;
1083err:
1084 QUOTA_STACK_UNWIND (mkdir, frame, -1, op_errno, NULL, NULL, NULL,do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_mkdir_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 1085, 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, -1, op_errno, ((void*)0), ((void*)0), ((void*)0), (
(void*)0), ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0); quota_local_cleanup (_this, _local); } while (
0)
1085 NULL, NULL)do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_mkdir_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 1085, 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, -1, op_errno, ((void*)0), ((void*)0), ((void*)0), (
(void*)0), ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0); quota_local_cleanup (_this, _local); } while (
0)
;
1086
1087 return 0;
1088}
1089
1090
1091int32_t
1092quota_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
1093 int32_t op_ret, int32_t op_errno, fd_t *fd, inode_t *inode,
1094 struct iatt *buf, struct iatt *preparent,
1095 struct iatt *postparent, dict_t *xdata)
1096{
1097 int32_t ret = -1;
1098 quota_local_t *local = NULL((void*)0);
1099 quota_inode_ctx_t *ctx = NULL((void*)0);
1100 quota_dentry_t *dentry = NULL((void*)0);
1101
1102 local = frame->local;
1103 if (op_ret < 0) {
1104 goto unwind;
1105 }
1106
1107 ret = quota_inode_ctx_get (inode, -1, this, NULL((void*)0), buf, &ctx, 1);
1108 if ((ret == -1) || (ctx == NULL((void*)0))) {
1109 gf_log (this->name, GF_LOG_WARNING, "cannot create quota "do { do { if (0) printf ("cannot create quota " "context in inode(gfid:%s)"
, uuid_utoa (inode->gfid)); } while (0); _gf_log (this->
name, "quota.c", __FUNCTION__, 1111, GF_LOG_WARNING, "cannot create quota "
"context in inode(gfid:%s)", uuid_utoa (inode->gfid)); } while
(0)
1110 "context in inode(gfid:%s)",do { do { if (0) printf ("cannot create quota " "context in inode(gfid:%s)"
, uuid_utoa (inode->gfid)); } while (0); _gf_log (this->
name, "quota.c", __FUNCTION__, 1111, GF_LOG_WARNING, "cannot create quota "
"context in inode(gfid:%s)", uuid_utoa (inode->gfid)); } while
(0)
1111 uuid_utoa (inode->gfid))do { do { if (0) printf ("cannot create quota " "context in inode(gfid:%s)"
, uuid_utoa (inode->gfid)); } while (0); _gf_log (this->
name, "quota.c", __FUNCTION__, 1111, GF_LOG_WARNING, "cannot create quota "
"context in inode(gfid:%s)", uuid_utoa (inode->gfid)); } while
(0)
;
1112 op_ret = -1;
1113 op_errno = ENOMEM12;
1114 goto unwind;
1115 }
1116
1117 LOCK (&ctx->lock)pthread_spin_lock (&ctx->lock);
1118 {
1119 ctx->buf = *buf;
1120
1121 dentry = __quota_dentry_new (ctx, (char *)local->loc.name,
1122 local->loc.parent->gfid);
1123 if (dentry == NULL((void*)0)) {
1124 gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("cannot create a new dentry (name:%s) for "
"inode(gfid:%s)", local->loc.name, uuid_utoa (local->loc
.inode->gfid)); } while (0); _gf_log (this->name, "quota.c"
, __FUNCTION__, 1127, GF_LOG_WARNING, "cannot create a new dentry (name:%s) for "
"inode(gfid:%s)", local->loc.name, uuid_utoa (local->loc
.inode->gfid)); } while (0)
1125 "cannot create a new dentry (name:%s) for "do { do { if (0) printf ("cannot create a new dentry (name:%s) for "
"inode(gfid:%s)", local->loc.name, uuid_utoa (local->loc
.inode->gfid)); } while (0); _gf_log (this->name, "quota.c"
, __FUNCTION__, 1127, GF_LOG_WARNING, "cannot create a new dentry (name:%s) for "
"inode(gfid:%s)", local->loc.name, uuid_utoa (local->loc
.inode->gfid)); } while (0)
1126 "inode(gfid:%s)", local->loc.name,do { do { if (0) printf ("cannot create a new dentry (name:%s) for "
"inode(gfid:%s)", local->loc.name, uuid_utoa (local->loc
.inode->gfid)); } while (0); _gf_log (this->name, "quota.c"
, __FUNCTION__, 1127, GF_LOG_WARNING, "cannot create a new dentry (name:%s) for "
"inode(gfid:%s)", local->loc.name, uuid_utoa (local->loc
.inode->gfid)); } while (0)
1127 uuid_utoa (local->loc.inode->gfid))do { do { if (0) printf ("cannot create a new dentry (name:%s) for "
"inode(gfid:%s)", local->loc.name, uuid_utoa (local->loc
.inode->gfid)); } while (0); _gf_log (this->name, "quota.c"
, __FUNCTION__, 1127, GF_LOG_WARNING, "cannot create a new dentry (name:%s) for "
"inode(gfid:%s)", local->loc.name, uuid_utoa (local->loc
.inode->gfid)); } while (0)
;
1128 op_ret = -1;
1129 op_errno = ENOMEM12;
1130 goto unlock;
1131 }
1132 }
1133unlock:
1134 UNLOCK (&ctx->lock)pthread_spin_unlock (&ctx->lock);
1135
1136unwind:
1137 QUOTA_STACK_UNWIND (create, frame, op_ret, op_errno, fd, inode, buf,do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_create_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 1138, 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); quota_local_cleanup (_this, _local); } while (0)
1138 preparent, postparent, xdata)do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_create_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 1138, 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); quota_local_cleanup (_this, _local); } while (0)
;
1139 return 0;
1140}
1141
1142
1143int32_t
1144quota_create_helper (call_frame_t *frame, xlator_t *this, loc_t *loc,
1145 int32_t flags, mode_t mode, mode_t umask, fd_t *fd,
1146 dict_t *xdata)
1147{
1148 quota_local_t *local = NULL((void*)0);
1149 int32_t op_errno = EINVAL22;
1150
1151 local = frame->local;
1152 if (local == NULL((void*)0)) {
1153 gf_log (this->name, GF_LOG_WARNING, "local is NULL")do { do { if (0) printf ("local is NULL"); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 1153, GF_LOG_WARNING
, "local is NULL"); } while (0)
;
1154 goto unwind;
1155 }
1156
1157 if (local->op_ret == -1) {
1158 op_errno = local->op_errno;
1159 goto unwind;
1160 }
1161
1162 STACK_WIND (frame, quota_create_cbk, FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "quota.c", __FUNCTION__, 1164, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->create_cbk) tmp_cbk = quota_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 = "quota_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)
1163 FIRST_CHILD(this)->fops->create, loc, flags, mode, umask,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "quota.c", __FUNCTION__, 1164, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->create_cbk) tmp_cbk = quota_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 = "quota_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)
1164 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", "quota.c", __FUNCTION__, 1164, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->create_cbk) tmp_cbk = quota_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 = "quota_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)
;
1165 return 0;
1166
1167unwind:
1168 QUOTA_STACK_UNWIND (create, frame, -1, op_errno, NULL, NULL,do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_create_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 1169, 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, -1, op_errno, ((void*)0), ((void*)0), ((void*)0), (
(void*)0), ((void*)0), ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); quota_local_cleanup (_this, _local
); } while (0)
1169 NULL, NULL, NULL, NULL)do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_create_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 1169, 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, -1, op_errno, ((void*)0), ((void*)0), ((void*)0), (
(void*)0), ((void*)0), ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); quota_local_cleanup (_this, _local
); } while (0)
;
1170 return 0;
1171}
1172
1173
1174int32_t
1175quota_create (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags,
1176 mode_t mode, mode_t umask, fd_t *fd, dict_t *xdata)
1177{
1178 int32_t ret = -1;
1179 quota_local_t *local = NULL((void*)0);
1180 call_stub_t *stub = NULL((void*)0);
1181
1182 local = quota_local_new ();
1183 if (local == NULL((void*)0)) {
1184 goto err;
1185 }
1186
1187 frame->local = local;
1188
1189 ret = loc_copy (&local->loc, loc);
1190 if (ret) {
1191 gf_log (this->name, GF_LOG_WARNING, "loc_copy failed")do { do { if (0) printf ("loc_copy failed"); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 1191, GF_LOG_WARNING
, "loc_copy failed"); } while (0)
;
1192 goto err;
1193 }
1194
1195 stub = fop_create_stub (frame, quota_create_helper, loc, flags, mode,
1196 umask, fd, xdata);
1197 if (stub == NULL((void*)0)) {
1198 goto err;
1199 }
1200
1201 local->link_count = 1;
1202 local->stub = stub;
1203 local->delta = 0;
1204
1205 quota_check_limit (frame, loc->parent, this, NULL((void*)0), NULL((void*)0));
1206
1207 stub = NULL((void*)0);
1208
1209 LOCK (&local->lock)pthread_spin_lock (&local->lock);
1210 {
1211 local->link_count = 0;
1212 if (local->validate_count == 0) {
1213 stub = local->stub;
1214 local->stub = NULL((void*)0);
1215 }
1216 }
1217 UNLOCK (&local->lock)pthread_spin_unlock (&local->lock);
1218
1219 if (stub != NULL((void*)0)) {
1220 call_resume (stub);
1221 }
1222
1223 return 0;
1224err:
1225 QUOTA_STACK_UNWIND (create, frame, -1, ENOMEM, NULL, NULL, NULL, NULL,do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_create_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 1226, 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, -1, 12, ((void*)0), ((void*)0), ((void*)0), ((void
*)0), ((void*)0), ((void*)0)); (*__glusterfs_this_location())
= old_THIS; } while (0); quota_local_cleanup (_this, _local)
; } while (0)
1226 NULL, NULL)do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_create_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 1226, 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, -1, 12, ((void*)0), ((void*)0), ((void*)0), ((void
*)0), ((void*)0), ((void*)0)); (*__glusterfs_this_location())
= old_THIS; } while (0); quota_local_cleanup (_this, _local)
; } while (0)
;
1227
1228 return 0;
1229}
1230
1231
1232int32_t
1233quota_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
1234 int32_t op_ret, int32_t op_errno, struct iatt *preparent,
1235 struct iatt *postparent, dict_t *xdata)
1236{
1237 quota_local_t *local = NULL((void*)0);
1238 quota_inode_ctx_t *ctx = NULL((void*)0);
1239 uint64_t value = 0;
1240
1241 if (op_ret < 0) {
1242 goto out;
1243 }
1244
1245 local = (quota_local_t *) frame->local;
1246
1247 inode_ctx_get (local->loc.inode, this, &value)inode_ctx_get2(local->loc.inode,this,&value,0);
1248 ctx = (quota_inode_ctx_t *)(unsigned long)value;
1249
1250 if (ctx == NULL((void*)0)) {
1251 gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("quota context not set in inode (gfid:%s)"
, uuid_utoa (local->loc.inode->gfid)); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 1253, GF_LOG_WARNING
, "quota context not set in inode (gfid:%s)", uuid_utoa (local
->loc.inode->gfid)); } while (0)
1252 "quota context not set in inode (gfid:%s)",do { do { if (0) printf ("quota context not set in inode (gfid:%s)"
, uuid_utoa (local->loc.inode->gfid)); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 1253, GF_LOG_WARNING
, "quota context not set in inode (gfid:%s)", uuid_utoa (local
->loc.inode->gfid)); } while (0)
1253 uuid_utoa (local->loc.inode->gfid))do { do { if (0) printf ("quota context not set in inode (gfid:%s)"
, uuid_utoa (local->loc.inode->gfid)); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 1253, GF_LOG_WARNING
, "quota context not set in inode (gfid:%s)", uuid_utoa (local
->loc.inode->gfid)); } while (0)
;
1254 goto out;
1255 }
1256
1257 quota_update_size (this, local->loc.inode, (char *)local->loc.name,
1258 local->loc.parent->gfid,
1259 (-(ctx->buf.ia_blocks * 512)));
1260
1261out:
1262 QUOTA_STACK_UNWIND (unlink, frame, op_ret, op_errno, preparent,do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_unlink_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 1263, 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); quota_local_cleanup
(_this, _local); } while (0)
1263 postparent, xdata)do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_unlink_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 1263, 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); quota_local_cleanup
(_this, _local); } while (0)
;
1264 return 0;
1265}
1266
1267
1268int32_t
1269quota_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc, int xflag,
1270 dict_t *xdata)
1271{
1272 int32_t ret = 0;
1273 quota_local_t *local = NULL((void*)0);
1274
1275 local = quota_local_new ();
1276 if (local == NULL((void*)0)) {
1277 goto err;
1278 }
1279
1280 frame->local = local;
1281
1282 ret = loc_copy (&local->loc, loc);
1283 if (ret) {
1284 gf_log (this->name, GF_LOG_WARNING, "loc_copy failed")do { do { if (0) printf ("loc_copy failed"); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 1284, GF_LOG_WARNING
, "loc_copy failed"); } while (0)
;
1285 goto err;
1286 }
1287
1288 STACK_WIND (frame, quota_unlink_cbk, FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "quota.c", __FUNCTION__, 1289, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->unlink_cbk) tmp_cbk = quota_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 = "quota_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)
1289 FIRST_CHILD(this)->fops->unlink, 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", "quota.c", __FUNCTION__, 1289, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->unlink_cbk) tmp_cbk = quota_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 = "quota_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)
;
1290
1291 ret = 0;
1292
1293err:
1294 if (ret == -1) {
1295 QUOTA_STACK_UNWIND (unlink, frame, -1, 0, NULL, NULL, NULL)do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_unlink_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 1295, 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, -1, 0, ((void*)0), ((void*)0), ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); quota_local_cleanup (_this, _local
); } while (0)
;
1296 }
1297
1298 return 0;
1299}
1300
1301
1302int32_t
1303quota_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
1304 int32_t op_ret, int32_t op_errno, inode_t *inode,
1305 struct iatt *buf, struct iatt *preparent,
1306 struct iatt *postparent, dict_t *xdata)
1307{
1308 int32_t ret = -1;
1309 quota_local_t *local = NULL((void*)0);
1310 quota_inode_ctx_t *ctx = NULL((void*)0);
1311 quota_dentry_t *dentry = NULL((void*)0);
1312 char found = 0;
1313
1314 if (op_ret < 0) {
1315 goto out;
1316 }
1317
1318 local = (quota_local_t *) frame->local;
1319
1320 quota_update_size (this, local->loc.parent, NULL((void*)0), NULL((void*)0),
1321 (buf->ia_blocks * 512));
1322
1323 ret = quota_inode_ctx_get (inode, -1, this, NULL((void*)0), NULL((void*)0), &ctx, 0);
1324 if ((ret == -1) || (ctx == NULL((void*)0))) {
1325 gf_log (this->name, GF_LOG_WARNING, "cannot find quota "do { do { if (0) printf ("cannot find quota " "context in %s (gfid:%s)"
, local->loc.path, uuid_utoa (inode->gfid)); } while (0
); _gf_log (this->name, "quota.c", __FUNCTION__, 1327, GF_LOG_WARNING
, "cannot find quota " "context in %s (gfid:%s)", local->loc
.path, uuid_utoa (inode->gfid)); } while (0)
1326 "context in %s (gfid:%s)", local->loc.path,do { do { if (0) printf ("cannot find quota " "context in %s (gfid:%s)"
, local->loc.path, uuid_utoa (inode->gfid)); } while (0
); _gf_log (this->name, "quota.c", __FUNCTION__, 1327, GF_LOG_WARNING
, "cannot find quota " "context in %s (gfid:%s)", local->loc
.path, uuid_utoa (inode->gfid)); } while (0)
1327 uuid_utoa (inode->gfid))do { do { if (0) printf ("cannot find quota " "context in %s (gfid:%s)"
, local->loc.path, uuid_utoa (inode->gfid)); } while (0
); _gf_log (this->name, "quota.c", __FUNCTION__, 1327, GF_LOG_WARNING
, "cannot find quota " "context in %s (gfid:%s)", local->loc
.path, uuid_utoa (inode->gfid)); } while (0)
;
1328 op_ret = -1;
1329 op_errno = EINVAL22;
1330 goto out;
1331 }
1332
1333 LOCK (&ctx->lock)pthread_spin_lock (&ctx->lock);
1334 {
1335 list_for_each_entry (dentry, &ctx->parents, next)for (dentry = ((typeof(*dentry) *)((char *)((&ctx->parents
)->next)-(unsigned long)(&((typeof(*dentry) *)0)->next
))); &dentry->next != (&ctx->parents); dentry =
((typeof(*dentry) *)((char *)(dentry->next.next)-(unsigned
long)(&((typeof(*dentry) *)0)->next))))
{
1336 if ((strcmp (dentry->name, local->loc.name) == 0) &&
1337 (uuid_compare (local->loc.parent->gfid,
1338 dentry->par) == 0)) {
1339 found = 1;
1340 gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("new entry being linked (name:%s) for "
"inode (gfid:%s) is already present " "in inode-dentry-list"
, dentry->name, uuid_utoa (local->loc.inode->gfid));
} while (0); _gf_log (this->name, "quota.c", __FUNCTION__
, 1344, GF_LOG_WARNING, "new entry being linked (name:%s) for "
"inode (gfid:%s) is already present " "in inode-dentry-list"
, dentry->name, uuid_utoa (local->loc.inode->gfid));
} while (0)
1341 "new entry being linked (name:%s) for "do { do { if (0) printf ("new entry being linked (name:%s) for "
"inode (gfid:%s) is already present " "in inode-dentry-list"
, dentry->name, uuid_utoa (local->loc.inode->gfid));
} while (0); _gf_log (this->name, "quota.c", __FUNCTION__
, 1344, GF_LOG_WARNING, "new entry being linked (name:%s) for "
"inode (gfid:%s) is already present " "in inode-dentry-list"
, dentry->name, uuid_utoa (local->loc.inode->gfid));
} while (0)
1342 "inode (gfid:%s) is already present "do { do { if (0) printf ("new entry being linked (name:%s) for "
"inode (gfid:%s) is already present " "in inode-dentry-list"
, dentry->name, uuid_utoa (local->loc.inode->gfid));
} while (0); _gf_log (this->name, "quota.c", __FUNCTION__
, 1344, GF_LOG_WARNING, "new entry being linked (name:%s) for "
"inode (gfid:%s) is already present " "in inode-dentry-list"
, dentry->name, uuid_utoa (local->loc.inode->gfid));
} while (0)
1343 "in inode-dentry-list", dentry->name,do { do { if (0) printf ("new entry being linked (name:%s) for "
"inode (gfid:%s) is already present " "in inode-dentry-list"
, dentry->name, uuid_utoa (local->loc.inode->gfid));
} while (0); _gf_log (this->name, "quota.c", __FUNCTION__
, 1344, GF_LOG_WARNING, "new entry being linked (name:%s) for "
"inode (gfid:%s) is already present " "in inode-dentry-list"
, dentry->name, uuid_utoa (local->loc.inode->gfid));
} while (0)
1344 uuid_utoa (local->loc.inode->gfid))do { do { if (0) printf ("new entry being linked (name:%s) for "
"inode (gfid:%s) is already present " "in inode-dentry-list"
, dentry->name, uuid_utoa (local->loc.inode->gfid));
} while (0); _gf_log (this->name, "quota.c", __FUNCTION__
, 1344, GF_LOG_WARNING, "new entry being linked (name:%s) for "
"inode (gfid:%s) is already present " "in inode-dentry-list"
, dentry->name, uuid_utoa (local->loc.inode->gfid));
} while (0)
;
1345 break;
1346 }
1347 }
1348
1349 if (!found) {
1350 dentry = __quota_dentry_new (ctx,
1351 (char *)local->loc.name,
1352 local->loc.parent->gfid);
1353 if (dentry == NULL((void*)0)) {
1354 gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("cannot create a new dentry (name:%s) "
"for inode(gfid:%s)", local->loc.name, uuid_utoa (local->
loc.inode->gfid)); } while (0); _gf_log (this->name, "quota.c"
, __FUNCTION__, 1357, GF_LOG_WARNING, "cannot create a new dentry (name:%s) "
"for inode(gfid:%s)", local->loc.name, uuid_utoa (local->
loc.inode->gfid)); } while (0)
1355 "cannot create a new dentry (name:%s) "do { do { if (0) printf ("cannot create a new dentry (name:%s) "
"for inode(gfid:%s)", local->loc.name, uuid_utoa (local->
loc.inode->gfid)); } while (0); _gf_log (this->name, "quota.c"
, __FUNCTION__, 1357, GF_LOG_WARNING, "cannot create a new dentry (name:%s) "
"for inode(gfid:%s)", local->loc.name, uuid_utoa (local->
loc.inode->gfid)); } while (0)
1356 "for inode(gfid:%s)", local->loc.name,do { do { if (0) printf ("cannot create a new dentry (name:%s) "
"for inode(gfid:%s)", local->loc.name, uuid_utoa (local->
loc.inode->gfid)); } while (0); _gf_log (this->name, "quota.c"
, __FUNCTION__, 1357, GF_LOG_WARNING, "cannot create a new dentry (name:%s) "
"for inode(gfid:%s)", local->loc.name, uuid_utoa (local->
loc.inode->gfid)); } while (0)
1357 uuid_utoa (local->loc.inode->gfid))do { do { if (0) printf ("cannot create a new dentry (name:%s) "
"for inode(gfid:%s)", local->loc.name, uuid_utoa (local->
loc.inode->gfid)); } while (0); _gf_log (this->name, "quota.c"
, __FUNCTION__, 1357, GF_LOG_WARNING, "cannot create a new dentry (name:%s) "
"for inode(gfid:%s)", local->loc.name, uuid_utoa (local->
loc.inode->gfid)); } while (0)
;
1358 op_ret = -1;
1359 op_errno = ENOMEM12;
1360 goto unlock;
1361 }
1362 }
1363
1364 ctx->buf = *buf;
1365 }
1366unlock:
1367 UNLOCK (&ctx->lock)pthread_spin_unlock (&ctx->lock);
1368
1369out:
1370 QUOTA_STACK_UNWIND (link, frame, op_ret, op_errno, inode, buf,do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_link_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 1371, 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); quota_local_cleanup (_this, _local); } while (0)
1371 preparent, postparent, xdata)do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_link_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 1371, 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); quota_local_cleanup (_this, _local); } while (0)
;
1372
1373 return 0;
1374}
1375
1376
1377int32_t
1378quota_link_helper (call_frame_t *frame, xlator_t *this, loc_t *oldloc,
1379 loc_t *newloc, dict_t *xdata)
1380{
1381 quota_local_t *local = NULL((void*)0);
1382 int32_t op_errno = EINVAL22;
1383
1384 local = frame->local;
1385 if (local == NULL((void*)0)) {
1386 gf_log (this->name, GF_LOG_WARNING, "local is NULL")do { do { if (0) printf ("local is NULL"); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 1386, GF_LOG_WARNING
, "local is NULL"); } while (0)
;
1387 goto unwind;
1388 }
1389
1390 op_errno = local->op_errno;
1391
1392 if (local->op_ret == -1) {
1393 goto unwind;
1394 }
1395
1396 STACK_WIND (frame, quota_link_cbk, FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "quota.c", __FUNCTION__, 1397, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->link_cbk) tmp_cbk = quota_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 = "quota_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)
1397 FIRST_CHILD(this)->fops->link, 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", "quota.c", __FUNCTION__, 1397, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->link_cbk) tmp_cbk = quota_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 = "quota_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)
;
1398 return 0;
1399
1400unwind:
1401 QUOTA_STACK_UNWIND (link, frame, -1, op_errno, NULL, NULL,do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_link_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 1402, 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, -1, op_errno, ((void*)0), ((void*)0), ((void*)0), (
(void*)0), ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0); quota_local_cleanup (_this, _local); } while (
0)
1402 NULL, NULL, NULL)do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_link_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 1402, 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, -1, op_errno, ((void*)0), ((void*)0), ((void*)0), (
(void*)0), ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0); quota_local_cleanup (_this, _local); } while (
0)
;
1403 return 0;
1404}
1405
1406
1407int32_t
1408quota_link (call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc,
1409 dict_t *xdata)
1410{
1411 int32_t ret = -1, op_errno = ENOMEM12;
1412 quota_local_t *local = NULL((void*)0);
1413 call_stub_t *stub = NULL((void*)0);
1414 quota_inode_ctx_t *ctx = NULL((void*)0);
1415
1416 local = quota_local_new ();
1417 if (local == NULL((void*)0)) {
1418 goto err;
1419 }
1420
1421 frame->local = (void *) local;
1422
1423 ret = loc_copy (&local->loc, newloc);
1424 if (ret == -1) {
1425 gf_log (this->name, GF_LOG_WARNING, "loc_copy failed")do { do { if (0) printf ("loc_copy failed"); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 1425, GF_LOG_WARNING
, "loc_copy failed"); } while (0)
;
1426 goto err;
1427 }
1428
1429 stub = fop_link_stub (frame, quota_link_helper, oldloc, newloc, xdata);
1430 if (stub == NULL((void*)0)) {
1431 goto err;
1432 }
1433
1434 local->link_count = 1;
1435 local->stub = stub;
1436
1437 ret = quota_inode_ctx_get (oldloc->inode, -1, this, NULL((void*)0), NULL((void*)0), &ctx,
1438 0);
1439 if (ctx == NULL((void*)0)) {
1440 gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("quota context not set in inode (gfid:%s)"
, oldloc->inode ? uuid_utoa (oldloc->inode->gfid) : "0"
); } while (0); _gf_log (this->name, "quota.c", __FUNCTION__
, 1442, GF_LOG_WARNING, "quota context not set in inode (gfid:%s)"
, oldloc->inode ? uuid_utoa (oldloc->inode->gfid) : "0"
); } while (0)
1441 "quota context not set in inode (gfid:%s)",do { do { if (0) printf ("quota context not set in inode (gfid:%s)"
, oldloc->inode ? uuid_utoa (oldloc->inode->gfid) : "0"
); } while (0); _gf_log (this->name, "quota.c", __FUNCTION__
, 1442, GF_LOG_WARNING, "quota context not set in inode (gfid:%s)"
, oldloc->inode ? uuid_utoa (oldloc->inode->gfid) : "0"
); } while (0)
1442 oldloc->inode ? uuid_utoa (oldloc->inode->gfid) : "0")do { do { if (0) printf ("quota context not set in inode (gfid:%s)"
, oldloc->inode ? uuid_utoa (oldloc->inode->gfid) : "0"
); } while (0); _gf_log (this->name, "quota.c", __FUNCTION__
, 1442, GF_LOG_WARNING, "quota context not set in inode (gfid:%s)"
, oldloc->inode ? uuid_utoa (oldloc->inode->gfid) : "0"
); } while (0)
;
1443 op_errno = EINVAL22;
1444 goto err;
1445 }
1446
1447 local->delta = ctx->buf.ia_blocks * 512;
1448
1449 quota_check_limit (frame, newloc->parent, this, NULL((void*)0), NULL((void*)0));
1450
1451 stub = NULL((void*)0);
1452
1453 LOCK (&local->lock)pthread_spin_lock (&local->lock);
1454 {
1455 if (local->validate_count == 0) {
1456 stub = local->stub;
1457 local->stub = NULL((void*)0);
1458 }
1459
1460 local->link_count = 0;
1461 }
1462 UNLOCK (&local->lock)pthread_spin_unlock (&local->lock);
1463
1464 if (stub != NULL((void*)0)) {
1465 call_resume (stub);
1466 }
1467
1468 ret = 0;
1469err:
1470 if (ret < 0) {
1471 QUOTA_STACK_UNWIND (link, frame, -1, op_errno, NULL, NULL,do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_link_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 1472, 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, -1, op_errno, ((void*)0), ((void*)0), ((void*)0), (
(void*)0), ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0); quota_local_cleanup (_this, _local); } while (
0)
1472 NULL, NULL, NULL)do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_link_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 1472, 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, -1, op_errno, ((void*)0), ((void*)0), ((void*)0), (
(void*)0), ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0); quota_local_cleanup (_this, _local); } while (
0)
;
1473 }
1474
1475 return 0;
1476}
1477
1478
1479int32_t
1480quota_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
1481 int32_t op_ret, int32_t op_errno, struct iatt *buf,
1482 struct iatt *preoldparent, struct iatt *postoldparent,
1483 struct iatt *prenewparent, struct iatt *postnewparent,
1484 dict_t *xdata)
1485{
1486 int32_t ret = -1;
1487 quota_local_t *local = NULL((void*)0);
1488 quota_inode_ctx_t *ctx = NULL((void*)0);
1489 quota_dentry_t *old_dentry = NULL((void*)0), *dentry = NULL((void*)0);
1490 char new_dentry_found = 0;
1491 int64_t size = 0;
1492
1493 if (op_ret < 0) {
1494 goto out;
1495 }
1496
1497 local = frame->local;
1498 if (local == NULL((void*)0)) {
1499 op_ret = -1;
1500 op_errno = EINVAL22;
1501 gf_log (this->name, GF_LOG_WARNING, "local is NULL")do { do { if (0) printf ("local is NULL"); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 1501, GF_LOG_WARNING
, "local is NULL"); } while (0)
;
1502 goto out;
1503 }
1504
1505 if (IA_ISREG (local->oldloc.inode->ia_type)(local->oldloc.inode->ia_type == IA_IFREG)
1506 || IA_ISLNK (local->oldloc.inode->ia_type)(local->oldloc.inode->ia_type == IA_IFLNK)) {
1507 size = buf->ia_blocks * 512;
1508 }
1509
1510 if (local->oldloc.parent != local->newloc.parent) {
1511 quota_update_size (this, local->oldloc.parent, NULL((void*)0), NULL((void*)0), (-size));
1512 quota_update_size (this, local->newloc.parent, NULL((void*)0), NULL((void*)0), size);
1513 }
1514
1515 if (!(IA_ISREG (local->oldloc.inode->ia_type)(local->oldloc.inode->ia_type == IA_IFREG)
1516 || IA_ISLNK (local->oldloc.inode->ia_type)(local->oldloc.inode->ia_type == IA_IFLNK))) {
1517 goto out;
1518 }
1519
1520 ret = quota_inode_ctx_get (local->oldloc.inode, -1, this, NULL((void*)0), NULL((void*)0),
1521 &ctx, 0);
1522 if ((ret == -1) || (ctx == NULL((void*)0))) {
1523 gf_log (this->name, GF_LOG_WARNING, "quota context not"do { do { if (0) printf ("quota context not" "set in inode(gfid:%s)"
, uuid_utoa (local->oldloc.inode->gfid)); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 1525, GF_LOG_WARNING
, "quota context not" "set in inode(gfid:%s)", uuid_utoa (local
->oldloc.inode->gfid)); } while (0)
1524 "set in inode(gfid:%s)",do { do { if (0) printf ("quota context not" "set in inode(gfid:%s)"
, uuid_utoa (local->oldloc.inode->gfid)); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 1525, GF_LOG_WARNING
, "quota context not" "set in inode(gfid:%s)", uuid_utoa (local
->oldloc.inode->gfid)); } while (0)
1525 uuid_utoa (local->oldloc.inode->gfid))do { do { if (0) printf ("quota context not" "set in inode(gfid:%s)"
, uuid_utoa (local->oldloc.inode->gfid)); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 1525, GF_LOG_WARNING
, "quota context not" "set in inode(gfid:%s)", uuid_utoa (local
->oldloc.inode->gfid)); } while (0)
;
1526 op_ret = -1;
1527 op_errno = EINVAL22;
1528 goto out;
1529 }
1530
1531 LOCK (&ctx->lock)pthread_spin_lock (&ctx->lock);
1532 {
1533 /* decision of whether to create a context in newloc->inode
1534 * depends on fuse_rename_cbk's choice of inode it retains
1535 * after rename. currently it just associates oldloc->inode
1536 * with new parent and name. If this changes, following code
1537 * should be changed to set a new context in newloc->inode.
1538 */
1539 list_for_each_entry (dentry, &ctx->parents, next)for (dentry = ((typeof(*dentry) *)((char *)((&ctx->parents
)->next)-(unsigned long)(&((typeof(*dentry) *)0)->next
))); &dentry->next != (&ctx->parents); dentry =
((typeof(*dentry) *)((char *)(dentry->next.next)-(unsigned
long)(&((typeof(*dentry) *)0)->next))))
{
1540 if ((strcmp (dentry->name, local->oldloc.name) == 0) &&
1541 (uuid_compare (local->oldloc.parent->gfid,
1542 dentry->par) == 0)) {
1543 old_dentry = dentry;
1544 } else if ((strcmp (dentry->name,
1545 local->newloc.name) == 0) &&
1546 (uuid_compare (local->oldloc.parent->gfid,
1547 dentry->par) == 0)) {
1548 new_dentry_found = 1;
1549 gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("new entry being linked (name:%s) for "
"inode (gfid:%s) is already present " "in inode-dentry-list"
, dentry->name, uuid_utoa (local->newloc.inode->gfid
)); } while (0); _gf_log (this->name, "quota.c", __FUNCTION__
, 1553, GF_LOG_WARNING, "new entry being linked (name:%s) for "
"inode (gfid:%s) is already present " "in inode-dentry-list"
, dentry->name, uuid_utoa (local->newloc.inode->gfid
)); } while (0)
1550 "new entry being linked (name:%s) for "do { do { if (0) printf ("new entry being linked (name:%s) for "
"inode (gfid:%s) is already present " "in inode-dentry-list"
, dentry->name, uuid_utoa (local->newloc.inode->gfid
)); } while (0); _gf_log (this->name, "quota.c", __FUNCTION__
, 1553, GF_LOG_WARNING, "new entry being linked (name:%s) for "
"inode (gfid:%s) is already present " "in inode-dentry-list"
, dentry->name, uuid_utoa (local->newloc.inode->gfid
)); } while (0)
1551 "inode (gfid:%s) is already present "do { do { if (0) printf ("new entry being linked (name:%s) for "
"inode (gfid:%s) is already present " "in inode-dentry-list"
, dentry->name, uuid_utoa (local->newloc.inode->gfid
)); } while (0); _gf_log (this->name, "quota.c", __FUNCTION__
, 1553, GF_LOG_WARNING, "new entry being linked (name:%s) for "
"inode (gfid:%s) is already present " "in inode-dentry-list"
, dentry->name, uuid_utoa (local->newloc.inode->gfid
)); } while (0)
1552 "in inode-dentry-list", dentry->name,do { do { if (0) printf ("new entry being linked (name:%s) for "
"inode (gfid:%s) is already present " "in inode-dentry-list"
, dentry->name, uuid_utoa (local->newloc.inode->gfid
)); } while (0); _gf_log (this->name, "quota.c", __FUNCTION__
, 1553, GF_LOG_WARNING, "new entry being linked (name:%s) for "
"inode (gfid:%s) is already present " "in inode-dentry-list"
, dentry->name, uuid_utoa (local->newloc.inode->gfid
)); } while (0)
1553 uuid_utoa (local->newloc.inode->gfid))do { do { if (0) printf ("new entry being linked (name:%s) for "
"inode (gfid:%s) is already present " "in inode-dentry-list"
, dentry->name, uuid_utoa (local->newloc.inode->gfid
)); } while (0); _gf_log (this->name, "quota.c", __FUNCTION__
, 1553, GF_LOG_WARNING, "new entry being linked (name:%s) for "
"inode (gfid:%s) is already present " "in inode-dentry-list"
, dentry->name, uuid_utoa (local->newloc.inode->gfid
)); } while (0)
;
1554 break;
1555 }
1556 }
1557
1558 if (old_dentry != NULL((void*)0)) {
1559 __quota_dentry_free (old_dentry);
1560 } else {
1561 gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("dentry corresponding to the path just renamed "
"(name:%s) is not present", local->oldloc.name); } while (
0); _gf_log (this->name, "quota.c", __FUNCTION__, 1563, GF_LOG_WARNING
, "dentry corresponding to the path just renamed " "(name:%s) is not present"
, local->oldloc.name); } while (0)
1562 "dentry corresponding to the path just renamed "do { do { if (0) printf ("dentry corresponding to the path just renamed "
"(name:%s) is not present", local->oldloc.name); } while (
0); _gf_log (this->name, "quota.c", __FUNCTION__, 1563, GF_LOG_WARNING
, "dentry corresponding to the path just renamed " "(name:%s) is not present"
, local->oldloc.name); } while (0)
1563 "(name:%s) is not present", local->oldloc.name)do { do { if (0) printf ("dentry corresponding to the path just renamed "
"(name:%s) is not present", local->oldloc.name); } while (
0); _gf_log (this->name, "quota.c", __FUNCTION__, 1563, GF_LOG_WARNING
, "dentry corresponding to the path just renamed " "(name:%s) is not present"
, local->oldloc.name); } while (0)
;
1564 }
1565
1566 if (!new_dentry_found) {
1567 dentry = __quota_dentry_new (ctx,
1568 (char *)local->newloc.name,
1569 local->newloc.parent->gfid);
1570 if (dentry == NULL((void*)0)) {
1571 gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("cannot create a new dentry (name:%s) "
"for inode(gfid:%s)", local->newloc.name, uuid_utoa (local
->newloc.inode->gfid)); } while (0); _gf_log (this->
name, "quota.c", __FUNCTION__, 1574, GF_LOG_WARNING, "cannot create a new dentry (name:%s) "
"for inode(gfid:%s)", local->newloc.name, uuid_utoa (local
->newloc.inode->gfid)); } while (0)
1572 "cannot create a new dentry (name:%s) "do { do { if (0) printf ("cannot create a new dentry (name:%s) "
"for inode(gfid:%s)", local->newloc.name, uuid_utoa (local
->newloc.inode->gfid)); } while (0); _gf_log (this->
name, "quota.c", __FUNCTION__, 1574, GF_LOG_WARNING, "cannot create a new dentry (name:%s) "
"for inode(gfid:%s)", local->newloc.name, uuid_utoa (local
->newloc.inode->gfid)); } while (0)
1573 "for inode(gfid:%s)", local->newloc.name,do { do { if (0) printf ("cannot create a new dentry (name:%s) "
"for inode(gfid:%s)", local->newloc.name, uuid_utoa (local
->newloc.inode->gfid)); } while (0); _gf_log (this->
name, "quota.c", __FUNCTION__, 1574, GF_LOG_WARNING, "cannot create a new dentry (name:%s) "
"for inode(gfid:%s)", local->newloc.name, uuid_utoa (local
->newloc.inode->gfid)); } while (0)
1574 uuid_utoa (local->newloc.inode->gfid))do { do { if (0) printf ("cannot create a new dentry (name:%s) "
"for inode(gfid:%s)", local->newloc.name, uuid_utoa (local
->newloc.inode->gfid)); } while (0); _gf_log (this->
name, "quota.c", __FUNCTION__, 1574, GF_LOG_WARNING, "cannot create a new dentry (name:%s) "
"for inode(gfid:%s)", local->newloc.name, uuid_utoa (local
->newloc.inode->gfid)); } while (0)
;
1575 op_ret = -1;
1576 op_errno = ENOMEM12;
1577 goto unlock;
1578 }
1579 }
1580
1581 ctx->buf = *buf;
1582 }
1583unlock:
1584 UNLOCK (&ctx->lock)pthread_spin_unlock (&ctx->lock);
1585
1586out:
1587 QUOTA_STACK_UNWIND (rename, frame, op_ret, op_errno, buf, preoldparent,do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_rename_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 1588, 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); quota_local_cleanup (_this, _local
); } while (0)
1588 postoldparent, prenewparent, postnewparent, xdata)do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_rename_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 1588, 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); quota_local_cleanup (_this, _local
); } while (0)
;
1589
1590 return 0;
1591}
1592
1593
1594int32_t
1595quota_rename_helper (call_frame_t *frame, xlator_t *this, loc_t *oldloc,
1596 loc_t *newloc, dict_t *xdata)
1597{
1598 quota_local_t *local = NULL((void*)0);
1599 int32_t op_errno = EINVAL22;
1600
1601 local = frame->local;
1602 if (local == NULL((void*)0)) {
1603 gf_log (this->name, GF_LOG_WARNING, "local is NULL")do { do { if (0) printf ("local is NULL"); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 1603, GF_LOG_WARNING
, "local is NULL"); } while (0)
;
1604 goto unwind;
1605 }
1606
1607 op_errno = local->op_errno;
1608
1609 if (local->op_ret == -1) {
1610 goto unwind;
1611 }
1612
1613 STACK_WIND (frame, quota_rename_cbk, FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "quota.c", __FUNCTION__, 1614, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->rename_cbk) tmp_cbk = quota_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 = "quota_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)
1614 FIRST_CHILD(this)->fops->rename, 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", "quota.c", __FUNCTION__, 1614, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->rename_cbk) tmp_cbk = quota_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 = "quota_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)
;
1615 return 0;
1616
1617unwind:
1618 QUOTA_STACK_UNWIND (rename, frame, -1, op_errno, NULL, NULL,do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_rename_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 1619, 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, -1, op_errno, ((void*)0), ((void*)0), ((void*)0), (
(void*)0), ((void*)0), ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); quota_local_cleanup (_this, _local
); } while (0)
1619 NULL, NULL, NULL, NULL)do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_rename_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 1619, 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, -1, op_errno, ((void*)0), ((void*)0), ((void*)0), (
(void*)0), ((void*)0), ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); quota_local_cleanup (_this, _local
); } while (0)
;
1620 return 0;
1621}
1622
1623
1624int32_t
1625quota_rename (call_frame_t *frame, xlator_t *this, loc_t *oldloc,
1626 loc_t *newloc, dict_t *xdata)
1627{
1628 int32_t ret = -1, op_errno = ENOMEM12;
1629 quota_local_t *local = NULL((void*)0);
1630 call_stub_t *stub = NULL((void*)0);
1631 quota_inode_ctx_t *ctx = NULL((void*)0);
1632
1633 local = quota_local_new ();
1634 if (local == NULL((void*)0)) {
1635 goto err;
1636 }
1637
1638 frame->local = local;
1639
1640 ret = loc_copy (&local->oldloc, oldloc);
1641 if (ret < 0) {
1642 gf_log (this->name, GF_LOG_WARNING, "loc_copy failed")do { do { if (0) printf ("loc_copy failed"); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 1642, GF_LOG_WARNING
, "loc_copy failed"); } while (0)
;
1643 goto err;
1644 }
1645
1646 ret = loc_copy (&local->newloc, newloc);
1647 if (ret < 0) {
1648 gf_log (this->name, GF_LOG_WARNING, "loc_copy failed")do { do { if (0) printf ("loc_copy failed"); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 1648, GF_LOG_WARNING
, "loc_copy failed"); } while (0)
;
1649 goto err;
1650 }
1651
1652 stub = fop_rename_stub (frame, quota_rename_helper, oldloc, newloc,
1653 xdata);
1654 if (stub == NULL((void*)0)) {
1655 goto err;
1656 }
1657
1658 local->link_count = 1;
1659 local->stub = stub;
1660
1661 if (IA_ISREG (oldloc->inode->ia_type)(oldloc->inode->ia_type == IA_IFREG)
1662 || IA_ISLNK (oldloc->inode->ia_type)(oldloc->inode->ia_type == IA_IFLNK)) {
1663 ret = quota_inode_ctx_get (oldloc->inode, -1, this, NULL((void*)0), NULL((void*)0),
1664 &ctx, 0);
1665 if (ctx == NULL((void*)0)) {
1666 gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("quota context not set in inode (gfid:%s)"
, oldloc->inode ? uuid_utoa (oldloc->inode->gfid) : "0"
); } while (0); _gf_log (this->name, "quota.c", __FUNCTION__
, 1669, GF_LOG_WARNING, "quota context not set in inode (gfid:%s)"
, oldloc->inode ? uuid_utoa (oldloc->inode->gfid) : "0"
); } while (0)
1667 "quota context not set in inode (gfid:%s)",do { do { if (0) printf ("quota context not set in inode (gfid:%s)"
, oldloc->inode ? uuid_utoa (oldloc->inode->gfid) : "0"
); } while (0); _gf_log (this->name, "quota.c", __FUNCTION__
, 1669, GF_LOG_WARNING, "quota context not set in inode (gfid:%s)"
, oldloc->inode ? uuid_utoa (oldloc->inode->gfid) : "0"
); } while (0)
1668 oldloc->inode ? uuid_utoa (oldloc->inode->gfid)do { do { if (0) printf ("quota context not set in inode (gfid:%s)"
, oldloc->inode ? uuid_utoa (oldloc->inode->gfid) : "0"
); } while (0); _gf_log (this->name, "quota.c", __FUNCTION__
, 1669, GF_LOG_WARNING, "quota context not set in inode (gfid:%s)"
, oldloc->inode ? uuid_utoa (oldloc->inode->gfid) : "0"
); } while (0)
1669 : "0")do { do { if (0) printf ("quota context not set in inode (gfid:%s)"
, oldloc->inode ? uuid_utoa (oldloc->inode->gfid) : "0"
); } while (0); _gf_log (this->name, "quota.c", __FUNCTION__
, 1669, GF_LOG_WARNING, "quota context not set in inode (gfid:%s)"
, oldloc->inode ? uuid_utoa (oldloc->inode->gfid) : "0"
); } while (0)
;
1670 op_errno = EINVAL22;
1671 goto err;
1672 }
1673 local->delta = ctx->buf.ia_blocks * 512;
1674 } else {
1675 local->delta = 0;
1676 }
1677
1678 quota_check_limit (frame, newloc->parent, this, NULL((void*)0), NULL((void*)0));
1679
1680 stub = NULL((void*)0);
1681
1682 LOCK (&local->lock)pthread_spin_lock (&local->lock);
1683 {
1684 if (local->validate_count == 0) {
1685 stub = local->stub;
1686 local->stub = NULL((void*)0);
1687 }
1688
1689 local->link_count = 0;
1690 }
1691 UNLOCK (&local->lock)pthread_spin_unlock (&local->lock);
1692
1693 if (stub != NULL((void*)0)) {
1694 call_resume (stub);
1695 }
1696
1697 ret = 0;
1698err:
1699 if (ret == -1) {
1700 QUOTA_STACK_UNWIND (rename, frame, -1, op_errno, NULL,do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_rename_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 1701, 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, -1, op_errno, ((void*)0), ((void*)0), ((void*)0), (
(void*)0), ((void*)0), ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); quota_local_cleanup (_this, _local
); } while (0)
1701 NULL, NULL, NULL, NULL, NULL)do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_rename_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 1701, 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, -1, op_errno, ((void*)0), ((void*)0), ((void*)0), (
(void*)0), ((void*)0), ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); quota_local_cleanup (_this, _local
); } while (0)
;
1702 }
1703
1704 return 0;
1705}
1706
1707
1708int32_t
1709quota_symlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
1710 int32_t op_ret, int32_t op_errno, inode_t *inode,
1711 struct iatt *buf, struct iatt *preparent,
1712 struct iatt *postparent, dict_t *xdata)
1713{
1714 int64_t size = 0;
1715 quota_local_t *local = NULL((void*)0);
1716 quota_inode_ctx_t *ctx = NULL((void*)0);
1717 quota_dentry_t *dentry = NULL((void*)0);
1718
1719 if (op_ret < 0) {
1720 goto out;
1721 }
1722
1723 local = frame->local;
1724 size = buf->ia_blocks * 512;
1725
1726 quota_update_size (this, local->loc.parent, NULL((void*)0), NULL((void*)0), size);
1727
1728 quota_inode_ctx_get (local->loc.inode, -1, this, NULL((void*)0), NULL((void*)0),
1729 &ctx, 1);
1730 if (ctx == NULL((void*)0)) {
1731 gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("quota context not set in inode (gfid:%s)"
, uuid_utoa (local->loc.inode->gfid)); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 1733, GF_LOG_WARNING
, "quota context not set in inode (gfid:%s)", uuid_utoa (local
->loc.inode->gfid)); } while (0)
1732 "quota context not set in inode (gfid:%s)",do { do { if (0) printf ("quota context not set in inode (gfid:%s)"
, uuid_utoa (local->loc.inode->gfid)); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 1733, GF_LOG_WARNING
, "quota context not set in inode (gfid:%s)", uuid_utoa (local
->loc.inode->gfid)); } while (0)
1733 uuid_utoa (local->loc.inode->gfid))do { do { if (0) printf ("quota context not set in inode (gfid:%s)"
, uuid_utoa (local->loc.inode->gfid)); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 1733, GF_LOG_WARNING
, "quota context not set in inode (gfid:%s)", uuid_utoa (local
->loc.inode->gfid)); } while (0)
;
1734 goto out;
1735 }
1736
1737 LOCK (&ctx->lock)pthread_spin_lock (&ctx->lock);
1738 {
1739 ctx->buf = *buf;
1740
1741 dentry = __quota_dentry_new (ctx, (char *)local->loc.name,
1742 local->loc.parent->gfid);
1743 if (dentry == NULL((void*)0)) {
1744 gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("cannot create a new dentry (name:%s) for "
"inode(gfid:%s)", local->loc.name, uuid_utoa (local->loc
.inode->gfid)); } while (0); _gf_log (this->name, "quota.c"
, __FUNCTION__, 1747, GF_LOG_WARNING, "cannot create a new dentry (name:%s) for "
"inode(gfid:%s)", local->loc.name, uuid_utoa (local->loc
.inode->gfid)); } while (0)
1745 "cannot create a new dentry (name:%s) for "do { do { if (0) printf ("cannot create a new dentry (name:%s) for "
"inode(gfid:%s)", local->loc.name, uuid_utoa (local->loc
.inode->gfid)); } while (0); _gf_log (this->name, "quota.c"
, __FUNCTION__, 1747, GF_LOG_WARNING, "cannot create a new dentry (name:%s) for "
"inode(gfid:%s)", local->loc.name, uuid_utoa (local->loc
.inode->gfid)); } while (0)
1746 "inode(gfid:%s)", local->loc.name,do { do { if (0) printf ("cannot create a new dentry (name:%s) for "
"inode(gfid:%s)", local->loc.name, uuid_utoa (local->loc
.inode->gfid)); } while (0); _gf_log (this->name, "quota.c"
, __FUNCTION__, 1747, GF_LOG_WARNING, "cannot create a new dentry (name:%s) for "
"inode(gfid:%s)", local->loc.name, uuid_utoa (local->loc
.inode->gfid)); } while (0)
1747 uuid_utoa (local->loc.inode->gfid))do { do { if (0) printf ("cannot create a new dentry (name:%s) for "
"inode(gfid:%s)", local->loc.name, uuid_utoa (local->loc
.inode->gfid)); } while (0); _gf_log (this->name, "quota.c"
, __FUNCTION__, 1747, GF_LOG_WARNING, "cannot create a new dentry (name:%s) for "
"inode(gfid:%s)", local->loc.name, uuid_utoa (local->loc
.inode->gfid)); } while (0)
;
1748 op_ret = -1;
1749 op_errno = ENOMEM12;
1750 }
1751 }
1752 UNLOCK (&ctx->lock)pthread_spin_unlock (&ctx->lock);
1753
1754out:
1755 QUOTA_STACK_UNWIND (symlink, frame, op_ret, op_errno, inode, buf,do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_symlink_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 1756, 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); quota_local_cleanup (_this, _local); } while (0)
1756 preparent, postparent, xdata)do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_symlink_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 1756, 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); quota_local_cleanup (_this, _local); } while (0)
;
1757
1758 return 0;
1759}
1760
1761
1762int
1763quota_symlink_helper (call_frame_t *frame, xlator_t *this, const char *linkpath,
1764 loc_t *loc, mode_t umask, dict_t *xdata)
1765{
1766 quota_local_t *local = NULL((void*)0);
1767 int32_t op_errno = EINVAL22;
1768
1769 local = frame->local;
1770 if (local == NULL((void*)0)) {
1771 gf_log (this->name, GF_LOG_WARNING, "local is NULL")do { do { if (0) printf ("local is NULL"); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 1771, GF_LOG_WARNING
, "local is NULL"); } while (0)
;
1772 goto unwind;
1773 }
1774
1775 if (local->op_ret == -1) {
1776 op_errno = local->op_errno;
1777 goto unwind;
1778 }
1779
1780 STACK_WIND (frame, quota_symlink_cbk, FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "quota.c", __FUNCTION__, 1782, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->symlink_cbk) tmp_cbk = quota_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 = "quota_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)
1781 FIRST_CHILD(this)->fops->symlink, linkpath, loc, umask,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "quota.c", __FUNCTION__, 1782, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->symlink_cbk) tmp_cbk = quota_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 = "quota_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)
1782 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", "quota.c", __FUNCTION__, 1782, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->symlink_cbk) tmp_cbk = quota_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 = "quota_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)
;
1783 return 0;
1784
1785unwind:
1786 QUOTA_STACK_UNWIND (symlink, frame, -1, op_errno, NULL, NULL,do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_symlink_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 1787, 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, -1, op_errno, ((void*)0), ((void*)0), ((void*)0), (
(void*)0), ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0); quota_local_cleanup (_this, _local); } while (
0)
1787 NULL, NULL, NULL)do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_symlink_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 1787, 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, -1, op_errno, ((void*)0), ((void*)0), ((void*)0), (
(void*)0), ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0); quota_local_cleanup (_this, _local); } while (
0)
;
1788 return 0;
1789}
1790
1791
1792int
1793quota_symlink (call_frame_t *frame, xlator_t *this, const char *linkpath,
1794 loc_t *loc, mode_t umask, dict_t *xdata)
1795{
1796 int32_t ret = -1;
1797 int32_t op_errno = ENOMEM12;
1798 quota_local_t *local = NULL((void*)0);
1799 call_stub_t *stub = NULL((void*)0);
1800
1801 local = quota_local_new ();
1802 if (local == NULL((void*)0)) {
1803 goto err;
1804 }
1805
1806 frame->local = local;
1807
1808 ret = loc_copy (&local->loc, loc);
1809 if (ret < 0) {
1810 gf_log (this->name, GF_LOG_WARNING, "loc_copy failed")do { do { if (0) printf ("loc_copy failed"); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 1810, GF_LOG_WARNING
, "loc_copy failed"); } while (0)
;
1811 goto err;
1812 }
1813
1814 local->link_count = 1;
1815
1816 stub = fop_symlink_stub (frame, quota_symlink_helper, linkpath, loc,
1817 umask, xdata);
1818 if (stub == NULL((void*)0)) {
1819 goto err;
1820 }
1821
1822 local->stub = stub;
1823 local->delta = strlen (linkpath);
1824
1825 quota_check_limit (frame, loc->parent, this, NULL((void*)0), NULL((void*)0));
1826
1827 stub = NULL((void*)0);
1828
1829 LOCK (&local->lock)pthread_spin_lock (&local->lock);
1830 {
1831 if (local->validate_count == 0) {
1832 stub = local->stub;
1833 local->stub = NULL((void*)0);
1834 }
1835
1836 local->link_count = 0;
1837 }
1838 UNLOCK (&local->lock)pthread_spin_unlock (&local->lock);
1839
1840 if (stub != NULL((void*)0)) {
1841 call_resume (stub);
1842 }
1843
1844 return 0;
1845
1846err:
1847 QUOTA_STACK_UNWIND (symlink, frame, -1, op_errno, NULL, NULL, NULL,do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_symlink_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 1848, 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, -1, op_errno, ((void*)0), ((void*)0), ((void*)0), (
(void*)0), ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0); quota_local_cleanup (_this, _local); } while (
0)
1848 NULL, NULL)do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_symlink_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 1848, 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, -1, op_errno, ((void*)0), ((void*)0), ((void*)0), (
(void*)0), ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0); quota_local_cleanup (_this, _local); } while (
0)
;
1849
1850 return 0;
1851}
1852
1853
1854int32_t
1855quota_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
1856 int32_t op_ret, int32_t op_errno, struct iatt *prebuf,
1857 struct iatt *postbuf, dict_t *xdata)
1858{
1859 quota_local_t *local = NULL((void*)0);
1860 int64_t delta = 0;
1861 quota_inode_ctx_t *ctx = NULL((void*)0);
1862
1863 if (op_ret < 0) {
1864 goto out;
1865 }
1866
1867 local = frame->local;
1868 if (local == NULL((void*)0)) {
1869 gf_log (this->name, GF_LOG_WARNING, "local is NULL")do { do { if (0) printf ("local is NULL"); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 1869, GF_LOG_WARNING
, "local is NULL"); } while (0)
;
1870 goto out;
1871 }
1872
1873 delta = (postbuf->ia_blocks - prebuf->ia_blocks) * 512;
1874
1875 quota_update_size (this, local->loc.inode, NULL((void*)0), NULL((void*)0), delta);
1876
1877 quota_inode_ctx_get (local->loc.inode, -1, this, NULL((void*)0), NULL((void*)0),
1878 &ctx, 0);
1879 if (ctx == NULL((void*)0)) {
1880 gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("quota context not set in inode (gfid:%s)"
, uuid_utoa (local->loc.inode->gfid)); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 1882, GF_LOG_WARNING
, "quota context not set in inode (gfid:%s)", uuid_utoa (local
->loc.inode->gfid)); } while (0)
1881 "quota context not set in inode (gfid:%s)",do { do { if (0) printf ("quota context not set in inode (gfid:%s)"
, uuid_utoa (local->loc.inode->gfid)); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 1882, GF_LOG_WARNING
, "quota context not set in inode (gfid:%s)", uuid_utoa (local
->loc.inode->gfid)); } while (0)
1882 uuid_utoa (local->loc.inode->gfid))do { do { if (0) printf ("quota context not set in inode (gfid:%s)"
, uuid_utoa (local->loc.inode->gfid)); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 1882, GF_LOG_WARNING
, "quota context not set in inode (gfid:%s)", uuid_utoa (local
->loc.inode->gfid)); } while (0)
;
1883 goto out;
1884 }
1885
1886 LOCK (&ctx->lock)pthread_spin_lock (&ctx->lock);
1887 {
1888 ctx->buf = *postbuf;
1889 }
1890 UNLOCK (&ctx->lock)pthread_spin_unlock (&ctx->lock);
1891
1892out:
1893 QUOTA_STACK_UNWIND (truncate, frame, op_ret, op_errno, prebuf,do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_truncate_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 1894, 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); quota_local_cleanup (_this, _local
); } while (0)
1894 postbuf, xdata)do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_truncate_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 1894, 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); quota_local_cleanup (_this, _local
); } while (0)
;
1895 return 0;
1896}
1897
1898
1899int32_t
1900quota_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset,
1901 dict_t *xdata)
1902{
1903 int32_t ret = -1;
1904 quota_local_t *local = NULL((void*)0);
1905
1906 local = quota_local_new ();
1907 if (local == NULL((void*)0)) {
1908 goto err;
1909 }
1910
1911 frame->local = local;
1912
1913 ret = loc_copy (&local->loc, loc);
1914 if (ret < 0) {
1915 gf_log (this->name, GF_LOG_WARNING, "loc_copy failed")do { do { if (0) printf ("loc_copy failed"); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 1915, GF_LOG_WARNING
, "loc_copy failed"); } while (0)
;
1916 goto err;
1917 }
1918
1919 STACK_WIND (frame, quota_truncate_cbk, FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "quota.c", __FUNCTION__, 1920, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->truncate_cbk) tmp_cbk = quota_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 = "quota_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)
1920 FIRST_CHILD(this)->fops->truncate, 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", "quota.c", __FUNCTION__, 1920, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->truncate_cbk) tmp_cbk = quota_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 = "quota_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)
;
1921
1922 return 0;
1923err:
1924 QUOTA_STACK_UNWIND (truncate, frame, -1, ENOMEM, NULL, NULL, NULL)do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_truncate_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 1924, 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, -1, 12, ((void*)0), ((void*)0), ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); quota_local_cleanup (_this, _local
); } while (0)
;
1925
1926 return 0;
1927}
1928
1929
1930int32_t
1931quota_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
1932 int32_t op_ret, int32_t op_errno, struct iatt *prebuf,
1933 struct iatt *postbuf, dict_t *xdata)
1934{
1935 quota_local_t *local = NULL((void*)0);
1936 int64_t delta = 0;
1937 quota_inode_ctx_t *ctx = NULL((void*)0);
1938
1939 if (op_ret < 0) {
1940 goto out;
1941 }
1942
1943 local = frame->local;
1944 if (local == NULL((void*)0)) {
1945 gf_log (this->name, GF_LOG_WARNING, "local is NULL")do { do { if (0) printf ("local is NULL"); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 1945, GF_LOG_WARNING
, "local is NULL"); } while (0)
;
1946 goto out;
1947 }
1948
1949 delta = (postbuf->ia_blocks - prebuf->ia_blocks) * 512;
1950
1951 quota_update_size (this, local->loc.inode, NULL((void*)0), NULL((void*)0), delta);
1952
1953 quota_inode_ctx_get (local->loc.inode, -1, this, NULL((void*)0), NULL((void*)0),
1954 &ctx, 0);
1955 if (ctx == NULL((void*)0)) {
1956 gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("quota context not set in inode (gfid:%s)"
, uuid_utoa (local->loc.inode->gfid)); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 1958, GF_LOG_WARNING
, "quota context not set in inode (gfid:%s)", uuid_utoa (local
->loc.inode->gfid)); } while (0)
1957 "quota context not set in inode (gfid:%s)",do { do { if (0) printf ("quota context not set in inode (gfid:%s)"
, uuid_utoa (local->loc.inode->gfid)); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 1958, GF_LOG_WARNING
, "quota context not set in inode (gfid:%s)", uuid_utoa (local
->loc.inode->gfid)); } while (0)
1958 uuid_utoa (local->loc.inode->gfid))do { do { if (0) printf ("quota context not set in inode (gfid:%s)"
, uuid_utoa (local->loc.inode->gfid)); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 1958, GF_LOG_WARNING
, "quota context not set in inode (gfid:%s)", uuid_utoa (local
->loc.inode->gfid)); } while (0)
;
1959 goto out;
1960 }
1961
1962 LOCK (&ctx->lock)pthread_spin_lock (&ctx->lock);
1963 {
1964 ctx->buf = *postbuf;
1965 }
1966 UNLOCK (&ctx->lock)pthread_spin_unlock (&ctx->lock);
1967
1968out:
1969 QUOTA_STACK_UNWIND (ftruncate, frame, op_ret, op_errno, prebuf,do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_ftruncate_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 1970, 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); quota_local_cleanup (_this, _local
); } while (0)
1970 postbuf, xdata)do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_ftruncate_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 1970, 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); quota_local_cleanup (_this, _local
); } while (0)
;
1971 return 0;
1972}
1973
1974
1975int32_t
1976quota_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
1977 dict_t *xdata)
1978{
1979 quota_local_t *local = NULL((void*)0);
1980
1981 local = quota_local_new ();
1982 if (local == NULL((void*)0))
1983 goto err;
1984
1985 frame->local = local;
1986
1987 local->loc.inode = inode_ref (fd->inode);
1988
1989 STACK_WIND (frame, quota_ftruncate_cbk, FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "quota.c", __FUNCTION__, 1990, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->ftruncate_cbk) tmp_cbk = quota_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 = "quota_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)
1990 FIRST_CHILD(this)->fops->ftruncate, 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", "quota.c", __FUNCTION__, 1990, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->ftruncate_cbk) tmp_cbk = quota_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 = "quota_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)
;
1991
1992 return 0;
1993err:
1994 QUOTA_STACK_UNWIND (ftruncate, frame, -1, ENOMEM, NULL, NULL, NULL)do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_ftruncate_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 1994, 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, -1, 12, ((void*)0), ((void*)0), ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); quota_local_cleanup (_this, _local
); } while (0)
;
1995
1996 return 0;
1997}
1998
1999
2000int32_t
2001quota_send_dir_limit_to_cli (call_frame_t *frame, xlator_t *this,
2002 inode_t *inode, const char *name)
2003{
2004 int32_t ret = 0;
2005 char dir_limit [1024] = {0, };
2006 dict_t *dict = NULL((void*)0);
2007 quota_inode_ctx_t *ctx = NULL((void*)0);
2008 uint64_t value = 0;
2009
2010 ret = inode_ctx_get (inode, this, &value)inode_ctx_get2(inode,this,&value,0);
2011 if (ret < 0)
2012 goto out;
2013
2014 ctx = (quota_inode_ctx_t *)(unsigned long)value;
2015 snprintf (dir_limit, 1024, "%"PRId64"ll" "d"",%"PRId64"ll" "d", ctx->size, ctx->limit);
2016
2017 dict = dict_new ();
2018 if (dict == NULL((void*)0)) {
2019 ret = -1;
2020 goto out;
2021 }
2022
2023 ret = dict_set_str (dict, (char *) name, dir_limit);
2024 if (ret < 0)
2025 goto out;
2026
2027 gf_log (this->name, GF_LOG_INFO, "str = %s", dir_limit)do { do { if (0) printf ("str = %s", dir_limit); } while (0);
_gf_log (this->name, "quota.c", __FUNCTION__, 2027, GF_LOG_INFO
, "str = %s", dir_limit); } while (0)
;
2028
2029 QUOTA_STACK_UNWIND (getxattr, frame, 0, 0, dict, NULL)do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_getxattr_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 2029, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_getxattr_cbk_t )frame->ret; _parent = frame->parent
; pthread_spin_lock (&frame->root->stack_lock); { _parent
->ref_count--; } pthread_spin_unlock (&frame->root->
stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, 0, 0, dict, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); quota_local_cleanup (_this, _local
); } while (0)
;
2030
2031 ret = 0;
2032
2033out:
2034 return ret;
2035}
2036
2037
2038int32_t
2039quota_fgetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd,
2040 const char *name, dict_t *xdata)
2041{
2042 int32_t ret = 0;
2043
2044 if (name && strcasecmp (name, "trusted.limit.list") == 0) {
2045 ret = quota_send_dir_limit_to_cli (frame, this, fd->inode,
2046 name);
2047 if (ret == 0) {
2048 return 0;
2049 }
2050 }
2051
2052 STACK_WIND (frame, default_fgetxattr_cbk, FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "quota.c", __FUNCTION__, 2053, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->fgetxattr_cbk) tmp_cbk = default_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 = "default_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)
2053 FIRST_CHILD(this)->fops->fgetxattr, 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", "quota.c", __FUNCTION__, 2053, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->fgetxattr_cbk) tmp_cbk = default_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 = "default_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)
;
2054 return 0;
2055}
2056
2057
2058int32_t
2059quota_getxattr (call_frame_t *frame, xlator_t *this, loc_t *loc,
2060 const char *name, dict_t *xdata)
2061{
2062 int32_t ret = 0;
2063
2064 if ((name != NULL((void*)0)) && strcasecmp (name, "trusted.limit.list") == 0) {
2065 ret = quota_send_dir_limit_to_cli (frame, this, loc->inode,
2066 name);
2067 if (ret == 0)
2068 return 0;
2069 }
2070
2071 STACK_WIND (frame, default_getxattr_cbk, FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "quota.c", __FUNCTION__, 2072, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->getxattr_cbk) tmp_cbk = default_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 = "default_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)
2072 FIRST_CHILD(this)->fops->getxattr, 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", "quota.c", __FUNCTION__, 2072, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->getxattr_cbk) tmp_cbk = default_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 = "default_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)
;
2073 return 0;
2074}
2075
2076
2077int32_t
2078quota_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
2079 int32_t op_ret, int32_t op_errno, struct iatt *buf, dict_t *xdata)
2080{
2081 quota_local_t *local = NULL((void*)0);
2082 quota_inode_ctx_t *ctx = NULL((void*)0);
2083
2084 if (op_ret < 0) {
2085 goto out;
2086 }
2087
2088 local = frame->local;
2089 if (local == NULL((void*)0)) {
2090 gf_log (this->name, GF_LOG_WARNING, "local is NULL")do { do { if (0) printf ("local is NULL"); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 2090, GF_LOG_WARNING
, "local is NULL"); } while (0)
;
2091 goto out;
2092 }
2093
2094 quota_inode_ctx_get (local->loc.inode, -1, this, NULL((void*)0), NULL((void*)0),
2095 &ctx, 0);
2096 if (ctx == NULL((void*)0)) {
2097 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("quota context not set in inode (gfid:%s)"
, uuid_utoa (local->loc.inode->gfid)); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 2099, GF_LOG_DEBUG,
"quota context not set in inode (gfid:%s)", uuid_utoa (local
->loc.inode->gfid)); } while (0)
2098 "quota context not set in inode (gfid:%s)",do { do { if (0) printf ("quota context not set in inode (gfid:%s)"
, uuid_utoa (local->loc.inode->gfid)); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 2099, GF_LOG_DEBUG,
"quota context not set in inode (gfid:%s)", uuid_utoa (local
->loc.inode->gfid)); } while (0)
2099 uuid_utoa (local->loc.inode->gfid))do { do { if (0) printf ("quota context not set in inode (gfid:%s)"
, uuid_utoa (local->loc.inode->gfid)); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 2099, GF_LOG_DEBUG,
"quota context not set in inode (gfid:%s)", uuid_utoa (local
->loc.inode->gfid)); } while (0)
;
2100 goto out;
2101 }
2102
2103 LOCK (&ctx->lock)pthread_spin_lock (&ctx->lock);
2104 {
2105 if (buf)
2106 ctx->buf = *buf;
2107 }
2108 UNLOCK (&ctx->lock)pthread_spin_unlock (&ctx->lock);
2109
2110out:
2111 QUOTA_STACK_UNWIND (stat, frame, op_ret, op_errno, buf, xdata)do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_stat_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 2111, 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); quota_local_cleanup (_this, _local
); } while (0)
;
2112 return 0;
2113}
2114
2115
2116int32_t
2117quota_stat (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
2118{
2119 quota_local_t *local = NULL((void*)0);
2120 int32_t ret = -1;
2121
2122 local = quota_local_new ();
2123 if (local == NULL((void*)0)) {
2124 goto unwind;
2125 }
2126
2127 frame->local = local;
2128 ret = loc_copy (&local->loc, loc);
2129 if (ret < 0) {
2130 gf_log (this->name, GF_LOG_WARNING, "loc_copy failed")do { do { if (0) printf ("loc_copy failed"); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 2130, GF_LOG_WARNING
, "loc_copy failed"); } while (0)
;
2131 goto unwind;
2132 }
2133
2134 STACK_WIND (frame, quota_stat_cbk, FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "quota.c", __FUNCTION__, 2135, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->stat_cbk) tmp_cbk = quota_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 = "quota_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)
2135 FIRST_CHILD(this)->fops->stat, 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", "quota.c", __FUNCTION__, 2135, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->stat_cbk) tmp_cbk = quota_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 = "quota_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)
;
2136 return 0;
2137
2138unwind:
2139 QUOTA_STACK_UNWIND (stat, frame, -1, ENOMEM, NULL, NULL)do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_stat_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 2139, 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, -1, 12, ((void*)0), ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); quota_local_cleanup (_this, _local
); } while (0)
;
2140 return 0;
2141}
2142
2143
2144int32_t
2145quota_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
2146 int32_t op_ret, int32_t op_errno, struct iatt *buf,
2147 dict_t *xdata)
2148{
2149 quota_local_t *local = NULL((void*)0);
2150 quota_inode_ctx_t *ctx = NULL((void*)0);
2151
2152 if (op_ret < 0) {
2153 goto out;
2154 }
2155
2156 local = frame->local;
2157 if (local == NULL((void*)0)) {
2158 gf_log (this->name, GF_LOG_WARNING, "local is NULL")do { do { if (0) printf ("local is NULL"); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 2158, GF_LOG_WARNING
, "local is NULL"); } while (0)
;
2159 goto out;
2160 }
2161
2162 quota_inode_ctx_get (local->loc.inode, -1, this, NULL((void*)0), NULL((void*)0),
2163 &ctx, 0);
2164 if (ctx == NULL((void*)0)) {
2165 gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("quota context not set in inode (gfid:%s)"
, uuid_utoa (local->loc.inode->gfid)); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 2167, GF_LOG_WARNING
, "quota context not set in inode (gfid:%s)", uuid_utoa (local
->loc.inode->gfid)); } while (0)
2166 "quota context not set in inode (gfid:%s)",do { do { if (0) printf ("quota context not set in inode (gfid:%s)"
, uuid_utoa (local->loc.inode->gfid)); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 2167, GF_LOG_WARNING
, "quota context not set in inode (gfid:%s)", uuid_utoa (local
->loc.inode->gfid)); } while (0)
2167 uuid_utoa (local->loc.inode->gfid))do { do { if (0) printf ("quota context not set in inode (gfid:%s)"
, uuid_utoa (local->loc.inode->gfid)); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 2167, GF_LOG_WARNING
, "quota context not set in inode (gfid:%s)", uuid_utoa (local
->loc.inode->gfid)); } while (0)
;
2168 goto out;
2169 }
2170
2171 LOCK (&ctx->lock)pthread_spin_lock (&ctx->lock);
2172 {
2173 if (buf)
2174 ctx->buf = *buf;
2175 }
2176 UNLOCK (&ctx->lock)pthread_spin_unlock (&ctx->lock);
2177
2178out:
2179 QUOTA_STACK_UNWIND (fstat, frame, op_ret, op_errno, buf, xdata)do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_fstat_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 2179, 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); quota_local_cleanup (_this, _local
); } while (0)
;
2180 return 0;
2181}
2182
2183
2184int32_t
2185quota_fstat (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata)
2186{
2187 quota_local_t *local = NULL((void*)0);
2188
2189 local = quota_local_new ();
2190 if (local == NULL((void*)0)) {
2191 goto unwind;
2192 }
2193
2194 frame->local = local;
2195
2196 local->loc.inode = inode_ref (fd->inode);
2197
2198 STACK_WIND (frame, quota_fstat_cbk, FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "quota.c", __FUNCTION__, 2199, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->fstat_cbk) tmp_cbk = quota_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 = "quota_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)
2199 FIRST_CHILD(this)->fops->fstat, 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", "quota.c", __FUNCTION__, 2199, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->fstat_cbk) tmp_cbk = quota_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 = "quota_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)
;
2200 return 0;
2201
2202unwind:
2203 QUOTA_STACK_UNWIND (fstat, frame, -1, ENOMEM, NULL, NULL)do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_fstat_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 2203, 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, -1, 12, ((void*)0), ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); quota_local_cleanup (_this, _local
); } while (0)
;
2204 return 0;
2205}
2206
2207
2208int32_t
2209quota_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
2210 int32_t op_ret, int32_t op_errno, const char *path,
2211 struct iatt *buf, dict_t *xdata)
2212{
2213 quota_local_t *local = NULL((void*)0);
2214 quota_inode_ctx_t *ctx = NULL((void*)0);
2215
2216 if (op_ret < 0) {
2217 goto out;
2218 }
2219
2220 local = frame->local;
2221 if (local == NULL((void*)0)) {
2222 gf_log (this->name, GF_LOG_WARNING, "local is NULL")do { do { if (0) printf ("local is NULL"); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 2222, GF_LOG_WARNING
, "local is NULL"); } while (0)
;
2223 goto out;
2224 }
2225
2226 quota_inode_ctx_get (local->loc.inode, -1, this, NULL((void*)0), NULL((void*)0),
2227 &ctx, 0);
2228 if (ctx == NULL((void*)0)) {
2229 gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("quota context not set in inode (gfid:%s)"
, uuid_utoa (local->loc.inode->gfid)); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 2231, GF_LOG_WARNING
, "quota context not set in inode (gfid:%s)", uuid_utoa (local
->loc.inode->gfid)); } while (0)
2230 "quota context not set in inode (gfid:%s)",do { do { if (0) printf ("quota context not set in inode (gfid:%s)"
, uuid_utoa (local->loc.inode->gfid)); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 2231, GF_LOG_WARNING
, "quota context not set in inode (gfid:%s)", uuid_utoa (local
->loc.inode->gfid)); } while (0)
2231 uuid_utoa (local->loc.inode->gfid))do { do { if (0) printf ("quota context not set in inode (gfid:%s)"
, uuid_utoa (local->loc.inode->gfid)); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 2231, GF_LOG_WARNING
, "quota context not set in inode (gfid:%s)", uuid_utoa (local
->loc.inode->gfid)); } while (0)
;
2232 goto out;
2233 }
2234
2235 LOCK (&ctx->lock)pthread_spin_lock (&ctx->lock);
2236 {
2237 ctx->buf = *buf;
2238 }
2239 UNLOCK (&ctx->lock)pthread_spin_unlock (&ctx->lock);
2240
2241out:
2242 QUOTA_STACK_UNWIND (readlink, frame, op_ret, op_errno, path, buf, xdata)do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } 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", "quota.c", __FUNCTION__
, 2242, 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, path, buf, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0); quota_local_cleanup (_this, _local
); } while (0)
;
2243 return 0;
2244}
2245
2246
2247int32_t
2248quota_readlink (call_frame_t *frame, xlator_t *this, loc_t *loc, size_t size,
2249 dict_t *xdata)
2250{
2251 quota_local_t *local = NULL((void*)0);
2252 int32_t ret = -1;
2253
2254 local = quota_local_new ();
2255 if (local == NULL((void*)0)) {
2256 goto unwind;
2257 }
2258
2259 frame->local = local;
2260
2261 ret = loc_copy (&local->loc, loc);
2262 if (ret < 0) {
2263 gf_log (this->name, GF_LOG_WARNING, "loc_copy failed")do { do { if (0) printf ("loc_copy failed"); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 2263, GF_LOG_WARNING
, "loc_copy failed"); } while (0)
;
2264 goto unwind;
2265 }
2266
2267 STACK_WIND (frame, quota_readlink_cbk, FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "quota.c", __FUNCTION__, 2268, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->readlink_cbk) tmp_cbk = quota_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 = "quota_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)
2268 FIRST_CHILD(this)->fops->readlink, 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", "quota.c", __FUNCTION__, 2268, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->readlink_cbk) tmp_cbk = quota_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 = "quota_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)
;
2269 return 0;
2270
2271unwind:
2272 QUOTA_STACK_UNWIND (readlink, frame, -1, ENOMEM, NULL, NULL, NULL)do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } 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", "quota.c", __FUNCTION__
, 2272, 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, -1, 12, ((void*)0), ((void*)0), ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); quota_local_cleanup (_this, _local
); } while (0)
;
2273 return 0;
2274}
2275
2276
2277int32_t
2278quota_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
2279 int32_t op_ret, int32_t op_errno, struct iovec *vector,
2280 int32_t count, struct iatt *buf, struct iobref *iobref,
2281 dict_t *xdata)
2282{
2283 quota_local_t *local = NULL((void*)0);
2284 quota_inode_ctx_t *ctx = NULL((void*)0);
2285
2286 if (op_ret < 0) {
2287 goto out;
2288 }
2289
2290 local = frame->local;
2291 if (local == NULL((void*)0)) {
2292 gf_log (this->name, GF_LOG_WARNING, "local is NULL")do { do { if (0) printf ("local is NULL"); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 2292, GF_LOG_WARNING
, "local is NULL"); } while (0)
;
2293 goto out;
2294 }
2295
2296 quota_inode_ctx_get (local->loc.inode, -1, this, NULL((void*)0), NULL((void*)0),
2297 &ctx, 0);
2298 if (ctx == NULL((void*)0)) {
2299 gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("quota context not set in inode (gfid:%s)"
, uuid_utoa (local->loc.inode->gfid)); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 2301, GF_LOG_WARNING
, "quota context not set in inode (gfid:%s)", uuid_utoa (local
->loc.inode->gfid)); } while (0)
2300 "quota context not set in inode (gfid:%s)",do { do { if (0) printf ("quota context not set in inode (gfid:%s)"
, uuid_utoa (local->loc.inode->gfid)); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 2301, GF_LOG_WARNING
, "quota context not set in inode (gfid:%s)", uuid_utoa (local
->loc.inode->gfid)); } while (0)
2301 uuid_utoa (local->loc.inode->gfid))do { do { if (0) printf ("quota context not set in inode (gfid:%s)"
, uuid_utoa (local->loc.inode->gfid)); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 2301, GF_LOG_WARNING
, "quota context not set in inode (gfid:%s)", uuid_utoa (local
->loc.inode->gfid)); } while (0)
;
2302 goto out;
2303 }
2304
2305 LOCK (&ctx->lock)pthread_spin_lock (&ctx->lock);
2306 {
2307 ctx->buf = *buf;
2308 }
2309 UNLOCK (&ctx->lock)pthread_spin_unlock (&ctx->lock);
2310
2311out:
2312 QUOTA_STACK_UNWIND (readv, frame, op_ret, op_errno, vector, count,do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_readv_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 2313, 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); quota_local_cleanup
(_this, _local); } while (0)
2313 buf, iobref, xdata)do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_readv_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 2313, 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); quota_local_cleanup
(_this, _local); } while (0)
;
2314 return 0;
2315}
2316
2317
2318int32_t
2319quota_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
2320 off_t offset, uint32_t flags, dict_t *xdata)
2321{
2322 quota_local_t *local = NULL((void*)0);
2323
2324 local = quota_local_new ();
2325 if (local == NULL((void*)0)) {
2326 goto unwind;
2327 }
2328
2329 frame->local = local;
2330
2331 local->loc.inode = inode_ref (fd->inode);
2332
2333 STACK_WIND (frame, quota_readv_cbk, FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "quota.c", __FUNCTION__, 2335, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->readv_cbk) tmp_cbk = quota_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 = "quota_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)
2334 FIRST_CHILD(this)->fops->readv, fd, size, offset, flags,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "quota.c", __FUNCTION__, 2335, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->readv_cbk) tmp_cbk = quota_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 = "quota_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)
2335 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", "quota.c", __FUNCTION__, 2335, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->readv_cbk) tmp_cbk = quota_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 = "quota_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)
;
2336 return 0;
2337
2338unwind:
2339 QUOTA_STACK_UNWIND (readv, frame, -1, ENOMEM, NULL, -1, NULL, NULL, NULL)do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_readv_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 2339, 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, -1, 12, ((void*)0), -1, ((void*)0), ((void*)0), ((
void*)0)); (*__glusterfs_this_location()) = old_THIS; } while
(0); quota_local_cleanup (_this, _local); } while (0)
;
2340 return 0;
2341}
2342
2343
2344int32_t
2345quota_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
2346 int32_t op_ret, int32_t op_errno, struct iatt *prebuf,
2347 struct iatt *postbuf, dict_t *xdata)
2348{
2349 quota_local_t *local = NULL((void*)0);
2350 quota_inode_ctx_t *ctx = NULL((void*)0);
2351
2352 if (op_ret < 0) {
2353 goto out;
2354 }
2355
2356 local = frame->local;
2357 if (local == NULL((void*)0)) {
2358 gf_log (this->name, GF_LOG_WARNING, "local is NULL")do { do { if (0) printf ("local is NULL"); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 2358, GF_LOG_WARNING
, "local is NULL"); } while (0)
;
2359 goto out;
2360 }
2361
2362 quota_inode_ctx_get (local->loc.inode, -1, this, NULL((void*)0), NULL((void*)0),
2363 &ctx, 0);
2364 if (ctx == NULL((void*)0)) {
2365 gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("quota context not set in inode (gfid:%s)"
, uuid_utoa (local->loc.inode->gfid)); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 2367, GF_LOG_WARNING
, "quota context not set in inode (gfid:%s)", uuid_utoa (local
->loc.inode->gfid)); } while (0)
2366 "quota context not set in inode (gfid:%s)",do { do { if (0) printf ("quota context not set in inode (gfid:%s)"
, uuid_utoa (local->loc.inode->gfid)); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 2367, GF_LOG_WARNING
, "quota context not set in inode (gfid:%s)", uuid_utoa (local
->loc.inode->gfid)); } while (0)
2367 uuid_utoa (local->loc.inode->gfid))do { do { if (0) printf ("quota context not set in inode (gfid:%s)"
, uuid_utoa (local->loc.inode->gfid)); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 2367, GF_LOG_WARNING
, "quota context not set in inode (gfid:%s)", uuid_utoa (local
->loc.inode->gfid)); } while (0)
;
2368 goto out;
2369 }
2370
2371 LOCK (&ctx->lock)pthread_spin_lock (&ctx->lock);
2372 {
2373 ctx->buf = *postbuf;
2374 }
2375 UNLOCK (&ctx->lock)pthread_spin_unlock (&ctx->lock);
2376
2377out:
2378 QUOTA_STACK_UNWIND (fsync, frame, op_ret, op_errno, prebuf, postbuf,do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_fsync_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 2379, 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); quota_local_cleanup (_this, _local
); } while (0)
2379 xdata)do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_fsync_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 2379, 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); quota_local_cleanup (_this, _local
); } while (0)
;
2380 return 0;
2381}
2382
2383
2384int32_t
2385quota_fsync (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags,
2386 dict_t *xdata)
2387{
2388 quota_local_t *local = NULL((void*)0);
2389
2390 local = quota_local_new ();
2391 if (local == NULL((void*)0)) {
2392 goto unwind;
2393 }
2394
2395 local->loc.inode = inode_ref (fd->inode);
2396
2397 frame->local = local;
2398
2399 STACK_WIND (frame, quota_fsync_cbk, FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "quota.c", __FUNCTION__, 2400, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->fsync_cbk) tmp_cbk = quota_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 = "quota_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)
2400 FIRST_CHILD(this)->fops->fsync, 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", "quota.c", __FUNCTION__, 2400, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->fsync_cbk) tmp_cbk = quota_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 = "quota_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)
;
2401 return 0;
2402
2403unwind:
2404 QUOTA_STACK_UNWIND (fsync, frame, -1, ENOMEM, NULL, NULL, NULL)do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_fsync_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 2404, 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, -1, 12, ((void*)0), ((void*)0), ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); quota_local_cleanup (_this, _local
); } while (0)
;
2405 return 0;
2406
2407}
2408
2409
2410int32_t
2411quota_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
2412 int32_t op_ret, int32_t op_errno, struct iatt *statpre,
2413 struct iatt *statpost, dict_t *xdata)
2414{
2415 quota_local_t *local = NULL((void*)0);
2416 quota_inode_ctx_t *ctx = NULL((void*)0);
2417
2418 if (op_ret < 0) {
2419 goto out;
2420 }
2421
2422 local = frame->local;
2423 if (local == NULL((void*)0)) {
2424 gf_log (this->name, GF_LOG_WARNING, "local is NULL")do { do { if (0) printf ("local is NULL"); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 2424, GF_LOG_WARNING
, "local is NULL"); } while (0)
;
2425 goto out;
2426 }
2427
2428 quota_inode_ctx_get (local->loc.inode, -1, this, NULL((void*)0), NULL((void*)0),
2429 &ctx, 0);
2430 if (ctx == NULL((void*)0)) {
2431 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("quota context not set in inode (gfid:%s)"
, uuid_utoa (local->loc.inode->gfid)); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 2433, GF_LOG_DEBUG,
"quota context not set in inode (gfid:%s)", uuid_utoa (local
->loc.inode->gfid)); } while (0)
2432 "quota context not set in inode (gfid:%s)",do { do { if (0) printf ("quota context not set in inode (gfid:%s)"
, uuid_utoa (local->loc.inode->gfid)); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 2433, GF_LOG_DEBUG,
"quota context not set in inode (gfid:%s)", uuid_utoa (local
->loc.inode->gfid)); } while (0)
2433 uuid_utoa (local->loc.inode->gfid))do { do { if (0) printf ("quota context not set in inode (gfid:%s)"
, uuid_utoa (local->loc.inode->gfid)); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 2433, GF_LOG_DEBUG,
"quota context not set in inode (gfid:%s)", uuid_utoa (local
->loc.inode->gfid)); } while (0)
;
2434 goto out;
2435 }
2436
2437 LOCK (&ctx->lock)pthread_spin_lock (&ctx->lock);
2438 {
2439 if (statpost)
2440 ctx->buf = *statpost;
2441 }
2442 UNLOCK (&ctx->lock)pthread_spin_unlock (&ctx->lock);
2443
2444out:
2445 QUOTA_STACK_UNWIND (setattr, frame, op_ret, op_errno, statpre,do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_setattr_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 2446, 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, statpre, statpost, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0); quota_local_cleanup (_this, _local
); } while (0)
2446 statpost, xdata)do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_setattr_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 2446, 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, statpre, statpost, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0); quota_local_cleanup (_this, _local
); } while (0)
;
2447 return 0;
2448}
2449
2450
2451int32_t
2452quota_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc,
2453 struct iatt *stbuf, int32_t valid, dict_t *xdata)
2454{
2455 quota_local_t *local = NULL((void*)0);
2456 int32_t ret = -1;
2457
2458 local = quota_local_new ();
2459 if (local == NULL((void*)0)) {
2460 goto unwind;
2461 }
2462
2463 frame->local = local;
2464
2465 ret = loc_copy (&local->loc, loc);
2466 if (ret < 0) {
2467 gf_log (this->name, GF_LOG_WARNING, "loc_copy failed")do { do { if (0) printf ("loc_copy failed"); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 2467, GF_LOG_WARNING
, "loc_copy failed"); } while (0)
;
2468 goto unwind;
2469 }
2470
2471 STACK_WIND (frame, quota_setattr_cbk, FIRST_CHILD (this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "quota.c", __FUNCTION__, 2472, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->setattr_cbk) tmp_cbk = quota_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 = "quota_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)
2472 FIRST_CHILD (this)->fops->setattr, 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", "quota.c", __FUNCTION__, 2472, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->setattr_cbk) tmp_cbk = quota_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 = "quota_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)
;
2473 return 0;
2474
2475unwind:
2476 QUOTA_STACK_UNWIND (setattr, frame, -1, ENOMEM, NULL, NULL, NULL)do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_setattr_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 2476, 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, -1, 12, ((void*)0), ((void*)0), ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); quota_local_cleanup (_this, _local
); } while (0)
;
2477 return 0;
2478}
2479
2480
2481int32_t
2482quota_fsetattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
2483 int32_t op_ret, int32_t op_errno, struct iatt *statpre,
2484 struct iatt *statpost, dict_t *xdata)
2485{
2486 quota_local_t *local = NULL((void*)0);
2487 quota_inode_ctx_t *ctx = NULL((void*)0);
2488
2489 if (op_ret < 0) {
2490 goto out;
2491 }
2492
2493 local = frame->local;
2494 if (local == NULL((void*)0)) {
2495 gf_log (this->name, GF_LOG_WARNING, "local is NULL")do { do { if (0) printf ("local is NULL"); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 2495, GF_LOG_WARNING
, "local is NULL"); } while (0)
;
2496 goto out;
2497 }
2498
2499 quota_inode_ctx_get (local->loc.inode, -1, this, NULL((void*)0), NULL((void*)0),
2500 &ctx, 0);
2501 if (ctx == NULL((void*)0)) {
2502 gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("quota context not set in inode (gfid:%s)"
, uuid_utoa (local->loc.inode->gfid)); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 2504, GF_LOG_WARNING
, "quota context not set in inode (gfid:%s)", uuid_utoa (local
->loc.inode->gfid)); } while (0)
2503 "quota context not set in inode (gfid:%s)",do { do { if (0) printf ("quota context not set in inode (gfid:%s)"
, uuid_utoa (local->loc.inode->gfid)); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 2504, GF_LOG_WARNING
, "quota context not set in inode (gfid:%s)", uuid_utoa (local
->loc.inode->gfid)); } while (0)
2504 uuid_utoa (local->loc.inode->gfid))do { do { if (0) printf ("quota context not set in inode (gfid:%s)"
, uuid_utoa (local->loc.inode->gfid)); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 2504, GF_LOG_WARNING
, "quota context not set in inode (gfid:%s)", uuid_utoa (local
->loc.inode->gfid)); } while (0)
;
2505 goto out;
2506 }
2507
2508 LOCK (&ctx->lock)pthread_spin_lock (&ctx->lock);
2509 {
2510 ctx->buf = *statpost;
2511 }
2512 UNLOCK (&ctx->lock)pthread_spin_unlock (&ctx->lock);
2513
2514out:
2515 QUOTA_STACK_UNWIND (fsetattr, frame, op_ret, op_errno, statpre,do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_fsetattr_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 2516, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_fsetattr_cbk_t )frame->ret; _parent = frame->parent
; pthread_spin_lock (&frame->root->stack_lock); { _parent
->ref_count--; } pthread_spin_unlock (&frame->root->
stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, op_ret, op_errno, statpre, statpost, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0); quota_local_cleanup (_this, _local
); } while (0)
2516 statpost, xdata)do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_fsetattr_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 2516, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_fsetattr_cbk_t )frame->ret; _parent = frame->parent
; pthread_spin_lock (&frame->root->stack_lock); { _parent
->ref_count--; } pthread_spin_unlock (&frame->root->
stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, op_ret, op_errno, statpre, statpost, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0); quota_local_cleanup (_this, _local
); } while (0)
;
2517 return 0;
2518}
2519
2520
2521int32_t
2522quota_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd,
2523 struct iatt *stbuf, int32_t valid, dict_t *xdata)
2524{
2525 quota_local_t *local = NULL((void*)0);
2526
2527 local = quota_local_new ();
2528 if (local == NULL((void*)0)) {
2529 goto unwind;
2530 }
2531
2532 frame->local = local;
2533
2534 local->loc.inode = inode_ref (fd->inode);
2535
2536 STACK_WIND (frame, quota_fsetattr_cbk, FIRST_CHILD (this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "quota.c", __FUNCTION__, 2537, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->fsetattr_cbk) tmp_cbk = quota_fsetattr_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD (this)->fops->fsetattr"
; _new->unwind_to = "quota_fsetattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->fsetattr); (this->children->xlator
)->fops->fsetattr (_new, (this->children->xlator)
, fd, stbuf, valid, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
2537 FIRST_CHILD (this)->fops->fsetattr, 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", "quota.c", __FUNCTION__, 2537, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->fsetattr_cbk) tmp_cbk = quota_fsetattr_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = _new; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD (this)->fops->fsetattr"
; _new->unwind_to = "quota_fsetattr_cbk"; pthread_spin_init
(&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { _new->next = frame->root->frames
.next; _new->prev = &frame->root->frames; if (frame
->root->frames.next) frame->root->frames.next->
prev = _new; frame->root->frames.next = _new; frame->
ref_count++; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if (frame->this->
ctx->measure_latency) gf_latency_begin (_new, (this->children
->xlator)->fops->fsetattr); (this->children->xlator
)->fops->fsetattr (_new, (this->children->xlator)
, fd, stbuf, valid, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
;
2538 return 0;
2539
2540unwind:
2541 QUOTA_STACK_UNWIND (fsetattr, frame, -1, ENOMEM, NULL, NULL, NULL)do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_fsetattr_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 2541, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_fsetattr_cbk_t )frame->ret; _parent = frame->parent
; pthread_spin_lock (&frame->root->stack_lock); { _parent
->ref_count--; } pthread_spin_unlock (&frame->root->
stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, -1, 12, ((void*)0), ((void*)0), ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); quota_local_cleanup (_this, _local
); } while (0)
;
2542 return 0;
2543}
2544
2545
2546int32_t
2547quota_mknod_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
2548 int32_t op_ret, int32_t op_errno, inode_t *inode,
2549 struct iatt *buf, struct iatt *preparent,
2550 struct iatt *postparent, dict_t *xdata)
2551{
2552 int32_t ret = -1;
2553 quota_local_t *local = NULL((void*)0);
2554 quota_inode_ctx_t *ctx = NULL((void*)0);
2555 quota_dentry_t *dentry = NULL((void*)0);
2556
2557 local = frame->local;
2558 if (op_ret < 0) {
2559 goto unwind;
2560 }
2561
2562 ret = quota_inode_ctx_get (inode, -1, this, NULL((void*)0), buf, &ctx, 1);
2563 if ((ret == -1) || (ctx == NULL((void*)0))) {
2564 gf_log (this->name, GF_LOG_WARNING, "cannot create quota "do { do { if (0) printf ("cannot create quota " "context in inode (gfid:%s)"
, uuid_utoa (inode->gfid)); } while (0); _gf_log (this->
name, "quota.c", __FUNCTION__, 2565, GF_LOG_WARNING, "cannot create quota "
"context in inode (gfid:%s)", uuid_utoa (inode->gfid)); }
while (0)
2565 "context in inode (gfid:%s)", uuid_utoa (inode->gfid))do { do { if (0) printf ("cannot create quota " "context in inode (gfid:%s)"
, uuid_utoa (inode->gfid)); } while (0); _gf_log (this->
name, "quota.c", __FUNCTION__, 2565, GF_LOG_WARNING, "cannot create quota "
"context in inode (gfid:%s)", uuid_utoa (inode->gfid)); }
while (0)
;
2566 op_ret = -1;
2567 op_errno = ENOMEM12;
2568 goto unwind;
2569 }
2570
2571 LOCK (&ctx->lock)pthread_spin_lock (&ctx->lock);
2572 {
2573 ctx->buf = *buf;
2574
2575 dentry = __quota_dentry_new (ctx, (char *)local->loc.name,
2576 local->loc.parent->gfid);
2577 if (dentry == NULL((void*)0)) {
2578 gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("cannot create a new dentry (name:%s) for "
"inode(gfid:%s)", local->loc.name, uuid_utoa (local->loc
.inode->gfid)); } while (0); _gf_log (this->name, "quota.c"
, __FUNCTION__, 2581, GF_LOG_WARNING, "cannot create a new dentry (name:%s) for "
"inode(gfid:%s)", local->loc.name, uuid_utoa (local->loc
.inode->gfid)); } while (0)
2579 "cannot create a new dentry (name:%s) for "do { do { if (0) printf ("cannot create a new dentry (name:%s) for "
"inode(gfid:%s)", local->loc.name, uuid_utoa (local->loc
.inode->gfid)); } while (0); _gf_log (this->name, "quota.c"
, __FUNCTION__, 2581, GF_LOG_WARNING, "cannot create a new dentry (name:%s) for "
"inode(gfid:%s)", local->loc.name, uuid_utoa (local->loc
.inode->gfid)); } while (0)
2580 "inode(gfid:%s)", local->loc.name,do { do { if (0) printf ("cannot create a new dentry (name:%s) for "
"inode(gfid:%s)", local->loc.name, uuid_utoa (local->loc
.inode->gfid)); } while (0); _gf_log (this->name, "quota.c"
, __FUNCTION__, 2581, GF_LOG_WARNING, "cannot create a new dentry (name:%s) for "
"inode(gfid:%s)", local->loc.name, uuid_utoa (local->loc
.inode->gfid)); } while (0)
2581 uuid_utoa (local->loc.inode->gfid))do { do { if (0) printf ("cannot create a new dentry (name:%s) for "
"inode(gfid:%s)", local->loc.name, uuid_utoa (local->loc
.inode->gfid)); } while (0); _gf_log (this->name, "quota.c"
, __FUNCTION__, 2581, GF_LOG_WARNING, "cannot create a new dentry (name:%s) for "
"inode(gfid:%s)", local->loc.name, uuid_utoa (local->loc
.inode->gfid)); } while (0)
;
2582 op_ret = -1;
2583 op_errno = ENOMEM12;
2584 goto unlock;
2585 }
2586 }
2587unlock:
2588 UNLOCK (&ctx->lock)pthread_spin_unlock (&ctx->lock);
2589
2590unwind:
2591 QUOTA_STACK_UNWIND (mknod, frame, op_ret, op_errno, inode,do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_mknod_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 2592, 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); quota_local_cleanup (_this, _local); } while (0)
2592 buf, preparent, postparent, xdata)do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_mknod_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 2592, 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); quota_local_cleanup (_this, _local); } while (0)
;
2593 return 0;
2594}
2595
2596
2597int
2598quota_mknod_helper (call_frame_t *frame, xlator_t *this, loc_t *loc,
2599 mode_t mode, dev_t rdev, mode_t umask, dict_t *xdata)
2600{
2601 quota_local_t *local = NULL((void*)0);
2602 int32_t op_errno = EINVAL22;
2603
2604 local = frame->local;
2605 if (local == NULL((void*)0)) {
2606 gf_log (this->name, GF_LOG_WARNING, "local is NULL")do { do { if (0) printf ("local is NULL"); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 2606, GF_LOG_WARNING
, "local is NULL"); } while (0)
;
2607 goto unwind;
2608 }
2609
2610 if (local->op_ret == -1) {
2611 op_errno = local->op_errno;
2612 goto unwind;
2613 }
2614
2615 STACK_WIND (frame, quota_mknod_cbk, FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "quota.c", __FUNCTION__, 2617, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->mknod_cbk) tmp_cbk = quota_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 = "quota_mknod_cbk"; pthread_spin_init (&_new
->lock, 0); pthread_spin_lock (&frame->root->stack_lock
); { _new->next = frame->root->frames.next; _new->
prev = &frame->root->frames; if (frame->root->
frames.next) frame->root->frames.next->prev = _new; frame
->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock
(&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = (this->children->
xlator); if (frame->this->ctx->measure_latency) gf_latency_begin
(_new, (this->children->xlator)->fops->mknod); (
this->children->xlator)->fops->mknod (_new, (this
->children->xlator), loc, mode, rdev, umask, xdata); (*
__glusterfs_this_location()) = old_THIS; } while (0)
2616 FIRST_CHILD(this)->fops->mknod, loc, mode, rdev, umask,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "quota.c", __FUNCTION__, 2617, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->mknod_cbk) tmp_cbk = quota_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 = "quota_mknod_cbk"; pthread_spin_init (&_new
->lock, 0); pthread_spin_lock (&frame->root->stack_lock
); { _new->next = frame->root->frames.next; _new->
prev = &frame->root->frames; if (frame->root->
frames.next) frame->root->frames.next->prev = _new; frame
->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock
(&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = (this->children->
xlator); if (frame->this->ctx->measure_latency) gf_latency_begin
(_new, (this->children->xlator)->fops->mknod); (
this->children->xlator)->fops->mknod (_new, (this
->children->xlator), loc, mode, rdev, umask, xdata); (*
__glusterfs_this_location()) = old_THIS; } while (0)
2617 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", "quota.c", __FUNCTION__, 2617, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->mknod_cbk) tmp_cbk = quota_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 = "quota_mknod_cbk"; pthread_spin_init (&_new
->lock, 0); pthread_spin_lock (&frame->root->stack_lock
); { _new->next = frame->root->frames.next; _new->
prev = &frame->root->frames; if (frame->root->
frames.next) frame->root->frames.next->prev = _new; frame
->root->frames.next = _new; frame->ref_count++; } pthread_spin_unlock
(&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = (this->children->
xlator); if (frame->this->ctx->measure_latency) gf_latency_begin
(_new, (this->children->xlator)->fops->mknod); (
this->children->xlator)->fops->mknod (_new, (this
->children->xlator), loc, mode, rdev, umask, xdata); (*
__glusterfs_this_location()) = old_THIS; } while (0)
;
2618
2619 return 0;
2620
2621unwind:
2622 QUOTA_STACK_UNWIND (mknod, frame, -1, op_errno, NULL, NULL,do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_mknod_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 2623, 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, -1, op_errno, ((void*)0), ((void*)0), ((void*)0), (
(void*)0), ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0); quota_local_cleanup (_this, _local); } while (
0)
2623 NULL, NULL, NULL)do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_mknod_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 2623, 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, -1, op_errno, ((void*)0), ((void*)0), ((void*)0), (
(void*)0), ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0); quota_local_cleanup (_this, _local); } while (
0)
;
2624 return 0;
2625}
2626
2627
2628int
2629quota_mknod (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode,
2630 dev_t rdev, mode_t umask, dict_t *xdata)
2631{
2632 int32_t ret = -1;
2633 quota_local_t *local = NULL((void*)0);
2634 call_stub_t *stub = NULL((void*)0);
2635
2636 local = quota_local_new ();
2637 if (local == NULL((void*)0)) {
2638 goto err;
2639 }
2640
2641 frame->local = local;
2642
2643 ret = loc_copy (&local->loc, loc);
2644 if (ret) {
2645 gf_log (this->name, GF_LOG_WARNING, "loc_copy failed")do { do { if (0) printf ("loc_copy failed"); } while (0); _gf_log
(this->name, "quota.c", __FUNCTION__, 2645, GF_LOG_WARNING
, "loc_copy failed"); } while (0)
;
2646 goto err;
2647 }
2648
2649 stub = fop_mknod_stub (frame, quota_mknod_helper, loc, mode, rdev,
2650 umask, xdata);
2651 if (stub == NULL((void*)0)) {
2652 goto err;
2653 }
2654
2655 local->link_count = 1;
2656 local->stub = stub;
2657 local->delta = 0;
2658
2659 quota_check_limit (frame, loc->parent, this, NULL((void*)0), NULL((void*)0));
2660
2661 stub = NULL((void*)0);
2662
2663 LOCK (&local->lock)pthread_spin_lock (&local->lock);
2664 {
2665 local->link_count = 0;
2666 if (local->validate_count == 0) {
2667 stub = local->stub;
2668 local->stub = NULL((void*)0);
2669 }
2670 }
2671 UNLOCK (&local->lock)pthread_spin_unlock (&local->lock);
2672
2673 if (stub != NULL((void*)0)) {
2674 call_resume (stub);
2675 }
2676
2677 return 0;
2678err:
2679 QUOTA_STACK_UNWIND (mknod, frame, -1, ENOMEM, NULL, NULL, NULL, NULL,do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_mknod_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 2680, 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, -1, 12, ((void*)0), ((void*)0), ((void*)0), ((void
*)0), ((void*)0)); (*__glusterfs_this_location()) = old_THIS;
} while (0); quota_local_cleanup (_this, _local); } while (0
)
2680 NULL)do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_mknod_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 2680, 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, -1, 12, ((void*)0), ((void*)0), ((void*)0), ((void
*)0), ((void*)0)); (*__glusterfs_this_location()) = old_THIS;
} while (0); quota_local_cleanup (_this, _local); } while (0
)
;
2681
2682 return 0;
2683}
2684
2685int
2686quota_setxattr_cbk (call_frame_t *frame, void *cookie,
2687 xlator_t *this, int op_ret, int op_errno, dict_t *xdata)
2688{
2689 QUOTA_STACK_UNWIND (setxattr, frame, op_ret, op_errno, xdata)do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_setxattr_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 2689, 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); quota_local_cleanup (_this, _local
); } while (0)
;
2690 return 0;
2691}
2692
2693int
2694quota_setxattr (call_frame_t *frame, xlator_t *this,
2695 loc_t *loc, dict_t *dict, int flags, dict_t *xdata)
2696{
2697 int op_errno = EINVAL22;
2698 int op_ret = -1;
2699
2700 VALIDATE_OR_GOTO (frame, err)do { if (!frame) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "frame"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "quota.c"
, __FUNCTION__, 2700, GF_LOG_WARNING, "invalid argument: " "frame"
); } while (0); goto err; } } while (0)
;
2701 VALIDATE_OR_GOTO (this, err)do { if (!this) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "this"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "quota.c"
, __FUNCTION__, 2701, GF_LOG_WARNING, "invalid argument: " "this"
); } while (0); goto err; } } while (0)
;
2702 VALIDATE_OR_GOTO (loc, err)do { if (!loc) { (*__errno_location ()) = 22; do { do { if (0
) printf ("invalid argument: " "loc"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "quota.c"
, __FUNCTION__, 2702, GF_LOG_WARNING, "invalid argument: " "loc"
); } while (0); goto err; } } while (0)
;
2703
2704 GF_IF_INTERNAL_XATTR_GOTO ("trusted.glusterfs.quota*", dict,do { if (!dict) { do { do { if (0) printf ("setxattr dict is null"
); } while (0); _gf_log (this->name, "quota.c", __FUNCTION__
, 2705, GF_LOG_ERROR, "setxattr dict is null"); } while (0); goto
err; } if (dict_foreach_fnmatch (dict, "trusted.glusterfs.quota*"
, dict_null_foreach_fn, ((void*)0)) > 0) { op_errno = 1; do
{ do { if (0) printf ("attempt to set internal" " xattr: %s: %s"
, "trusted.glusterfs.quota*", strerror (op_errno)); } while (
0); _gf_log (this->name, "quota.c", __FUNCTION__, 2705, GF_LOG_ERROR
, "attempt to set internal" " xattr: %s: %s", "trusted.glusterfs.quota*"
, strerror (op_errno)); } while (0); goto err; } } while (0)
2705 op_errno, err)do { if (!dict) { do { do { if (0) printf ("setxattr dict is null"
); } while (0); _gf_log (this->name, "quota.c", __FUNCTION__
, 2705, GF_LOG_ERROR, "setxattr dict is null"); } while (0); goto
err; } if (dict_foreach_fnmatch (dict, "trusted.glusterfs.quota*"
, dict_null_foreach_fn, ((void*)0)) > 0) { op_errno = 1; do
{ do { if (0) printf ("attempt to set internal" " xattr: %s: %s"
, "trusted.glusterfs.quota*", strerror (op_errno)); } while (
0); _gf_log (this->name, "quota.c", __FUNCTION__, 2705, GF_LOG_ERROR
, "attempt to set internal" " xattr: %s: %s", "trusted.glusterfs.quota*"
, strerror (op_errno)); } while (0); goto err; } } while (0)
;
2706
2707 STACK_WIND (frame, quota_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", "quota.c", __FUNCTION__, 2710, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->setxattr_cbk) tmp_cbk = quota_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 = "quota_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)
2708 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", "quota.c", __FUNCTION__, 2710, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->setxattr_cbk) tmp_cbk = quota_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 = "quota_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)
2709 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", "quota.c", __FUNCTION__, 2710, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->setxattr_cbk) tmp_cbk = quota_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 = "quota_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)
2710 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", "quota.c", __FUNCTION__, 2710, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->setxattr_cbk) tmp_cbk = quota_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 = "quota_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)
;
2711 return 0;
2712err:
2713 QUOTA_STACK_UNWIND (setxattr, frame, op_ret, op_errno, NULL)do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_setxattr_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 2713, 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, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); quota_local_cleanup (_this, _local
); } while (0)
;
2714 return 0;
2715}
2716
2717int
2718quota_fsetxattr_cbk (call_frame_t *frame, void *cookie,
2719 xlator_t *this, int op_ret, int op_errno, dict_t *xdata)
2720{
2721 QUOTA_STACK_UNWIND (fsetxattr, frame, op_ret, op_errno, xdata)do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_fsetxattr_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 2721, 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); quota_local_cleanup (_this, _local
); } while (0)
;
2722 return 0;
2723}
2724
2725int
2726quota_fsetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd,
2727 dict_t *dict, int flags, dict_t *xdata)
2728{
2729 int32_t op_ret = -1;
2730 int32_t op_errno = EINVAL22;
2731
2732 VALIDATE_OR_GOTO (frame, err)do { if (!frame) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "frame"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "quota.c"
, __FUNCTION__, 2732, GF_LOG_WARNING, "invalid argument: " "frame"
); } while (0); goto err; } } while (0)
;
2733 VALIDATE_OR_GOTO (this, err)do { if (!this) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "this"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "quota.c"
, __FUNCTION__, 2733, GF_LOG_WARNING, "invalid argument: " "this"
); } while (0); goto err; } } while (0)
;
2734 VALIDATE_OR_GOTO (fd, err)do { if (!fd) { (*__errno_location ()) = 22; do { do { if (0)
printf ("invalid argument: " "fd"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "quota.c"
, __FUNCTION__, 2734, GF_LOG_WARNING, "invalid argument: " "fd"
); } while (0); goto err; } } while (0)
;
2735
2736 GF_IF_INTERNAL_XATTR_GOTO ("trusted.glusterfs.quota*", dict,do { if (!dict) { do { do { if (0) printf ("setxattr dict is null"
); } while (0); _gf_log (this->name, "quota.c", __FUNCTION__
, 2737, GF_LOG_ERROR, "setxattr dict is null"); } while (0); goto
err; } if (dict_foreach_fnmatch (dict, "trusted.glusterfs.quota*"
, dict_null_foreach_fn, ((void*)0)) > 0) { op_errno = 1; do
{ do { if (0) printf ("attempt to set internal" " xattr: %s: %s"
, "trusted.glusterfs.quota*", strerror (op_errno)); } while (
0); _gf_log (this->name, "quota.c", __FUNCTION__, 2737, GF_LOG_ERROR
, "attempt to set internal" " xattr: %s: %s", "trusted.glusterfs.quota*"
, strerror (op_errno)); } while (0); goto err; } } while (0)
2737 op_errno, err)do { if (!dict) { do { do { if (0) printf ("setxattr dict is null"
); } while (0); _gf_log (this->name, "quota.c", __FUNCTION__
, 2737, GF_LOG_ERROR, "setxattr dict is null"); } while (0); goto
err; } if (dict_foreach_fnmatch (dict, "trusted.glusterfs.quota*"
, dict_null_foreach_fn, ((void*)0)) > 0) { op_errno = 1; do
{ do { if (0) printf ("attempt to set internal" " xattr: %s: %s"
, "trusted.glusterfs.quota*", strerror (op_errno)); } while (
0); _gf_log (this->name, "quota.c", __FUNCTION__, 2737, GF_LOG_ERROR
, "attempt to set internal" " xattr: %s: %s", "trusted.glusterfs.quota*"
, strerror (op_errno)); } while (0); goto err; } } while (0)
;
2738
2739 STACK_WIND (frame, quota_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", "quota.c", __FUNCTION__, 2742, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->fsetxattr_cbk) tmp_cbk = quota_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 = "quota_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)
2740 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", "quota.c", __FUNCTION__, 2742, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->fsetxattr_cbk) tmp_cbk = quota_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 = "quota_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)
2741 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", "quota.c", __FUNCTION__, 2742, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->fsetxattr_cbk) tmp_cbk = quota_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 = "quota_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)
2742 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", "quota.c", __FUNCTION__, 2742, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->fsetxattr_cbk) tmp_cbk = quota_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 = "quota_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)
;
2743 return 0;
2744 err:
2745 QUOTA_STACK_UNWIND (fsetxattr, frame, op_ret, op_errno, NULL)do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } do { fop_fsetxattr_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "quota.c", __FUNCTION__
, 2745, 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, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); quota_local_cleanup (_this, _local
); } while (0)
;
2746 return 0;
2747}
2748
2749
2750int
2751quota_removexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
2752 int32_t op_ret, int32_t op_errno, dict_t *xdata)
2753{
2754 QUOTA_STACK_UNWIND (removexattr, frame, op_ret, op_errno, xdata)do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } 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", "quota.c", __FUNCTION__
, 2754, 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); quota_local_cleanup (_this, _local
); } while (0)
;
2755 return 0;
2756}
2757
2758int
2759quota_removexattr (call_frame_t *frame, xlator_t *this,
2760 loc_t *loc, const char *name, dict_t *xdata)
2761{
2762 int32_t op_errno = EINVAL22;
2763
2764 VALIDATE_OR_GOTO (this, err)do { if (!this) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "this"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "quota.c"
, __FUNCTION__, 2764, GF_LOG_WARNING, "invalid argument: " "this"
); } while (0); goto err; } } while (0)
;
2765
2766 GF_IF_NATIVE_XATTR_GOTO ("trusted.quota*",do { if (!name) { do { do { if (0) printf ("no key for removexattr"
); } while (0); _gf_log (this->name, "quota.c", __FUNCTION__
, 2767, GF_LOG_ERROR, "no key for removexattr"); } while (0);
goto err; } if (!fnmatch ("trusted.quota*", name, 0)) { op_errno
= 1; do { do { if (0) printf ("attempt to remove internal " "xattr: %s: %s"
, name, strerror (op_errno)); } while (0); _gf_log (this->
name, "quota.c", __FUNCTION__, 2767, GF_LOG_ERROR, "attempt to remove internal "
"xattr: %s: %s", name, strerror (op_errno)); } while (0); goto
err; } } while (0)
2767 name, op_errno, err)do { if (!name) { do { do { if (0) printf ("no key for removexattr"
); } while (0); _gf_log (this->name, "quota.c", __FUNCTION__
, 2767, GF_LOG_ERROR, "no key for removexattr"); } while (0);
goto err; } if (!fnmatch ("trusted.quota*", name, 0)) { op_errno
= 1; do { do { if (0) printf ("attempt to remove internal " "xattr: %s: %s"
, name, strerror (op_errno)); } while (0); _gf_log (this->
name, "quota.c", __FUNCTION__, 2767, GF_LOG_ERROR, "attempt to remove internal "
"xattr: %s: %s", name, strerror (op_errno)); } while (0); goto
err; } } while (0)
;
2768
2769 VALIDATE_OR_GOTO (frame, err)do { if (!frame) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "frame"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "quota.c"
, __FUNCTION__, 2769, GF_LOG_WARNING, "invalid argument: " "frame"
); } while (0); goto err; } } while (0)
;
2770 VALIDATE_OR_GOTO (loc, err)do { if (!loc) { (*__errno_location ()) = 22; do { do { if (0
) printf ("invalid argument: " "loc"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "quota.c"
, __FUNCTION__, 2770, GF_LOG_WARNING, "invalid argument: " "loc"
); } while (0); goto err; } } while (0)
;
2771
2772 STACK_WIND (frame, quota_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", "quota.c", __FUNCTION__, 2775, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->removexattr_cbk) tmp_cbk = quota_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 = "quota_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)
2773 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", "quota.c", __FUNCTION__, 2775, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->removexattr_cbk) tmp_cbk = quota_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 = "quota_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)
2774 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", "quota.c", __FUNCTION__, 2775, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->removexattr_cbk) tmp_cbk = quota_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 = "quota_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)
2775 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", "quota.c", __FUNCTION__, 2775, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->removexattr_cbk) tmp_cbk = quota_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 = "quota_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)
;
2776 return 0;
2777err:
2778 QUOTA_STACK_UNWIND (removexattr, frame, -1, op_errno, NULL)do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } 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", "quota.c", __FUNCTION__
, 2778, 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, -1, op_errno, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); quota_local_cleanup (_this, _local
); } while (0)
;
2779 return 0;
2780}
2781
2782
2783int
2784quota_fremovexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
2785 int32_t op_ret, int32_t op_errno, dict_t *xdata)
2786{
2787 QUOTA_STACK_UNWIND (fremovexattr, frame, op_ret, op_errno, xdata)do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } 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", "quota.c", __FUNCTION__
, 2787, 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); quota_local_cleanup (_this, _local); } while (
0)
;
2788 return 0;
2789}
2790
2791int
2792quota_fremovexattr (call_frame_t *frame, xlator_t *this,
2793 fd_t *fd, const char *name, dict_t *xdata)
2794{
2795 int32_t op_ret = -1;
2796 int32_t op_errno = EINVAL22;
2797
2798 VALIDATE_OR_GOTO (frame, err)do { if (!frame) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "frame"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "quota.c"
, __FUNCTION__, 2798, GF_LOG_WARNING, "invalid argument: " "frame"
); } while (0); goto err; } } while (0)
;
2799 VALIDATE_OR_GOTO (this, err)do { if (!this) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "this"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "quota.c"
, __FUNCTION__, 2799, GF_LOG_WARNING, "invalid argument: " "this"
); } while (0); goto err; } } while (0)
;
2800 VALIDATE_OR_GOTO (fd, err)do { if (!fd) { (*__errno_location ()) = 22; do { do { if (0)
printf ("invalid argument: " "fd"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "quota.c"
, __FUNCTION__, 2800, GF_LOG_WARNING, "invalid argument: " "fd"
); } while (0); goto err; } } while (0)
;
2801
2802 GF_IF_NATIVE_XATTR_GOTO ("trusted.quota*",do { if (!name) { do { do { if (0) printf ("no key for removexattr"
); } while (0); _gf_log (this->name, "quota.c", __FUNCTION__
, 2803, GF_LOG_ERROR, "no key for removexattr"); } while (0);
goto err; } if (!fnmatch ("trusted.quota*", name, 0)) { op_errno
= 1; do { do { if (0) printf ("attempt to remove internal " "xattr: %s: %s"
, name, strerror (op_errno)); } while (0); _gf_log (this->
name, "quota.c", __FUNCTION__, 2803, GF_LOG_ERROR, "attempt to remove internal "
"xattr: %s: %s", name, strerror (op_errno)); } while (0); goto
err; } } while (0)
2803 name, op_errno, err)do { if (!name) { do { do { if (0) printf ("no key for removexattr"
); } while (0); _gf_log (this->name, "quota.c", __FUNCTION__
, 2803, GF_LOG_ERROR, "no key for removexattr"); } while (0);
goto err; } if (!fnmatch ("trusted.quota*", name, 0)) { op_errno
= 1; do { do { if (0) printf ("attempt to remove internal " "xattr: %s: %s"
, name, strerror (op_errno)); } while (0); _gf_log (this->
name, "quota.c", __FUNCTION__, 2803, GF_LOG_ERROR, "attempt to remove internal "
"xattr: %s: %s", name, strerror (op_errno)); } while (0); goto
err; } } while (0)
;
2804
2805 STACK_WIND (frame, quota_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", "quota.c", __FUNCTION__, 2808, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->fremovexattr_cbk) tmp_cbk = quota_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 = "quota_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)
2806 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", "quota.c", __FUNCTION__, 2808, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->fremovexattr_cbk) tmp_cbk = quota_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 = "quota_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)
2807 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", "quota.c", __FUNCTION__, 2808, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->fremovexattr_cbk) tmp_cbk = quota_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 = "quota_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)
2808 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", "quota.c", __FUNCTION__, 2808, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->fremovexattr_cbk) tmp_cbk = quota_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 = "quota_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)
;
2809 return 0;
2810 err:
2811 QUOTA_STACK_UNWIND (fremovexattr, frame, op_ret, op_errno, NULL)do { quota_local_t *_local = ((void*)0); xlator_t *_this = ((
void*)0); if (frame) { _local = frame->local; _this = frame
->this; frame->local = ((void*)0); } 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", "quota.c", __FUNCTION__
, 2811, 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, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0); quota_local_cleanup (_this, _local); } while (
0)
;
2812 return 0;
2813}
2814
2815
2816int32_t
2817quota_statfs_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
2818 int32_t op_ret, int32_t op_errno, struct statvfs *buf,
2819 dict_t *xdata)
2820{
2821 inode_t *root_inode = NULL((void*)0);
2822 quota_priv_t *priv = NULL((void*)0);
2823 uint64_t value = 0;
2824 quota_inode_ctx_t *ctx = NULL((void*)0);
2825 limits_t *limit_node = NULL((void*)0);
2826 int64_t usage = -1;
2827 int64_t avail = -1;
2828 int64_t blocks = 0;
2829
2830 root_inode = cookie;
2831
2832 /* This fop will fail mostly in case of client disconnect's,
2833 * which is already logged. Hence, not logging here */
2834 if (op_ret == -1)
2835 goto unwind;
2836 /*
2837 * We should never get here unless quota_statfs (below) sent us a
2838 * cookie, and it would only do so if the value was non-NULL. This
2839 * check is therefore just routine defensive coding.
2840 */
2841 if (!root_inode) {
2842 gf_log(this->name,GF_LOG_WARNING,do { do { if (0) printf ("null inode, cannot adjust for quota"
); } while (0); _gf_log (this->name, "quota.c", __FUNCTION__
, 2843, GF_LOG_WARNING, "null inode, cannot adjust for quota"
); } while (0)
2843 "null inode, cannot adjust for quota")do { do { if (0) printf ("null inode, cannot adjust for quota"
); } while (0); _gf_log (this->name, "quota.c", __FUNCTION__
, 2843, GF_LOG_WARNING, "null inode, cannot adjust for quota"
); } while (0)
;
2844 goto unwind;
2845 }
2846 if (!root_inode->table || (root_inode != root_inode->table->root)) {
2847 gf_log(this->name,GF_LOG_WARNING,do { do { if (0) printf ("non-root inode, cannot adjust for quota"
); } while (0); _gf_log (this->name, "quota.c", __FUNCTION__
, 2848, GF_LOG_WARNING, "non-root inode, cannot adjust for quota"
); } while (0)
2848 "non-root inode, cannot adjust for quota")do { do { if (0) printf ("non-root inode, cannot adjust for quota"
); } while (0); _gf_log (this->name, "quota.c", __FUNCTION__
, 2848, GF_LOG_WARNING, "non-root inode, cannot adjust for quota"
); } while (0)
;
2849 goto unwind;
2850 }
2851
2852 inode_ctx_get (root_inode, this, &value)inode_ctx_get2(root_inode,this,&value,0);
2853 if (!value) {
2854 goto unwind;
2855 }
2856 ctx = (quota_inode_ctx_t *)(unsigned long)value;
2857 usage = (ctx->size) / buf->f_bsize;
2858 priv = this->private;
2859
2860 list_for_each_entry (limit_node, &priv->limit_head, limit_list)for (limit_node = ((typeof(*limit_node) *)((char *)((&priv
->limit_head)->next)-(unsigned long)(&((typeof(*limit_node
) *)0)->limit_list))); &limit_node->limit_list != (
&priv->limit_head); limit_node = ((typeof(*limit_node)
*)((char *)(limit_node->limit_list.next)-(unsigned long)(
&((typeof(*limit_node) *)0)->limit_list))))
{
2861 /* Notice that this only works for volume-level quota. */
2862 if (strcmp (limit_node->path, "/") == 0) {
2863 blocks = limit_node->value / buf->f_bsize;
2864 if (usage > blocks) {
2865 break;
2866 }
2867
2868 buf->f_blocks = blocks;
2869 avail = buf->f_blocks - usage;
2870 if (buf->f_bfree > avail) {
2871 buf->f_bfree = avail;
2872 }
2873 /*
2874 * We have to assume that the total assigned quota
2875 * won't cause us to dip into the reserved space,
2876 * because dealing with the overcommitted cases is
2877 * just too hairy (especially when different bricks
2878 * might be using different reserved percentages and
2879 * such).
2880 */
2881 buf->f_bavail = buf->f_bfree;
2882 break;
2883 }
2884 }
2885
2886unwind:
2887 if (root_inode) {
2888 inode_unref(root_inode);
2889 }
2890 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"
, "quota.c", __FUNCTION__, 2890, 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)
;
2891 return 0;
2892}
2893
2894
2895int32_t
2896quota_statfs (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
2897{
2898 inode_t *root_inode = NULL((void*)0);
2899 quota_priv_t *priv = NULL((void*)0);
2900
2901 priv = this->private;
2902
2903 if (priv->consider_statfs && loc->inode) {
2904 root_inode = loc->inode->table->root;
2905 inode_ref(root_inode);
2906 STACK_WIND_COOKIE (frame, quota_statfs_cbk, root_inode,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "quota.c", __FUNCTION__, 2908, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->statfs_cbk) tmp_cbk = quota_statfs_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = root_inode; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->statfs";
_new->unwind_to = "quota_statfs_cbk"; pthread_spin_init (
&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { frame->ref_count++; _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; } pthread_spin_unlock (&frame->root->stack_lock
); (this->children->xlator)->fops->statfs_cbk = quota_statfs_cbk
; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if ((this->children->
xlator)->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)
2907 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", "quota.c", __FUNCTION__, 2908, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->statfs_cbk) tmp_cbk = quota_statfs_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = root_inode; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->statfs";
_new->unwind_to = "quota_statfs_cbk"; pthread_spin_init (
&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { frame->ref_count++; _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; } pthread_spin_unlock (&frame->root->stack_lock
); (this->children->xlator)->fops->statfs_cbk = quota_statfs_cbk
; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if ((this->children->
xlator)->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)
2908 FIRST_CHILD(this)->fops->statfs, 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", "quota.c", __FUNCTION__, 2908, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->statfs_cbk) tmp_cbk = quota_statfs_cbk
; _new->root = frame->root; _new->this = (this->children
->xlator); _new->ret = (ret_fn_t) tmp_cbk; _new->parent
= frame; _new->cookie = root_inode; _new->wind_from = __FUNCTION__
; _new->wind_to = "FIRST_CHILD(this)->fops->statfs";
_new->unwind_to = "quota_statfs_cbk"; pthread_spin_init (
&_new->lock, 0); pthread_spin_lock (&frame->root
->stack_lock); { frame->ref_count++; _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; } pthread_spin_unlock (&frame->root->stack_lock
); (this->children->xlator)->fops->statfs_cbk = quota_statfs_cbk
; old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = (this->children->xlator); if ((this->children->
xlator)->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)
;
2909 }
2910 else {
2911 /*
2912 * We have to make sure that we never get to quota_statfs_cbk
2913 * with a cookie that points to something other than an inode,
2914 * which is exactly what would happen with STACK_UNWIND using
2915 * that as a callback. Therefore, use default_statfs_cbk in
2916 * this case instead.
2917 *
2918 * Also if the option deem-statfs is not set to "on" don't
2919 * bother calculating quota limit on / in statfs_cbk.
2920 */
2921 if (priv->consider_statfs)
2922 gf_log(this->name,GF_LOG_WARNING,do { do { if (0) printf ("missing inode, cannot adjust for quota"
); } while (0); _gf_log (this->name, "quota.c", __FUNCTION__
, 2923, GF_LOG_WARNING, "missing inode, cannot adjust for quota"
); } while (0)
2923 "missing inode, cannot adjust for quota")do { do { if (0) printf ("missing inode, cannot adjust for quota"
); } while (0); _gf_log (this->name, "quota.c", __FUNCTION__
, 2923, GF_LOG_WARNING, "missing inode, cannot adjust for quota"
); } while (0)
;
2924 STACK_WIND (frame, default_statfs_cbk, FIRST_CHILD(this),do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "quota.c", __FUNCTION__, 2925, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->statfs_cbk) tmp_cbk = default_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 = "default_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)
2925 FIRST_CHILD(this)->fops->statfs, 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", "quota.c", __FUNCTION__, 2925, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->statfs_cbk) tmp_cbk = default_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 = "default_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)
;
2926 }
2927 return 0;
2928}
2929
2930
2931int
2932quota_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
2933 int op_ret, int op_errno, gf_dirent_t *entries,
2934 dict_t *xdata)
2935{
2936 gf_dirent_t *entry = NULL((void*)0);
2937
2938 if (op_ret <= 0)
2939 goto unwind;
2940
2941 list_for_each_entry (entry, &entries->list, list)for (entry = ((typeof(*entry) *)((char *)((&entries->list
)->next)-(unsigned long)(&((typeof(*entry) *)0)->list
))); &entry->list != (&entries->list); entry = (
(typeof(*entry) *)((char *)(entry->list.next)-(unsigned long
)(&((typeof(*entry) *)0)->list))))
{
2942 /* TODO: fill things */
2943 }
2944
2945unwind:
2946 STACK_UNWIND_STRICT (readdirp, frame, op_ret, op_errno, entries, xdata)do { fop_readdirp_cbk_t fn = ((void*)0); call_frame_t *_parent
= ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) {
do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack"
, "quota.c", __FUNCTION__, 2946, GF_LOG_CRITICAL, "!frame"); }
while (0); break; } fn = (fop_readdirp_cbk_t )frame->ret;
_parent = frame->parent; pthread_spin_lock (&frame->
root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock
(&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = _parent->this; frame
->complete = _gf_true; frame->unwind_from = __FUNCTION__
; if (frame->this->ctx->measure_latency) gf_latency_end
(frame); fn (_parent, frame->cookie, _parent->this, op_ret
, op_errno, entries, xdata); (*__glusterfs_this_location()) =
old_THIS; } while (0)
;
2947
2948 return 0;
2949}
2950int
2951quota_readdirp (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
2952 off_t offset, dict_t *dict)
2953{
2954 int ret = 0;
2955
2956 if (dict) {
2957 ret = dict_set_uint64 (dict, QUOTA_SIZE_KEY"trusted.glusterfs.quota.size", 0);
2958 if (ret < 0) {
2959 goto err;
2960 }
2961 }
2962
2963 STACK_WIND (frame, quota_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", "quota.c", __FUNCTION__, 2965, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->readdirp_cbk) tmp_cbk = quota_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 = "quota_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)
2964 FIRST_CHILD(this), FIRST_CHILD(this)->fops->readdirp,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "quota.c", __FUNCTION__, 2965, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->readdirp_cbk) tmp_cbk = quota_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 = "quota_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)
2965 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", "quota.c", __FUNCTION__, 2965, GF_LOG_ERROR
, "alloc failed"); } while (0); break; } typeof( (this->children
->xlator)->fops->readdirp_cbk) tmp_cbk = quota_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 = "quota_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)
;
2966 return 0;
2967err:
2968 STACK_UNWIND_STRICT (readdirp, frame, -1, EINVAL, NULL, NULL)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"
, "quota.c", __FUNCTION__, 2968, 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, -1
, 22, ((void*)0), ((void*)0)); (*__glusterfs_this_location())
= old_THIS; } while (0)
;
2969 return 0;
2970}
2971
2972
2973int32_t
2974mem_acct_init (xlator_t *this)
2975{
2976 int ret = -1;
2977
2978 if (!this)
2979 return ret;
2980
2981 ret = xlator_mem_acct_init (this, gf_quota_mt_end + 1);
2982
2983 if (ret != 0) {
2984 gf_log (this->name, GF_LOG_WARNING, "Memory accounting"do { do { if (0) printf ("Memory accounting" "init failed"); }
while (0); _gf_log (this->name, "quota.c", __FUNCTION__, 2985
, GF_LOG_WARNING, "Memory accounting" "init failed"); } while
(0)
2985 "init failed")do { do { if (0) printf ("Memory accounting" "init failed"); }
while (0); _gf_log (this->name, "quota.c", __FUNCTION__, 2985
, GF_LOG_WARNING, "Memory accounting" "init failed"); } while
(0)
;
2986 return ret;
2987 }
2988
2989 return ret;
2990}
2991
2992
2993int32_t
2994quota_forget (xlator_t *this, inode_t *inode)
2995{
2996 int32_t ret = 0;
2997 uint64_t ctx_int = 0;
2998 quota_inode_ctx_t *ctx = NULL((void*)0);
2999 quota_dentry_t *dentry = NULL((void*)0), *tmp;
3000
3001 ret = inode_ctx_del (inode, this, &ctx_int)inode_ctx_del2(inode,this,&ctx_int,0);
3002
3003 if (ret < 0) {
3004 return 0;
3005 }
3006
3007 ctx = (quota_inode_ctx_t *) (long)ctx_int;
3008
3009 LOCK (&ctx->lock)pthread_spin_lock (&ctx->lock);
3010 {
3011 list_for_each_entry_safe (dentry, tmp, &ctx->parents, next)for (dentry = ((typeof(*dentry) *)((char *)((&ctx->parents
)->next)-(unsigned long)(&((typeof(*dentry) *)0)->next
))), tmp = ((typeof(*dentry) *)((char *)(dentry->next.next
)-(unsigned long)(&((typeof(*dentry) *)0)->next))); &
dentry->next != (&ctx->parents); dentry = tmp, tmp =
((typeof(*tmp) *)((char *)(tmp->next.next)-(unsigned long
)(&((typeof(*tmp) *)0)->next))))
{
3012 __quota_dentry_free (dentry);
3013 }
3014 }
3015 UNLOCK (&ctx->lock)pthread_spin_unlock (&ctx->lock);
3016
3017 LOCK_DESTROY (&ctx->lock)pthread_spin_destroy (&ctx->lock);
3018
3019 GF_FREE (ctx)__gf_free (ctx);
3020
3021 return 0;
3022}
3023
3024
3025int
3026quota_parse_limits (quota_priv_t *priv, xlator_t *this, dict_t *xl_options,
3027 struct list_head *old_list)
3028{
3029 int32_t ret = -1;
3030 char *str = NULL((void*)0);
3031 char *str_val = NULL((void*)0);
3032 char *path = NULL((void*)0), *saveptr = NULL((void*)0);
3033 uint64_t value = 0;
3034 limits_t *quota_lim = NULL((void*)0), *old = NULL((void*)0);
3035 char *last_colon= NULL((void*)0);
3036
3037 ret = dict_get_str (xl_options, "limit-set", &str);
3038
3039 if (str) {
3040 path = strtok_r (str, ",", &saveptr);
3041
3042 while (path) {
3043 last_colon = strrchr (path, ':');
3044 *last_colon = '\0';
3045 str_val = last_colon + 1;
3046
3047 ret = gf_string2bytesize (str_val, &value);
3048 if (ret != 0)
3049 goto err;
3050
3051 QUOTA_ALLOC_OR_GOTO (quota_lim, limits_t, err)do { quota_lim = __gf_calloc (sizeof (limits_t), 1, gf_quota_mt_limits_t
); if (!quota_lim) { do { do { if (0) printf ("out of memory :("
); } while (0); _gf_log ("", "quota.c", __FUNCTION__, 3051, GF_LOG_ERROR
, "out of memory :("); } while (0); ret = -1; goto err; } } while
(0);
;
3052
3053 quota_lim->path = path;
3054
3055 quota_lim->value = value;
3056
3057 gf_log (this->name, GF_LOG_INFO, "%s:%"PRId64,do { do { if (0) printf ("%s:%""ll" "d", quota_lim->path, quota_lim
->value); } while (0); _gf_log (this->name, "quota.c", __FUNCTION__
, 3058, GF_LOG_INFO, "%s:%""ll" "d", quota_lim->path, quota_lim
->value); } while (0)
3058 quota_lim->path, quota_lim->value)do { do { if (0) printf ("%s:%""ll" "d", quota_lim->path, quota_lim
->value); } while (0); _gf_log (this->name, "quota.c", __FUNCTION__
, 3058, GF_LOG_INFO, "%s:%""ll" "d", quota_lim->path, quota_lim
->value); } while (0)
;
3059
3060 if (old_list != NULL((void*)0)) {
3061 list_for_each_entry (old, old_list,for (old = ((typeof(*old) *)((char *)((old_list)->next)-(unsigned
long)(&((typeof(*old) *)0)->limit_list))); &old->
limit_list != (old_list); old = ((typeof(*old) *)((char *)(old
->limit_list.next)-(unsigned long)(&((typeof(*old) *)0
)->limit_list))))
3062 limit_list)for (old = ((typeof(*old) *)((char *)((old_list)->next)-(unsigned
long)(&((typeof(*old) *)0)->limit_list))); &old->
limit_list != (old_list); old = ((typeof(*old) *)((char *)(old
->limit_list.next)-(unsigned long)(&((typeof(*old) *)0
)->limit_list))))
{
3063 if (strcmp (old->path, quota_lim->path)
3064 == 0) {
3065 uuid_copy (quota_lim->gfid,
3066 old->gfid);
3067 break;
3068 }
3069 }
3070 }
3071
3072 LOCK (&priv->lock)pthread_spin_lock (&priv->lock);
3073 {
3074 list_add_tail (&quota_lim->limit_list,
3075 &priv->limit_head);
3076 }
3077 UNLOCK (&priv->lock)pthread_spin_unlock (&priv->lock);
3078
3079 path = strtok_r (NULL((void*)0), ",", &saveptr);
3080 }
3081 } else {
3082 gf_log (this->name, GF_LOG_INFO,do { do { if (0) printf ("no \"limit-set\" option provided");
} while (0); _gf_log (this->name, "quota.c", __FUNCTION__
, 3083, GF_LOG_INFO, "no \"limit-set\" option provided"); } while
(0)
3083 "no \"limit-set\" option provided")do { do { if (0) printf ("no \"limit-set\" option provided");
} while (0); _gf_log (this->name, "quota.c", __FUNCTION__
, 3083, GF_LOG_INFO, "no \"limit-set\" option provided"); } while
(0)
;
3084 }
3085
3086 LOCK (&priv->lock)pthread_spin_lock (&priv->lock);
3087 {
3088 list_for_each_entry (quota_lim, &priv->limit_head, limit_list)for (quota_lim = ((typeof(*quota_lim) *)((char *)((&priv->
limit_head)->next)-(unsigned long)(&((typeof(*quota_lim
) *)0)->limit_list))); &quota_lim->limit_list != (&
priv->limit_head); quota_lim = ((typeof(*quota_lim) *)((char
*)(quota_lim->limit_list.next)-(unsigned long)(&((typeof
(*quota_lim) *)0)->limit_list))))
{
3089 gf_log (this->name, GF_LOG_INFO, "%s:%"PRId64,do { do { if (0) printf ("%s:%""ll" "d", quota_lim->path, quota_lim
->value); } while (0); _gf_log (this->name, "quota.c", __FUNCTION__
, 3090, GF_LOG_INFO, "%s:%""ll" "d", quota_lim->path, quota_lim
->value); } while (0)
3090 quota_lim->path, quota_lim->value)do { do { if (0) printf ("%s:%""ll" "d", quota_lim->path, quota_lim
->value); } while (0); _gf_log (this->name, "quota.c", __FUNCTION__
, 3090, GF_LOG_INFO, "%s:%""ll" "d", quota_lim->path, quota_lim
->value); } while (0)
;
3091 }
3092 }
3093 UNLOCK (&priv->lock)pthread_spin_unlock (&priv->lock);
3094
3095 ret = 0;
3096err:
3097 return ret;
3098}
3099
3100
3101int32_t
3102init (xlator_t *this)
3103{
3104 int32_t ret = -1;
3105 quota_priv_t *priv = NULL((void*)0);
3106
3107 if ((this->children == NULL((void*)0))
3108 || this->children->next) {
3109 gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("FATAL: quota (%s) not configured with "
"exactly one child", this->name); } while (0); _gf_log (this
->name, "quota.c", __FUNCTION__, 3111, GF_LOG_ERROR, "FATAL: quota (%s) not configured with "
"exactly one child", this->name); } while (0)
3110 "FATAL: quota (%s) not configured with "do { do { if (0) printf ("FATAL: quota (%s) not configured with "
"exactly one child", this->name); } while (0); _gf_log (this
->name, "quota.c", __FUNCTION__, 3111, GF_LOG_ERROR, "FATAL: quota (%s) not configured with "
"exactly one child", this->name); } while (0)
3111 "exactly one child", this->name)do { do { if (0) printf ("FATAL: quota (%s) not configured with "
"exactly one child", this->name); } while (0); _gf_log (this
->name, "quota.c", __FUNCTION__, 3111, GF_LOG_ERROR, "FATAL: quota (%s) not configured with "
"exactly one child", this->name); } while (0)
;
3112 return -1;
3113 }
3114
3115 if (this->parents == NULL((void*)0)) {
3116 gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("dangling volume. check volfile"); }
while (0); _gf_log (this->name, "quota.c", __FUNCTION__, 3117
, GF_LOG_WARNING, "dangling volume. check volfile"); } while (
0)
3117 "dangling volume. check volfile")do { do { if (0) printf ("dangling volume. check volfile"); }
while (0); _gf_log (this->name, "quota.c", __FUNCTION__, 3117
, GF_LOG_WARNING, "dangling volume. check volfile"); } while (
0)
;
3118 }
3119
3120 QUOTA_ALLOC_OR_GOTO (priv, quota_priv_t, err)do { priv = __gf_calloc (sizeof (quota_priv_t), 1, gf_quota_mt_quota_priv_t
); if (!priv) { do { do { if (0) printf ("out of memory :(");
} while (0); _gf_log ("", "quota.c", __FUNCTION__, 3120, GF_LOG_ERROR
, "out of memory :("); } while (0); ret = -1; goto err; } } while
(0);
;
3121
3122 INIT_LIST_HEAD (&priv->limit_head)do { (&priv->limit_head)->next = (&priv->limit_head
)->prev = &priv->limit_head; } while (0)
;
3123
3124 LOCK_INIT (&priv->lock)pthread_spin_init (&priv->lock, 0);
3125
3126 this->private = priv;
3127
3128 ret = quota_parse_limits (priv, this, this->options, NULL((void*)0));
3129
3130 if (ret) {
3131 goto err;
3132 }
3133
3134 GF_OPTION_INIT ("timeout", priv->timeout, int64, err)do { int val_ret = 0; val_ret = xlator_option_init_int64 ((*__glusterfs_this_location
()), (*__glusterfs_this_location())->options, "timeout", &
(priv->timeout)); if (val_ret) goto err; } while (0)
;
3135 GF_OPTION_INIT ("deem-statfs", priv->consider_statfs, bool, err)do { int val_ret = 0; val_ret = xlator_option_init_bool ((*__glusterfs_this_location
()), (*__glusterfs_this_location())->options, "deem-statfs"
, &(priv->consider_statfs)); if (val_ret) goto err; } while
(0)
;
3136
3137 this->local_pool = mem_pool_new (quota_local_t, 64)mem_pool_new_fn (sizeof(quota_local_t), 64, "quota_local_t");
3138 if (!this->local_pool) {
3139 ret = -1;
3140 gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("failed to create local_t's memory pool"
); } while (0); _gf_log (this->name, "quota.c", __FUNCTION__
, 3141, GF_LOG_ERROR, "failed to create local_t's memory pool"
); } while (0)
3141 "failed to create local_t's memory pool")do { do { if (0) printf ("failed to create local_t's memory pool"
); } while (0); _gf_log (this->name, "quota.c", __FUNCTION__
, 3141, GF_LOG_ERROR, "failed to create local_t's memory pool"
); } while (0)
;
3142 goto err;
3143 }
3144
3145 ret = 0;
3146err:
3147 return ret;
3148}
3149
3150
3151void
3152__quota_reconfigure_inode_ctx (xlator_t *this, inode_t *inode, limits_t *limit)
3153{
3154 int ret = -1;
3155 quota_inode_ctx_t *ctx = NULL((void*)0);
3156
3157 GF_VALIDATE_OR_GOTO ("quota", this, out)do { if (!this) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "this"); } while (0); _gf_log_callingfn
("quota", "quota.c", __FUNCTION__, 3157, GF_LOG_ERROR, "invalid argument: "
"this"); } while (0); goto out; } } while (0)
;
3158 GF_VALIDATE_OR_GOTO (this->name, inode, out)do { if (!inode) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "inode"); } while (0); _gf_log_callingfn
(this->name, "quota.c", __FUNCTION__, 3158, GF_LOG_ERROR,
"invalid argument: " "inode"); } while (0); goto out; } } while
(0)
;
3159 GF_VALIDATE_OR_GOTO (this->name, limit, out)do { if (!limit) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "limit"); } while (0); _gf_log_callingfn
(this->name, "quota.c", __FUNCTION__, 3159, GF_LOG_ERROR,
"invalid argument: " "limit"); } while (0); goto out; } } while
(0)
;
3160
3161 ret = quota_inode_ctx_get (inode, limit->value, this, NULL((void*)0), NULL((void*)0), &ctx,
3162 1);
3163 if ((ret == -1) || (ctx == NULL((void*)0))) {
3164 gf_log (this->name, GF_LOG_WARNING, "cannot create quota "do { do { if (0) printf ("cannot create quota " "context in inode(gfid:%s)"
, uuid_utoa (inode->gfid)); } while (0); _gf_log (this->
name, "quota.c", __FUNCTION__, 3166, GF_LOG_WARNING, "cannot create quota "
"context in inode(gfid:%s)", uuid_utoa (inode->gfid)); } while
(0)
3165 "context in inode(gfid:%s)",do { do { if (0) printf ("cannot create quota " "context in inode(gfid:%s)"
, uuid_utoa (inode->gfid)); } while (0); _gf_log (this->
name, "quota.c", __FUNCTION__, 3166, GF_LOG_WARNING, "cannot create quota "
"context in inode(gfid:%s)", uuid_utoa (inode->gfid)); } while
(0)
3166 uuid_utoa (inode->gfid))do { do { if (0) printf ("cannot create quota " "context in inode(gfid:%s)"
, uuid_utoa (inode->gfid)); } while (0); _gf_log (this->
name, "quota.c", __FUNCTION__, 3166, GF_LOG_WARNING, "cannot create quota "
"context in inode(gfid:%s)", uuid_utoa (inode->gfid)); } while
(0)
;
3167 goto out;
3168 }
3169
3170 LOCK (&ctx->lock)pthread_spin_lock (&ctx->lock);
3171 {
3172 ctx->limit = limit->value;
3173 }
3174 UNLOCK (&ctx->lock)pthread_spin_unlock (&ctx->lock);
3175
3176out:
3177 return;
3178}
3179
3180
3181void
3182__quota_reconfigure (xlator_t *this, inode_table_t *itable, limits_t *limit)
3183{
3184 inode_t *inode = NULL((void*)0);
3185
3186 if ((this == NULL((void*)0)) || (itable == NULL((void*)0)) || (limit == NULL((void*)0))) {
3187 goto out;
3188 }
3189
3190 if (!uuid_is_null (limit->gfid)) {
3191 inode = inode_find (itable, limit->gfid);
3192 } else {
3193 inode = inode_resolve (itable, limit->path);
3194 }
3195
3196 if (inode != NULL((void*)0)) {
3197 __quota_reconfigure_inode_ctx (this, inode, limit);
3198 }
3199
3200out:
3201 return;
3202}
3203
3204
3205int
3206reconfigure (xlator_t *this, dict_t *options)
3207{
3208 int32_t ret = -1;
3209 quota_priv_t *priv = NULL((void*)0);
3210 limits_t *limit = NULL((void*)0), *next = NULL((void*)0), *new = NULL((void*)0);
3211 struct list_head head = {0, };
3212 xlator_t *top = NULL((void*)0);
3213 char found = 0;
3214
3215 priv = this->private;
3216
3217 INIT_LIST_HEAD (&head)do { (&head)->next = (&head)->prev = &head;
} while (0)
;
3218
3219 LOCK (&priv->lock)pthread_spin_lock (&priv->lock);
3220 {
3221 list_splice_init (&priv->limit_head, &head);
3222 }
3223 UNLOCK (&priv->lock)pthread_spin_unlock (&priv->lock);
3224
3225 ret = quota_parse_limits (priv, this, options, &head);
3226 if (ret == -1) {
3227 gf_log ("quota", GF_LOG_WARNING,do { do { if (0) printf ("quota reconfigure failed, " "new changes will not take effect"
); } while (0); _gf_log ("quota", "quota.c", __FUNCTION__, 3229
, GF_LOG_WARNING, "quota reconfigure failed, " "new changes will not take effect"
); } while (0)
3228 "quota reconfigure failed, "do { do { if (0) printf ("quota reconfigure failed, " "new changes will not take effect"
); } while (0); _gf_log ("quota", "quota.c", __FUNCTION__, 3229
, GF_LOG_WARNING, "quota reconfigure failed, " "new changes will not take effect"
); } while (0)
3229 "new changes will not take effect")do { do { if (0) printf ("quota reconfigure failed, " "new changes will not take effect"
); } while (0); _gf_log ("quota", "quota.c", __FUNCTION__, 3229
, GF_LOG_WARNING, "quota reconfigure failed, " "new changes will not take effect"
); } while (0)
;
3230 goto out;
3231 }
3232
3233 LOCK (&priv->lock)pthread_spin_lock (&priv->lock);
3234 {
3235 top = ((glusterfs_ctx_t *)this->ctx)->active->top;
3236 GF_ASSERT (top)do { if (!(top)) { do { do { if (0) printf ("Assertion failed: "
"top"); } while (0); _gf_log_callingfn ("", "quota.c", __FUNCTION__
, 3236, GF_LOG_ERROR, "Assertion failed: " "top"); } while (0
); } } while (0)
;
3237
3238 list_for_each_entry (limit, &priv->limit_head, limit_list)for (limit = ((typeof(*limit) *)((char *)((&priv->limit_head
)->next)-(unsigned long)(&((typeof(*limit) *)0)->limit_list
))); &limit->limit_list != (&priv->limit_head);
limit = ((typeof(*limit) *)((char *)(limit->limit_list.next
)-(unsigned long)(&((typeof(*limit) *)0)->limit_list))
))
{
3239 __quota_reconfigure (this, top->itable, limit);
3240 }
3241
3242 list_for_each_entry_safe (limit, next, &head, limit_list)for (limit = ((typeof(*limit) *)((char *)((&head)->next
)-(unsigned long)(&((typeof(*limit) *)0)->limit_list))
), next = ((typeof(*limit) *)((char *)(limit->limit_list.next
)-(unsigned long)(&((typeof(*limit) *)0)->limit_list))
); &limit->limit_list != (&head); limit = next, next
= ((typeof(*next) *)((char *)(next->limit_list.next)-(unsigned
long)(&((typeof(*next) *)0)->limit_list))))
{
3243 found = 0;
3244 list_for_each_entry (new, &priv->limit_head,for (new = ((typeof(*new) *)((char *)((&priv->limit_head
)->next)-(unsigned long)(&((typeof(*new) *)0)->limit_list
))); &new->limit_list != (&priv->limit_head); new
= ((typeof(*new) *)((char *)(new->limit_list.next)-(unsigned
long)(&((typeof(*new) *)0)->limit_list))))
3245 limit_list)for (new = ((typeof(*new) *)((char *)((&priv->limit_head
)->next)-(unsigned long)(&((typeof(*new) *)0)->limit_list
))); &new->limit_list != (&priv->limit_head); new
= ((typeof(*new) *)((char *)(new->limit_list.next)-(unsigned
long)(&((typeof(*new) *)0)->limit_list))))
{
3246 if (strcmp (new->path, limit->path) == 0) {
3247 found = 1;
3248 break;
3249 }
3250 }
3251
3252 if (!found) {
3253 limit->value = -1;
3254 __quota_reconfigure (this, top->itable, limit);
3255 }
3256
3257 list_del_init (&limit->limit_list);
3258 GF_FREE (limit)__gf_free (limit);
3259 }
3260 }
3261 UNLOCK (&priv->lock)pthread_spin_unlock (&priv->lock);
3262
3263 GF_OPTION_RECONF ("timeout", priv->timeout, options, int64, out)do { int val_ret = 0; val_ret = xlator_option_reconf_int64 ((
*__glusterfs_this_location()), options, "timeout", &(priv
->timeout)); if (val_ret) goto out; } while (0)
;
3264 GF_OPTION_RECONF ("deem-statfs", priv->consider_statfs, options, bool,do { int val_ret = 0; val_ret = xlator_option_reconf_bool ((*
__glusterfs_this_location()), options, "deem-statfs", &(priv
->consider_statfs)); if (val_ret) goto out; } while (0)
3265 out)do { int val_ret = 0; val_ret = xlator_option_reconf_bool ((*
__glusterfs_this_location()), options, "deem-statfs", &(priv
->consider_statfs)); if (val_ret) goto out; } while (0)
;
3266
3267 ret = 0;
3268out:
3269 return ret;
3270}
3271
3272
3273void
3274fini (xlator_t *this)
3275{
3276 return;
3277}
3278
3279
3280struct xlator_fops fops = {
3281 .statfs = quota_statfs,
3282 .lookup = quota_lookup,
3283 .writev = quota_writev,
3284 .create = quota_create,
3285 .mkdir = quota_mkdir,
3286 .truncate = quota_truncate,
3287 .ftruncate = quota_ftruncate,
3288 .unlink = quota_unlink,
3289 .symlink = quota_symlink,
3290 .link = quota_link,
3291 .rename = quota_rename,
3292 .getxattr = quota_getxattr,
3293 .fgetxattr = quota_fgetxattr,
3294 .stat = quota_stat,
3295 .fstat = quota_fstat,
3296 .readlink = quota_readlink,
3297 .readv = quota_readv,
3298 .fsync = quota_fsync,
3299 .setattr = quota_setattr,
3300 .fsetattr = quota_fsetattr,
3301 .mknod = quota_mknod,
3302 .setxattr = quota_setxattr,
3303 .fsetxattr = quota_fsetxattr,
3304 .removexattr = quota_removexattr,
3305 .fremovexattr = quota_fremovexattr,
3306 .readdirp = quota_readdirp,
3307};
3308
3309struct xlator_cbks cbks = {
3310 .forget = quota_forget
3311};
3312
3313struct volume_options options[] = {
3314 {.key = {"limit-set"}},
3315 {.key = {"timeout"},
3316 .type = GF_OPTION_TYPE_SIZET,
3317 .min = 0,
3318 .max = 60,
3319 .default_value = "0",
3320 .description = "quota caches the directory sizes on client. Timeout "
3321 "indicates the timeout for the cache to be revalidated."
3322 },
3323 {.key = {"deem-statfs"},
3324 .type = GF_OPTION_TYPE_BOOL,
3325 .default_value = "off",
3326 .description = "If set to on, it takes quota limits into"
3327 "consideration while estimating fs size. (df command)"
3328 " (Default is off)."
3329 },
3330 {.key = {NULL((void*)0)}}
3331};