Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
rgrp.c File Reference
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/completion.h>
#include <linux/buffer_head.h>
#include <linux/fs.h>
#include <linux/gfs2_ondisk.h>
#include <linux/prefetch.h>
#include <linux/blkdev.h>
#include <linux/rbtree.h>
#include "gfs2.h"
#include "incore.h"
#include "glock.h"
#include "glops.h"
#include "lops.h"
#include "meta_io.h"
#include "quota.h"
#include "rgrp.h"
#include "super.h"
#include "trans.h"
#include "util.h"
#include "log.h"
#include "inode.h"
#include "trace_gfs2.h"

Go to the source code of this file.

Macros

#define BFITNOENT   ((u32)~0)
 
#define NO_BLOCK   ((u64)~0)
 
#define LBITMASK   (0x5555555555555555UL)
 
#define LBITSKIP55   (0x5555555555555555UL)
 
#define LBITSKIP00   (0x0000000000000000UL)
 

Functions

void gfs2_rgrp_verify (struct gfs2_rgrpd *rgd)
 
struct gfs2_rgrpdgfs2_blk2rgrpd (struct gfs2_sbd *sdp, u64 blk, bool exact)
 
struct gfs2_rgrpdgfs2_rgrpd_get_first (struct gfs2_sbd *sdp)
 
struct gfs2_rgrpdgfs2_rgrpd_get_next (struct gfs2_rgrpd *rgd)
 
void gfs2_free_clones (struct gfs2_rgrpd *rgd)
 
int gfs2_rs_alloc (struct gfs2_inode *ip)
 
void gfs2_rs_deltree (struct gfs2_inode *ip, struct gfs2_blkreserv *rs)
 
void gfs2_rs_delete (struct gfs2_inode *ip)
 
void gfs2_clear_rgrpd (struct gfs2_sbd *sdp)
 
u64 gfs2_ri_total (struct gfs2_sbd *sdp)
 
int gfs2_rindex_update (struct gfs2_sbd *sdp)
 
int gfs2_rgrp_bh_get (struct gfs2_rgrpd *rgd)
 
int update_rgrp_lvb (struct gfs2_rgrpd *rgd)
 
int gfs2_rgrp_go_lock (struct gfs2_holder *gh)
 
void gfs2_rgrp_go_unlock (struct gfs2_holder *gh)
 
int gfs2_rgrp_send_discards (struct gfs2_sbd *sdp, u64 offset, struct buffer_head *bh, const struct gfs2_bitmap *bi, unsigned minlen, u64 *ptrimmed)
 
int gfs2_fitrim (struct file *filp, void __user *argp)
 
int gfs2_inplace_reserve (struct gfs2_inode *ip, u32 requested)
 
void gfs2_inplace_release (struct gfs2_inode *ip)
 
int gfs2_rgrp_dump (struct seq_file *seq, const struct gfs2_glock *gl)
 
int gfs2_alloc_blocks (struct gfs2_inode *ip, u64 *bn, unsigned int *nblocks, bool dinode, u64 *generation)
 
void __gfs2_free_blocks (struct gfs2_inode *ip, u64 bstart, u32 blen, int meta)
 
void gfs2_free_meta (struct gfs2_inode *ip, u64 bstart, u32 blen)
 
void gfs2_unlink_di (struct inode *inode)
 
void gfs2_free_di (struct gfs2_rgrpd *rgd, struct gfs2_inode *ip)
 
int gfs2_check_blk_type (struct gfs2_sbd *sdp, u64 no_addr, unsigned int type)
 
void gfs2_rlist_add (struct gfs2_inode *ip, struct gfs2_rgrp_list *rlist, u64 block)
 
void gfs2_rlist_alloc (struct gfs2_rgrp_list *rlist, unsigned int state)
 
void gfs2_rlist_free (struct gfs2_rgrp_list *rlist)
 

Macro Definition Documentation

#define BFITNOENT   ((u32)~0)

Definition at line 35 of file rgrp.c.

#define LBITMASK   (0x5555555555555555UL)

Definition at line 43 of file rgrp.c.

#define LBITSKIP00   (0x0000000000000000UL)

