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