Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Functions
sufile.c File Reference
#include <linux/kernel.h>
#include <linux/fs.h>
#include <linux/string.h>
#include <linux/buffer_head.h>
#include <linux/errno.h>
#include <linux/nilfs2_fs.h>
#include "mdt.h"
#include "sufile.h"

Go to the source code of this file.

Data Structures

struct  nilfs_sufile_info
 

Functions

unsigned long nilfs_sufile_get_ncleansegs (struct inode *sufile)
 
int nilfs_sufile_updatev (struct inode *sufile, __u64 *segnumv, size_t nsegs, int create, size_t *ndone, void(*dofunc)(struct inode *, __u64, struct buffer_head *, struct buffer_head *))
 
int nilfs_sufile_update (struct inode *sufile, __u64 segnum, int create, void(*dofunc)(struct inode *, __u64, struct buffer_head *, struct buffer_head *))
 
int nilfs_sufile_set_alloc_range (struct inode *sufile, __u64 start, __u64 end)
 
int nilfs_sufile_alloc (struct inode *sufile, __u64 *segnump)
 
void nilfs_sufile_do_cancel_free (struct inode *sufile, __u64 segnum, struct buffer_head *header_bh, struct buffer_head *su_bh)
 
void nilfs_sufile_do_scrap (struct inode *sufile, __u64 segnum, struct buffer_head *header_bh, struct buffer_head *su_bh)
 
void nilfs_sufile_do_free (struct inode *sufile, __u64 segnum, struct buffer_head *header_bh, struct buffer_head *su_bh)
 
int nilfs_sufile_mark_dirty (struct inode *sufile, __u64 segnum)
 
int nilfs_sufile_set_segment_usage (struct inode *sufile, __u64 segnum, unsigned long nblocks, time_t modtime)
 
int nilfs_sufile_get_stat (struct inode *sufile, struct nilfs_sustat *sustat)
 
void nilfs_sufile_do_set_error (struct inode *sufile, __u64 segnum, struct buffer_head *header_bh, struct buffer_head *su_bh)
 
int nilfs_sufile_resize (struct inode *sufile, __u64 newnsegs)
 
ssize_t nilfs_sufile_get_suinfo (struct inode *sufile, __u64 segnum, void *buf, unsigned sisz, size_t nsi)
 
int nilfs_sufile_read (struct super_block *sb, size_t susize, struct nilfs_inode *raw_inode, struct inode **inodep)
 

Function Documentation

int nilfs_sufile_alloc ( struct inode sufile,
__u64 segnump 
)

nilfs_sufile_alloc - allocate a segment : inode of segment usage file : pointer to segment number

Description: nilfs_sufile_alloc() allocates a clean segment.

Return Value: On success, 0 is returned and the segment number of the allocated segment 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.

%-ENOSPC - No clean segment left.

Definition at line 311 of file sufile.c.

void nilfs_sufile_do_cancel_free ( struct inode sufile,
__u64  segnum,
struct buffer_head *  header_bh,
struct buffer_head *  su_bh 
)

Definition at line 409 of file sufile.c.

void nilfs_sufile_do_free ( struct inode sufile,
__u64  segnum,
struct buffer_head *  header_bh,
struct buffer_head *  su_bh 
)

Definition at line 465 of file sufile.c.

void nilfs_sufile_do_scrap ( struct inode sufile,
__u64  segnum,
struct buffer_head *  header_bh,
struct buffer_head *  su_bh 
)

Definition at line 434 of file sufile.c.

void nilfs_sufile_do_set_error ( struct inode sufile,
__u64  segnum,
struct buffer_head *  header_bh,
struct buffer_head *  su_bh 
)

Definition at line 599 of file sufile.c.

unsigned long nilfs_sufile_get_ncleansegs ( struct inode sufile)

nilfs_sufile_get_ncleansegs - return the number of clean segments : inode of segment usage file

Definition at line 133 of file sufile.c.

int nilfs_sufile_get_stat ( struct inode sufile,
struct nilfs_sustat sustat 
)

nilfs_sufile_get_stat - get segment usage statistics : inode of segment usage file : pointer to a structure of segment usage statistics

Description: nilfs_sufile_get_stat() returns information about segment usage.

Return Value: On success, 0 is returned, and segment usage information 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.

Definition at line 567 of file sufile.c.

ssize_t nilfs_sufile_get_suinfo ( struct inode sufile,
__u64  segnum,
void buf,
unsigned  sisz,
size_t  nsi 
)

nilfs_sufile_get_suinfo - : inode of segment usage file : segment number to start looking : array of suinfo : byte size of suinfo : size of suinfo array

Description:

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

%-EIO - I/O error.

%-ENOMEM - Insufficient amount of memory available.

Definition at line 814 of file sufile.c.

int nilfs_sufile_mark_dirty ( struct inode sufile,
__u64  segnum 
)

nilfs_sufile_mark_dirty - mark the buffer having a segment usage dirty : inode of segment usage file : segment number

Definition at line 500 of file sufile.c.

int nilfs_sufile_read ( struct super_block sb,
size_t  susize,
struct nilfs_inode raw_inode,
struct inode **  inodep 
)

nilfs_sufile_read - read or get sufile inode : super block instance : size of a segment usage entry : on-disk sufile inode : buffer to store the inode

Definition at line 879 of file sufile.c.

int nilfs_sufile_resize ( struct inode sufile,
__u64  newnsegs 
)

nilfs_sufile_resize - resize segment array : inode of segment usage file : new number of segments

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.

%-ENOSPC - Enough free space is not left for shrinking

%-EBUSY - Dirty or active segments exist in the region to be truncated

Definition at line 746 of file sufile.c.

int nilfs_sufile_set_alloc_range ( struct inode sufile,
__u64  start,
__u64  end 
)

nilfs_sufile_set_alloc_range - limit range of segment to be allocated : inode of segment usage file : minimum segment number of allocatable region (inclusive) : maximum segment number of allocatable region (inclusive)

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

%-ERANGE - invalid segment region

Definition at line 276 of file sufile.c.

int nilfs_sufile_set_segment_usage ( struct inode sufile,
__u64  segnum,
unsigned long  nblocks,
time_t  modtime 
)

nilfs_sufile_set_segment_usage - set usage of a segment : inode of segment usage file : segment number : number of live blocks in the segment : modification time (option)

Definition at line 521 of file sufile.c.

int nilfs_sufile_update ( struct inode sufile,
__u64  segnum,
int  create,
void(*)(struct inode *, __u64, struct buffer_head *, struct buffer_head *)  dofunc 
)

Definition at line 234 of file sufile.c.

int nilfs_sufile_updatev ( struct inode sufile,
__u64 segnumv,
size_t  nsegs,
int  create,
size_t ndone,
void(*)(struct inode *, __u64, struct buffer_head *, struct buffer_head *)  dofunc 
)

nilfs_sufile_updatev - modify multiple segment usages at a time : inode of segment usage file : array of segment numbers : size of array : creation flag : place to store number of modified segments on : primitive operation for the update

Description: nilfs_sufile_updatev() repeatedly calls against the given array of segments. The is called with buffers of a header block and the sufile block in which the target segment usage entry is contained. If is given, the number of successfully modified segments from the head is stored in the place points to.

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

%-EIO - I/O error.

%-ENOMEM - Insufficient amount of memory available.

%-ENOENT - Given segment usage is in hole block (may be returned if is zero)

%-EINVAL - Invalid segment usage number

Definition at line 166 of file sufile.c.