metaslab_impl.h revision fa9e4066f08beec538e775443c5be79dd423fcab
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_METASLAB_IMPL_H
#define _SYS_METASLAB_IMPL_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/metaslab.h>
#include <sys/space_map.h>
#ifdef __cplusplus
extern "C" {
#endif
struct metaslab_class {
};
struct metaslab_group {
};
/*
* Each metaslab's free block list is kept in its own DMU object in the
* metaslab freelist dataset. To minimize space consumption, the list
* is circular.
*
* Allocations and frees can happen in multiple transaction groups at
* the same time, which makes it a bit challening to keep the metaslab
* consistent. For example, we cannot allow frees from different
* transaction groups to be interleaved in the metaslab's free block list.
*
* We address this in several ways:
*
* We don't allow allocations from the same metaslab in concurrent
* transaction groups. metaslab_alloc() enforces this by checking
* the ms_last_alloc field, which specifies the last txg in which
* the metaslab was used for allocations.
*
* We can't segregate frees this way because we can't choose which
* DVAs someone wants to free. So we keep separate in-core freelists
* for each active transaction group. This in-core data is only
* written to the metaslab's on-disk freelist in metaslab_sync(),
* which solves the interleave problem: we only append frees from
* the syncing txg to the on-disk freelist, so the appends all occur
* in txg order.
*
* We cannot allow a block which was freed in a given txg to be
* allocated again until that txg has closed; otherwise, if we
* failed to sync that txg and had to roll back to txg - 1,
* changes in txg + 1 could have overwritten the data. Therefore,
* we partition the free blocks into "available" and "limbo" states.
* A block is available if the txg in which it was freed has closed;
* until then, the block is in limbo. Each time metaslab_sync() runs,
* if first adds any limbo blocks to the avail list, clears the limbo
* list, and starts writing the new limbo blocks (i.e. the ones that
* were freed in the syncing txg).
*/
struct metaslab {
};
/*
* ms_dirty[] flags
*/
#ifdef __cplusplus
}
#endif
#endif /* _SYS_METASLAB_IMPL_H */