Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
bmap.h File Reference
#include <linux/types.h>
#include <linux/fs.h>
#include <linux/buffer_head.h>
#include <linux/nilfs2_fs.h>
#include "alloc.h"
#include "dat.h"

Go to the source code of this file.

Data Structures

union  nilfs_bmap_ptr_req
 
struct  nilfs_bmap_stats
 
struct  nilfs_bmap_operations
 
struct  nilfs_bmap
 
struct  nilfs_bmap_store
 

Macros

#define NILFS_BMAP_INVALID_PTR   0
 
#define nilfs_bmap_keydiff_abs(diff)   ((diff) < 0 ? -(diff) : (diff))
 
#define NILFS_BMAP_SIZE   (NILFS_INODE_BMAP_SIZE * sizeof(__le64))
 
#define NILFS_BMAP_KEY_BIT   (sizeof(unsigned long) * 8 /* CHAR_BIT */)
 
#define NILFS_BMAP_NEW_PTR_INIT   (1UL << (sizeof(unsigned long) * 8 /* CHAR_BIT */ - 1))
 
#define NILFS_BMAP_PTR_P   0 /* physical block number (i.e. LBN) */
 
#define NILFS_BMAP_PTR_VS
 
#define NILFS_BMAP_PTR_VM
 
#define NILFS_BMAP_PTR_U   (-1) /* never perform pointer operations */
 
#define NILFS_BMAP_USE_VBN(bmap)   ((bmap)->b_ptr_type > 0)
 
#define NILFS_BMAP_DIRTY   0x00000001
 
#define NILFS_BMAP_LARGE   0x1
 
#define NILFS_BMAP_SMALL_LOW   NILFS_DIRECT_KEY_MIN
 
#define NILFS_BMAP_SMALL_HIGH   NILFS_DIRECT_KEY_MAX
 
#define NILFS_BMAP_LARGE_LOW   NILFS_BTREE_ROOT_NCHILDREN_MAX
 
#define NILFS_BMAP_LARGE_HIGH   NILFS_BTREE_KEY_MAX
 

Functions

int nilfs_bmap_test_and_clear_dirty (struct nilfs_bmap *)
 
int nilfs_bmap_read (struct nilfs_bmap *, struct nilfs_inode *)
 
void nilfs_bmap_write (struct nilfs_bmap *, struct nilfs_inode *)
 
int nilfs_bmap_lookup_contig (struct nilfs_bmap *, __u64, __u64 *, unsigned)
 
int nilfs_bmap_insert (struct nilfs_bmap *, unsigned long, unsigned long)
 
int nilfs_bmap_delete (struct nilfs_bmap *, unsigned long)
 
int nilfs_bmap_last_key (struct nilfs_bmap *, unsigned long *)
 
int nilfs_bmap_truncate (struct nilfs_bmap *, unsigned long)
 
void nilfs_bmap_clear (struct nilfs_bmap *)
 
int nilfs_bmap_propagate (struct nilfs_bmap *, struct buffer_head *)
 
void nilfs_bmap_lookup_dirty_buffers (struct nilfs_bmap *, struct list_head *)
 
int nilfs_bmap_assign (struct nilfs_bmap *, struct buffer_head **, unsigned long, union nilfs_binfo *)
 
int nilfs_bmap_lookup_at_level (struct nilfs_bmap *, __u64, int, __u64 *)
 
int nilfs_bmap_mark (struct nilfs_bmap *, __u64, int)
 
void nilfs_bmap_init_gc (struct nilfs_bmap *)
 
void nilfs_bmap_save (const struct nilfs_bmap *, struct nilfs_bmap_store *)
 
void nilfs_bmap_restore (struct nilfs_bmap *, const struct nilfs_bmap_store *)
 
struct inodenilfs_bmap_get_dat (const struct nilfs_bmap *)
 
__u64 nilfs_bmap_data_get_key (const struct nilfs_bmap *, const struct buffer_head *)
 
__u64 nilfs_bmap_find_target_seq (const struct nilfs_bmap *, __u64)
 
__u64 nilfs_bmap_find_target_in_group (const struct nilfs_bmap *)
 

Macro Definition Documentation

#define NILFS_BMAP_DIRTY   0x00000001

Definition at line 134 of file bmap.h.

#define NILFS_BMAP_INVALID_PTR   0

Definition at line 33 of file bmap.h.

#define NILFS_BMAP_KEY_BIT   (sizeof(unsigned long) * 8 /* CHAR_BIT */)

Definition at line 88 of file bmap.h.

#define nilfs_bmap_keydiff_abs (   diff)    ((diff) < 0 ? -(diff) : (diff))

Definition at line 35 of file bmap.h.

#define NILFS_BMAP_LARGE   0x1

Definition at line 268 of file bmap.h.

#define NILFS_BMAP_LARGE_HIGH   NILFS_BTREE_KEY_MAX

Definition at line 273 of file bmap.h.

#define NILFS_BMAP_LARGE_LOW   NILFS_BTREE_ROOT_NCHILDREN_MAX

Definition at line 272 of file bmap.h.

#define NILFS_BMAP_NEW_PTR_INIT   (1UL << (sizeof(unsigned long) * 8 /* CHAR_BIT */ - 1))

Definition at line 89 of file bmap.h.

#define NILFS_BMAP_PTR_P   0 /* physical block number (i.e. LBN) */

Definition at line 126 of file bmap.h.

#define NILFS_BMAP_PTR_U   (-1) /* never perform pointer operations */

Definition at line 129 of file bmap.h.

#define NILFS_BMAP_PTR_VM
Value:
2 /* virtual block number (has multiple
versions) */

Definition at line 128 of file bmap.h.

#define NILFS_BMAP_PTR_VS
Value:
1 /* virtual block number (single
version) */

Definition at line 127 of file bmap.h.

#define NILFS_BMAP_SIZE   (NILFS_INODE_BMAP_SIZE * sizeof(__le64))

Definition at line 87 of file bmap.h.

#define NILFS_BMAP_SMALL_HIGH   NILFS_DIRECT_KEY_MAX

Definition at line 271 of file bmap.h.

#define NILFS_BMAP_SMALL_LOW   NILFS_DIRECT_KEY_MIN

Definition at line 270 of file bmap.h.

#define NILFS_BMAP_USE_VBN (   bmap)    ((bmap)->b_ptr_type > 0)

Definition at line 131 of file bmap.h.

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 ,
const struct buffer_head *   
)

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 )

Definition at line 457 of file bmap.c.

__u64 nilfs_bmap_find_target_seq ( const struct nilfs_bmap ,
__u64   
)

Definition at line 443 of file bmap.c.

struct inode* nilfs_bmap_get_dat ( const struct nilfs_bmap )
read

Definition at line 35 of file bmap.c.

void nilfs_bmap_init_gc ( struct nilfs_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 ,
unsigned long  
)

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 ,
__u64  ,
__u64 ,
unsigned   
)

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 ,
const struct nilfs_bmap_store  
)

Definition at line 560 of file bmap.c.

void nilfs_bmap_save ( const struct nilfs_bmap ,
struct nilfs_bmap_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.