Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
mdt.h File Reference
#include <linux/buffer_head.h>
#include <linux/blockgroup_lock.h>
#include "nilfs.h"
#include "page.h"

Go to the source code of this file.

Data Structures

struct  nilfs_shadow_map
 
struct  nilfs_mdt_info
 

Macros

#define NILFS_MDT_GFP   (__GFP_WAIT | __GFP_IO | __GFP_HIGHMEM)
 
#define nilfs_mdt_bgl_lock(inode, bg)   (&NILFS_MDT(inode)->mi_bgl->locks[(bg) & (NR_BG_LOCKS-1)].lock)
 

Functions

int nilfs_mdt_get_block (struct inode *, unsigned long, int, void(*init_block)(struct inode *, struct buffer_head *, void *), struct buffer_head **)
 
int nilfs_mdt_delete_block (struct inode *, unsigned long)
 
int nilfs_mdt_forget_block (struct inode *, unsigned long)
 
int nilfs_mdt_mark_block_dirty (struct inode *, unsigned long)
 
int nilfs_mdt_fetch_dirty (struct inode *)
 
int nilfs_mdt_init (struct inode *inode, gfp_t gfp_mask, size_t objsz)
 
void nilfs_mdt_set_entry_size (struct inode *, unsigned, unsigned)
 
int nilfs_mdt_setup_shadow_map (struct inode *inode, struct nilfs_shadow_map *shadow)
 
int nilfs_mdt_save_to_shadow_map (struct inode *inode)
 
void nilfs_mdt_restore_from_shadow_map (struct inode *inode)
 
void nilfs_mdt_clear_shadow_map (struct inode *inode)
 
int nilfs_mdt_freeze_buffer (struct inode *inode, struct buffer_head *bh)
 
struct buffer_head * nilfs_mdt_get_frozen_buffer (struct inode *inode, struct buffer_head *bh)
 

Macro Definition Documentation

#define nilfs_mdt_bgl_lock (   inode,
  bg 
)    (&NILFS_MDT(inode)->mi_bgl->locks[(bg) & (NR_BG_LOCKS-1)].lock)

Definition at line 114 of file mdt.h.

#define NILFS_MDT_GFP   (__GFP_WAIT | __GFP_IO | __GFP_HIGHMEM)

Definition at line 75 of file mdt.h.

Function Documentation

void nilfs_mdt_clear_shadow_map ( struct inode inode)

nilfs_mdt_clear_shadow_map - truncate pages in shadow map caches : inode of the metadata file

Definition at line 579 of file mdt.c.

int nilfs_mdt_delete_block ( struct inode inode,
unsigned long  block 
)

nilfs_mdt_delete_block - make a hole on the meta data file. : inode of the meta data file : block offset

Return Value: On success, zero is returned. On error, one of the following negative error code is returned.

%-ENOMEM - Insufficient memory available.

%-EIO - I/O error

Definition at line 275 of file mdt.c.

int nilfs_mdt_fetch_dirty ( struct inode )

Definition at line 364 of file mdt.c.

int nilfs_mdt_forget_block ( struct inode inode,
unsigned long  block 
)

nilfs_mdt_forget_block - discard dirty state and try to remove the page : inode of the meta data file : block offset

nilfs_mdt_forget_block() clears a dirty flag of the specified buffer, and tries to release the page including the buffer from a page cache.

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

%-EBUSY - page has an active buffer.

%-ENOENT - page cache has no page addressed by the offset.

Definition at line 303 of file mdt.c.

int nilfs_mdt_freeze_buffer ( struct inode inode,
struct buffer_head *  bh 
)

Definition at line 485 of file mdt.c.

int nilfs_mdt_get_block ( struct inode inode,
unsigned long  blkoff,
int  create,
void(*)(struct inode *, struct buffer_head *, void *)  init_block,
struct buffer_head **  out_bh 
)

nilfs_mdt_get_block - read or create a buffer on meta data file. : inode of the meta data file : block offset : create flag : initializer used for newly allocated block : output of a pointer to the buffer_head

nilfs_mdt_get_block() looks up the specified buffer and tries to create a new buffer if is not zero. On success, the returned buffer is assured to be either existing or formatted using a buffer lock on success. is substituted only when zero is returned.

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

%-ENOMEM - Insufficient memory available.

%-EIO - I/O error

%-ENOENT - the specified block does not exist (hole block)

%-EROFS - Read only filesystem (for create mode)

Definition at line 242 of file mdt.c.

struct buffer_head* nilfs_mdt_get_frozen_buffer ( struct inode inode,
struct buffer_head *  bh 
)
read

Definition at line 517 of file mdt.c.

int nilfs_mdt_init ( struct inode inode,
gfp_t  gfp_mask,
size_t  objsz 
)

Definition at line 408 of file mdt.c.

int nilfs_mdt_mark_block_dirty ( struct inode inode,
unsigned long  block 
)

nilfs_mdt_mark_block_dirty - mark a block on the meta data file dirty. : inode of the meta data file : block offset

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

%-ENOMEM - Insufficient memory available.

%-EIO - I/O error

%-ENOENT - the specified block does not exist (hole block)

Definition at line 350 of file mdt.c.

void nilfs_mdt_restore_from_shadow_map ( struct inode inode)

nilfs_mdt_restore_from_shadow_map - restore dirty pages and bmap state : inode of the metadata file

Definition at line 553 of file mdt.c.

int nilfs_mdt_save_to_shadow_map ( struct inode inode)

nilfs_mdt_save_to_shadow_map - copy bmap and dirty pages to shadow map : inode of the metadata file

Definition at line 464 of file mdt.c.

void nilfs_mdt_set_entry_size ( struct inode ,
unsigned  ,
unsigned   
)

Definition at line 430 of file mdt.c.

int nilfs_mdt_setup_shadow_map ( struct inode inode,
struct nilfs_shadow_map shadow 
)

nilfs_mdt_setup_shadow_map - setup shadow map and bind it to metadata file : inode of the metadata file : shadow mapping

Definition at line 445 of file mdt.c.