~ubuntu-branches/ubuntu/saucy/glusterfs/saucy

« back to all changes in this revision

Viewing changes to libglusterfs/src/stack.h

  • Committer: Package Import Robot
  • Author(s): Louis Zuckerman
  • Date: 2012-01-28 15:32:55 UTC
  • Revision ID: package-import@ubuntu.com-20120128153255-9hy06lmlw8ev6ttr
Added Ubuntu upstart jobs providing support for local glusterfs mounts
(LP: #876648)

Show diffs side-by-side

added added

removed removed

Lines of Context:
99
99
                };
100
100
        };
101
101
        call_pool_t                  *pool;
102
 
        gf_lock_t                     stack_lock;
103
102
        void                         *trans;
104
103
        uint64_t                      unique;
105
104
        void                         *state;  /* pointer to request state */
176
175
        }
177
176
 
178
177
        LOCK_DESTROY (&stack->frames.lock);
179
 
        LOCK_DESTROY (&stack->stack_lock);
180
178
 
181
179
        while (stack->frames.next) {
182
180
                FRAME_DESTROY (stack->frames.next);
220
218
                }                                                       \
221
219
                typeof(fn##_cbk) tmp_cbk = rfn;                         \
222
220
                _new->root = frame->root;                               \
 
221
                _new->next = frame->root->frames.next;                  \
 
222
                _new->prev = &frame->root->frames;                      \
 
223
                if (frame->root->frames.next)                           \
 
224
                        frame->root->frames.next->prev = _new;          \
 
225
                frame->root->frames.next = _new;                        \
223
226
                _new->this = obj;                                       \
224
227
                _new->ret = (ret_fn_t) tmp_cbk;                         \
225
228
                _new->parent = frame;                                   \
226
229
                _new->cookie = _new;                                    \
 
230
                LOCK_INIT (&_new->lock);                                \
227
231
                _new->wind_from = __FUNCTION__;                         \
228
232
                _new->wind_to = #fn;                                    \
229
233
                _new->unwind_to = #rfn;                                 \
230
 
                LOCK_INIT (&_new->lock);                                \
231
 
                LOCK(&frame->root->stack_lock);                         \
232
 
                {                                                       \
233
 
                        _new->next = frame->root->frames.next;          \
234
 
                        _new->prev = &frame->root->frames;              \
235
 
                        if (frame->root->frames.next)                   \
236
 
                                frame->root->frames.next->prev = _new;  \
237
 
                        frame->root->frames.next = _new;                \
238
 
                        frame->ref_count++;                             \
239
 
                }                                                       \
240
 
                UNLOCK(&frame->root->stack_lock);                       \
 
234
                frame->ref_count++;                                     \
241
235
                old_THIS = THIS;                                        \
242
236
                THIS = obj;                                             \
243
237
                fn (_new, obj, params);                                 \
258
252
                }                                                       \
259
253
                typeof(fn##_cbk) tmp_cbk = rfn;                         \
260
254
                _new->root = frame->root;                               \
 
255
                _new->next = frame->root->frames.next;                  \
 
256
                _new->prev = &frame->root->frames;                      \
 
257
                if (frame->root->frames.next)                           \
 
258
                        frame->root->frames.next->prev = _new;          \
 
259
                frame->root->frames.next = _new;                        \
261
260
                _new->this = obj;                                       \
262
261
                _new->ret = (ret_fn_t) tmp_cbk;                         \
263
262
                _new->parent = frame;                                   \
264
263
                _new->cookie = cky;                                     \
 
264
                LOCK_INIT (&_new->lock);                                \
265
265
                _new->wind_from = __FUNCTION__;                         \
266
266
                _new->wind_to = #fn;                                    \
267
267
                _new->unwind_to = #rfn;                                 \
268
 
                LOCK_INIT (&_new->lock);                                \
269
 
                LOCK(&frame->root->stack_lock);                         \
270
 
                {                                                       \
271
 
                        frame->ref_count++;                             \
272
 
                        _new->next = frame->root->frames.next;          \
273
 
                        _new->prev = &frame->root->frames;              \
274
 
                        if (frame->root->frames.next)                   \
275
 
                                frame->root->frames.next->prev = _new;  \
276
 
                        frame->root->frames.next = _new;                \
277
 
                }                                                       \
278
 
                UNLOCK(&frame->root->stack_lock);                       \
 
268
                frame->ref_count++;                                     \
279
269
                fn##_cbk = rfn;                                         \
280
270
                old_THIS = THIS;                                        \
281
271
                THIS = obj;                                             \
296
286
                }                                                       \
297
287
                fn = frame->ret;                                        \
298
288
                _parent = frame->parent;                                \
299
 
                LOCK(&frame->root->stack_lock);                         \
300
 
                {                                                       \
301
 
                        _parent->ref_count--;                           \
302
 
                }                                                       \
303
 
                UNLOCK(&frame->root->stack_lock);                       \
 
289
                _parent->ref_count--;                                   \
304
290
                old_THIS = THIS;                                        \
305
291
                THIS = _parent->this;                                   \
306
292
                frame->complete = _gf_true;                             \
323
309
                }                                                       \
324
310
                fn = (fop_##op##_cbk_t )frame->ret;                     \
325
311
                _parent = frame->parent;                                \
326
 
                LOCK(&frame->root->stack_lock);                         \
327
 
                {                                                       \
328
 
                        _parent->ref_count--;                           \
329
 
                }                                                       \
330
 
                UNLOCK(&frame->root->stack_lock);                       \
 
312
                _parent->ref_count--;                                   \
331
313
                old_THIS = THIS;                                        \
332
314
                THIS = _parent->this;                                   \
333
315
                frame->complete = _gf_true;                             \
370
352
        newstack->lk_owner = oldstack->lk_owner;
371
353
 
372
354
        LOCK_INIT (&newstack->frames.lock);
373
 
        LOCK_INIT (&newstack->stack_lock);
374
355
 
375
356
        LOCK (&oldstack->pool->lock);
376
357
        {
408
389
        UNLOCK (&pool->lock);
409
390
 
410
391
        LOCK_INIT (&stack->frames.lock);
411
 
        LOCK_INIT (&stack->stack_lock);
412
392
 
413
393
        return &stack->frames;
414
394
}