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) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
28 * Use is subject to license terms.
30 * Copyright (c) 2012, 2013, Intel Corporation.
33 * This file is part of Lustre, http://www.lustre.org/
34 * Lustre is a trademark of Sun Microsystems, Inc.
36 * lustre/osp/osp_object.c
38 * Lustre OST Proxy Device
40 * Author: Alex Zhuravlev <alexey.zhuravlev@intel.com>
41 * Author: Mikhail Pershin <mike.tappro@intel.com>
44 #define DEBUG_SUBSYSTEM S_MDS
46 #include "osp_internal.h"
48 static inline bool is_ost_obj(struct lu_object *lo)
50 return !lu2osp_dev(lo->lo_dev)->opd_connect_mdt;
53 static void osp_object_assign_fid(const struct lu_env *env,
54 struct osp_device *d, struct osp_object *o)
56 struct osp_thread_info *osi = osp_env_info(env);
58 LASSERT(fid_is_zero(lu_object_fid(&o->opo_obj.do_lu)));
59 LASSERT(o->opo_reserved);
62 osp_precreate_get_fid(env, d, &osi->osi_fid);
64 lu_object_assign_fid(env, &o->opo_obj.do_lu, &osi->osi_fid);
67 static int osp_oac_init(struct osp_object *obj)
69 struct osp_object_attr *ooa;
75 INIT_LIST_HEAD(&ooa->ooa_xattr_list);
76 spin_lock(&obj->opo_lock);
77 if (likely(obj->opo_ooa == NULL)) {
79 spin_unlock(&obj->opo_lock);
81 spin_unlock(&obj->opo_lock);
88 static struct osp_xattr_entry *
89 osp_oac_xattr_find_locked(struct osp_object_attr *ooa,
90 const char *name, size_t namelen, bool unlink)
92 struct osp_xattr_entry *oxe;
94 list_for_each_entry(oxe, &ooa->ooa_xattr_list, oxe_list) {
95 if (namelen == oxe->oxe_namelen &&
96 strncmp(name, oxe->oxe_buf, namelen) == 0) {
98 list_del_init(&oxe->oxe_list);
100 atomic_inc(&oxe->oxe_ref);
109 static struct osp_xattr_entry *osp_oac_xattr_find(struct osp_object *obj,
112 struct osp_xattr_entry *oxe = NULL;
114 spin_lock(&obj->opo_lock);
115 if (obj->opo_ooa != NULL)
116 oxe = osp_oac_xattr_find_locked(obj->opo_ooa, name,
117 strlen(name), false);
118 spin_unlock(&obj->opo_lock);
123 static struct osp_xattr_entry *
124 osp_oac_xattr_find_or_add(struct osp_object *obj, const char *name, size_t len)
126 struct osp_object_attr *ooa = obj->opo_ooa;
127 struct osp_xattr_entry *oxe;
128 struct osp_xattr_entry *tmp = NULL;
129 size_t namelen = strlen(name);
130 size_t size = sizeof(*oxe) + namelen + 1 + len;
132 LASSERT(ooa != NULL);
134 oxe = osp_oac_xattr_find(obj, name);
138 OBD_ALLOC(oxe, size);
139 if (unlikely(oxe == NULL))
142 INIT_LIST_HEAD(&oxe->oxe_list);
143 oxe->oxe_buflen = size;
144 oxe->oxe_namelen = namelen;
145 memcpy(oxe->oxe_buf, name, namelen);
146 oxe->oxe_value = oxe->oxe_buf + namelen + 1;
147 /* One ref is for the caller, the other is for the entry on the list. */
148 atomic_set(&oxe->oxe_ref, 2);
150 spin_lock(&obj->opo_lock);
151 tmp = osp_oac_xattr_find_locked(ooa, name, namelen, false);
153 list_add_tail(&oxe->oxe_list, &ooa->ooa_xattr_list);
154 spin_unlock(&obj->opo_lock);
164 static struct osp_xattr_entry *
165 osp_oac_xattr_replace(struct osp_object *obj,
166 struct osp_xattr_entry **poxe, size_t len)
168 struct osp_object_attr *ooa = obj->opo_ooa;
169 struct osp_xattr_entry *old = *poxe;
170 struct osp_xattr_entry *oxe;
171 struct osp_xattr_entry *tmp = NULL;
172 size_t namelen = old->oxe_namelen;
173 size_t size = sizeof(*oxe) + namelen + 1 + len;
175 LASSERT(ooa != NULL);
177 OBD_ALLOC(oxe, size);
178 if (unlikely(oxe == NULL))
181 INIT_LIST_HEAD(&oxe->oxe_list);
182 oxe->oxe_buflen = size;
183 oxe->oxe_namelen = namelen;
184 memcpy(oxe->oxe_buf, old->oxe_buf, namelen);
185 oxe->oxe_value = oxe->oxe_buf + namelen + 1;
186 /* One ref is for the caller, the other is for the entry on the list. */
187 atomic_set(&oxe->oxe_ref, 2);
189 spin_lock(&obj->opo_lock);
190 tmp = osp_oac_xattr_find_locked(ooa, oxe->oxe_buf, namelen, true);
191 list_add_tail(&oxe->oxe_list, &ooa->ooa_xattr_list);
192 spin_unlock(&obj->opo_lock);
195 LASSERT(tmp != NULL);
200 static inline void osp_oac_xattr_put(struct osp_xattr_entry *oxe)
202 if (atomic_dec_and_test(&oxe->oxe_ref)) {
203 LASSERT(list_empty(&oxe->oxe_list));
205 OBD_FREE(oxe, oxe->oxe_buflen);
209 static int osp_get_attr_from_reply(const struct lu_env *env,
210 struct object_update_reply *reply,
211 struct ptlrpc_request *req,
212 struct lu_attr *attr,
213 struct osp_object *obj, int index)
215 struct osp_thread_info *osi = osp_env_info(env);
216 struct lu_buf *rbuf = &osi->osi_lb2;
217 struct obdo *lobdo = &osi->osi_obdo;
221 rc = object_update_result_data_get(reply, rbuf, index);
225 wobdo = rbuf->lb_buf;
226 if (rbuf->lb_len != sizeof(*wobdo))
229 LASSERT(req != NULL);
230 if (ptlrpc_req_need_swab(req))
231 lustre_swab_obdo(wobdo);
233 lustre_get_wire_obdo(NULL, lobdo, wobdo);
234 spin_lock(&obj->opo_lock);
235 if (obj->opo_ooa != NULL) {
236 la_from_obdo(&obj->opo_ooa->ooa_attr, lobdo, lobdo->o_valid);
238 *attr = obj->opo_ooa->ooa_attr;
240 LASSERT(attr != NULL);
242 la_from_obdo(attr, lobdo, lobdo->o_valid);
244 spin_unlock(&obj->opo_lock);
249 static int osp_attr_get_interpterer(const struct lu_env *env,
250 struct object_update_reply *reply,
251 struct ptlrpc_request *req,
252 struct osp_object *obj,
253 void *data, int index, int rc)
255 struct lu_attr *attr = data;
257 LASSERT(obj->opo_ooa != NULL);
260 osp2lu_obj(obj)->lo_header->loh_attr |= LOHA_EXISTS;
261 obj->opo_non_exist = 0;
263 return osp_get_attr_from_reply(env, reply, req, NULL, obj,
267 osp2lu_obj(obj)->lo_header->loh_attr &= ~LOHA_EXISTS;
268 obj->opo_non_exist = 1;
271 spin_lock(&obj->opo_lock);
273 spin_unlock(&obj->opo_lock);
279 static int osp_declare_attr_get(const struct lu_env *env, struct dt_object *dt,
280 struct lustre_capa *capa)
282 struct osp_object *obj = dt2osp_obj(dt);
283 struct osp_device *osp = lu2osp_dev(dt->do_lu.lo_dev);
286 if (obj->opo_ooa == NULL) {
287 rc = osp_oac_init(obj);
292 mutex_lock(&osp->opd_async_requests_mutex);
293 rc = osp_insert_async_request(env, OUT_ATTR_GET, obj, 0, NULL, NULL,
294 &obj->opo_ooa->ooa_attr,
295 osp_attr_get_interpterer);
296 mutex_unlock(&osp->opd_async_requests_mutex);
301 int osp_attr_get(const struct lu_env *env, struct dt_object *dt,
302 struct lu_attr *attr, struct lustre_capa *capa)
304 struct osp_device *osp = lu2osp_dev(dt->do_lu.lo_dev);
305 struct osp_object *obj = dt2osp_obj(dt);
306 struct dt_device *dev = &osp->opd_dt_dev;
307 struct dt_update_request *update;
308 struct object_update_reply *reply;
309 struct ptlrpc_request *req = NULL;
313 if (is_ost_obj(&dt->do_lu) && obj->opo_non_exist)
316 if (obj->opo_ooa != NULL) {
317 spin_lock(&obj->opo_lock);
318 if (obj->opo_ooa->ooa_attr.la_valid != 0) {
319 *attr = obj->opo_ooa->ooa_attr;
320 spin_unlock(&obj->opo_lock);
324 spin_unlock(&obj->opo_lock);
327 update = out_create_update_req(dev);
329 RETURN(PTR_ERR(update));
331 rc = out_insert_update(env, update, OUT_ATTR_GET,
332 lu_object_fid(&dt->do_lu), 0, NULL, NULL);
334 CERROR("%s: Insert update error "DFID": rc = %d\n",
335 dev->dd_lu_dev.ld_obd->obd_name,
336 PFID(lu_object_fid(&dt->do_lu)), rc);
341 rc = out_remote_sync(env, osp->opd_obd->u.cli.cl_import, update, &req);
344 osp2lu_obj(obj)->lo_header->loh_attr &= ~LOHA_EXISTS;
345 obj->opo_non_exist = 1;
347 CERROR("%s:osp_attr_get update error "DFID": rc = %d\n",
348 dev->dd_lu_dev.ld_obd->obd_name,
349 PFID(lu_object_fid(&dt->do_lu)), rc);
355 osp2lu_obj(obj)->lo_header->loh_attr |= LOHA_EXISTS;
356 obj->opo_non_exist = 0;
357 reply = req_capsule_server_sized_get(&req->rq_pill,
358 &RMF_OUT_UPDATE_REPLY,
359 OUT_UPDATE_REPLY_SIZE);
360 if (reply == NULL || reply->ourp_magic != UPDATE_REPLY_MAGIC)
361 GOTO(out, rc = -EPROTO);
363 rc = osp_get_attr_from_reply(env, reply, req, attr, obj, 0);
371 ptlrpc_req_finished(req);
373 out_destroy_update_req(update);
378 static int osp_declare_attr_set(const struct lu_env *env, struct dt_object *dt,
379 const struct lu_attr *attr, struct thandle *th)
381 struct osp_device *d = lu2osp_dev(dt->do_lu.lo_dev);
382 struct osp_object *o = dt2osp_obj(dt);
389 * Usually we don't allow server stack to manipulate size
390 * but there is a special case when striping is created
391 * late, after stripless file got truncated to non-zero.
393 * In this case we do the following:
395 * 1) grab id in declare - this can lead to leaked OST objects
396 * but we don't currently have proper mechanism and the only
397 * options we have are to do truncate RPC holding transaction
398 * open (very bad) or to grab id in declare at cost of leaked
399 * OST object in same very rare unfortunate case (just bad)
400 * notice 1.6-2.0 do assignment outside of running transaction
401 * all the time, meaning many more chances for leaked objects.
403 * 2) send synchronous truncate RPC with just assigned id
406 /* there are few places in MDD code still passing NULL
407 * XXX: to be fixed soon */
411 if (attr->la_valid & LA_SIZE && attr->la_size > 0 &&
412 fid_is_zero(lu_object_fid(&o->opo_obj.do_lu))) {
413 LASSERT(!dt_object_exists(dt));
414 osp_object_assign_fid(env, d, o);
415 rc = osp_object_truncate(env, dt, attr->la_size);
421 /* no need in logging for new objects being created */
425 if (!(attr->la_valid & (LA_UID | LA_GID)))
428 if (!is_only_remote_trans(th))
430 * track all UID/GID changes via llog
432 rc = osp_sync_declare_add(env, o, MDS_SETATTR64_REC, th);
434 /* It is for OST-object attr_set directly without updating
435 * local MDT-object attribute. It is usually used by LFSCK. */
436 rc = osp_md_declare_attr_set(env, dt, attr, th);
438 if (rc != 0 || o->opo_ooa == NULL)
441 la = &o->opo_ooa->ooa_attr;
442 spin_lock(&o->opo_lock);
443 if (attr->la_valid & LA_UID) {
444 la->la_uid = attr->la_uid;
445 la->la_valid |= LA_UID;
448 if (attr->la_valid & LA_GID) {
449 la->la_gid = attr->la_gid;
450 la->la_valid |= LA_GID;
452 spin_unlock(&o->opo_lock);
457 static int osp_attr_set(const struct lu_env *env, struct dt_object *dt,
458 const struct lu_attr *attr, struct thandle *th,
459 struct lustre_capa *capa)
461 struct osp_object *o = dt2osp_obj(dt);
466 /* we're interested in uid/gid changes only */
467 if (!(attr->la_valid & (LA_UID | LA_GID)))
470 /* new object, the very first ->attr_set()
471 * initializing attributes needs no logging
472 * all subsequent one are subject to the
473 * logging and synchronization with OST */
479 if (!is_only_remote_trans(th))
481 * once transaction is committed put proper command on
482 * the queue going to our OST
484 rc = osp_sync_add(env, o, MDS_SETATTR64_REC, th, attr);
485 /* XXX: send new uid/gid to OST ASAP? */
487 /* It is for OST-object attr_set directly without updating
488 * local MDT-object attribute. It is usually used by LFSCK. */
489 rc = osp_md_attr_set(env, dt, attr, th, capa);
494 static int osp_xattr_get_interpterer(const struct lu_env *env,
495 struct object_update_reply *reply,
496 struct ptlrpc_request *req,
497 struct osp_object *obj,
498 void *data, int index, int rc)
500 struct osp_object_attr *ooa = obj->opo_ooa;
501 struct osp_xattr_entry *oxe = data;
502 struct lu_buf *rbuf = &osp_env_info(env)->osi_lb2;
504 LASSERT(ooa != NULL);
507 size_t len = sizeof(*oxe) + oxe->oxe_namelen + 1;
509 rc = object_update_result_data_get(reply, rbuf, index);
510 if (rc < 0 || rbuf->lb_len > (oxe->oxe_buflen - len)) {
511 spin_lock(&obj->opo_lock);
513 spin_unlock(&obj->opo_lock);
514 osp_oac_xattr_put(oxe);
516 return rc < 0 ? rc : -ERANGE;
519 spin_lock(&obj->opo_lock);
520 oxe->oxe_vallen = rbuf->lb_len;
521 memcpy(oxe->oxe_value, rbuf->lb_buf, rbuf->lb_len);
524 spin_unlock(&obj->opo_lock);
525 } else if (rc == -ENOENT || rc == -ENODATA) {
526 spin_lock(&obj->opo_lock);
529 spin_unlock(&obj->opo_lock);
531 spin_lock(&obj->opo_lock);
533 spin_unlock(&obj->opo_lock);
536 osp_oac_xattr_put(oxe);
541 static int osp_declare_xattr_get(const struct lu_env *env, struct dt_object *dt,
542 struct lu_buf *buf, const char *name,
543 struct lustre_capa *capa)
545 struct osp_object *obj = dt2osp_obj(dt);
546 struct osp_device *osp = lu2osp_dev(dt->do_lu.lo_dev);
547 struct osp_xattr_entry *oxe;
548 int namelen = strlen(name);
551 LASSERT(buf != NULL);
552 LASSERT(name != NULL);
554 /* If only for xattr size, return directly. */
555 if (unlikely(buf->lb_len == 0))
558 if (obj->opo_ooa == NULL) {
559 rc = osp_oac_init(obj);
564 oxe = osp_oac_xattr_find_or_add(obj, name, buf->lb_len);
568 mutex_lock(&osp->opd_async_requests_mutex);
569 rc = osp_insert_async_request(env, OUT_XATTR_GET, obj, 1,
570 &namelen, &name, oxe,
571 osp_xattr_get_interpterer);
573 mutex_unlock(&osp->opd_async_requests_mutex);
574 osp_oac_xattr_put(oxe);
576 struct dt_update_request *update;
578 /* XXX: Currently, we trigger the batched async OUT
579 * RPC via dt_declare_xattr_get(). It is not
580 * perfect solution, but works well now.
582 * We will improve it in the future. */
583 update = osp->opd_async_requests;
584 if (update != NULL && update->dur_req != NULL &&
585 update->dur_req->ourq_count > 0) {
586 osp->opd_async_requests = NULL;
587 mutex_unlock(&osp->opd_async_requests_mutex);
588 rc = osp_unplug_async_request(env, osp, update);
590 mutex_unlock(&osp->opd_async_requests_mutex);
597 int osp_xattr_get(const struct lu_env *env, struct dt_object *dt,
598 struct lu_buf *buf, const char *name,
599 struct lustre_capa *capa)
601 struct osp_device *osp = lu2osp_dev(dt->do_lu.lo_dev);
602 struct osp_object *obj = dt2osp_obj(dt);
603 struct dt_device *dev = &osp->opd_dt_dev;
604 struct lu_buf *rbuf = &osp_env_info(env)->osi_lb2;
605 struct dt_update_request *update = NULL;
606 struct ptlrpc_request *req = NULL;
607 struct object_update_reply *reply;
608 struct osp_xattr_entry *oxe = NULL;
609 const char *dname = dt->do_lu.lo_dev->ld_obd->obd_name;
614 LASSERT(buf != NULL);
615 LASSERT(name != NULL);
617 if (unlikely(obj->opo_non_exist))
620 oxe = osp_oac_xattr_find(obj, name);
622 spin_lock(&obj->opo_lock);
623 if (oxe->oxe_ready) {
625 GOTO(unlock, rc = -ENODATA);
627 if (buf->lb_buf == NULL)
628 GOTO(unlock, rc = oxe->oxe_vallen);
630 if (buf->lb_len < oxe->oxe_vallen)
631 GOTO(unlock, rc = -ERANGE);
633 memcpy(buf->lb_buf, oxe->oxe_value, oxe->oxe_vallen);
635 GOTO(unlock, rc = oxe->oxe_vallen);
638 spin_unlock(&obj->opo_lock);
639 osp_oac_xattr_put(oxe);
643 spin_unlock(&obj->opo_lock);
646 update = out_create_update_req(dev);
648 GOTO(out, rc = PTR_ERR(update));
650 namelen = strlen(name) + 1;
651 rc = out_insert_update(env, update, OUT_XATTR_GET,
652 lu_object_fid(&dt->do_lu), 1, &namelen, &name);
654 CERROR("%s: Insert update error "DFID": rc = %d\n",
655 dname, PFID(lu_object_fid(&dt->do_lu)), rc);
660 rc = out_remote_sync(env, osp->opd_obd->u.cli.cl_import, update, &req);
662 if (obj->opo_ooa == NULL)
666 oxe = osp_oac_xattr_find_or_add(obj, name, buf->lb_len);
669 CWARN("%s: Fail to add xattr (%s) to cache for "
670 DFID" (1): rc = %d\n", dname, name,
671 PFID(lu_object_fid(&dt->do_lu)), rc);
676 spin_lock(&obj->opo_lock);
677 if (rc == -ENOENT || rc == -ENODATA) {
683 spin_unlock(&obj->opo_lock);
688 reply = req_capsule_server_sized_get(&req->rq_pill,
689 &RMF_OUT_UPDATE_REPLY,
690 OUT_UPDATE_REPLY_SIZE);
691 if (reply->ourp_magic != UPDATE_REPLY_MAGIC) {
692 CERROR("%s: Wrong version %x expected %x "DFID": rc = %d\n",
693 dname, reply->ourp_magic, UPDATE_REPLY_MAGIC,
694 PFID(lu_object_fid(&dt->do_lu)), -EPROTO);
696 GOTO(out, rc = -EPROTO);
699 rc = object_update_result_data_get(reply, rbuf, 0);
703 if (buf->lb_buf == NULL)
704 GOTO(out, rc = rbuf->lb_len);
706 if (unlikely(buf->lb_len < rbuf->lb_len))
707 GOTO(out, rc = -ERANGE);
709 memcpy(buf->lb_buf, rbuf->lb_buf, rbuf->lb_len);
711 if (obj->opo_ooa == NULL)
715 oxe = osp_oac_xattr_find_or_add(obj, name, rbuf->lb_len);
717 CWARN("%s: Fail to add xattr (%s) to "
718 "cache for "DFID" (2): rc = %d\n",
719 dname, name, PFID(lu_object_fid(&dt->do_lu)), rc);
725 if (oxe->oxe_buflen - oxe->oxe_namelen - 1 < rbuf->lb_len) {
726 struct osp_xattr_entry *old = oxe;
727 struct osp_xattr_entry *tmp;
729 tmp = osp_oac_xattr_replace(obj, &old, rbuf->lb_len);
730 osp_oac_xattr_put(oxe);
733 CWARN("%s: Fail to update xattr (%s) to "
734 "cache for "DFID": rc = %d\n",
735 dname, name, PFID(lu_object_fid(&dt->do_lu)), rc);
736 spin_lock(&obj->opo_lock);
738 spin_unlock(&obj->opo_lock);
743 /* Drop the ref for entry on list. */
744 osp_oac_xattr_put(old);
747 spin_lock(&obj->opo_lock);
748 oxe->oxe_vallen = rbuf->lb_len;
749 memcpy(oxe->oxe_value, rbuf->lb_buf, rbuf->lb_len);
752 spin_unlock(&obj->opo_lock);
758 ptlrpc_req_finished(req);
760 if (update != NULL && !IS_ERR(update))
761 out_destroy_update_req(update);
764 osp_oac_xattr_put(oxe);
769 int osp_declare_xattr_set(const struct lu_env *env, struct dt_object *dt,
770 const struct lu_buf *buf, const char *name,
771 int flag, struct thandle *th)
773 struct osp_object *o = dt2osp_obj(dt);
774 struct dt_update_request *update;
776 struct osp_xattr_entry *oxe;
777 int sizes[3] = {strlen(name), buf->lb_len,
779 char *bufs[3] = {(char *)name, (char *)buf->lb_buf };
782 LASSERT(buf->lb_len > 0 && buf->lb_buf != NULL);
784 update = out_find_create_update_loc(th, dt);
785 if (IS_ERR(update)) {
786 CERROR("%s: Get OSP update buf failed "DFID": rc = %d\n",
787 dt->do_lu.lo_dev->ld_obd->obd_name,
788 PFID(lu_object_fid(&dt->do_lu)),
789 (int)PTR_ERR(update));
791 return PTR_ERR(update);
794 flag = cpu_to_le32(flag);
795 bufs[2] = (char *)&flag;
797 fid = (struct lu_fid *)lu_object_fid(&dt->do_lu);
798 rc = out_insert_update(env, update, OUT_XATTR_SET, fid,
799 ARRAY_SIZE(sizes), sizes, (const char **)bufs);
800 if (rc != 0 || o->opo_ooa == NULL)
803 oxe = osp_oac_xattr_find_or_add(o, name, buf->lb_len);
805 CWARN("%s: Fail to add xattr (%s) to cache for "DFID
806 ": rc = %d\n", dt->do_lu.lo_dev->ld_obd->obd_name,
807 name, PFID(lu_object_fid(&dt->do_lu)), rc);
812 if (oxe->oxe_buflen - oxe->oxe_namelen - 1 < buf->lb_len) {
813 struct osp_xattr_entry *old = oxe;
814 struct osp_xattr_entry *tmp;
816 tmp = osp_oac_xattr_replace(o, &old, buf->lb_len);
817 osp_oac_xattr_put(oxe);
820 CWARN("%s: Fail to update xattr (%s) to cache for "DFID
821 ": rc = %d\n", dt->do_lu.lo_dev->ld_obd->obd_name,
822 name, PFID(lu_object_fid(&dt->do_lu)), rc);
823 spin_lock(&o->opo_lock);
825 spin_unlock(&o->opo_lock);
830 /* Drop the ref for entry on list. */
831 osp_oac_xattr_put(old);
834 spin_lock(&o->opo_lock);
835 oxe->oxe_vallen = buf->lb_len;
836 memcpy(oxe->oxe_value, buf->lb_buf, buf->lb_len);
839 spin_unlock(&o->opo_lock);
840 osp_oac_xattr_put(oxe);
845 int osp_xattr_set(const struct lu_env *env, struct dt_object *dt,
846 const struct lu_buf *buf, const char *name, int fl,
847 struct thandle *th, struct lustre_capa *capa)
849 CDEBUG(D_INFO, "xattr %s set object "DFID"\n", name,
850 PFID(&dt->do_lu.lo_header->loh_fid));
855 int osp_declare_xattr_del(const struct lu_env *env, struct dt_object *dt,
856 const char *name, struct thandle *th)
858 struct dt_update_request *update;
859 const struct lu_fid *fid;
860 int size = strlen(name);
863 update = out_find_create_update_loc(th, dt);
865 return PTR_ERR(update);
867 fid = lu_object_fid(&dt->do_lu);
869 rc = out_insert_update(env, update, OUT_XATTR_DEL, fid, 1, &size,
870 (const char **)&name);
875 int osp_xattr_del(const struct lu_env *env, struct dt_object *dt,
876 const char *name, struct thandle *th,
877 struct lustre_capa *capa)
879 CDEBUG(D_INFO, "xattr %s del object "DFID"\n", name,
880 PFID(&dt->do_lu.lo_header->loh_fid));
885 static int osp_declare_object_create(const struct lu_env *env,
886 struct dt_object *dt,
887 struct lu_attr *attr,
888 struct dt_allocation_hint *hint,
889 struct dt_object_format *dof,
892 struct osp_thread_info *osi = osp_env_info(env);
893 struct osp_device *d = lu2osp_dev(dt->do_lu.lo_dev);
894 struct osp_object *o = dt2osp_obj(dt);
895 const struct lu_fid *fid = lu_object_fid(&dt->do_lu);
900 if (is_only_remote_trans(th)) {
901 LASSERT(fid_is_sane(fid));
903 rc = osp_md_declare_object_create(env, dt, attr, hint, dof, th);
908 /* should happen to non-0 OSP only so that at least one object
909 * has been already declared in the scenario and LOD should
911 if (OBD_FAIL_CHECK(OBD_FAIL_MDS_OSC_CREATE_FAIL) && d->opd_index == 1)
914 LASSERT(d->opd_last_used_oid_file);
917 * There can be gaps in precreated ids and record to unlink llog
918 * XXX: we do not handle gaps yet, implemented before solution
919 * was found to be racy, so we disabled that. there is no
920 * point in making useless but expensive llog declaration.
922 /* rc = osp_sync_declare_add(env, o, MDS_UNLINK64_REC, th); */
924 if (unlikely(!fid_is_zero(fid))) {
925 /* replay case: caller knows fid */
926 osi->osi_off = sizeof(osi->osi_id) * d->opd_index;
927 osi->osi_lb.lb_len = sizeof(osi->osi_id);
928 osi->osi_lb.lb_buf = NULL;
929 rc = dt_declare_record_write(env, d->opd_last_used_oid_file,
930 &osi->osi_lb, osi->osi_off, th);
935 * in declaration we need to reserve object so that we don't block
936 * awaiting precreation RPC to complete
938 rc = osp_precreate_reserve(env, d);
940 * we also need to declare update to local "last used id" file for
941 * recovery if object isn't used for a reason, we need to release
942 * reservation, this can be made in osd_object_release()
945 /* mark id is reserved: in create we don't want to talk
947 LASSERT(o->opo_reserved == 0);
950 /* common for all OSPs file hystorically */
951 osi->osi_off = sizeof(osi->osi_id) * d->opd_index;
952 osi->osi_lb.lb_len = sizeof(osi->osi_id);
953 osi->osi_lb.lb_buf = NULL;
954 rc = dt_declare_record_write(env, d->opd_last_used_oid_file,
955 &osi->osi_lb, osi->osi_off, th);
957 /* not needed in the cache anymore */
958 set_bit(LU_OBJECT_HEARD_BANSHEE,
959 &dt->do_lu.lo_header->loh_flags);
964 static int osp_object_create(const struct lu_env *env, struct dt_object *dt,
965 struct lu_attr *attr,
966 struct dt_allocation_hint *hint,
967 struct dt_object_format *dof, struct thandle *th)
969 struct osp_thread_info *osi = osp_env_info(env);
970 struct osp_device *d = lu2osp_dev(dt->do_lu.lo_dev);
971 struct osp_object *o = dt2osp_obj(dt);
973 struct lu_fid *fid = &osi->osi_fid;
976 if (is_only_remote_trans(th)) {
977 LASSERT(fid_is_sane(lu_object_fid(&dt->do_lu)));
979 rc = osp_md_object_create(env, dt, attr, hint, dof, th);
981 o->opo_non_exist = 0;
986 o->opo_non_exist = 0;
987 if (o->opo_reserved) {
988 /* regular case, fid is assigned holding trunsaction open */
989 osp_object_assign_fid(env, d, o);
992 memcpy(fid, lu_object_fid(&dt->do_lu), sizeof(*fid));
994 LASSERTF(fid_is_sane(fid), "fid for osp_object %p is insane"DFID"!\n",
997 if (!o->opo_reserved) {
998 /* special case, id was assigned outside of transaction
999 * see comments in osp_declare_attr_set */
1000 LASSERT(d->opd_pre != NULL);
1001 spin_lock(&d->opd_pre_lock);
1002 osp_update_last_fid(d, fid);
1003 spin_unlock(&d->opd_pre_lock);
1006 CDEBUG(D_INODE, "fid for osp_object %p is "DFID"\n", o, PFID(fid));
1008 /* If the precreate ends, it means it will be ready to rollover to
1009 * the new sequence soon, all the creation should be synchronized,
1010 * otherwise during replay, the replay fid will be inconsistent with
1011 * last_used/create fid */
1012 if (osp_precreate_end_seq(env, d) && osp_is_fid_client(d))
1016 * it's OK if the import is inactive by this moment - id was created
1017 * by OST earlier, we just need to maintain it consistently on the disk
1018 * once import is reconnected, OSP will claim this and other objects
1019 * used and OST either keep them, if they exist or recreate
1022 /* we might have lost precreated objects */
1023 if (unlikely(d->opd_gap_count) > 0) {
1024 LASSERT(d->opd_pre != NULL);
1025 spin_lock(&d->opd_pre_lock);
1026 if (d->opd_gap_count > 0) {
1027 int count = d->opd_gap_count;
1029 ostid_set_id(&osi->osi_oi,
1030 fid_oid(&d->opd_gap_start_fid));
1031 d->opd_gap_count = 0;
1032 spin_unlock(&d->opd_pre_lock);
1034 CDEBUG(D_HA, "Writting gap "DFID"+%d in llog\n",
1035 PFID(&d->opd_gap_start_fid), count);
1036 /* real gap handling is disabled intil ORI-692 will be
1037 * fixed, now we only report gaps */
1039 spin_unlock(&d->opd_pre_lock);
1043 /* new object, the very first ->attr_set()
1044 * initializing attributes needs no logging */
1047 /* Only need update last_used oid file, seq file will only be update
1048 * during seq rollover */
1049 osp_objid_buf_prep(&osi->osi_lb, &osi->osi_off,
1050 &d->opd_last_used_fid.f_oid, d->opd_index);
1052 rc = dt_record_write(env, d->opd_last_used_oid_file, &osi->osi_lb,
1055 CDEBUG(D_HA, "%s: Wrote last used FID: "DFID", index %d: %d\n",
1056 d->opd_obd->obd_name, PFID(fid), d->opd_index, rc);
1061 int osp_declare_object_destroy(const struct lu_env *env,
1062 struct dt_object *dt, struct thandle *th)
1064 struct osp_object *o = dt2osp_obj(dt);
1070 * track objects to be destroyed via llog
1072 rc = osp_sync_declare_add(env, o, MDS_UNLINK64_REC, th);
1077 int osp_object_destroy(const struct lu_env *env, struct dt_object *dt,
1080 struct osp_object *o = dt2osp_obj(dt);
1085 o->opo_non_exist = 1;
1087 * once transaction is committed put proper command on
1088 * the queue going to our OST
1090 rc = osp_sync_add(env, o, MDS_UNLINK64_REC, th, NULL);
1092 /* not needed in cache any more */
1093 set_bit(LU_OBJECT_HEARD_BANSHEE, &dt->do_lu.lo_header->loh_flags);
1098 static int osp_orphan_index_lookup(const struct lu_env *env,
1099 struct dt_object *dt,
1101 const struct dt_key *key,
1102 struct lustre_capa *capa)
1107 static int osp_orphan_index_declare_insert(const struct lu_env *env,
1108 struct dt_object *dt,
1109 const struct dt_rec *rec,
1110 const struct dt_key *key,
1111 struct thandle *handle)
1116 static int osp_orphan_index_insert(const struct lu_env *env,
1117 struct dt_object *dt,
1118 const struct dt_rec *rec,
1119 const struct dt_key *key,
1120 struct thandle *handle,
1121 struct lustre_capa *capa,
1127 static int osp_orphan_index_declare_delete(const struct lu_env *env,
1128 struct dt_object *dt,
1129 const struct dt_key *key,
1130 struct thandle *handle)
1135 static int osp_orphan_index_delete(const struct lu_env *env,
1136 struct dt_object *dt,
1137 const struct dt_key *key,
1138 struct thandle *handle,
1139 struct lustre_capa *capa)
1144 struct dt_it *osp_it_init(const struct lu_env *env, struct dt_object *dt,
1145 __u32 attr, struct lustre_capa *capa)
1151 return ERR_PTR(-ENOMEM);
1153 it->ooi_pos_ent = -1;
1156 return (struct dt_it *)it;
1159 void osp_it_fini(const struct lu_env *env, struct dt_it *di)
1161 struct osp_it *it = (struct osp_it *)di;
1162 struct page **pages = it->ooi_pages;
1163 int npages = it->ooi_total_npages;
1166 if (pages != NULL) {
1167 for (i = 0; i < npages; i++) {
1168 if (pages[i] != NULL) {
1169 if (pages[i] == it->ooi_cur_page) {
1171 it->ooi_cur_page = NULL;
1173 __free_page(pages[i]);
1176 OBD_FREE(pages, npages * sizeof(*pages));
1181 static int osp_it_fetch(const struct lu_env *env, struct osp_it *it)
1183 struct lu_device *dev = it->ooi_obj->do_lu.lo_dev;
1184 struct osp_device *osp = lu2osp_dev(dev);
1185 struct page **pages;
1186 struct ptlrpc_request *req = NULL;
1187 struct ptlrpc_bulk_desc *desc;
1188 struct idx_info *ii;
1195 npages = min_t(unsigned int, OFD_MAX_BRW_SIZE, 1 << 20);
1196 npages /= PAGE_CACHE_SIZE;
1198 OBD_ALLOC(pages, npages * sizeof(*pages));
1202 it->ooi_pages = pages;
1203 it->ooi_total_npages = npages;
1204 for (i = 0; i < npages; i++) {
1205 pages[i] = alloc_page(GFP_IOFS);
1206 if (pages[i] == NULL)
1210 req = ptlrpc_request_alloc(osp->opd_obd->u.cli.cl_import,
1215 rc = ptlrpc_request_pack(req, LUSTRE_OBD_VERSION, OBD_IDX_READ);
1217 ptlrpc_request_free(req);
1221 req->rq_request_portal = OUT_PORTAL;
1222 ii = req_capsule_client_get(&req->rq_pill, &RMF_IDX_INFO);
1223 memset(ii, 0, sizeof(*ii));
1224 if (fid_is_last_id(lu_object_fid(&it->ooi_obj->do_lu))) {
1225 /* LFSCK will iterate orphan object[FID_SEQ_LAYOUT_BTREE,
1226 * ost_index, 0] with LAST_ID FID, so it needs to replace
1227 * the FID with orphan FID here */
1228 ii->ii_fid.f_seq = FID_SEQ_LAYOUT_RBTREE;
1229 ii->ii_fid.f_oid = osp->opd_index;
1230 ii->ii_fid.f_ver = 0;
1231 ii->ii_flags = II_FL_NOHASH;
1233 ii->ii_fid = *lu_object_fid(&it->ooi_obj->do_lu);
1234 ii->ii_flags = II_FL_NOHASH | II_FL_NOKEY | II_FL_VARKEY |
1237 ii->ii_magic = IDX_INFO_MAGIC;
1238 ii->ii_count = npages * LU_PAGE_COUNT;
1239 ii->ii_hash_start = it->ooi_next;
1241 osp->opd_storage->dd_lu_dev.ld_site->ld_seq_site->ss_node_id;
1243 ptlrpc_at_set_req_timeout(req);
1245 desc = ptlrpc_prep_bulk_imp(req, npages, 1, BULK_PUT_SINK,
1248 ptlrpc_request_free(req);
1252 for (i = 0; i < npages; i++)
1253 ptlrpc_prep_bulk_page_pin(desc, pages[i], 0, PAGE_CACHE_SIZE);
1255 ptlrpc_request_set_replen(req);
1256 rc = ptlrpc_queue_wait(req);
1260 rc = sptlrpc_cli_unwrap_bulk_read(req, req->rq_bulk,
1261 req->rq_bulk->bd_nob_transferred);
1266 ii = req_capsule_server_get(&req->rq_pill, &RMF_IDX_INFO);
1267 if (ii->ii_magic != IDX_INFO_MAGIC)
1268 GOTO(out, rc = -EPROTO);
1270 npages = (ii->ii_count + LU_PAGE_COUNT - 1) >>
1271 (PAGE_CACHE_SHIFT - LU_PAGE_SHIFT);
1272 if (npages > it->ooi_total_npages) {
1273 CERROR("%s: returned more pages than expected, %u > %u\n",
1274 osp->opd_obd->obd_name, npages, it->ooi_total_npages);
1275 GOTO(out, rc = -EINVAL);
1278 it->ooi_valid_npages = npages;
1279 if (ptlrpc_rep_need_swab(req))
1282 it->ooi_next = ii->ii_hash_end;
1285 ptlrpc_req_finished(req);
1290 int osp_it_next_page(const struct lu_env *env, struct dt_it *di)
1292 struct osp_it *it = (struct osp_it *)di;
1293 struct lu_idxpage *idxpage;
1294 struct page **pages;
1300 idxpage = it->ooi_cur_idxpage;
1301 if (idxpage != NULL) {
1302 if (idxpage->lip_nr == 0)
1305 if (it->ooi_pos_ent < idxpage->lip_nr) {
1306 CDEBUG(D_INFO, "ooi_pos %d nr %d\n",
1307 (int)it->ooi_pos_ent, (int)idxpage->lip_nr);
1310 it->ooi_cur_idxpage = NULL;
1311 it->ooi_pos_lu_page++;
1313 if (it->ooi_pos_lu_page < LU_PAGE_COUNT) {
1314 it->ooi_cur_idxpage = (void *)it->ooi_cur_page +
1315 LU_PAGE_SIZE * it->ooi_pos_lu_page;
1317 lustre_swab_lip_header(it->ooi_cur_idxpage);
1318 if (it->ooi_cur_idxpage->lip_magic != LIP_MAGIC) {
1319 struct osp_device *osp =
1320 lu2osp_dev(it->ooi_obj->do_lu.lo_dev);
1322 CERROR("%s: invalid magic (%x != %x) for page "
1323 "%d/%d while read layout orphan index\n",
1324 osp->opd_obd->obd_name,
1325 it->ooi_cur_idxpage->lip_magic,
1326 LIP_MAGIC, it->ooi_pos_page,
1327 it->ooi_pos_lu_page);
1328 /* Skip this lu_page next time. */
1329 it->ooi_pos_ent = idxpage->lip_nr - 1;
1332 it->ooi_pos_ent = -1;
1336 kunmap(it->ooi_cur_page);
1337 it->ooi_cur_page = NULL;
1341 pages = it->ooi_pages;
1342 if (it->ooi_pos_page < it->ooi_valid_npages) {
1343 it->ooi_cur_page = kmap(pages[it->ooi_pos_page]);
1344 it->ooi_pos_lu_page = 0;
1348 for (i = 0; i < it->ooi_total_npages; i++) {
1349 if (pages[i] != NULL)
1350 __free_page(pages[i]);
1352 OBD_FREE(pages, it->ooi_total_npages * sizeof(*pages));
1354 it->ooi_pos_page = 0;
1355 it->ooi_total_npages = 0;
1356 it->ooi_valid_npages = 0;
1359 it->ooi_cur_page = NULL;
1360 it->ooi_cur_idxpage = NULL;
1361 it->ooi_pages = NULL;
1364 if (it->ooi_next == II_END_OFF)
1367 rc = osp_it_fetch(env, it);
1374 int osp_orphan_it_next(const struct lu_env *env, struct dt_it *di)
1376 struct osp_it *it = (struct osp_it *)di;
1377 struct lu_idxpage *idxpage;
1382 idxpage = it->ooi_cur_idxpage;
1383 if (idxpage != NULL) {
1384 if (idxpage->lip_nr == 0)
1388 if (it->ooi_pos_ent < idxpage->lip_nr) {
1390 (struct lu_orphan_ent *)idxpage->lip_entries +
1393 lustre_swab_orphan_ent(it->ooi_ent);
1398 rc = osp_it_next_page(env, di);
1405 int osp_it_get(const struct lu_env *env, struct dt_it *di,
1406 const struct dt_key *key)
1411 void osp_it_put(const struct lu_env *env, struct dt_it *di)
1415 struct dt_key *osp_orphan_it_key(const struct lu_env *env,
1416 const struct dt_it *di)
1418 struct osp_it *it = (struct osp_it *)di;
1419 struct lu_orphan_ent *ent = (struct lu_orphan_ent *)it->ooi_ent;
1421 if (likely(ent != NULL))
1422 return (struct dt_key *)(&ent->loe_key);
1427 int osp_orphan_it_key_size(const struct lu_env *env, const struct dt_it *di)
1429 return sizeof(struct lu_fid);
1432 int osp_orphan_it_rec(const struct lu_env *env, const struct dt_it *di,
1433 struct dt_rec *rec, __u32 attr)
1435 struct osp_it *it = (struct osp_it *)di;
1436 struct lu_orphan_ent *ent = (struct lu_orphan_ent *)it->ooi_ent;
1438 if (likely(ent != NULL)) {
1439 *(struct lu_orphan_rec *)rec = ent->loe_rec;
1446 __u64 osp_it_store(const struct lu_env *env, const struct dt_it *di)
1448 struct osp_it *it = (struct osp_it *)di;
1450 return it->ooi_next;
1454 * \retval +1: locate to the exactly position
1455 * \retval 0: cannot locate to the exactly position,
1456 * call next() to move to a valid position.
1457 * \retval -ve: on error
1459 int osp_orphan_it_load(const struct lu_env *env, const struct dt_it *di,
1462 struct osp_it *it = (struct osp_it *)di;
1465 it->ooi_next = hash;
1466 rc = osp_orphan_it_next(env, (struct dt_it *)di);
1476 int osp_it_key_rec(const struct lu_env *env, const struct dt_it *di,
1482 static const struct dt_index_operations osp_orphan_index_ops = {
1483 .dio_lookup = osp_orphan_index_lookup,
1484 .dio_declare_insert = osp_orphan_index_declare_insert,
1485 .dio_insert = osp_orphan_index_insert,
1486 .dio_declare_delete = osp_orphan_index_declare_delete,
1487 .dio_delete = osp_orphan_index_delete,
1489 .init = osp_it_init,
1490 .fini = osp_it_fini,
1491 .next = osp_orphan_it_next,
1494 .key = osp_orphan_it_key,
1495 .key_size = osp_orphan_it_key_size,
1496 .rec = osp_orphan_it_rec,
1497 .store = osp_it_store,
1498 .load = osp_orphan_it_load,
1499 .key_rec = osp_it_key_rec,
1503 static int osp_index_try(const struct lu_env *env,
1504 struct dt_object *dt,
1505 const struct dt_index_features *feat)
1507 const struct lu_fid *fid = lu_object_fid(&dt->do_lu);
1509 if (fid_is_last_id(fid) && fid_is_idif(fid))
1510 dt->do_index_ops = &osp_orphan_index_ops;
1512 dt->do_index_ops = &osp_md_index_ops;
1516 struct dt_object_operations osp_obj_ops = {
1517 .do_declare_attr_get = osp_declare_attr_get,
1518 .do_attr_get = osp_attr_get,
1519 .do_declare_attr_set = osp_declare_attr_set,
1520 .do_attr_set = osp_attr_set,
1521 .do_declare_xattr_get = osp_declare_xattr_get,
1522 .do_xattr_get = osp_xattr_get,
1523 .do_declare_xattr_set = osp_declare_xattr_set,
1524 .do_xattr_set = osp_xattr_set,
1525 .do_declare_create = osp_declare_object_create,
1526 .do_create = osp_object_create,
1527 .do_declare_destroy = osp_declare_object_destroy,
1528 .do_destroy = osp_object_destroy,
1529 .do_index_try = osp_index_try,
1532 static int osp_object_init(const struct lu_env *env, struct lu_object *o,
1533 const struct lu_object_conf *conf)
1535 struct osp_object *po = lu2osp_obj(o);
1539 spin_lock_init(&po->opo_lock);
1540 o->lo_header->loh_attr |= LOHA_REMOTE;
1542 if (is_ost_obj(o)) {
1543 po->opo_obj.do_ops = &osp_obj_ops;
1545 struct lu_attr *la = &osp_env_info(env)->osi_attr;
1547 po->opo_obj.do_ops = &osp_md_obj_ops;
1548 po->opo_obj.do_body_ops = &osp_md_body_ops;
1549 rc = po->opo_obj.do_ops->do_attr_get(env, lu2dt_obj(o),
1552 o->lo_header->loh_attr |=
1553 LOHA_EXISTS | (la->la_mode & S_IFMT);
1554 if (rc == -ENOENT) {
1555 po->opo_non_exist = 1;
1558 init_rwsem(&po->opo_sem);
1563 static void osp_object_free(const struct lu_env *env, struct lu_object *o)
1565 struct osp_object *obj = lu2osp_obj(o);
1566 struct lu_object_header *h = o->lo_header;
1568 dt_object_fini(&obj->opo_obj);
1569 lu_object_header_fini(h);
1570 if (obj->opo_ooa != NULL) {
1571 struct osp_xattr_entry *oxe;
1572 struct osp_xattr_entry *tmp;
1575 list_for_each_entry_safe(oxe, tmp,
1576 &obj->opo_ooa->ooa_xattr_list,
1578 list_del(&oxe->oxe_list);
1579 count = atomic_read(&oxe->oxe_ref);
1580 LASSERTF(count == 1,
1581 "Still has %d users on the xattr entry %.*s\n",
1582 count-1, (int)oxe->oxe_namelen, oxe->oxe_buf);
1584 OBD_FREE(oxe, oxe->oxe_buflen);
1586 OBD_FREE_PTR(obj->opo_ooa);
1588 OBD_SLAB_FREE_PTR(obj, osp_object_kmem);
1591 static void osp_object_release(const struct lu_env *env, struct lu_object *o)
1593 struct osp_object *po = lu2osp_obj(o);
1594 struct osp_device *d = lu2osp_dev(o->lo_dev);
1599 * release reservation if object was declared but not created
1600 * this may require lu_object_put() in LOD
1602 if (unlikely(po->opo_reserved)) {
1603 LASSERT(d->opd_pre != NULL);
1604 LASSERT(d->opd_pre_reserved > 0);
1605 spin_lock(&d->opd_pre_lock);
1606 d->opd_pre_reserved--;
1607 spin_unlock(&d->opd_pre_lock);
1609 /* not needed in cache any more */
1610 set_bit(LU_OBJECT_HEARD_BANSHEE, &o->lo_header->loh_flags);
1614 /* XXX: Currently, NOT cache OST-object on MDT because:
1615 * 1. it is not often accessed on MDT.
1616 * 2. avoid up layer (such as LFSCK) to load too many
1617 * once-used OST-objects. */
1618 set_bit(LU_OBJECT_HEARD_BANSHEE, &o->lo_header->loh_flags);
1623 static int osp_object_print(const struct lu_env *env, void *cookie,
1624 lu_printer_t p, const struct lu_object *l)
1626 const struct osp_object *o = lu2osp_obj((struct lu_object *)l);
1628 return (*p)(env, cookie, LUSTRE_OSP_NAME"-object@%p", o);
1631 static int osp_object_invariant(const struct lu_object *o)
1636 struct lu_object_operations osp_lu_obj_ops = {
1637 .loo_object_init = osp_object_init,
1638 .loo_object_free = osp_object_free,
1639 .loo_object_release = osp_object_release,
1640 .loo_object_print = osp_object_print,
1641 .loo_object_invariant = osp_object_invariant