Whamcloud - gitweb
9ed4d5eee14f11457ae53b552e63a03205a58272
[fs/lustre-release.git] / lustre / osd-ldiskfs / osd_quota.c
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, write to the
18  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19  * Boston, MA 021110-1307, USA
20  *
21  * GPL HEADER END
22  */
23 /*
24  * Copyright (c) 2012, 2015, Intel Corporation.
25  * Use is subject to license terms.
26  *
27  * Author: Johann Lombardi <johann@whamcloud.com>
28  * Author: Niu    Yawei    <niu@whamcloud.com>
29  */
30
31 #include <lustre_quota.h>
32 #include "osd_internal.h"
33
34 /**
35  * Helpers function to find out the quota type (USRQUOTA/GRPQUOTA) of a
36  * given object
37  */
38 static inline int fid2type(const struct lu_fid *fid)
39 {
40         LASSERT(fid_is_acct(fid));
41         switch (fid_oid(fid)) {
42         case ACCT_USER_OID:
43                 return USRQUOTA;
44         case ACCT_GROUP_OID:
45                 return GRPQUOTA;
46         case ACCT_PROJECT_OID:
47                 return PRJQUOTA;
48         }
49
50         LASSERTF(0, "invalid fid for quota type: %u", fid_oid(fid));
51         return USRQUOTA;
52 }
53
54 /**
55  * Space Accounting Management
56  */
57
58 /**
59  * Look up an accounting object based on its fid.
60  *
61  * \param info - is the osd thread info passed by the caller
62  * \param osd  - is the osd device
63  * \param fid  - is the fid of the accounting object we want to look up
64  * \param id   - is the osd_inode_id struct to fill with the inode number of
65  *               the quota file if the lookup is successful
66  */
67 int osd_acct_obj_lookup(struct osd_thread_info *info, struct osd_device *osd,
68                         const struct lu_fid *fid, struct osd_inode_id *id)
69 {
70         struct super_block *sb = osd_sb(osd);
71
72         ENTRY;
73         LASSERT(fid_is_acct(fid));
74
75         if (!LDISKFS_HAS_RO_COMPAT_FEATURE(sb,
76                                            LDISKFS_FEATURE_RO_COMPAT_QUOTA))
77                 RETURN(-ENOENT);
78
79         id->oii_gen = OSD_OII_NOGEN;
80         switch (fid2type(fid)) {
81         case USRQUOTA:
82                 id->oii_ino =
83                         le32_to_cpu(LDISKFS_SB(sb)->s_es->s_usr_quota_inum);
84                 break;
85         case GRPQUOTA:
86                 id->oii_ino =
87                         le32_to_cpu(LDISKFS_SB(sb)->s_es->s_grp_quota_inum);
88                 break;
89         case PRJQUOTA:
90  #ifdef HAVE_PROJECT_QUOTA
91                 if (LDISKFS_HAS_RO_COMPAT_FEATURE(sb,
92                                         LDISKFS_FEATURE_RO_COMPAT_PROJECT))
93                         id->oii_ino =
94                                 le32_to_cpu(LDISKFS_SB(sb)->s_es->s_prj_quota_inum);
95                 else
96  #endif
97                         RETURN(-ENOENT);
98                 break;
99         }
100
101         if (!ldiskfs_valid_inum(sb, id->oii_ino) &&
102             id->oii_ino != LDISKFS_USR_QUOTA_INO &&
103             id->oii_ino != LDISKFS_GRP_QUOTA_INO)
104                 RETURN(-ENOENT);
105
106         RETURN(0);
107 }
108
109 /**
110  * Return space usage (#blocks & #inodes) consumed by a given uid or gid.
111  *
112  * \param env   - is the environment passed by the caller
113  * \param dtobj - is the accounting object
114  * \param dtrec - is the record to fill with space usage information
115  * \param dtkey - is the id of the user or group for which we would
116  *                like to access disk usage.
117  *
118  * \retval +ve - success : exact match
119  * \retval -ve - failure
120  */
121 static int osd_acct_index_lookup(const struct lu_env *env,
122                                  struct dt_object *dtobj,
123                                  struct dt_rec *dtrec,
124                                  const struct dt_key *dtkey)
125 {
126         struct osd_thread_info  *info = osd_oti_get(env);
127 #if defined(HAVE_DQUOT_QC_DQBLK)
128         struct qc_dqblk         *dqblk = &info->oti_qdq;
129 #elif defined(HAVE_DQUOT_FS_DISK_QUOTA)
130         struct fs_disk_quota    *dqblk = &info->oti_fdq;
131 #else
132         struct if_dqblk         *dqblk = &info->oti_dqblk;
133 #endif
134         struct super_block      *sb = osd_sb(osd_obj2dev(osd_dt_obj(dtobj)));
135         struct lquota_acct_rec  *rec = (struct lquota_acct_rec *)dtrec;
136         __u64                    id = *((__u64 *)dtkey);
137         int                      rc;
138 #ifdef HAVE_DQUOT_KQID
139         struct kqid              qid;
140 #endif
141         int type;
142
143         ENTRY;
144
145         type = fid2type(lu_object_fid(&dtobj->do_lu));
146         memset(dqblk, 0, sizeof(*dqblk));
147 #ifdef HAVE_DQUOT_KQID
148         qid = make_kqid(&init_user_ns, type, id);
149         rc = sb->s_qcop->get_dqblk(sb, qid, dqblk);
150 #else
151         rc = sb->s_qcop->get_dqblk(sb, type, (qid_t) id, dqblk);
152 #endif
153         if (rc)
154                 RETURN(rc);
155 #if defined(HAVE_DQUOT_QC_DQBLK)
156         rec->bspace = dqblk->d_space;
157         rec->ispace = dqblk->d_ino_count;
158 #elif defined(HAVE_DQUOT_FS_DISK_QUOTA)
159         rec->bspace = dqblk->d_bcount;
160         rec->ispace = dqblk->d_icount;
161 #else
162         rec->bspace = dqblk->dqb_curspace;
163         rec->ispace = dqblk->dqb_curinodes;
164 #endif
165         RETURN(+1);
166 }
167
168 #define QUOTA_IT_READ_ERROR(it, rc)                                    \
169         CERROR("%s: Error while trying to read quota information, "    \
170                "failed with %d\n",                                     \
171                osd_dev(it->oiq_obj->oo_dt.do_lu.lo_dev)->od_svname, rc); \
172
173 /**
174  * Initialize osd Iterator for given osd index object.
175  *
176  * \param  dt    - osd index object
177  * \param  attr  - not used
178  */
179 static struct dt_it *osd_it_acct_init(const struct lu_env *env,
180                                       struct dt_object *dt,
181                                       __u32 attr)
182 {
183         struct osd_it_quota     *it;
184         struct lu_object        *lo = &dt->do_lu;
185         struct osd_object       *obj = osd_dt_obj(dt);
186
187         ENTRY;
188
189         LASSERT(lu_object_exists(lo));
190
191         OBD_ALLOC_PTR(it);
192         if (it == NULL)
193                 RETURN(ERR_PTR(-ENOMEM));
194
195         lu_object_get(lo);
196         it->oiq_obj = obj;
197         INIT_LIST_HEAD(&it->oiq_list);
198
199         /* LUSTRE_DQTREEOFF is the initial offset where the tree can be found */
200         it->oiq_blk[0] = LUSTRE_DQTREEOFF;
201
202         /* NB: we don't need to store the tree depth since it is always
203          * equal to LUSTRE_DQTREEDEPTH - 1 (root has depth = 0) for a leaf
204          * block. */
205         RETURN((struct dt_it *)it);
206 }
207
208 /**
209  * Free given iterator.
210  *
211  * \param  di   - osd iterator
212  */
213 static void osd_it_acct_fini(const struct lu_env *env, struct dt_it *di)
214 {
215         struct osd_it_quota *it = (struct osd_it_quota *)di;
216         struct osd_quota_leaf *leaf, *tmp;
217         ENTRY;
218
219         osd_object_put(env, it->oiq_obj);
220
221         list_for_each_entry_safe(leaf, tmp, &it->oiq_list, oql_link) {
222                 list_del_init(&leaf->oql_link);
223                 OBD_FREE_PTR(leaf);
224         }
225
226         OBD_FREE_PTR(it);
227
228         EXIT;
229 }
230
231 /**
232  * Move Iterator to record specified by \a key, if the \a key isn't found,
233  * move to the first valid record.
234  *
235  * \param  di   - osd iterator
236  * \param  key  - uid or gid
237  *
238  * \retval +ve  - di points to the first valid record
239  * \retval  +1  - di points to exact matched key
240  * \retval -ve  - failure
241  */
242 static int osd_it_acct_get(const struct lu_env *env, struct dt_it *di,
243                            const struct dt_key *key)
244 {
245         struct osd_it_quota     *it = (struct osd_it_quota *)di;
246         const struct lu_fid     *fid =
247                                 lu_object_fid(&it->oiq_obj->oo_dt.do_lu);
248         int                      type;
249         qid_t                    dqid = *(qid_t *)key;
250         loff_t                   offset;
251         int                      rc;
252
253         ENTRY;
254         type = fid2type(fid);
255
256         offset = find_tree_dqentry(env, it->oiq_obj, type, dqid,
257                                    LUSTRE_DQTREEOFF, 0, it);
258         if (offset > 0) { /* Found */
259                 RETURN(+1);
260         } else if (offset < 0) { /* Error */
261                 QUOTA_IT_READ_ERROR(it, (int)offset);
262                 RETURN((int)offset);
263         }
264
265         /* The @key is not found, move to the first valid entry */
266         rc = walk_tree_dqentry(env, it->oiq_obj, type, it->oiq_blk[0], 0,
267                                0, it);
268         if (rc == 0)
269                 rc = 1;
270         else if (rc > 0)
271                 rc = -ENOENT;
272
273         RETURN(rc);
274 }
275
276 /**
277  * Release Iterator
278  *
279  * \param  di   - osd iterator
280  */
281 static void osd_it_acct_put(const struct lu_env *env, struct dt_it *di)
282 {
283         return;
284 }
285
286 static int osd_it_add_processed(struct osd_it_quota *it, int depth)
287 {
288         struct osd_quota_leaf *leaf;
289
290         OBD_ALLOC_PTR(leaf);
291         if (leaf == NULL)
292                 RETURN(-ENOMEM);
293         INIT_LIST_HEAD(&leaf->oql_link);
294         leaf->oql_blk = it->oiq_blk[depth];
295         list_add_tail(&leaf->oql_link, &it->oiq_list);
296         RETURN(0);
297 }
298
299 /**
300  * Move on to the next valid entry.
301  *
302  * \param  di   - osd iterator
303  *
304  * \retval +ve  - iterator reached the end
305  * \retval   0  - iterator has not reached the end yet
306  * \retval -ve  - unexpected failure
307  */
308 static int osd_it_acct_next(const struct lu_env *env, struct dt_it *di)
309 {
310         struct osd_it_quota     *it = (struct osd_it_quota *)di;
311         const struct lu_fid     *fid =
312                                 lu_object_fid(&it->oiq_obj->oo_dt.do_lu);
313         int                      type;
314         int                      depth, rc;
315         uint                     index;
316
317         ENTRY;
318
319         type = fid2type(fid);
320
321         /* Let's first check if there are any remaining valid entry in the
322          * current leaf block. Start with the next entry after the current one.
323          */
324         depth = LUSTRE_DQTREEDEPTH;
325         index = it->oiq_index[depth];
326         if (++index < LUSTRE_DQSTRINBLK) {
327                 /* Search for the next valid entry from current index */
328                 rc = walk_block_dqentry(env, it->oiq_obj, type,
329                                         it->oiq_blk[depth], index, it);
330                 if (rc < 0) {
331                         QUOTA_IT_READ_ERROR(it, rc);
332                         RETURN(rc);
333                 } else if (rc == 0) {
334                         /* Found on entry, @it is already updated to the
335                          * new position in walk_block_dqentry(). */
336                         RETURN(0);
337                 } else {
338                         rc = osd_it_add_processed(it, depth);
339                         if (rc)
340                                 RETURN(rc);
341                 }
342         } else {
343                 rc = osd_it_add_processed(it, depth);
344                 if (rc)
345                         RETURN(rc);
346         }
347         rc = 1;
348
349         /* We have consumed all the entries of the current leaf block, move on
350          * to the next one. */
351         depth--;
352
353         /* We keep searching as long as walk_tree_dqentry() returns +1
354          * (= no valid entry found). */
355         for (; depth >= 0 && rc > 0; depth--) {
356                 index = it->oiq_index[depth];
357                 if (++index > 0xff)
358                         continue;
359                 rc = walk_tree_dqentry(env, it->oiq_obj, type,
360                                        it->oiq_blk[depth], depth, index, it);
361         }
362
363         if (rc < 0)
364                 QUOTA_IT_READ_ERROR(it, rc);
365         RETURN(rc);
366 }
367
368 /**
369  * Return pointer to the key under iterator.
370  *
371  * \param  di   - osd iterator
372  */
373 static struct dt_key *osd_it_acct_key(const struct lu_env *env,
374                                       const struct dt_it *di)
375 {
376         struct osd_it_quota *it = (struct osd_it_quota *)di;
377
378         ENTRY;
379         RETURN((struct dt_key *)&it->oiq_id);
380 }
381
382 /**
383  * Return size of key under iterator (in bytes)
384  *
385  * \param  di   - osd iterator
386  */
387 static int osd_it_acct_key_size(const struct lu_env *env,
388                                 const struct dt_it *di)
389 {
390         struct osd_it_quota *it = (struct osd_it_quota *)di;
391
392         ENTRY;
393         RETURN((int)sizeof(it->oiq_id));
394 }
395
396 /**
397  * Return pointer to the record under iterator.
398  *
399  * \param  di    - osd iterator
400  * \param  attr  - not used
401  */
402 static int osd_it_acct_rec(const struct lu_env *env,
403                            const struct dt_it *di,
404                            struct dt_rec *dtrec, __u32 attr)
405 {
406         struct osd_it_quota     *it = (struct osd_it_quota *)di;
407         const struct dt_key     *key = osd_it_acct_key(env, di);
408         int                      rc;
409
410         ENTRY;
411
412         rc = osd_acct_index_lookup(env, &it->oiq_obj->oo_dt, dtrec, key);
413         RETURN(rc > 0 ? 0 : rc);
414 }
415
416 /**
417  * Returns cookie for current Iterator position.
418  *
419  * \param  di    - osd iterator
420  */
421 static __u64 osd_it_acct_store(const struct lu_env *env,
422                                const struct dt_it *di)
423 {
424         struct osd_it_quota *it = (struct osd_it_quota *)di;
425
426         ENTRY;
427         RETURN(it->oiq_id);
428 }
429
430 /**
431  * Restore iterator from cookie. if the \a hash isn't found,
432  * restore the first valid record.
433  *
434  * \param  di    - osd iterator
435  * \param  hash  - iterator location cookie
436  *
437  * \retval +ve   - di points to the first valid record
438  * \retval  +1   - di points to exact matched hash
439  * \retval -ve   - failure
440  */
441 static int osd_it_acct_load(const struct lu_env *env,
442                             const struct dt_it *di, __u64 hash)
443 {
444         ENTRY;
445         RETURN(osd_it_acct_get(env, (struct dt_it *)di,
446                                (const struct dt_key *)&hash));
447 }
448
449 /**
450  * Index and Iterator operations for accounting objects
451  */
452 const struct dt_index_operations osd_acct_index_ops = {
453         .dio_lookup     = osd_acct_index_lookup,
454         .dio_it         = {
455                 .init           = osd_it_acct_init,
456                 .fini           = osd_it_acct_fini,
457                 .get            = osd_it_acct_get,
458                 .put            = osd_it_acct_put,
459                 .next           = osd_it_acct_next,
460                 .key            = osd_it_acct_key,
461                 .key_size       = osd_it_acct_key_size,
462                 .rec            = osd_it_acct_rec,
463                 .store          = osd_it_acct_store,
464                 .load           = osd_it_acct_load
465         }
466 };
467
468 static inline void osd_quota_swab(char *ptr, size_t size)
469 {
470         int offset;
471
472         LASSERT((size & (sizeof(__u64) - 1)) == 0);
473
474         for (offset = 0; offset < size; offset += sizeof(__u64))
475              __swab64s((__u64 *)(ptr + offset));
476 }
477
478 const struct dt_rec *osd_quota_pack(struct osd_object *obj,
479                                     const struct dt_rec *rec,
480                                     union lquota_rec *quota_rec)
481 {
482 #ifdef __BIG_ENDIAN
483         struct iam_descr        *descr;
484
485         LASSERT(obj->oo_dir != NULL);
486         descr = obj->oo_dir->od_container.ic_descr;
487
488         memcpy(quota_rec, rec, descr->id_rec_size);
489
490         osd_quota_swab((char *)quota_rec, descr->id_rec_size);
491         return (const struct dt_rec *)quota_rec;
492 #else
493         return rec;
494 #endif
495 }
496
497 void osd_quota_unpack(struct osd_object *obj, const struct dt_rec *rec)
498 {
499 #ifdef __BIG_ENDIAN
500         struct iam_descr *descr;
501
502         LASSERT(obj->oo_dir != NULL);
503         descr = obj->oo_dir->od_container.ic_descr;
504
505         osd_quota_swab((char *)rec, descr->id_rec_size);
506 #else
507         return;
508 #endif
509 }
510
511 static inline int osd_qid_type(struct osd_thandle *oh, int i)
512 {
513         return oh->ot_id_types[i];
514 }
515
516 /**
517  * Reserve journal credits for quota files update first, then call
518  * ->op_begin() to perform quota enforcement.
519  *
520  * \param  env     - the environment passed by the caller
521  * \param  oh      - osd transaction handle
522  * \param  qi      - quota id & space required for this operation
523  * \param  obj     - osd object, could be NULL when it's under create
524  * \param  enforce - whether to perform quota enforcement
525  * \param  flags   - if the operation is write, return no user quota, no
526  *                   group quota, or sync commit flags to the caller
527  *
528  * \retval 0       - success
529  * \retval -ve     - failure
530  */
531 int osd_declare_qid(const struct lu_env *env, struct osd_thandle *oh,
532                     struct lquota_id_info *qi, struct osd_object *obj,
533                     bool enforce, int *flags)
534 {
535         struct osd_device       *dev;
536         struct qsd_instance     *qsd;
537         struct inode            *inode = NULL;
538         int                      i, rc = 0, crd;
539         bool                     found = false;
540         ENTRY;
541
542         LASSERT(oh != NULL);
543         LASSERTF(oh->ot_id_cnt <= OSD_MAX_UGID_CNT, "count=%d\n",
544                  oh->ot_id_cnt);
545
546         dev = osd_dt_dev(oh->ot_super.th_dev);
547         LASSERT(dev != NULL);
548
549         qsd = dev->od_quota_slave;
550
551         for (i = 0; i < oh->ot_id_cnt; i++) {
552                 if (oh->ot_id_array[i] == qi->lqi_id.qid_uid &&
553                     oh->ot_id_types[i] == qi->lqi_type) {
554                         found = true;
555                         break;
556                 }
557         }
558
559         if (!found) {
560                 /* we need to account for credits for this new ID */
561                 if (i >= OSD_MAX_UGID_CNT) {
562                         CERROR("Too many(%d) trans qids!\n", i + 1);
563                         RETURN(-EOVERFLOW);
564                 }
565
566                 if (obj != NULL)
567                         inode = obj->oo_inode;
568
569                 /* root ID entry should be always present in the quota file */
570                 if (qi->lqi_id.qid_uid == 0) {
571                         crd = 1;
572                 } else {
573                         /* used space for this ID could be dropped to zero,
574                          * reserve extra credits for removing ID entry from
575                          * the quota file */
576                         if (qi->lqi_space < 0)
577                                 crd = LDISKFS_QUOTA_DEL_BLOCKS(osd_sb(dev));
578                         /* reserve credits for adding ID entry to the quota
579                          * file if the i_dquot isn't initialized yet. */
580                         else if (inode == NULL ||
581 #ifdef HAVE_EXT4_INFO_DQUOT
582                                  LDISKFS_I(inode)->i_dquot[qi->lqi_type] == NULL)
583 #else
584                                  inode->i_dquot[qi->lqi_type] == NULL)
585 #endif
586                                 crd = LDISKFS_QUOTA_INIT_BLOCKS(osd_sb(dev));
587                         else
588                                 crd = 1;
589                 }
590
591                 osd_trans_declare_op(env, oh, OSD_OT_QUOTA, crd);
592
593                 oh->ot_id_array[i] = qi->lqi_id.qid_uid;
594                 oh->ot_id_types[i] = qi->lqi_type;
595                 oh->ot_id_cnt++;
596         }
597
598         if (unlikely(qsd == NULL))
599                 /* quota slave instance hasn't been allocated yet */
600                 RETURN(0);
601
602         /* check quota */
603         if (enforce)
604                 rc = qsd_op_begin(env, qsd, oh->ot_quota_trans, qi, flags);
605         RETURN(rc);
606 }
607
608 /**
609  * Wrapper for osd_declare_qid()
610  *
611  * \param  env    - the environment passed by the caller
612  * \param  uid    - user id of the inode
613  * \param  gid    - group id of the inode
614  * \param  space  - how many blocks/inodes will be consumed/released
615  * \param  oh     - osd transaction handle
616  * \param  obj    - osd object, could be NULL when it's under create
617  * \param  flags  - if the operation is write, return no user quota, no
618  *                  group quota, or sync commit flags to the caller
619  * \param osd_qid_flags - indicate this is a inode/block accounting
620  *                      and whether changes are performed by root user
621  *
622  * \retval 0      - success
623  * \retval -ve    - failure
624  */
625 int osd_declare_inode_qid(const struct lu_env *env, qid_t uid, qid_t gid,
626                           __u32 projid, long long space, struct osd_thandle *oh,
627                           struct osd_object *obj, int *flags,
628                           enum osd_qid_declare_flags osd_qid_declare_flags)
629 {
630         struct osd_thread_info  *info = osd_oti_get(env);
631         struct lquota_id_info   *qi = &info->oti_qi;
632         int rcu, rcg, rcp = 0; /* user & group & project rc */
633         bool force = !!(osd_qid_declare_flags & OSD_QID_FORCE);
634         ENTRY;
635
636         /* let's start with user quota */
637         qi->lqi_id.qid_uid = uid;
638         qi->lqi_type       = USRQUOTA;
639         qi->lqi_space      = space;
640         qi->lqi_is_blk     = !!(osd_qid_declare_flags & OSD_QID_BLK);
641         rcu = osd_declare_qid(env, oh, qi, obj, true, flags);
642
643         if (force && (rcu == -EDQUOT || rcu == -EINPROGRESS))
644                 /* ignore EDQUOT & EINPROGRESS when changes are done by root */
645                 rcu = 0;
646
647         /* For non-fatal error, we want to continue to get the noquota flags
648          * for group id. This is only for commit write, which has @flags passed
649          * in. See osd_declare_write_commit().
650          * When force is set to true, we also want to proceed with the gid */
651         if (rcu && (rcu != -EDQUOT || flags == NULL))
652                 RETURN(rcu);
653
654         /* and now group quota */
655         qi->lqi_id.qid_gid = gid;
656         qi->lqi_type       = GRPQUOTA;
657         rcg = osd_declare_qid(env, oh, qi, obj, true, flags);
658
659         if (force && (rcg == -EDQUOT || rcg == -EINPROGRESS))
660                 /* as before, ignore EDQUOT & EINPROGRESS for root */
661                 rcg = 0;
662
663 #ifdef HAVE_PROJECT_QUOTA
664         if (rcg && (rcg != -EDQUOT || flags == NULL))
665                 RETURN(rcg);
666
667         /* and now project quota */
668         qi->lqi_id.qid_projid = projid;
669         qi->lqi_type = PRJQUOTA;
670         rcp = osd_declare_qid(env, oh, qi, obj, true, flags);
671
672         if (force && (rcp == -EDQUOT || rcp == -EINPROGRESS))
673                 /* as before, ignore EDQUOT & EINPROGRESS for root */
674                 rcp = 0;
675 #endif
676
677         RETURN(rcu ? rcu : (rcg ? rcg : rcp));
678 }