- RETURN(rc);
-}
-
-/*
- * Delete a DMU object
- *
- * The transaction passed to this routine must have
- * dmu_tx_hold_free(tx, oid, 0, DMU_OBJECT_END) called
- * and then assigned to a transaction group.
- *
- * This will release db and set it to NULL to prevent further dbuf releases.
- */
-static int __osd_object_destroy(const struct lu_env *env,
- struct osd_object *obj,
- dmu_tx_t *tx, void *tag)
-{
- struct osd_device *osd = osd_obj2dev(obj);
- uint64_t xid;
- zap_attribute_t *za = &osd_oti_get(env)->oti_za;
- zap_cursor_t *zc;
- int rc;
-
- /* Assert that the transaction has been assigned to a
- transaction group. */
- LASSERT(tx->tx_txg != 0);
-
- /* zap holding xattrs */
- if (obj->oo_xattr != ZFS_NO_OBJECT) {
- rc = osd_zap_cursor_init(&zc, osd->od_os, obj->oo_xattr, 0);
- if (rc)
- return rc;
- while ((rc = -zap_cursor_retrieve(zc, za)) == 0) {
- BUG_ON(za->za_integer_length != sizeof(uint64_t));
- BUG_ON(za->za_num_integers != 1);
-
- rc = -zap_lookup(osd->od_os, obj->oo_xattr, za->za_name,
- sizeof(uint64_t), 1, &xid);
- if (rc) {
- CERROR("%s: lookup xattr %s failed: rc = %d\n",
- osd->od_svname, za->za_name, rc);
- continue;
- }
- rc = -dmu_object_free(osd->od_os, xid, tx);
- if (rc)
- CERROR("%s: fetch xattr %s failed: rc = %d\n",
- osd->od_svname, za->za_name, rc);
- zap_cursor_advance(zc);
- }
- osd_zap_cursor_fini(zc);