Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
bmap.c File Reference
#include <linux/fs.h>
#include <linux/string.h>
#include <linux/errno.h>
#include "nilfs.h"
#include "bmap.h"
#include "btree.h"
#include "direct.h"
#include "btnode.h"
#include "mdt.h"
#include "dat.h"
#include "alloc.h"

Go to the source code of this file.

Macros

#define NILFS_BMAP_GROUP_DIV   8
 

Functions

struct inodenilfs_bmap_get_dat (const struct nilfs_bmap *bmap)
 
int nilfs_bmap_lookup_at_level (struct nilfs_bmap *bmap, __u64 key, int level, __u64 *ptrp)
 
int nilfs_bmap_lookup_contig (struct nilfs_bmap *bmap, __u64 key, __u64 *ptrp, unsigned maxblocks)
 
int nilfs_bmap_insert (struct nilfs_bmap *bmap, unsigned long key, unsigned long rec)
 
int nilfs_bmap_last_key (struct nilfs_bmap *bmap, unsigned long *key)
 
int nilfs_bmap_delete (struct nilfs_bmap *bmap, unsigned long key)
 
int nilfs_bmap_truncate (struct nilfs_bmap *bmap, unsigned long key)
 
void nilfs_bmap_clear (struct nilfs_bmap *bmap)
 
int nilfs_bmap_propagate (struct nilfs_bmap *bmap, struct buffer_head *bh)
 
void nilfs_bmap_lookup_dirty_buffers (struct nilfs_bmap *bmap, struct list_head *listp)
 
int nilfs_bmap_assign (struct nilfs_bmap *bmap, struct buffer_head **bh, unsigned long blocknr, union nilfs_binfo *binfo)
 
int nilfs_bmap_mark (struct nilfs_bmap *bmap, __u64 key, int level)
 
int nilfs_bmap_test_and_clear_dirty (struct nilfs_bmap *bmap)
 
__u64 nilfs_bmap_data_get_key (const struct nilfs_bmap *bmap, const struct buffer_head *bh)
 
__u64 nilfs_bmap_find_target_seq (const struct nilfs_bmap *bmap, __u64 key)
 
__u64 nilfs_bmap_find_target_in_group (const struct nilfs_bmap *bmap)
 
int nilfs_bmap_read (struct nilfs_bmap *bmap, struct nilfs_inode *raw_inode)
 
void nilfs_bmap_write (struct nilfs_bmap *bmap, struct nilfs_inode *raw_inode)
 
void nilfs_bmap_init_gc (struct nilfs_bmap *bmap)
 
void nilfs_bmap_save (const struct nilfs_bmap *bmap, struct nilfs_bmap_store *store)
 
void nilfs_bmap_restore (struct nilfs_bmap *bmap, const struct nilfs_bmap_store *store)
 

Macro Definition Documentation

#define NILFS_BMAP_GROUP_DIV   8

Definition at line 456 of file bmap.c.

Function Documentation

int nilfs_bmap_assign ( struct nilfs_bmap bmap,
struct buffer_head **  bh,
unsigned long  blocknr,
union nilfs_binfo binfo 
)

nilfs_bmap_assign - assign a new block number to a block : bmap : pointer to buffer head : block number : block information

Description: nilfs_bmap_assign() assigns the block number to the buffer specified by .

Return Value: On success, 0 is returned and the buffer head of a newly create buffer and the block information associated with the buffer are stored in the place pointed by and , respectively. On error, one of the following negative error codes is returned.

%-EIO - I/O error.

%-ENOMEM - Insufficient amount of memory available.

Definition at line 361 of file bmap.c.

void nilfs_bmap_clear ( struct nilfs_bmap bmap)

nilfs_bmap_clear - free resources a bmap holds : bmap

Description: nilfs_bmap_clear() frees resources associated with .

Definition at line 296 of file bmap.c.

__u64 nilfs_bmap_data_get_key ( const struct nilfs_bmap bmap,
const struct buffer_head *  bh 
)

Definition at line 429 of file bmap.c.

int nilfs_bmap_delete ( struct nilfs_bmap bmap,
unsigned long  key 
)

nilfs_bmap_delete - delete a key-record pair from a bmap : bmap : key

Description: nilfs_bmap_delete() deletes the key-record pair specified by from .

Return Value: On success, 0 is returned. On error, one of the following negative error codes is returned.

%-EIO - I/O error.

%-ENOMEM - Insufficient amount of memory available.

%-ENOENT - A record associated with does not exist.

Definition at line 227 of file bmap.c.

__u64 nilfs_bmap_find_target_in_group ( const struct nilfs_bmap bmap)

Definition at line 457 of file bmap.c.

__u64 nilfs_bmap_find_target_seq ( const struct nilfs_bmap bmap,
__u64  key 
)

Definition at line 443 of file bmap.c.

struct inode* nilfs_bmap_get_dat ( const struct nilfs_bmap bmap)
read

