zap_micro.c revision c5f9e43110e1fb316fc4297c2d150b3518b80bbe
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/zfs_context.h>
#include <sys/refcount.h>
#include <sys/zap_impl.h>
#include <sys/zap_leaf.h>
#include <sys/zfs_i18n.h>
static uint64_t
{
uint8_t c;
/* NB: name must already be normalized, if necessary */
}
/*
* Only use 28 bits, since we need 4 bits in the cookie for the
* collision differentiator. We MUST use the high bits, since
* those are the ones that we first pay attention to when
* chosing the bucket.
*/
return (crc);
}
static int
{
int err;
err = 0;
&err);
return (err);
}
{
char norm[ZAP_MAXNAMELEN];
return (B_FALSE);
} else {
/* MT_BEST or MT_EXACT */
}
}
void
{
}
/* XXX combine this with zap_lockdir()? */
{
if (zap->zap_normflags) {
return (NULL);
}
} else {
return (NULL);
}
}
return (zn);
}
static void
{
int i, max;
for (i = 0; i < max; i++) {
}
}
void
{
/* ASSERT(magic == ZAP_LEAF_MAGIC); */
} else {
}
}
static int
{
return (+1);
return (-1);
return (+1);
return (-1);
return (0);
}
static void
{
}
static mzap_ent_t *
{
return (NULL);
return (mze);
}
goto again;
}
return (NULL);
}
static uint32_t
{
cd = 0;
break;
cd++;
}
return (cd);
}
static void
{
}
static void
{
}
static zap_t *
{
int i;
} else {
}
/*
* Make sure that zap_ismicro is set before we let others see
* it, because zap_lockdir() checks zap_ismicro without the lock
* held.
*/
if (!zap->zap_ismicro)
return (winner);
}
if (zap->zap_ismicro) {
zap_name_t *zn;
MT_EXACT);
}
}
} else {
ASSERT3U(sizeof (struct zap_leaf_header), ==,
/*
* The embedded pointer table should not overlap the
* other members.
*/
/*
* The embedded pointer table should end at the end of
* the block
*/
}
return (zap);
}
int
{
int err;
if (err)
return (err);
#ifdef ZFS_DEBUG
{
}
#endif
/*
* We're checking zap_ismicro without the lock held, in order to
* tell what type of lock we want. Once we have some sort of
* lock, see if it really is the right type. In practice this
* can only be different if it was upgraded from micro to fat,
* and micro wanted WRITER but fat only needs READER.
*/
/* it was upgraded, now we only need reader */
}
if (newsz > MZAP_MAX_BLKSZ) {
dprintf("upgrading obj %llu: num_entries=%u\n",
return (0);
}
}
return (0);
}
void
{
}
static void
{
dprintf("upgrading obj=%llu with %u chunks\n",
/* XXX destroy the avl later, so we can use the stored hash value */
for (i = 0; i < nchunks; i++) {
int err;
zap_name_t *zn;
continue;
dprintf("adding %s=%llu\n",
}
}
static void
{
#ifdef ZFS_DEBUG
{
}
#endif
}
int
{
}
int
{
int err;
if (err != 0)
return (err);
return (0);
}
{
}
{
return (obj);
}
int
{
/*
* dmu_object_free will free the object number and free the
* data. Freeing the data will cause our pageout function to be
* called, which will destroy our data (zap_leaf_t's and zap_t).
*/
}
void
{
if (zap->zap_ismicro)
else
}
int
{
int err;
if (err)
return (err);
if (!zap->zap_ismicro) {
} else {
}
return (err);
}
/*
* zn may be NULL; if not specified, it will be computed if needed.
* See also the comment above zap_entry_normalization_conflict().
*/
static boolean_t
{
int direction = AVL_BEFORE;
if (zap->zap_normflags == 0)
return (B_FALSE);
MT_FIRST);
}
if (allocdzn)
return (B_TRUE);
}
}
if (direction == AVL_BEFORE) {
goto again;
}
if (allocdzn)
return (B_FALSE);
}
/*
* Routines for manipulating attributes.
*/
int
{
}
int
{
int err;
zap_name_t *zn;
if (err)
return (err);
return (ENOTSUP);
}
if (!zap->zap_ismicro) {
} else {
} else {
if (num_integers < 1) {
} else if (integer_size != 8) {
} else {
if (ncp) {
}
}
}
}
return (err);
}
int
{
int err;
zap_name_t *zn;
if (err)
return (err);
return (ENOTSUP);
}
if (!zap->zap_ismicro) {
} else {
} else {
if (integer_size)
*integer_size = 8;
if (num_integers)
*num_integers = 1;
}
}
return (err);
}
static void
{
int i;
#ifdef ZFS_DEBUG
}
#endif
/* given the limited size of the microzap, this can't happen */
return;
}
}
if (start != 0) {
start = 0;
goto again;
}
ASSERT(!"out of entries!");
}
int
{
int err;
zap_name_t *zn;
if (err)
return (err);
return (ENOTSUP);
}
if (!zap->zap_ismicro) {
dprintf("upgrading obj %llu: intsz=%u numint=%llu name=%s\n",
} else {
} else {
}
}
return (err);
}
int
{
zap_name_t *zn;
int err;
if (err)
return (err);
return (ENOTSUP);
}
if (!zap->zap_ismicro) {
dprintf("upgrading obj %llu: intsz=%u numint=%llu name=%s\n",
} else {
} else {
}
}
return (err);
}
int
{
}
int
{
int err;
zap_name_t *zn;
if (err)
return (err);
return (ENOTSUP);
}
if (!zap->zap_ismicro) {
} else {
} else {
sizeof (mzap_ent_phys_t));
}
}
return (err);
}
/*
* Routines for iterating over the attributes.
*/
/*
* We want to keep the high 32 bits of the cursor zero if we can, so
* that 32-bit programs can access this. So use a small hash value so
* we can fit 4 bits of cd into the 32-bit cursor.
*
* [ 4 zero bits | 32-bit collision differentiator | 28-bit hash value ]
*/
void
{
if (serialized == -1ULL) {
} else {
}
}
void
{
}
void
{
}
}
}
{
return (-1ULL);
}
int
{
int err;
return (ENOENT);
if (err)
return (err);
} else {
}
} else {
}
if (mze) {
err = 0;
} else {
}
}
return (err);
}
void
{
return;
}
}
int
{
int err;
if (err)
return (err);
if (zap->zap_ismicro) {
} else {
}
return (0);
}