#include "motr/client.h"
#include "motr/st/st_misc.h"
#include <stdlib.h>
#include <stdint.h>
#include <sys/time.h>
#include <sys/types.h>
#include <errno.h>
#include <pthread.h>
Go to the source code of this file.
|
static void | oid_extent_lock (void) |
|
static void | oid_extent_unlock (void) |
|
static int | oid_extent_is_overlapped (uint64_t start1, uint64_t range1, uint64_t start2, uint64_t range2) |
|
static void | oid_extent_delete (struct oid_extent *oe) |
|
static void | oid_extent_split (struct oid_extent *oe, uint64_t wanted) |
|
static void | oid_extent_merge (struct oid_extent *oe, uint64_t s_oid, uint64_t nr_oids, int direction) |
|
static void | oid_extent_insert_head (uint64_t s_oid, uint64_t nr_oids) |
|
static void | oid_extent_insert (uint64_t s_oid, uint64_t nr_oids) |
|
static void | oid_fill (struct m0_uint128 *oids, uint64_t s_id, int nr_id) |
|
static uint64_t | oid_alloc (struct m0_uint128 *oids, uint64_t nr_oids) |
|
int | oid_get (struct m0_uint128 *oid) |
|
void | oid_put (struct m0_uint128 oid) |
|
uint64_t | oid_get_many (struct m0_uint128 *oids, uint64_t nr_oids) |
|
void | oid_put_many (struct m0_uint128 *oids, uint64_t nr_oids) |
|
int | oid_allocator_init (void) |
|
int | oid_allocator_fini (void) |
|
◆ anonymous enum
Definition at line 72 of file oid.c.
◆ oid_alloc()
static uint64_t oid_alloc |
( |
struct m0_uint128 * |
oids, |
|
|
uint64_t |
nr_oids |
|
) |
| |
|
static |
Lookup the first available set of oids and allocate
- Parameters
-
oids | array for returned object IDs |
nr_oids | number of wanted object IDs |
- Returns
- : < 0, no free
Definition at line 322 of file oid.c.
◆ oid_extent_delete()
static void oid_extent_delete |
( |
struct oid_extent * |
oe | ) |
|
|
static |
◆ oid_extent_insert()
static void oid_extent_insert |
( |
uint64_t |
s_oid, |
|
|
uint64_t |
nr_oids |
|
) |
| |
|
static |
Insert oe to a place where: a. s_oid > prev->oe_start + prev->oe_range b. oe->oe_start > s_oid + nr_oids
Definition at line 245 of file oid.c.
◆ oid_extent_insert_head()
static void oid_extent_insert_head |
( |
uint64_t |
s_oid, |
|
|
uint64_t |
nr_oids |
|
) |
| |
|
static |
Insert an extent in head
Definition at line 183 of file oid.c.
◆ oid_extent_is_overlapped()
static int oid_extent_is_overlapped |
( |
uint64_t |
start1, |
|
|
uint64_t |
range1, |
|
|
uint64_t |
start2, |
|
|
uint64_t |
range2 |
|
) |
| |
|
static |
Definition at line 90 of file oid.c.
◆ oid_extent_lock()
static void oid_extent_lock |
( |
void |
| ) |
|
|
static |
Definition at line 76 of file oid.c.
◆ oid_extent_merge()
static void oid_extent_merge |
( |
struct oid_extent * |
oe, |
|
|
uint64_t |
s_oid, |
|
|
uint64_t |
nr_oids, |
|
|
int |
direction |
|
) |
| |
|
static |
◆ oid_extent_split()
static void oid_extent_split |
( |
struct oid_extent * |
oe, |
|
|
uint64_t |
wanted |
|
) |
| |
|
static |
◆ oid_extent_unlock()
static void oid_extent_unlock |
( |
void |
| ) |
|
|
static |
Definition at line 83 of file oid.c.
◆ oid_fill()
static void oid_fill |
( |
struct m0_uint128 * |
oids, |
|
|
uint64_t |
s_id, |
|
|
int |
nr_id |
|
) |
| |
|
static |
◆ oid_extent_lh
Initial value:= {
.oe_start = 0x100000UL,
.oe_range = 0xfffffffffffffeffUL,
}
static struct oid_extent oid_extent_lh
struct oid_extent * oe_next
Definition at line 65 of file oid.c.
◆ oid_extent_list_lock
pthread_mutex_t oid_extent_list_lock |
|
static |
A simple implementation of extent-based oid allocator for ST. (1) It supports single oid and range oid allocation and free. (2) FID extents are linked in a ordered list and performance is not our focus for this version (3) Simple allocation policy: the first found free oids first if there is no free object ID, we simply return with an error and we don't wait for others to release object IDs.
Definition at line 49 of file oid.c.