Definition at line 35 of file bmap.c.

void nilfs_bmap_init_gc ( struct nilfs_bmap bmap)

Definition at line 539 of file bmap.c.

int nilfs_bmap_insert ( struct nilfs_bmap bmap,
unsigned long  key,
unsigned long  rec 
)

nilfs_bmap_insert - insert a new key-record pair into a bmap : bmap : key : record

Description: nilfs_bmap_insert() inserts the new key-record pair specified by and into .

Return Value: On success, 0 is returned. On error, one of the following negative error codes is returned.

%-EIO - I/O error.

%-ENOMEM - Insufficient amount of memory available.

%-EEXIST - A record associated with already exist.

Definition at line 155 of file bmap.c.

int nilfs_bmap_last_key ( struct nilfs_bmap bmap,
unsigned long key 
)

Definition at line 194 of file bmap.c.

int nilfs_bmap_lookup_at_level ( struct nilfs_bmap bmap,
__u64  key,
int  level,
__u64 ptrp 
)

nilfs_bmap_lookup_at_level - find a data block or node block : bmap : key : level : place to store the value associated to

Description: nilfs_bmap_lookup_at_level() finds a record whose key matches in the block at of the bmap.

Return Value: On success, 0 is returned and the record associated with is stored in the place pointed by . On error, one of the following negative error codes is returned.

%-EIO - I/O error.

%-ENOMEM - Insufficient amount of memory available.

%-ENOENT - A record associated with does not exist.

Definition at line 75 of file bmap.c.

int nilfs_bmap_lookup_contig ( struct nilfs_bmap bmap,
__u64  key,
__u64 ptrp,
unsigned  maxblocks 
)

Definition at line 99 of file bmap.c.

void nilfs_bmap_lookup_dirty_buffers ( struct nilfs_bmap bmap,
struct list_head listp 
)

nilfs_bmap_lookup_dirty_buffers - : bmap : pointer to buffer head list

Definition at line 335 of file bmap.c.

int nilfs_bmap_mark ( struct nilfs_bmap bmap,
__u64  key,
int  level 
)

nilfs_bmap_mark - mark block dirty : bmap : key : level

Description: nilfs_bmap_mark() marks the block specified by and as dirty.

Return Value: On success, 0 is returned. On error, one of the following negative error codes is returned.

%-EIO - I/O error.

%-ENOMEM - Insufficient amount of memory available.

Definition at line 391 of file bmap.c.

int nilfs_bmap_propagate ( struct nilfs_bmap bmap,
struct buffer_head *  bh 
)

nilfs_bmap_propagate - propagate dirty state : bmap : buffer head

Description: nilfs_bmap_propagate() marks the buffers that directly or indirectly refer to the block specified by dirty.

Return Value: On success, 0 is returned. On error, one of the following negative error codes is returned.

%-EIO - I/O error.

%-ENOMEM - Insufficient amount of memory available.

Definition at line 319 of file bmap.c.

int nilfs_bmap_read ( struct nilfs_bmap bmap,
struct nilfs_inode raw_inode 
)

nilfs_bmap_read - read a bmap from an inode : bmap : on-disk inode

Description: nilfs_bmap_read() initializes the bmap .

Return Value: On success, 0 is returned. On error, the following negative error code is returned.

%-ENOMEM - Insufficient amount of memory available.

Definition at line 483 of file bmap.c.

void nilfs_bmap_restore ( struct nilfs_bmap bmap,
const struct nilfs_bmap_store store 
)

Definition at line 560 of file bmap.c.

void nilfs_bmap_save ( const struct nilfs_bmap bmap,
struct nilfs_bmap_store store 
)

Definition at line 551 of file bmap.c.

int nilfs_bmap_test_and_clear_dirty ( struct nilfs_bmap bmap)

nilfs_bmap_test_and_clear_dirty - test and clear a bmap dirty state : bmap

Description: nilfs_test_and_clear() is the atomic operation to test and clear the dirty state of .

Return Value: 1 is returned if is dirty, or 0 if clear.

Definition at line 414 of file bmap.c.

int nilfs_bmap_truncate ( struct nilfs_bmap bmap,
unsigned long  key 
)

nilfs_bmap_truncate - truncate a bmap to a specified key : bmap : key

Description: nilfs_bmap_truncate() removes key-record pairs whose keys are greater than or equal to from .

Return Value: On success, 0 is returned. On error, one of the following negative error codes is returned.

%-EIO - I/O error.

%-ENOMEM - Insufficient amount of memory available.

Definition at line 279 of file bmap.c.

void nilfs_bmap_write ( struct nilfs_bmap bmap,
struct nilfs_inode raw_inode 
)

nilfs_bmap_write - write back a bmap to an inode : bmap : on-disk inode

Description: nilfs_bmap_write() stores in .

Definition at line 528 of file bmap.c.