Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Functions | Variables
dir.c File Reference
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/buffer_head.h>
#include <linux/sort.h>
#include <linux/gfs2_ondisk.h>
#include <linux/crc32.h>
#include <linux/vmalloc.h>
#include "gfs2.h"
#include "incore.h"
#include "dir.h"
#include "glock.h"
#include "inode.h"
#include "meta_io.h"
#include "quota.h"
#include "rgrp.h"
#include "trans.h"
#include "bmap.h"
#include "util.h"

Go to the source code of this file.

Data Structures

struct  dirent_gather
 

Macros

#define IS_LEAF   1 /* Hashed (leaf) directory */
 
#define IS_DINODE   2 /* Linear (stuffed dinode block) directory */
 
#define MAX_RA_BLOCKS   32 /* max read-ahead blocks */
 
#define gfs2_disk_hash2offset(h)   (((u64)(h)) >> 1)
 
#define gfs2_dir_offset2hash(p)   ((u32)(((u64)(p)) << 1))
 

Typedefs

typedef int(* gfs2_dscan_t )(const struct gfs2_dirent *dent, const struct qstr *name, void *opaque)
 

Functions

int gfs2_dir_get_new_buffer (struct gfs2_inode *ip, u64 block, struct buffer_head **bhp)
 
void gfs2_dir_hash_inval (struct gfs2_inode *ip)
 
int gfs2_dir_read (struct inode *inode, u64 *offset, void *opaque, filldir_t filldir, struct file_ra_state *f_ra)
 
struct inodegfs2_dir_search (struct inode *dir, const struct qstr *name)
 
int gfs2_dir_check (struct inode *dir, const struct qstr *name, const struct gfs2_inode *ip)
 
int gfs2_dir_add (struct inode *inode, const struct qstr *name, const struct gfs2_inode *nip)
 
int gfs2_dir_del (struct gfs2_inode *dip, const struct dentry *dentry)
 
int gfs2_dir_mvino (struct gfs2_inode *dip, const struct qstr *filename, const struct gfs2_inode *nip, unsigned int new_type)
 
int gfs2_dir_exhash_dealloc (struct gfs2_inode *dip)
 
int gfs2_diradd_alloc_required (struct inode *inode, const struct qstr *name)
 

Variables

struct qstr gfs2_qdot __read_mostly
 

Macro Definition Documentation

#define gfs2_dir_offset2hash (   p)    ((u32)(((u64)(p)) << 1))

Definition at line 82 of file dir.c.

#define gfs2_disk_hash2offset (   h)    (((u64)(h)) >> 1)

Definition at line 81 of file dir.c.

#define IS_DINODE   2 /* Linear (stuffed dinode block) directory */

Definition at line 77 of file dir.c.

#define IS_LEAF   1 /* Hashed (leaf) directory */

Definition at line 76 of file dir.c.

#define MAX_RA_BLOCKS   32 /* max read-ahead blocks */

Definition at line 79 of file dir.c.

Typedef Documentation

typedef int(* gfs2_dscan_t)(const struct gfs2_dirent *dent, const struct qstr *name, void *opaque)

Definition at line 87 of file dir.c.

Function Documentation

int gfs2_dir_add ( struct inode inode,
const struct qstr name,
const struct gfs2_inode nip 
)

gfs2_dir_add - Add new filename into directory : The GFS2 inode : The new name : The inode number of the entry : The type of the entry

Returns: 0 on success, error code on failure

Definition at line 1656 of file dir.c.

int gfs2_dir_check ( struct inode dir,
const struct qstr name,
const struct gfs2_inode ip 
)

Definition at line 1570 of file dir.c.

int gfs2_dir_del ( struct gfs2_inode dip,
const struct dentry dentry 
)

gfs2_dir_del - Delete a directory entry : The GFS2 inode : The filename

Returns: 0 on success, error code on failure

Definition at line 1731 of file dir.c.

int gfs2_dir_exhash_dealloc ( struct gfs2_inode dip)

gfs2_dir_exhash_dealloc - free all the leaf blocks in a directory : the directory

Dealloc all on-disk directory leaves to FREEMETA state Change on-disk inode type to "regular file"

Returns: errno

Definition at line 1955 of file dir.c.

int gfs2_dir_get_new_buffer ( struct gfs2_inode ip,
u64  block,
struct buffer_head **  bhp 
)

Definition at line 90 of file dir.c.

void gfs2_dir_hash_inval ( struct gfs2_inode ip)

gfs2_dir_hash_inval - Invalidate dir hash : The directory inode

Must be called with an exclusive glock, or during glock invalidation.

Definition at line 384 of file dir.c.

int gfs2_dir_mvino ( struct gfs2_inode dip,
const struct qstr filename,
const struct gfs2_inode nip,
unsigned int  new_type 
)

gfs2_dir_mvino - Change inode number of directory entry : The GFS2 inode : :

This routine changes the inode number of a directory entry. It's used by rename to change ".." when a directory is moved. Assumes a glock is held on dvp.

Returns: errno

Definition at line 1788 of file dir.c.

int gfs2_dir_read ( struct inode inode,
u64 offset,
void opaque,
filldir_t  filldir,
struct file_ra_state f_ra 
)

Definition at line 1477 of file dir.c.

struct inode* gfs2_dir_search ( struct inode dir,
const struct qstr name 
)
read

gfs2_dir_search - Search a directory : The GFS2 inode : :

This routine searches a directory for a file or another directory. Assumes a glock is held on dip.

Returns: errno

Definition at line 1550 of file dir.c.

int gfs2_diradd_alloc_required ( struct inode inode,
const struct qstr name 
)

gfs2_diradd_alloc_required - find if adding entry will require an allocation : the file being written to : the filename that's going to be added

Returns: 1 if alloc required, 0 if not, -ve on error

Definition at line 2010 of file dir.c.

Variable Documentation

struct qstr gfs2_qdotdot __read_mostly

Definition at line 84 of file dir.c.