Changeset View
Changeset View
Standalone View
Standalone View
sys/sys/blist.h
Context not available. | |||||
typedef uint64_t u_daddr_t; /* unsigned disk address */ | typedef uint64_t u_daddr_t; /* unsigned disk address */ | ||||
/* | /* | ||||
* note: currently use SWAPBLK_NONE as an absolute value rather then | * note: currently use SWAPBLK_NONE as an absolute value rather then | ||||
* a flag bit. | * a flag bit. | ||||
*/ | */ | ||||
#define SWAPBLK_MASK ((daddr_t)((u_daddr_t)-1 >> 1)) /* mask */ | #define SWAPBLK_MASK ((daddr_t)((u_daddr_t)-1 >> 1)) /* mask */ | ||||
#define SWAPBLK_NONE ((daddr_t)((u_daddr_t)SWAPBLK_MASK + 1))/* flag */ | #define SWAPBLK_NONE ((daddr_t)((u_daddr_t)SWAPBLK_MASK + 1))/* flag */ | ||||
/* | /* | ||||
* Both blmeta and bmu_bitmap MUST be a power of 2 in size. | * Both blmeta and bmu_bitmap MUST be a power of 2 in size. | ||||
*/ | */ | ||||
typedef struct blmeta { | typedef struct blmeta { | ||||
union { | u_daddr_t bm_bitmap; /* bitmap if we are a leaf */ | ||||
daddr_t bmu_avail; /* space available under us */ | |||||
u_daddr_t bmu_bitmap; /* bitmap if we are a leaf */ | |||||
} u; | |||||
daddr_t bm_bighint; /* biggest contiguous block hint*/ | daddr_t bm_bighint; /* biggest contiguous block hint*/ | ||||
} blmeta_t; | } blmeta_t; | ||||
typedef struct blist { | typedef struct blist { | ||||
daddr_t bl_blocks; /* area of coverage */ | daddr_t bl_blocks; /* area of coverage */ | ||||
daddr_t bl_avail; /* # available blocks */ | |||||
u_daddr_t bl_radix; /* coverage radix */ | u_daddr_t bl_radix; /* coverage radix */ | ||||
daddr_t bl_cursor; /* next-fit search starts at */ | daddr_t bl_cursor; /* next-fit search starts at */ | ||||
blmeta_t bl_root[1]; /* root of radix tree */ | blmeta_t bl_root[1]; /* root of radix tree */ | ||||
} *blist_t; | } *blist_t; | ||||
#define BLIST_META_RADIX 16 | |||||
#define BLIST_BMAP_RADIX (sizeof(u_daddr_t)*8) | #define BLIST_BMAP_RADIX (sizeof(u_daddr_t)*8) | ||||
#define BLIST_META_RADIX BLIST_BMAP_RADIX | |||||
#define BLIST_MAX_ALLOC BLIST_BMAP_RADIX | #define BLIST_MAX_ALLOC BLIST_BMAP_RADIX | ||||
struct sbuf; | struct sbuf; | ||||
daddr_t blist_alloc(blist_t blist, daddr_t count); | daddr_t blist_alloc(blist_t blist, daddr_t count); | ||||
daddr_t blist_avail(blist_t blist); | daddr_t blist_avail(blist_t blist); | ||||
blist_t blist_create(daddr_t blocks, int flags); | blist_t blist_create(daddr_t blocks, int flags); | ||||
void blist_destroy(blist_t blist); | void blist_destroy(blist_t blist); | ||||
daddr_t blist_fill(blist_t bl, daddr_t blkno, daddr_t count); | daddr_t blist_fill(blist_t bl, daddr_t blkno, daddr_t count); | ||||
void blist_free(blist_t blist, daddr_t blkno, daddr_t count); | void blist_free(blist_t blist, daddr_t blkno, daddr_t count); | ||||
void blist_print(blist_t blist); | void blist_print(blist_t blist); | ||||
void blist_resize(blist_t *pblist, daddr_t count, int freenew, int flags); | void blist_resize(blist_t *pblist, daddr_t count, int freenew, int flags); | ||||
void blist_stats(blist_t blist, struct sbuf *s); | void blist_stats(blist_t blist, struct sbuf *s); | ||||
Context not available. |