Definition at line 45 of file rgrp.c.

#define LBITSKIP55   (0x5555555555555555UL)

Definition at line 44 of file rgrp.c.

#define NO_BLOCK   ((u64)~0)

Definition at line 36 of file rgrp.c.

Function Documentation

void __gfs2_free_blocks ( struct gfs2_inode ip,
u64  bstart,
u32  blen,
int  meta 
)

__gfs2_free_blocks - free a contiguous run of block(s) : the inode these blocks are being freed from : first block of a run of contiguous blocks : the length of the block run : 1 if the blocks represent metadata

Definition at line 2103 of file rgrp.c.

int gfs2_alloc_blocks ( struct gfs2_inode ip,
u64 bn,
unsigned int nblocks,
bool  dinode,
u64 generation 
)

gfs2_alloc_blocks - Allocate one or more blocks of data and/or a dinode : the inode to allocate the block for : Used to return the starting block number : requested number of blocks/extent length (value/result) : 1 if we're allocating a dinode block, else 0 : the generation number of the inode

Returns: 0 or error

Definition at line 1999 of file rgrp.c.

struct gfs2_rgrpd* gfs2_blk2rgrpd ( struct gfs2_sbd sdp,
u64  blk,
bool  exact 
)
read

gfs2_blk2rgrpd - Find resource group for a given data/meta block number : The GFS2 superblock : The data block number : True if this needs to be an exact match

Returns: The resource group, or NULL if not found

Definition at line 462 of file rgrp.c.

int gfs2_check_blk_type ( struct gfs2_sbd sdp,
u64  no_addr,
unsigned int  type 
)

gfs2_check_blk_type - Check the type of a block : The superblock : The block number to check : The block type we are looking for

Returns: 0 if the block type matches the expected type -ESTALE if it doesn't match or -ve errno if something went wrong while checking

Definition at line 2200 of file rgrp.c.

void gfs2_clear_rgrpd ( struct gfs2_sbd sdp)

Definition at line 666 of file rgrp.c.

int gfs2_fitrim ( struct file filp,
void __user argp 
)

gfs2_fitrim - Generate discard requests for unused bits of the filesystem : Any file on the filesystem : Pointer to the arguments (also used to pass result)

Returns: 0 on success, otherwise error code

Definition at line 1252 of file rgrp.c.

void gfs2_free_clones ( struct gfs2_rgrpd rgd)

Definition at line 539 of file rgrp.c.

void gfs2_free_di ( struct gfs2_rgrpd rgd,
struct gfs2_inode ip 
)

Definition at line 2181 of file rgrp.c.

void gfs2_free_meta ( struct gfs2_inode ip,
u64  bstart,
u32  blen 
)

gfs2_free_meta - free a contiguous run of data block(s) : the inode these blocks are being freed from : first block of a run of contiguous blocks : the length of the block run

Definition at line 2131 of file rgrp.c.

void gfs2_inplace_release ( struct gfs2_inode ip)

gfs2_inplace_release - release an inplace reservation : the inode the reservation was taken out on

Release a reservation made by gfs2_inplace_reserve().

Definition at line 1812 of file rgrp.c.

int gfs2_inplace_reserve ( struct gfs2_inode ip,
u32  requested 
)

gfs2_inplace_reserve - Reserve space in the filesystem : the inode to reserve space for : the number of blocks to be reserved

Returns: errno

Definition at line 1702 of file rgrp.c.

int gfs2_rgrp_bh_get ( struct gfs2_rgrpd rgd)

gfs2_rgrp_bh_get - Read in a RG's header and bitmaps : the struct gfs2_rgrpd describing the RG to read in

Read in all of a Resource Group's header and bitmap blocks. Caller must eventually call gfs2_rgrp_relse() to free the bitmaps.

Returns: errno

Definition at line 1054 of file rgrp.c.

int gfs2_rgrp_dump ( struct seq_file seq,
const struct gfs2_glock gl 
)

gfs2_rgrp_dump - print out an rgrp : The iterator : The glock in question

Definition at line 1919 of file rgrp.c.

