Whamcloud - gitweb
bfb8317ec8dc2bdf9a17b1e1a24f62480e066374
[fs/lustre-release.git] / lustre / include / lustre_update.h
1 /*
2  * GPL HEADER START
3  *
4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 only,
8  * as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License version 2 for more details (a copy is included
14  * in the LICENSE file that accompanied this code).
15  *
16  * You should have received a copy of the GNU General Public License
17  * version 2 along with this program; If not, see
18  * http://www.gnu.org/licenses/gpl-2.0.htm
19  *
20  * GPL HEADER END
21  */
22 /*
23  * Copyright (c) 2013, 2015, Intel Corporation.
24  */
25 /*
26  * lustre/include/lustre_update.h
27  *
28  * Author: Di Wang <di.wang@intel.com>
29  */
30
31 #ifndef _LUSTRE_UPDATE_H
32 #define _LUSTRE_UPDATE_H
33 #include <dt_object.h>
34 #include <lustre_net.h>
35 #include <obj_update.h>
36
37 #define OUT_UPDATE_INIT_BUFFER_SIZE     4096
38 #define OUT_UPDATE_REPLY_SIZE           4096
39 #define OUT_BULK_BUFFER_SIZE            4096
40
41 struct dt_key;
42 struct dt_rec;
43 struct object_update_param;
44 struct llog_update_record;
45
46 static inline size_t update_params_size(const struct update_params *params,
47                                         unsigned int param_count)
48 {
49         struct object_update_param      *param;
50         size_t total_size = sizeof(*params);
51         unsigned int i;
52
53         param = (struct object_update_param *)&params->up_params[0];
54         for (i = 0; i < param_count; i++) {
55                 size_t size = object_update_param_size(param);
56
57                 param = (struct object_update_param *)((char *)param + size);
58                 total_size += size;
59         }
60
61         return total_size;
62 }
63
64 static inline struct object_update_param *
65 update_params_get_param(const struct update_params *params,
66                         unsigned int index, unsigned int param_count)
67 {
68         struct object_update_param *param;
69         unsigned int            i;
70
71         if (index > param_count)
72                 return NULL;
73
74         param = (struct object_update_param *)&params->up_params[0];
75         for (i = 0; i < index; i++)
76                 param = (struct object_update_param *)((char *)param +
77                         object_update_param_size(param));
78
79         return param;
80 }
81
82 static inline void*
83 update_params_get_param_buf(const struct update_params *params, __u16 index,
84                             unsigned int param_count, __u16 *size)
85 {
86         struct object_update_param *param;
87
88         param = update_params_get_param(params, (unsigned int)index,
89                                         param_count);
90         if (param == NULL)
91                 return NULL;
92
93         if (size != NULL)
94                 *size = param->oup_len;
95
96         return param->oup_buf;
97 }
98
99 static inline size_t
100 update_op_size(unsigned int param_count)
101 {
102         return offsetof(struct update_op, uop_params_off[param_count]);
103 }
104
105 static inline struct update_op *
106 update_op_next_op(const struct update_op *uop)
107 {
108         return (struct update_op *)((char *)uop +
109                                 update_op_size(uop->uop_param_count));
110 }
111
112 static inline size_t update_ops_size(const struct update_ops *ops,
113                                      unsigned int update_count)
114 {
115         struct update_op *op;
116         size_t total_size = sizeof(*ops);
117         unsigned int i;
118
119         op = (struct update_op *)&ops->uops_op[0];
120         for (i = 0; i < update_count; i++, op = update_op_next_op(op))
121                 total_size += update_op_size(op->uop_param_count);
122
123         return total_size;
124 }
125
126 static inline struct update_params *
127 update_records_get_params(const struct update_records *record)
128 {
129         return (struct update_params *)((char *)record +
130                 offsetof(struct update_records, ur_ops) +
131                 update_ops_size(&record->ur_ops, record->ur_update_count));
132 }
133
134 static inline size_t
135 update_records_size(const struct update_records *record)
136 {
137         size_t op_size = 0;
138         size_t param_size = 0;
139
140         if (record->ur_update_count > 0)
141                 op_size = update_ops_size(&record->ur_ops,
142                                           record->ur_update_count);
143         if (record->ur_param_count > 0) {
144                 struct update_params *params;
145
146                 params = update_records_get_params(record);
147                 param_size = update_params_size(params, record->ur_param_count);
148         }
149
150         return cfs_size_round(offsetof(struct update_records, ur_ops) +
151                               op_size + param_size);
152 }
153
154 static inline size_t
155 llog_update_record_size(const struct llog_update_record *lur)
156 {
157         return cfs_size_round(sizeof(lur->lur_hdr) +
158                               update_records_size(&lur->lur_update_rec) +
159                               sizeof(struct llog_rec_tail));
160 }
161
162 static inline struct update_op *
163 update_ops_get_op(const struct update_ops *ops, unsigned int index,
164                   unsigned int update_count)
165 {
166         struct update_op *op;
167         unsigned int i;
168
169         if (index > update_count)
170                 return NULL;
171
172         op = (struct update_op *)&ops->uops_op[0];
173         for (i = 0; i < index; i++)
174                 op = update_op_next_op(op);
175
176         return op;
177 }
178
179 static inline void
180 *object_update_param_get(const struct object_update *update, size_t index,
181                          size_t *size)
182 {
183         const struct    object_update_param *param;
184         size_t          i;
185
186         if (index >= update->ou_params_count)
187                 return ERR_PTR(-EINVAL);
188
189         param = &update->ou_params[0];
190         for (i = 0; i < index; i++)
191                 param = (struct object_update_param *)((char *)param +
192                         object_update_param_size(param));
193
194         if (size != NULL)
195                 *size = param->oup_len;
196
197         if (param->oup_len == 0)
198                 return ERR_PTR(-ENODATA);
199
200         return (void *)&param->oup_buf[0];
201 }
202
203 static inline unsigned long
204 object_update_request_size(const struct object_update_request *our)
205 {
206         unsigned long   size;
207         size_t          i = 0;
208
209         size = offsetof(struct object_update_request, ourq_updates[0]);
210         for (i = 0; i < our->ourq_count; i++) {
211                 struct object_update *update;
212
213                 update = (struct object_update *)((char *)our + size);
214                 size += object_update_size(update);
215         }
216         return size;
217 }
218
219 static inline void
220 object_update_result_insert(struct object_update_reply *reply,
221                             void *data, size_t data_len, size_t index,
222                             int rc)
223 {
224         struct object_update_result *update_result;
225         char *ptr;
226
227         update_result = object_update_result_get(reply, index, NULL);
228         LASSERT(update_result != NULL);
229
230         update_result->our_rc = ptlrpc_status_hton(rc);
231         if (data != NULL && data_len > 0) {
232                 LASSERT(data != NULL);
233                 ptr = (char *)update_result +
234                         cfs_size_round(sizeof(struct object_update_reply));
235                 update_result->our_datalen = data_len;
236                 memcpy(ptr, data, data_len);
237         }
238
239         reply->ourp_lens[index] = cfs_size_round(data_len +
240                                         sizeof(struct object_update_result));
241 }
242
243 static inline int
244 object_update_result_data_get(const struct object_update_reply *reply,
245                               struct lu_buf *lbuf, size_t index)
246 {
247         struct object_update_result *update_result;
248         size_t size = 0;
249         int    result;
250
251         LASSERT(lbuf != NULL);
252         update_result = object_update_result_get(reply, index, &size);
253         if (update_result == NULL ||
254             size < cfs_size_round(sizeof(struct object_update_reply)) ||
255             update_result->our_datalen > size)
256                 RETURN(-EFAULT);
257
258         result = ptlrpc_status_ntoh(update_result->our_rc);
259         if (result < 0)
260                 return result;
261
262         lbuf->lb_buf = update_result->our_data;
263         lbuf->lb_len = update_result->our_datalen;
264
265         return result;
266 }
267
268 /**
269  * Attached in the thandle to record the updates for distribute
270  * distribution.
271  */
272 struct thandle_update_records {
273         /* All of updates for the cross-MDT operation, vmalloc'd. */
274         struct llog_update_record       *tur_update_records;
275         size_t                          tur_update_records_buf_size;
276
277         /* All of parameters for the cross-MDT operation, vmalloc'd */
278         struct update_params    *tur_update_params;
279         unsigned int            tur_update_param_count;
280         size_t                  tur_update_params_buf_size;
281 };
282
283 #define TOP_THANDLE_MAGIC       0x20140917
284 struct top_multiple_thandle {
285         struct dt_device        *tmt_master_sub_dt;
286         atomic_t                tmt_refcount;
287         /* Other sub transactions will be listed here. */
288         struct list_head        tmt_sub_thandle_list;
289         spinlock_t              tmt_sub_lock;
290
291         struct list_head        tmt_commit_list;
292         /* All of update records will packed here */
293         struct thandle_update_records *tmt_update_records;
294
295         wait_queue_head_t       tmt_stop_waitq;
296         __u64                   tmt_batchid;
297         int                     tmt_result;
298         __u32                   tmt_magic;
299         size_t                  tmt_record_size;
300         __u32                   tmt_committed:1;
301 };
302
303 /* {top,sub}_thandle are used to manage distributed transactions which
304  * include updates on several nodes. A top_handle represents the
305  * whole operation, and sub_thandle represents updates on each node. */
306 struct top_thandle {
307         struct thandle          tt_super;
308         /* The master sub transaction. */
309         struct thandle          *tt_master_sub_thandle;
310
311         struct top_multiple_thandle *tt_multiple_thandle;
312 };
313
314 struct sub_thandle_cookie {
315         struct llog_cookie      stc_cookie;
316         struct list_head        stc_list;
317 };
318
319 /* Sub thandle is used to track multiple sub thandles under one parent
320  * thandle */
321 struct sub_thandle {
322         struct thandle          *st_sub_th;
323         struct dt_device        *st_dt;
324         struct list_head        st_cookie_list;
325         struct dt_txn_commit_cb st_commit_dcb;
326         struct dt_txn_commit_cb st_stop_dcb;
327         int                     st_result;
328
329         /* linked to top_thandle */
330         struct list_head        st_sub_list;
331
332         /* If this sub thandle is committed */
333         bool                    st_committed:1,
334                                 st_stopped:1,
335                                 st_started:1;
336 };
337
338 struct tx_arg;
339 typedef int (*tx_exec_func_t)(const struct lu_env *env, struct thandle *th,
340                               struct tx_arg *ta);
341
342 /* Structure for holding one update execution */
343 struct tx_arg {
344         tx_exec_func_t           exec_fn;
345         tx_exec_func_t           undo_fn;
346         struct dt_object        *object;
347         const char              *file;
348         struct object_update_reply *reply;
349         int                      line;
350         int                      index;
351         union {
352                 struct {
353                         struct dt_insert_rec     rec;
354                         const struct dt_key     *key;
355                 } insert;
356                 struct {
357                 } ref;
358                 struct {
359                         struct lu_attr   attr;
360                 } attr_set;
361                 struct {
362                         struct lu_buf    buf;
363                         const char      *name;
364                         int              flags;
365                         __u32            csum;
366                 } xattr_set;
367                 struct {
368                         struct lu_attr                  attr;
369                         struct dt_allocation_hint       hint;
370                         struct dt_object_format         dof;
371                         struct lu_fid                   fid;
372                 } create;
373                 struct {
374                         struct lu_buf   buf;
375                         loff_t          pos;
376                 } write;
377                 struct {
378                         struct ost_body     *body;
379                 } destroy;
380         } u;
381 };
382
383 /* Structure for holding all update executations of one transaction */
384 struct thandle_exec_args {
385         struct thandle          *ta_handle;
386         int                     ta_argno;   /* used args */
387         int                     ta_alloc_args; /* allocated args count */
388         struct tx_arg           **ta_args;
389 };
390
391 /* target/out_lib.c */
392 int out_update_pack(const struct lu_env *env, struct object_update *update,
393                     size_t *max_update_size, enum update_type op,
394                     const struct lu_fid *fid, unsigned int params_count,
395                     __u16 *param_sizes, const void **param_bufs,
396                     __u32 reply_size);
397 int out_create_pack(const struct lu_env *env, struct object_update *update,
398                     size_t *max_update_size, const struct lu_fid *fid,
399                     const struct lu_attr *attr, struct dt_allocation_hint *hint,
400                     struct dt_object_format *dof);
401 int out_object_destroy_pack(const struct lu_env *env,
402                             struct object_update *update,
403                             size_t *max_update_size,
404                             const struct lu_fid *fid);
405 int out_index_delete_pack(const struct lu_env *env,
406                           struct object_update *update, size_t *max_update_size,
407                           const struct lu_fid *fid, const struct dt_key *key);
408 int out_index_insert_pack(const struct lu_env *env,
409                           struct object_update *update, size_t *max_update_size,
410                           const struct lu_fid *fid, const struct dt_rec *rec,
411                           const struct dt_key *key);
412 int out_xattr_set_pack(const struct lu_env *env,
413                        struct object_update *update, size_t *max_update_size,
414                        const struct lu_fid *fid, const struct lu_buf *buf,
415                        const char *name, __u32 flag);
416 int out_xattr_del_pack(const struct lu_env *env,
417                        struct object_update *update, size_t *max_update_size,
418                        const struct lu_fid *fid, const char *name);
419 int out_attr_set_pack(const struct lu_env *env,
420                       struct object_update *update, size_t *max_update_size,
421                       const struct lu_fid *fid, const struct lu_attr *attr);
422 int out_ref_add_pack(const struct lu_env *env,
423                      struct object_update *update, size_t *max_update_size,
424                      const struct lu_fid *fid);
425 int out_ref_del_pack(const struct lu_env *env,
426                      struct object_update *update, size_t *max_update_size,
427                      const struct lu_fid *fid);
428 int out_write_pack(const struct lu_env *env,
429                    struct object_update *update, size_t *max_update_size,
430                    const struct lu_fid *fid, const struct lu_buf *buf,
431                    __u64 pos);
432 int out_attr_get_pack(const struct lu_env *env,
433                       struct object_update *update, size_t *max_update_size,
434                       const struct lu_fid *fid);
435 int out_index_lookup_pack(const struct lu_env *env,
436                           struct object_update *update, size_t *max_update_size,
437                           const struct lu_fid *fid, struct dt_rec *rec,
438                           const struct dt_key *key);
439 int out_xattr_get_pack(const struct lu_env *env,
440                        struct object_update *update, size_t *max_update_size,
441                        const struct lu_fid *fid, const char *name,
442                        const int bufsize);
443 int out_read_pack(const struct lu_env *env, struct object_update *update,
444                   size_t *max_update_length, const struct lu_fid *fid,
445                   size_t size, loff_t pos);
446
447 const char *update_op_str(__u16 opcode);
448
449 /* target/update_trans.c */
450 struct thandle *thandle_get_sub_by_dt(const struct lu_env *env,
451                                       struct thandle *th,
452                                       struct dt_device *sub_dt);
453
454 static inline struct thandle *
455 thandle_get_sub(const struct lu_env *env, struct thandle *th,
456                  const struct dt_object *sub_obj)
457 {
458         return thandle_get_sub_by_dt(env, th, lu2dt_dev(sub_obj->do_lu.lo_dev));
459 }
460
461 struct thandle *
462 top_trans_create(const struct lu_env *env, struct dt_device *master_dev);
463 int top_trans_start(const struct lu_env *env, struct dt_device *master_dev,
464                     struct thandle *th);
465 int top_trans_stop(const struct lu_env *env, struct dt_device *master_dev,
466                    struct thandle *th);
467 void top_multiple_thandle_destroy(struct top_multiple_thandle *tmt);
468
469 static inline void top_multiple_thandle_get(struct top_multiple_thandle *tmt)
470 {
471         atomic_inc(&tmt->tmt_refcount);
472 }
473
474 static inline void top_multiple_thandle_put(struct top_multiple_thandle *tmt)
475 {
476         if (atomic_dec_and_test(&tmt->tmt_refcount))
477                 top_multiple_thandle_destroy(tmt);
478 }
479
480 struct sub_thandle *lookup_sub_thandle(struct top_multiple_thandle *tmt,
481                                        struct dt_device *dt_dev);
482 int sub_thandle_trans_create(const struct lu_env *env,
483                              struct top_thandle *top_th,
484                              struct sub_thandle *st);
485
486 /* update_records.c */
487 size_t update_records_create_size(const struct lu_env *env,
488                                   const struct lu_fid *fid,
489                                   const struct lu_attr *attr,
490                                   const struct dt_allocation_hint *hint,
491                                   struct dt_object_format *dof);
492 size_t update_records_attr_set_size(const struct lu_env *env,
493                                     const struct lu_fid *fid,
494                                     const struct lu_attr *attr);
495 size_t update_records_ref_add_size(const struct lu_env *env,
496                                    const struct lu_fid *fid);
497 size_t update_records_ref_del_size(const struct lu_env *env,
498                                    const struct lu_fid *fid);
499 size_t update_records_object_destroy_size(const struct lu_env *env,
500                                           const struct lu_fid *fid);
501 size_t update_records_index_insert_size(const struct lu_env *env,
502                                         const struct lu_fid *fid,
503                                         const struct dt_rec *rec,
504                                         const struct dt_key *key);
505 size_t update_records_index_delete_size(const struct lu_env *env,
506                                         const struct lu_fid *fid,
507                                         const struct dt_key *key);
508 size_t update_records_xattr_set_size(const struct lu_env *env,
509                                      const struct lu_fid *fid,
510                                      const struct lu_buf *buf,
511                                      const char *name,
512                                      __u32 flag);
513 size_t update_records_xattr_del_size(const struct lu_env *env,
514                                      const struct lu_fid *fid,
515                                      const char *name);
516 size_t update_records_write_size(const struct lu_env *env,
517                                  const struct lu_fid *fid,
518                                  const struct lu_buf *buf,
519                                  __u64 pos);
520 size_t update_records_punch_size(const struct lu_env *env,
521                                  const struct lu_fid *fid,
522                                  __u64 start, __u64 end);
523
524 int update_records_create_pack(const struct lu_env *env,
525                                struct update_ops *ops,
526                                unsigned int *op_count,
527                                size_t *max_ops_size,
528                                struct update_params *params,
529                                unsigned int *param_count,
530                                size_t *max_param_size,
531                                const struct lu_fid *fid,
532                                const struct lu_attr *attr,
533                                const struct dt_allocation_hint *hint,
534                                struct dt_object_format *dof);
535 int update_records_attr_set_pack(const struct lu_env *env,
536                                  struct update_ops *ops,
537                                  unsigned int *op_count,
538                                  size_t *max_ops_size,
539                                  struct update_params *params,
540                                  unsigned int *param_count,
541                                  size_t *max_param_size,
542                                  const struct lu_fid *fid,
543                                  const struct lu_attr *attr);
544 int update_records_ref_add_pack(const struct lu_env *env,
545                                 struct update_ops *ops,
546                                 unsigned int *op_count,
547                                 size_t *max_ops_size,
548                                 struct update_params *params,
549                                 unsigned int *param_count,
550                                 size_t *max_param_size,
551                                 const struct lu_fid *fid);
552 int update_records_ref_del_pack(const struct lu_env *env,
553                                 struct update_ops *ops,
554                                 unsigned int *op_count,
555                                 size_t *max_ops_size,
556                                 struct update_params *params,
557                                 unsigned int *param_count,
558                                 size_t *max_param_size,
559                                 const struct lu_fid *fid);
560 int update_records_object_destroy_pack(const struct lu_env *env,
561                                        struct update_ops *ops,
562                                        unsigned int *op_count,
563                                        size_t *max_ops_size,
564                                        struct update_params *params,
565                                        unsigned int *param_count,
566                                        size_t *max_param_size,
567                                        const struct lu_fid *fid);
568 int update_records_index_insert_pack(const struct lu_env *env,
569                                      struct update_ops *ops,
570                                      unsigned int *op_count,
571                                      size_t *max_ops_size,
572                                      struct update_params *params,
573                                      unsigned int *param_count,
574                                      size_t *max_param_size,
575                                      const struct lu_fid *fid,
576                                      const struct dt_rec *rec,
577                                      const struct dt_key *key);
578 int update_records_index_delete_pack(const struct lu_env *env,
579                                      struct update_ops *ops,
580                                      unsigned int *op_count,
581                                      size_t *max_ops_size,
582                                      struct update_params *params,
583                                      unsigned int *param_count,
584                                      size_t *max_param_size,
585                                      const struct lu_fid *fid,
586                                      const struct dt_key *key);
587 int update_records_xattr_set_pack(const struct lu_env *env,
588                                   struct update_ops *ops,
589                                   unsigned int *op_count,
590                                   size_t *max_ops_size,
591                                   struct update_params *params,
592                                   unsigned int *param_count,
593                                   size_t *max_param_size,
594                                   const struct lu_fid *fid,
595                                   const struct lu_buf *buf, const char *name,
596                                   __u32 flag);
597 int update_records_xattr_del_pack(const struct lu_env *env,
598                                   struct update_ops *ops,
599                                   unsigned int *op_count,
600                                   size_t *max_ops_size,
601                                   struct update_params *params,
602                                   unsigned int *param_count,
603                                   size_t *max_param_size,
604                                   const struct lu_fid *fid,
605                                   const char *name);
606 int update_records_write_pack(const struct lu_env *env,
607                               struct update_ops *ops,
608                               unsigned int *op_count,
609                               size_t *max_ops_size,
610                               struct update_params *params,
611                               unsigned int *param_count,
612                               size_t *max_param_size,
613                               const struct lu_fid *fid,
614                               const struct lu_buf *buf,
615                               __u64 pos);
616 int update_records_punch_pack(const struct lu_env *env,
617                               struct update_ops *ops,
618                               unsigned int *op_count,
619                               size_t *max_ops_size,
620                               struct update_params *params,
621                               unsigned int *param_count,
622                               size_t *max_param_size,
623                               const struct lu_fid *fid,
624                               __u64 start, __u64 end);
625 int update_records_noop_pack(const struct lu_env *env,
626                              struct update_ops *ops,
627                              unsigned int *op_count,
628                              size_t *max_ops_size,
629                              struct update_params *params,
630                              unsigned int *param_count,
631                              size_t *max_param_size,
632                              const struct lu_fid *fid);
633
634 int tur_update_records_extend(struct thandle_update_records *tur,
635                               size_t new_size);
636 int tur_update_params_extend(struct thandle_update_records *tur,
637                              size_t new_size);
638 int tur_update_extend(struct thandle_update_records *tur,
639                       size_t new_op_size, size_t new_param_size);
640
641 #define update_record_pack(name, th, ...)                               \
642 ({                                                                      \
643         struct top_thandle *top_th;                                     \
644         struct top_multiple_thandle *tmt;                               \
645         struct thandle_update_records *tur;                             \
646         struct llog_update_record     *lur;                             \
647         size_t          avail_param_size;                               \
648         size_t          avail_op_size;                                  \
649         int             ret;                                            \
650                                                                         \
651         while (1) {                                                     \
652                 top_th = container_of(th, struct top_thandle, tt_super);\
653                 tmt = top_th->tt_multiple_thandle;                      \
654                 tur = tmt->tmt_update_records;                          \
655                 lur = tur->tur_update_records;                          \
656                 avail_param_size = tur->tur_update_params_buf_size -    \
657                              update_params_size(tur->tur_update_params, \
658                                         tur->tur_update_param_count);   \
659                 avail_op_size = tur->tur_update_records_buf_size -      \
660                                 llog_update_record_size(lur);           \
661                 ret = update_records_##name##_pack(env,                 \
662                                           &lur->lur_update_rec.ur_ops,  \
663                                   &lur->lur_update_rec.ur_update_count, \
664                                   &avail_op_size,                       \
665                                   tur->tur_update_params,               \
666                                   &tur->tur_update_param_count,         \
667                                   &avail_param_size, __VA_ARGS__);      \
668                 if (ret == -E2BIG) {                                    \
669                         ret = tur_update_extend(tur, avail_op_size,     \
670                                                    avail_param_size);   \
671                         if (ret != 0)                                   \
672                                 break;                                  \
673                         continue;                                       \
674                 } else {                                                \
675                         break;                                          \
676                 }                                                       \
677         }                                                               \
678         ret;                                                            \
679 })
680
681 #define update_record_size(env, name, th, ...)                          \
682 ({                                                                      \
683         struct top_thandle *top_th;                                     \
684         struct top_multiple_thandle *tmt;                               \
685                                                                         \
686         top_th = container_of(th, struct top_thandle, tt_super);        \
687                                                                         \
688         LASSERT(top_th->tt_multiple_thandle != NULL);                   \
689         tmt = top_th->tt_multiple_thandle;                              \
690         tmt->tmt_record_size +=                                         \
691                 update_records_##name##_size(env, __VA_ARGS__);         \
692 })
693 #endif