4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
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.
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).
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.sun.com/software/products/lustre/docs/GPLv2.pdf
20 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
21 * CA 95054 USA or visit www.sun.com if you need additional information or
27 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
28 * Use is subject to license terms.
30 * Copyright (c) 2011, Whamcloud, Inc.
33 * This file is part of Lustre, http://www.lustre.org/
34 * Lustre is a trademark of Sun Microsystems, Inc.
36 * lustre/osc/osc_create.c
37 * For testing and management it is treated as an obd_device,
38 * although * it does not export a full OBD method table (the
39 * requests are coming * in over the wire, so object target modules
40 * do not have a full * method table.)
42 * Author: Peter Braam <braam@clusterfs.com>
45 #define DEBUG_SUBSYSTEM S_OSC
48 # include <libcfs/libcfs.h>
49 #else /* __KERNEL__ */
50 # include <liblustre.h>
57 #include <lustre_dlm.h>
58 #include <obd_class.h>
59 #include "osc_internal.h"
61 /* XXX need AT adjust ? */
62 #define osc_create_timeout (obd_timeout / 2)
64 struct osc_create_async_args {
65 struct osc_creator *rq_oscc;
66 struct lov_stripe_md *rq_lsm;
67 struct obd_info *rq_oinfo;
71 static int oscc_internal_create(struct osc_creator *oscc);
72 static int handle_async_create(struct ptlrpc_request *req, int rc);
74 static int osc_interpret_create(const struct lu_env *env,
75 struct ptlrpc_request *req, void *data, int rc)
77 struct osc_create_async_args *args = ptlrpc_req_async_args(req);
78 struct osc_creator *oscc = args->rq_oscc;
79 struct ost_body *body = NULL;
80 struct ptlrpc_request *fake_req, *pos;
84 body = req_capsule_server_get(&req->rq_pill, &RMF_OST_BODY);
85 if (body == NULL && rc == 0)
89 LASSERT(oscc && (oscc->oscc_obd != LP_POISON));
91 cfs_spin_lock(&oscc->oscc_lock);
92 oscc->oscc_flags &= ~OSCC_FLAG_CREATING;
96 int diff =ostid_id(&body->oa.o_oi)- oscc->oscc_last_id;
98 /* oscc_internal_create() stores the original value of
99 * grow_count in osc_create_async_args::rq_grow_count.
100 * We can't compare against oscc_grow_count directly,
101 * because it may have been increased while the RPC
102 * is in flight, so we would always find ourselves
103 * having created fewer objects and decreasing the
104 * precreate request size. b=18577 */
105 if (diff < args->rq_grow_count) {
106 /* the OST has not managed to create all the
107 * objects we asked for */
108 oscc->oscc_grow_count = max(diff,
110 /* don't bump grow_count next time */
111 oscc->oscc_flags |= OSCC_FLAG_LOW;
113 /* the OST is able to keep up with the work,
114 * we could consider increasing grow_count
115 * next time if needed */
116 oscc->oscc_flags &= ~OSCC_FLAG_LOW;
118 oscc->oscc_last_id = ostid_id(&body->oa.o_oi);
120 cfs_spin_unlock(&oscc->oscc_lock);
124 oscc->oscc_flags |= OSCC_FLAG_RDONLY;
128 oscc->oscc_flags |= OSCC_FLAG_NOSPC;
129 if (body && rc == -ENOSPC) {
130 oscc->oscc_last_id = body->oa.o_id;
131 oscc->oscc_grow_count = OST_MIN_PRECREATE;
133 if ((body->oa.o_valid & OBD_MD_FLFLAGS) &&
134 (body->oa.o_flags & OBD_FL_NOSPC_BLK))
135 oscc->oscc_flags |= OSCC_FLAG_NOSPC_BLK;
140 cfs_spin_unlock(&oscc->oscc_lock);
141 DEBUG_REQ(D_INODE, req, "OST out of space, flagging");
144 /* filter always set body->oa.o_id as the last_id
145 * of filter (see filter_handle_precreate for detail)*/
146 if (body && body->oa.o_id > oscc->oscc_last_id)
147 oscc->oscc_last_id = body->oa.o_id;
148 cfs_spin_unlock(&oscc->oscc_lock);
153 /* aka EAGAIN we should not delay create if import failed -
154 * this avoid client stick in create and avoid race with
156 /* EINTR say - old create request is killed due mds<>ost
157 * eviction - OSCC_FLAG_RECOVERING can already set due
158 * IMP_DISCONN event */
159 oscc->oscc_flags |= OSCC_FLAG_RECOVERING;
160 /* oscc->oscc_grow_count = OST_MIN_PRECREATE; */
161 cfs_spin_unlock(&oscc->oscc_lock);
165 oscc->oscc_flags |= OSCC_FLAG_RECOVERING;
166 oscc->oscc_grow_count = OST_MIN_PRECREATE;
167 cfs_spin_unlock(&oscc->oscc_lock);
168 DEBUG_REQ(D_ERROR, req,
169 "Unknown rc %d from async create: failing oscc", rc);
170 ptlrpc_fail_import(req->rq_import,
171 lustre_msg_get_conn_cnt(req->rq_reqmsg));
175 CDEBUG(D_HA, "preallocated through id "LPU64" (next to use "LPU64")\n",
176 oscc->oscc_last_id, oscc->oscc_next_id);
178 cfs_spin_lock(&oscc->oscc_lock);
179 cfs_list_for_each_entry_safe(fake_req, pos,
180 &oscc->oscc_wait_create_list, rq_list) {
181 if (handle_async_create(fake_req, rc) == -EAGAIN) {
182 oscc_internal_create(oscc);
183 /* sending request should be never fail because
184 * osc use preallocated requests pool */
185 GOTO(exit_wakeup, rc);
188 cfs_spin_unlock(&oscc->oscc_lock);
191 cfs_waitq_signal(&oscc->oscc_waitq);
195 static int oscc_internal_create(struct osc_creator *oscc)
197 struct osc_create_async_args *args;
198 struct ptlrpc_request *request;
199 struct ost_body *body;
202 LASSERT_SPIN_LOCKED(&oscc->oscc_lock);
204 /* Do not check for a degraded OST here - bug21563/bug18539 */
205 if (oscc->oscc_flags & OSCC_FLAG_RECOVERING) {
206 cfs_spin_unlock(&oscc->oscc_lock);
210 /* we need check it before OSCC_FLAG_CREATING - because need
211 * see lower number of precreate objects */
212 if (oscc->oscc_grow_count < oscc->oscc_max_grow_count &&
213 ((oscc->oscc_flags & OSCC_FLAG_LOW) == 0) &&
214 (__s64)(oscc->oscc_last_id - oscc->oscc_next_id) <=
215 (oscc->oscc_grow_count / 4 + 1)) {
216 oscc->oscc_flags |= OSCC_FLAG_LOW;
217 oscc->oscc_grow_count *= 2;
220 if (oscc->oscc_flags & OSCC_FLAG_CREATING) {
221 cfs_spin_unlock(&oscc->oscc_lock);
225 if (oscc->oscc_grow_count > oscc->oscc_max_grow_count / 2)
226 oscc->oscc_grow_count = oscc->oscc_max_grow_count / 2;
228 oscc->oscc_flags |= OSCC_FLAG_CREATING;
229 cfs_spin_unlock(&oscc->oscc_lock);
231 request = ptlrpc_request_alloc_pack(oscc->oscc_obd->u.cli.cl_import,
233 LUSTRE_OST_VERSION, OST_CREATE);
234 if (request == NULL) {
235 cfs_spin_lock(&oscc->oscc_lock);
236 oscc->oscc_flags &= ~OSCC_FLAG_CREATING;
237 cfs_spin_unlock(&oscc->oscc_lock);
241 request->rq_request_portal = OST_CREATE_PORTAL;
242 ptlrpc_at_set_req_timeout(request);
243 body = req_capsule_client_get(&request->rq_pill, &RMF_OST_BODY);
244 args = ptlrpc_req_async_args(request);
245 args->rq_oscc = oscc;
247 cfs_spin_lock(&oscc->oscc_lock);
248 args->rq_grow_count = oscc->oscc_grow_count;
250 if (likely(fid_seq_is_mdt(oscc->oscc_oa.o_seq))) {
251 body->oa.o_oi.oi_seq = oscc->oscc_oa.o_seq;
252 body->oa.o_oi.oi_id = oscc->oscc_last_id +
253 oscc->oscc_grow_count;
255 /*Just warning here currently, since not sure how fid-on-ost
256 *will be implemented here */
257 CWARN("o_seq: "LPU64" is not indicate any MDTs.\n",
258 oscc->oscc_oa.o_seq);
260 cfs_spin_unlock(&oscc->oscc_lock);
262 body->oa.o_valid |= OBD_MD_FLID | OBD_MD_FLGROUP;
263 CDEBUG(D_RPCTRACE, "prealloc through id "LPU64" (last seen "LPU64")\n",
264 body->oa.o_id, oscc->oscc_last_id);
266 /* we should not resend create request - anyway we will have delorphan
267 * and kill these objects */
268 request->rq_no_delay = request->rq_no_resend = 1;
269 ptlrpc_request_set_replen(request);
271 request->rq_interpret_reply = osc_interpret_create;
272 ptlrpcd_add_req(request, PDL_POLICY_ROUND, -1);
277 static int oscc_has_objects_nolock(struct osc_creator *oscc, int count)
279 return ((__s64)(oscc->oscc_last_id - oscc->oscc_next_id) >= count);
282 static int oscc_has_objects(struct osc_creator *oscc, int count)
286 cfs_spin_lock(&oscc->oscc_lock);
287 have_objs = oscc_has_objects_nolock(oscc, count);
288 cfs_spin_unlock(&oscc->oscc_lock);
293 static int oscc_wait_for_objects(struct osc_creator *oscc, int count)
298 ost_unusable = oscc->oscc_obd->u.cli.cl_import->imp_invalid;
300 cfs_spin_lock(&oscc->oscc_lock);
301 ost_unusable |= (OSCC_FLAG_NOSPC | OSCC_FLAG_RDONLY |
302 OSCC_FLAG_EXITING) & oscc->oscc_flags;
303 have_objs = oscc_has_objects_nolock(oscc, count);
305 if (!ost_unusable && !have_objs)
306 /* they release lock himself */
307 have_objs = oscc_internal_create(oscc);
309 cfs_spin_unlock(&oscc->oscc_lock);
311 return have_objs || ost_unusable;
314 static int oscc_precreate(struct osc_creator *oscc)
316 struct l_wait_info lwi;
320 if (oscc_has_objects(oscc, oscc->oscc_grow_count / 2))
323 /* we should be not block forever - because client's create rpc can
324 * stick in mds for long time and forbid client reconnect */
325 lwi = LWI_TIMEOUT(cfs_timeout_cap(cfs_time_seconds(osc_create_timeout)),
328 rc = l_wait_event(oscc->oscc_waitq, oscc_wait_for_objects(oscc, 1), &lwi);
332 static int oscc_in_sync(struct osc_creator *oscc)
336 cfs_spin_lock(&oscc->oscc_lock);
337 sync = oscc->oscc_flags & OSCC_FLAG_SYNC_IN_PROGRESS;
338 cfs_spin_unlock(&oscc->oscc_lock);
343 /* decide if the OST has remaining object, return value :
344 0 : the OST has remaining objects, may or may not send precreation RPC.
345 1 : the OST has no remaining object, and the sent precreation RPC
346 has not been completed yet.
347 2 : the OST has no remaining object, and will not get any for
348 a potentially very long time
351 int osc_precreate(struct obd_export *exp)
353 struct osc_creator *oscc = &exp->exp_obd->u.cli.cl_oscc;
354 struct obd_import *imp = exp->exp_imp_reverse;
358 LASSERT(oscc != NULL);
359 if (imp != NULL && imp->imp_deactive)
360 GOTO(out_nolock, rc = 1000);
362 /* Handle critical states first */
363 cfs_spin_lock(&oscc->oscc_lock);
364 if (oscc->oscc_flags & OSCC_FLAG_NOSPC_BLK ||
365 oscc->oscc_flags & OSCC_FLAG_RDONLY ||
366 oscc->oscc_flags & OSCC_FLAG_EXITING)
367 GOTO(out, rc = 1000);
369 if ((oscc->oscc_flags & OSCC_FLAG_RECOVERING) ||
370 (oscc->oscc_flags & OSCC_FLAG_DEGRADED))
373 if (oscc_has_objects_nolock(oscc, oscc->oscc_grow_count / 2))
376 /* Return 0, if we have at least one object - bug 22884 */
377 rc = oscc_has_objects_nolock(oscc, 1) ? 0 : 1;
379 if (oscc->oscc_flags & OSCC_FLAG_NOSPC)
380 GOTO(out, (rc == 0) ? 0 : 1000);
382 /* Do not check for OSCC_FLAG_CREATING flag here, let
383 * osc_precreate() call oscc_internal_create() and
384 * adjust oscc_grow_count bug21563 */
385 if (oscc->oscc_flags & OSCC_FLAG_SYNC_IN_PROGRESS)
388 if (oscc_internal_create(oscc))
389 GOTO(out_nolock, rc = 1000);
393 cfs_spin_unlock(&oscc->oscc_lock);
398 static int handle_async_create(struct ptlrpc_request *req, int rc)
400 struct osc_create_async_args *args = ptlrpc_req_async_args(req);
401 struct osc_creator *oscc = args->rq_oscc;
402 struct lov_stripe_md *lsm = args->rq_lsm;
403 struct obd_info *oinfo = args->rq_oinfo;
404 struct obdo *oa = oinfo->oi_oa;
406 LASSERT_SPIN_LOCKED(&oscc->oscc_lock);
411 /* Handle the critical type errors first.
412 * Should we also test cl_import state as well ? */
413 if (oscc->oscc_flags & OSCC_FLAG_EXITING)
414 GOTO(out_wake, rc = -EIO);
416 if (oscc->oscc_flags & OSCC_FLAG_NOSPC_BLK)
417 GOTO(out_wake, rc = -ENOSPC);
419 if (oscc->oscc_flags & OSCC_FLAG_RDONLY)
420 GOTO(out_wake, rc = -EROFS);
422 /* should be try wait until recovery finished */
423 if((oscc->oscc_flags & OSCC_FLAG_RECOVERING) ||
424 (oscc->oscc_flags & OSCC_FLAG_DEGRADED))
427 if (oscc_has_objects_nolock(oscc, 1)) {
428 memcpy(oa, &oscc->oscc_oa, sizeof(*oa));
429 oa->o_id = oscc->oscc_next_id;
430 lsm->lsm_object_id = oscc->oscc_next_id;
431 oscc->oscc_next_id++;
433 CDEBUG(D_RPCTRACE, " set oscc_next_id = "LPU64"\n",
435 GOTO(out_wake, rc = 0);
438 /* we don't have objects now - continue wait */
443 rc = oinfo->oi_cb_up(oinfo, rc);
444 ptlrpc_fakereq_finished(req);
449 static int async_create_interpret(const struct lu_env *env,
450 struct ptlrpc_request *req, void *data,
453 struct osc_create_async_args *args = ptlrpc_req_async_args(req);
454 struct osc_creator *oscc = args->rq_oscc;
457 cfs_spin_lock(&oscc->oscc_lock);
458 ret = handle_async_create(req, rc);
459 cfs_spin_unlock(&oscc->oscc_lock);
464 int osc_create_async(struct obd_export *exp, struct obd_info *oinfo,
465 struct lov_stripe_md **ea, struct obd_trans_info *oti)
468 struct ptlrpc_request *fake_req;
469 struct osc_create_async_args *args;
470 struct osc_creator *oscc = &exp->exp_obd->u.cli.cl_oscc;
471 struct obdo *oa = oinfo->oi_oa;
474 if ((oa->o_valid & OBD_MD_FLGROUP) && !fid_seq_is_mdt(oa->o_seq)) {
475 rc = osc_real_create(exp, oinfo->oi_oa, ea, oti);
476 rc = oinfo->oi_cb_up(oinfo, rc);
480 if ((oa->o_valid & OBD_MD_FLFLAGS) &&
481 oa->o_flags == OBD_FL_RECREATE_OBJS) {
482 rc = osc_real_create(exp, oinfo->oi_oa, ea, oti);
483 rc = oinfo->oi_cb_up(oinfo, rc);
487 LASSERT((*ea) != NULL);
489 fake_req = ptlrpc_prep_fakereq(oscc->oscc_obd->u.cli.cl_import,
491 async_create_interpret);
492 if (fake_req == NULL) {
493 rc = oinfo->oi_cb_up(oinfo, -ENOMEM);
497 args = ptlrpc_req_async_args(fake_req);
498 CLASSERT(sizeof(*args) <= sizeof(fake_req->rq_async_args));
500 args->rq_oscc = oscc;
502 args->rq_oinfo = oinfo;
504 cfs_spin_lock(&oscc->oscc_lock);
506 rc = handle_async_create(fake_req, 0);
508 /* We don't have any objects, wait until we get a reply. */
509 ptlrpcd_add_req(fake_req, PDL_POLICY_ROUND, -1);
510 cfs_list_add(&fake_req->rq_list,
511 &oscc->oscc_wait_create_list);
512 cfs_spin_unlock(&oscc->oscc_lock);
513 /* EAGAIN mean - request is delayed */
516 cfs_spin_unlock(&oscc->oscc_lock);
517 /* need free request if was error hit or
518 * objects already allocated */
519 ptlrpc_req_finished(fake_req);
525 int osc_create(const struct lu_env *env, struct obd_export *exp,
526 struct obdo *oa, struct lov_stripe_md **ea,
527 struct obd_trans_info *oti)
529 struct osc_creator *oscc = &exp->exp_obd->u.cli.cl_oscc;
530 struct obd_import *imp = exp->exp_obd->u.cli.cl_import;
531 struct lov_stripe_md *lsm;
532 int del_orphan = 0, rc = 0;
537 LASSERT(oa->o_valid & OBD_MD_FLGROUP);
539 if ((oa->o_valid & OBD_MD_FLFLAGS) &&
540 oa->o_flags == OBD_FL_RECREATE_OBJS) {
541 RETURN(osc_real_create(exp, oa, ea, oti));
544 if (!fid_seq_is_mdt(oa->o_seq))
545 RETURN(osc_real_create(exp, oa, ea, oti));
547 /* this is the special case where create removes orphans */
548 if (oa->o_valid & OBD_MD_FLFLAGS &&
549 oa->o_flags == OBD_FL_DELORPHAN) {
550 cfs_spin_lock(&oscc->oscc_lock);
551 if (oscc->oscc_flags & OSCC_FLAG_SYNC_IN_PROGRESS) {
552 cfs_spin_unlock(&oscc->oscc_lock);
555 if (!(oscc->oscc_flags & OSCC_FLAG_RECOVERING)) {
556 cfs_spin_unlock(&oscc->oscc_lock);
560 oscc->oscc_flags |= OSCC_FLAG_SYNC_IN_PROGRESS;
561 /* seting flag LOW we prevent extra grow precreate size
562 * and enforce use last assigned size */
563 oscc->oscc_flags |= OSCC_FLAG_LOW;
564 cfs_spin_unlock(&oscc->oscc_lock);
565 CDEBUG(D_HA, "%s: oscc recovery started - delete to "LPU64"\n",
566 oscc->oscc_obd->obd_name, oscc->oscc_next_id - 1);
570 /* delete from next_id on up */
571 oa->o_valid |= OBD_MD_FLID;
572 oa->o_id = oscc->oscc_next_id - 1;
574 rc = osc_real_create(exp, oa, ea, NULL);
576 cfs_spin_lock(&oscc->oscc_lock);
577 oscc->oscc_flags &= ~OSCC_FLAG_SYNC_IN_PROGRESS;
578 if (rc == 0 || rc == -ENOSPC) {
579 struct obd_connect_data *ocd;
582 oscc->oscc_flags |= OSCC_FLAG_NOSPC;
583 if ((oa->o_valid & OBD_MD_FLFLAGS) &&
584 (oa->o_flags & OBD_FL_NOSPC_BLK))
585 oscc->oscc_flags |= OSCC_FLAG_NOSPC_BLK;
587 oscc->oscc_flags &= ~OSCC_FLAG_RECOVERING;
589 oscc->oscc_last_id = oa->o_id;
590 ocd = &imp->imp_connect_data;
591 if (ocd->ocd_connect_flags & OBD_CONNECT_SKIP_ORPHAN) {
593 * The OST reports back in oa->o_id from where
594 * we should restart in order to skip orphan
597 CDEBUG(D_HA, "%s: Skip orphan set, reset last "
598 "objid\n", oscc->oscc_obd->obd_name);
599 oscc->oscc_next_id = oa->o_id + 1;
602 /* sanity check for next objid. see bug 17025 */
603 LASSERT(oscc->oscc_next_id == oa->o_id + 1);
605 CDEBUG(D_HA, "%s: oscc recovery finished, last_id: "
606 LPU64", rc: %d\n", oscc->oscc_obd->obd_name,
607 oscc->oscc_last_id, rc);
609 CDEBUG(D_ERROR, "%s: oscc recovery failed: %d\n",
610 oscc->oscc_obd->obd_name, rc);
613 cfs_waitq_signal(&oscc->oscc_waitq);
614 cfs_spin_unlock(&oscc->oscc_lock);
622 rc = obd_alloc_memmd(exp, &lsm);
628 if (oscc_in_sync(oscc))
629 CDEBUG(D_HA,"%s: oscc recovery in progress, waiting\n",
630 oscc->oscc_obd->obd_name);
632 rc = oscc_precreate(oscc);
634 CDEBUG(D_HA,"%s: error create %d\n",
635 oscc->oscc_obd->obd_name, rc);
637 cfs_spin_lock(&oscc->oscc_lock);
639 /* wakeup but recovery did not finished */
640 if ((oscc->oscc_obd->u.cli.cl_import->imp_invalid) ||
641 (oscc->oscc_flags & OSCC_FLAG_RECOVERING)) {
643 cfs_spin_unlock(&oscc->oscc_lock);
647 if (oscc->oscc_flags & OSCC_FLAG_NOSPC_BLK) {
649 cfs_spin_unlock(&oscc->oscc_lock);
653 if (oscc->oscc_flags & OSCC_FLAG_RDONLY) {
655 cfs_spin_unlock(&oscc->oscc_lock);
659 // Should we report -EIO error ?
660 if (oscc->oscc_flags & OSCC_FLAG_EXITING) {
661 cfs_spin_unlock(&oscc->oscc_lock);
666 * If this is DELORPHAN process, no need create object here,
667 * otherwise this will create a gap of object id, and MDS
668 * might create some orphan log (mds_lov_update_objids), then
669 * remove objects wrongly on OST. Bug 21379.
671 if (oa->o_valid & OBD_MD_FLFLAGS &&
672 oa->o_flags == OBD_FL_DELORPHAN) {
673 cfs_spin_unlock(&oscc->oscc_lock);
677 if (oscc_has_objects_nolock(oscc, 1)) {
678 memcpy(oa, &oscc->oscc_oa, sizeof(*oa));
679 oa->o_id = oscc->oscc_next_id;
680 lsm->lsm_object_id = oscc->oscc_next_id;
682 oscc->oscc_next_id++;
683 cfs_spin_unlock(&oscc->oscc_lock);
685 CDEBUG(D_RPCTRACE, "%s: set oscc_next_id = "LPU64"\n",
686 exp->exp_obd->obd_name, oscc->oscc_next_id);
690 if (oscc->oscc_flags & OSCC_FLAG_NOSPC) {
692 cfs_spin_unlock(&oscc->oscc_lock);
696 cfs_spin_unlock(&oscc->oscc_lock);
700 CDEBUG(D_INFO, "%s: returning objid "LPU64"\n",
701 obd2cli_tgt(oscc->oscc_obd), lsm->lsm_object_id);
704 obd_free_memmd(exp, &lsm);
705 if (del_orphan != 0 && rc != -EIO)
706 /* Ignore non-IO precreate error for clear orphan */
712 void oscc_init(struct obd_device *obd)
714 struct osc_creator *oscc;
719 oscc = &obd->u.cli.cl_oscc;
721 memset(oscc, 0, sizeof(*oscc));
723 cfs_waitq_init(&oscc->oscc_waitq);
724 cfs_spin_lock_init(&oscc->oscc_lock);
725 oscc->oscc_obd = obd;
726 oscc->oscc_grow_count = OST_MIN_PRECREATE;
727 oscc->oscc_max_grow_count = OST_MAX_PRECREATE;
729 oscc->oscc_next_id = 2;
730 oscc->oscc_last_id = 1;
731 oscc->oscc_flags |= OSCC_FLAG_RECOVERING;
733 CFS_INIT_LIST_HEAD(&oscc->oscc_wait_create_list);
735 /* XXX the export handle should give the oscc the last object */
736 /* oed->oed_oscc.oscc_last_id = exph->....; */
739 void oscc_fini(struct obd_device *obd)
741 struct osc_creator *oscc = &obd->u.cli.cl_oscc;
745 cfs_spin_lock(&oscc->oscc_lock);
746 oscc->oscc_flags &= ~OSCC_FLAG_RECOVERING;
747 oscc->oscc_flags |= OSCC_FLAG_EXITING;
748 cfs_spin_unlock(&oscc->oscc_lock);