int gfs2_rgrp_go_lock ( struct gfs2_holder gh)

Definition at line 1142 of file rgrp.c.

void gfs2_rgrp_go_unlock ( struct gfs2_holder gh)

gfs2_rgrp_go_unlock - Release RG bitmaps read in with gfs2_rgrp_bh_get() : The glock holder for the resource group

Definition at line 1158 of file rgrp.c.

int gfs2_rgrp_send_discards ( struct gfs2_sbd sdp,
u64  offset,
struct buffer_head *  bh,
const struct gfs2_bitmap bi,
unsigned  minlen,
u64 ptrimmed 
)

Definition at line 1173 of file rgrp.c.

void gfs2_rgrp_verify ( struct gfs2_rgrpd rgd)

gfs2_rgrp_verify - Verify that a resource group is consistent : the rgrp

Definition at line 403 of file rgrp.c.

struct gfs2_rgrpd* gfs2_rgrpd_get_first ( struct gfs2_sbd sdp)
read

gfs2_rgrpd_get_first - get the first Resource Group in the filesystem : The GFS2 superblock

Returns: The first rgrp in the filesystem

Definition at line 500 of file rgrp.c.

struct gfs2_rgrpd* gfs2_rgrpd_get_next ( struct gfs2_rgrpd rgd)
read

gfs2_rgrpd_get_next - get the next RG : the resource group descriptor

Returns: The next rgrp

Definition at line 520 of file rgrp.c.

u64 gfs2_ri_total ( struct gfs2_sbd sdp)

gfs2_ri_total - Total up the file system space, according to the rindex. : the filesystem

Definition at line 784 of file rgrp.c.

int gfs2_rindex_update ( struct gfs2_sbd sdp)

gfs2_rindex_update - Update the rindex if required : The GFS2 superblock

We grab a lock on the rindex inode to make sure that it doesn't change whilst we are performing an operation. We keep this lock for quite long periods of time compared to other locks. This doesn't matter, since it is shared and it is very, very rarely accessed in the exclusive mode (i.e. only when expanding the filesystem).

This makes sure that we're using the latest copy of the resource index special file, which might have been updated if someone expanded the filesystem (via gfs2_grow utility), which adds new resource groups.

Returns: 0 on succeess, error code otherwise

Definition at line 937 of file rgrp.c.

void gfs2_rlist_add ( struct gfs2_inode ip,
struct gfs2_rgrp_list rlist,
u64  block 
)

gfs2_rlist_add - add a RG to a list of RGs : the inode : the list of resource groups : the block

Figure out what RG a block belongs to and add that RG to the list

FIXME: Don't use NOFAIL

Definition at line 2234 of file rgrp.c.

void gfs2_rlist_alloc ( struct gfs2_rgrp_list rlist,
unsigned int  state 
)

gfs2_rlist_alloc - all RGs have been added to the rlist, now allocate and initialize an array of glock holders for them : the list of resource groups : the lock state to acquire the RG lock in

FIXME: Don't use NOFAIL

Definition at line 2289 of file rgrp.c.

void gfs2_rlist_free ( struct gfs2_rgrp_list rlist)

gfs2_rlist_free - free a resource group list : the list of resource groups

Definition at line 2307 of file rgrp.c.

int gfs2_rs_alloc ( struct gfs2_inode ip)

gfs2_rs_alloc - make sure we have a reservation assigned to the inode : the inode for this reservation

Definition at line 554 of file rgrp.c.

void gfs2_rs_delete ( struct gfs2_inode ip)

gfs2_rs_delete - delete a multi-block reservation : The inode for this reservation

Definition at line 633 of file rgrp.c.

void gfs2_rs_deltree ( struct gfs2_inode ip,
struct gfs2_blkreserv rs 
)

gfs2_rs_deltree - remove a multi-block reservation from the rgd tree : The reservation to remove

Definition at line 616 of file rgrp.c.

void gfs2_unlink_di ( struct inode inode)

Definition at line 2140 of file rgrp.c.

int update_rgrp_lvb ( struct gfs2_rgrpd rgd)

Definition at line 1119 of file rgrp.c.