Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
mdt.c File Reference
#include <linux/buffer_head.h>
#include <linux/mpage.h>
#include <linux/mm.h>
#include <linux/writeback.h>
#include <linux/backing-dev.h>
#include <linux/swap.h>
#include <linux/slab.h>
#include "nilfs.h"
#include "btnode.h"
#include "segment.h"
#include "page.h"
#include "mdt.h"

Go to the source code of this file.

Macros

#define NILFS_MDT_MAX_RA_BLOCKS   (16 - 1)
 

Functions

int nilfs_mdt_get_block (struct inode *inode, unsigned long blkoff, int create, void(*init_block)(struct inode *, struct buffer_head *, void *), struct buffer_head **out_bh)
 
int nilfs_mdt_delete_block (struct inode *inode, unsigned long block)
 
int nilfs_mdt_forget_block (struct inode *inode, unsigned long block)
 
int nilfs_mdt_mark_block_dirty (struct inode *inode, unsigned long block)
 
int nilfs_mdt_fetch_dirty (struct inode *inode)
 
int nilfs_mdt_init (struct inode *inode, gfp_t gfp_mask, size_t objsz)
 
void nilfs_mdt_set_entry_size (struct inode *inode, unsigned entry_size, unsigned header_size)
 
int nilfs_mdt_setup_shadow_map (struct inode *inode, struct nilfs_shadow_map *shadow)
 
int nilfs_mdt_save_to_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)
 
void nilfs_mdt_restore_from_shadow_map (struct inode *inode)
 
void nilfs_mdt_clear_shadow_map (struct inode *inode)
 

Macro Definition Documentation

#define NILFS_MDT_MAX_RA_BLOCKS   (16 - 1)

Definition at line 37 of file mdt.c.

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 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 inode,
unsigned  entry_size,
unsigned  header_size 
)

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.