Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
reservations.c File Reference
#include <linux/fs.h>
#include <linux/types.h>
#include <linux/highmem.h>
#include <linux/bitops.h>
#include <linux/list.h>
#include <cluster/masklog.h>
#include "ocfs2.h"
#include "ocfs2_trace.h"

Go to the source code of this file.

Macros

#define OCFS2_MIN_RESV_WINDOW_BITS   8
 
#define OCFS2_MAX_RESV_WINDOW_BITS   1024
 

Functions

 DEFINE_SPINLOCK (resv_lock)
 
int ocfs2_dir_resv_allowed (struct ocfs2_super *osb)
 
void ocfs2_resv_init_once (struct ocfs2_alloc_reservation *resv)
 
void ocfs2_resv_set_type (struct ocfs2_alloc_reservation *resv, unsigned int flags)
 
int ocfs2_resmap_init (struct ocfs2_super *osb, struct ocfs2_reservation_map *resmap)
 
void ocfs2_resv_discard (struct ocfs2_reservation_map *resmap, struct ocfs2_alloc_reservation *resv)
 
void ocfs2_resmap_restart (struct ocfs2_reservation_map *resmap, unsigned int clen, char *disk_bitmap)
 
void ocfs2_resmap_uninit (struct ocfs2_reservation_map *resmap)
 
int ocfs2_resmap_resv_bits (struct ocfs2_reservation_map *resmap, struct ocfs2_alloc_reservation *resv, int *cstart, int *clen)
 
void ocfs2_resmap_claimed_bits (struct ocfs2_reservation_map *resmap, struct ocfs2_alloc_reservation *resv, u32 cstart, u32 clen)
 

Macro Definition Documentation

#define OCFS2_MAX_RESV_WINDOW_BITS   1024

Definition at line 45 of file reservations.c.

#define OCFS2_MIN_RESV_WINDOW_BITS   8

Definition at line 44 of file reservations.c.

Function Documentation

DEFINE_SPINLOCK ( resv_lock  )
int ocfs2_dir_resv_allowed ( struct ocfs2_super osb)

Definition at line 47 of file reservations.c.

void ocfs2_resmap_claimed_bits ( struct ocfs2_reservation_map resmap,
struct ocfs2_alloc_reservation resv,
u32  cstart,
u32  clen 
)

ocfs2_resmap_claimed_bits() - Tell the reservation code that bits were used. : reservations bitmap : optional reservation to recalulate based on new bitmap : start of allocation in clusters : end of allocation in clusters.

Tell the reservation code that bits were used to fulfill allocation in resmap. The bits don't have to have been part of any existing reservation. But we must always call this function when bits are claimed. Internally, the reservations code will use this information to mark the reservations bitmap. If resv is passed, it's next allocation window will be calculated. It also expects that 'cstart' is the same as we passed back from ocfs2_resmap_resv_bits().

Definition at line 796 of file reservations.c.

int ocfs2_resmap_init ( struct ocfs2_super osb,
struct ocfs2_reservation_map resmap 
)

ocfs2_resmap_init() - Initialize fields of a reservations bitmap : struct ocfs2_reservation_map to initialize : unused for now : unused for now : Maximum size of the bitmap (typically blocksize)

Only possible return value other than '0' is -ENOMEM for failure to allocation mirror bitmap.

Definition at line 214 of file reservations.c.

void ocfs2_resmap_restart ( struct ocfs2_reservation_map resmap,
unsigned int  clen,
char disk_bitmap 
)

ocfs2_resmap_restart() - "restart" a reservation bitmap : reservations bitmap : Number of valid bits in the bitmap : the disk bitmap this resmap should refer to.

Re-initialize the parameters of a reservation bitmap. This is useful for local alloc window slides.

This function will call ocfs2_trunc_resv against all existing reservations. A future version will recalculate existing reservations based on the new bitmap.

Definition at line 294 of file reservations.c.

int ocfs2_resmap_resv_bits ( struct ocfs2_reservation_map resmap,
struct ocfs2_alloc_reservation resv,
int cstart,
int clen 
)

ocfs2_resmap_resv_bits() - Return still-valid reservation bits : reservations bitmap : reservation to base search from : start of proposed allocation : length (in clusters) of proposed allocation

Using the reservation data from resv, this function will compare resmap and resmap->m_disk_bitmap to determine what part (if any) of the reservation window is still clear to use. If resv is empty, this function will try to allocate a window for it.

On success, zero is returned and the valid allocation area is set in cstart and clen.

Returns -ENOSPC if reservations are disabled.

Definition at line 727 of file reservations.c.

void ocfs2_resmap_uninit ( struct ocfs2_reservation_map resmap)

ocfs2_resmap_uninit() - uninitialize a reservation bitmap structure : the struct ocfs2_reservation_map to uninitialize

Definition at line 309 of file reservations.c.

void ocfs2_resv_discard ( struct ocfs2_reservation_map resmap,
struct ocfs2_alloc_reservation resv 
)

ocfs2_resv_discard() - truncate a reservation : : the reservation to truncate.

After this function is called, the reservation will be empty, and unlinked from the rbtree.

Definition at line 270 of file reservations.c.

void ocfs2_resv_init_once ( struct ocfs2_alloc_reservation resv)

Definition at line 200 of file reservations.c.

void ocfs2_resv_set_type ( struct ocfs2_alloc_reservation resv,
unsigned int  flags 
)

Definition at line 206 of file reservations.c.