|
Packit Service |
360c39 |
#ifndef _METAWALK_H
|
|
Packit Service |
360c39 |
#define _METAWALK_H
|
|
Packit Service |
360c39 |
|
|
Packit Service |
360c39 |
#define DIR_LINEAR 1
|
|
Packit Service |
360c39 |
#define DIR_EXHASH 2
|
|
Packit Service |
360c39 |
|
|
Packit Service |
360c39 |
#include "util.h"
|
|
Packit Service |
360c39 |
|
|
Packit Service |
360c39 |
struct metawalk_fxns;
|
|
Packit Service |
360c39 |
|
|
Packit Service |
360c39 |
extern int check_inode_eattr(struct gfs2_inode *ip,
|
|
Packit Service |
360c39 |
struct metawalk_fxns *pass);
|
|
Packit Service |
360c39 |
extern int check_metatree(struct gfs2_inode *ip, struct metawalk_fxns *pass);
|
|
Packit Service |
360c39 |
extern int check_leaf_blks(struct gfs2_inode *ip, struct metawalk_fxns *pass);
|
|
Packit Service |
360c39 |
extern int check_dir(struct gfs2_sbd *sdp, struct gfs2_inode *ip,
|
|
Packit Service |
360c39 |
struct metawalk_fxns *pass);
|
|
Packit Service |
360c39 |
extern int check_linear_dir(struct gfs2_inode *ip, struct gfs2_buffer_head *bh,
|
|
Packit Service |
360c39 |
struct metawalk_fxns *pass);
|
|
Packit Service |
360c39 |
extern int check_leaf(struct gfs2_inode *ip, int lindex,
|
|
Packit Service |
360c39 |
struct metawalk_fxns *pass, uint64_t *leaf_no,
|
|
Packit Service |
360c39 |
struct gfs2_leaf *leaf, int *ref_count);
|
|
Packit Service |
360c39 |
extern int _fsck_bitmap_set(struct gfs2_inode *ip, uint64_t bblock,
|
|
Packit Service |
360c39 |
const char *btype, int mark, int error_on_dinode,
|
|
Packit Service |
360c39 |
const char *caller, int line);
|
|
Packit Service |
360c39 |
extern int check_n_fix_bitmap(struct gfs2_sbd *sdp, struct rgrp_tree *rgd,
|
|
Packit Service |
360c39 |
uint64_t blk, int error_on_dinode,
|
|
Packit Service |
360c39 |
int new_state);
|
|
Packit Service |
360c39 |
extern struct duptree *dupfind(uint64_t block);
|
|
Packit Service |
360c39 |
extern struct gfs2_inode *fsck_system_inode(struct gfs2_sbd *sdp,
|
|
Packit Service |
360c39 |
uint64_t block);
|
|
Packit Service |
360c39 |
|
|
Packit Service |
360c39 |
#define is_duplicate(dblock) ((dupfind(dblock)) ? 1 : 0)
|
|
Packit Service |
360c39 |
|
|
Packit Service |
360c39 |
#define fsck_bitmap_set(ip, b, bt, m) \
|
|
Packit Service |
360c39 |
_fsck_bitmap_set(ip, b, bt, m, 0, __FUNCTION__, __LINE__)
|
|
Packit Service |
360c39 |
#define fsck_bitmap_set_noino(ip, b, bt, m) \
|
|
Packit Service |
360c39 |
_fsck_bitmap_set(ip, b, bt, m, 1, __FUNCTION__, __LINE__)
|
|
Packit Service |
360c39 |
enum meta_check_rc {
|
|
Packit Service |
360c39 |
meta_error = -1,
|
|
Packit Service |
360c39 |
meta_is_good = 0,
|
|
Packit Service |
360c39 |
meta_skip_further = 1,
|
|
Packit Service |
360c39 |
};
|
|
Packit Service |
360c39 |
|
|
Packit Service |
360c39 |
/* metawalk_fxns: function pointers to check various parts of the fs
|
|
Packit Service |
360c39 |
*
|
|
Packit Service |
360c39 |
* The functions should return -1 on fatal errors, 1 if the block
|
|
Packit Service |
360c39 |
* should be skipped, and 0 on success
|
|
Packit Service |
360c39 |
*
|
|
Packit Service |
360c39 |
* private: Data that should be passed to the fxns
|
|
Packit Service |
360c39 |
* check_leaf:
|
|
Packit Service |
360c39 |
* check_metalist:
|
|
Packit Service |
360c39 |
* check_data:
|
|
Packit Service |
360c39 |
* check_eattr_indir:
|
|
Packit Service |
360c39 |
* check_eattr_leaf:
|
|
Packit Service |
360c39 |
* check_dentry:
|
|
Packit Service |
360c39 |
* check_eattr_entry:
|
|
Packit Service |
360c39 |
* check_eattr_extentry:
|
|
Packit Service |
360c39 |
*/
|
|
Packit Service |
360c39 |
struct metawalk_fxns {
|
|
Packit Service |
360c39 |
void *private;
|
|
Packit Service |
360c39 |
int invalid_meta_is_fatal;
|
|
Packit Service |
360c39 |
int readahead;
|
|
Packit Service |
360c39 |
int (*check_leaf_depth) (struct gfs2_inode *ip, uint64_t leaf_no,
|
|
Packit Service |
360c39 |
int ref_count, struct gfs2_buffer_head *lbh);
|
|
Packit Service |
360c39 |
int (*check_leaf) (struct gfs2_inode *ip, uint64_t block,
|
|
Packit Service |
360c39 |
void *private);
|
|
Packit Service |
360c39 |
/* parameters to the check_metalist sub-functions:
|
|
Packit Service |
360c39 |
ip: incore inode pointer
|
|
Packit Service |
360c39 |
block: block number of the metadata block to be checked
|
|
Packit Service |
360c39 |
bh: buffer_head to be returned
|
|
Packit Service |
360c39 |
h: height
|
|
Packit Service |
360c39 |
is_valid: returned as 1 if the metadata block is valid and should
|
|
Packit Service |
360c39 |
be added to the metadata list for further processing.
|
|
Packit Service |
360c39 |
was_duplicate: returns as 1 if the metadata block was determined
|
|
Packit Service |
360c39 |
to be a duplicate reference, in which case we want to
|
|
Packit Service |
360c39 |
skip adding it to the metadata list.
|
|
Packit Service |
360c39 |
private: Pointer to pass-specific data
|
|
Packit Service |
360c39 |
returns: 0 - everything is good, but there may be duplicates
|
|
Packit Service |
360c39 |
1 - skip further processing
|
|
Packit Service |
360c39 |
*/
|
|
Packit Service |
360c39 |
int (*check_metalist) (struct gfs2_inode *ip, uint64_t block,
|
|
Packit Service |
360c39 |
struct gfs2_buffer_head **bh, int h,
|
|
Packit Service |
360c39 |
int *is_valid, int *was_duplicate,
|
|
Packit Service |
360c39 |
void *private);
|
|
Packit Service |
360c39 |
int (*check_data) (struct gfs2_inode *ip, uint64_t metablock,
|
|
Packit Service |
360c39 |
uint64_t block, void *private,
|
|
Packit Service |
360c39 |
struct gfs2_buffer_head *bh, uint64_t *ptr);
|
|
Packit Service |
360c39 |
int (*check_eattr_indir) (struct gfs2_inode *ip, uint64_t block,
|
|
Packit Service |
360c39 |
uint64_t parent,
|
|
Packit Service |
360c39 |
struct gfs2_buffer_head **bh, void *private);
|
|
Packit Service |
360c39 |
int (*check_eattr_leaf) (struct gfs2_inode *ip, uint64_t block,
|
|
Packit Service |
360c39 |
uint64_t parent, struct gfs2_buffer_head **bh,
|
|
Packit Service |
360c39 |
void *private);
|
|
Packit Service |
360c39 |
int (*check_dentry) (struct gfs2_inode *ip, struct gfs2_dirent *de,
|
|
Packit Service |
360c39 |
struct gfs2_dirent *prev,
|
|
Packit Service |
360c39 |
struct gfs2_buffer_head *bh,
|
|
Packit Service |
360c39 |
char *filename, uint32_t *count,
|
|
Packit Service |
360c39 |
int *lindex, void *private);
|
|
Packit Service |
360c39 |
int (*check_eattr_entry) (struct gfs2_inode *ip,
|
|
Packit Service |
360c39 |
struct gfs2_buffer_head *leaf_bh,
|
|
Packit Service |
360c39 |
struct gfs2_ea_header *ea_hdr,
|
|
Packit Service |
360c39 |
struct gfs2_ea_header *ea_hdr_prev,
|
|
Packit Service |
360c39 |
void *private);
|
|
Packit Service |
360c39 |
int (*check_eattr_extentry) (struct gfs2_inode *ip, int i,
|
|
Packit Service |
360c39 |
uint64_t *ea_data_ptr,
|
|
Packit Service |
360c39 |
struct gfs2_buffer_head *leaf_bh,
|
|
Packit Service |
360c39 |
uint32_t tot_ealen,
|
|
Packit Service |
360c39 |
struct gfs2_ea_header *ea_hdr,
|
|
Packit Service |
360c39 |
struct gfs2_ea_header *ea_hdr_prev,
|
|
Packit Service |
360c39 |
void *private);
|
|
Packit Service |
360c39 |
int (*finish_eattr_indir) (struct gfs2_inode *ip, int leaf_pointers,
|
|
Packit Service |
360c39 |
int leaf_pointer_errors, void *private);
|
|
Packit Service |
360c39 |
void (*big_file_msg) (struct gfs2_inode *ip, uint64_t blks_checked);
|
|
Packit Service |
360c39 |
int (*check_hash_tbl) (struct gfs2_inode *ip, uint64_t *tbl,
|
|
Packit Service |
360c39 |
unsigned hsize, void *private);
|
|
Packit Service |
360c39 |
int (*repair_leaf) (struct gfs2_inode *ip, uint64_t *leaf_no,
|
|
Packit Service |
360c39 |
int lindex, int ref_count, const char *msg);
|
|
Packit Service |
360c39 |
int (*undo_check_meta) (struct gfs2_inode *ip, uint64_t block,
|
|
Packit Service |
360c39 |
int h, void *private);
|
|
Packit Service |
360c39 |
int (*undo_check_data) (struct gfs2_inode *ip, uint64_t block,
|
|
Packit Service |
360c39 |
void *private);
|
|
Packit Service |
360c39 |
int (*delete_block) (struct gfs2_inode *ip, uint64_t block,
|
|
Packit Service |
360c39 |
struct gfs2_buffer_head **bh, const char *btype,
|
|
Packit Service |
360c39 |
void *private);
|
|
Packit Service |
360c39 |
};
|
|
Packit Service |
360c39 |
|
|
Packit Service |
360c39 |
#endif /* _METAWALK_H */
|