⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 reiserfs_fs.h

📁 arm_uclinux_tools用于安装linux的编译器
💻 H
📖 第 1 页 / 共 5 页
字号:
  int s0num;             /* number of items that fall into left most  node when S[0] splits	*/  int s1num;             /* number of items that fall into first  new node when S[0] splits	*/  int s2num;             /* number of items that fall into second new node when S[0] splits	*/  int lbytes;            /* number of bytes which can flow to the left neighbor from the	left	*/  /* most liquid item that cannot be shifted from S[0] entirely		*/  /* if -1 then nothing will be partially shifted */  int rbytes;            /* number of bytes which will flow to the right neighbor from the right	*/  /* most liquid item that cannot be shifted from S[0] entirely		*/  /* if -1 then nothing will be partially shifted                           */  int s1bytes;		/* number of bytes which flow to the first  new node when S[0] splits	*/            			/* note: if S[0] splits into 3 nodes, then items do not need to be cut	*/  int s2bytes;  struct buffer_head * buf_to_free[MAX_FREE_BLOCK]; /* buffers which are to be freed after do_balance finishes by unfix_nodes */  char * vn_buf;		/* kmalloced memory. Used to create				   virtual node and keep map of				   dirtied bitmap blocks */  int vn_buf_size;		/* size of the vn_buf */  struct virtual_node * tb_vn;	/* VN starts after bitmap of bitmap blocks */  int fs_gen;                  /* saved value of `reiserfs_generation' counter			          see FILESYSTEM_CHANGED() macro in reiserfs_fs.h */} ;/* These are modes of balancing *//* When inserting an item. */#define M_INSERT	'i'/* When inserting into (directories only) or appending onto an already   existant item. */#define M_PASTE		'p'/* When deleting an item. */#define M_DELETE	'd'/* When truncating an item or removing an entry from a (directory) item. */#define M_CUT 		'c'/* used when balancing on leaf level skipped (in reiserfsck) */#define M_INTERNAL	'n'/* When further balancing is not needed, then do_balance does not need   to be called. */#define M_SKIP_BALANCING 		's'#define M_CONVERT	'v'/* modes of leaf_move_items */#define LEAF_FROM_S_TO_L 0#define LEAF_FROM_S_TO_R 1#define LEAF_FROM_R_TO_L 2#define LEAF_FROM_L_TO_R 3#define LEAF_FROM_S_TO_SNEW 4#define FIRST_TO_LAST 0#define LAST_TO_FIRST 1/* used in do_balance for passing parent of node information that has   been gotten from tb struct */struct buffer_info {    struct tree_balance * tb;    struct buffer_head * bi_bh;    struct buffer_head * bi_parent;    int bi_position;};/* there are 4 types of items: stat data, directory item, indirect, direct.+-------------------+------------+--------------+------------+|	            |  k_offset  | k_uniqueness | mergeable? |+-------------------+------------+--------------+------------+|     stat data     |	0        |      0       |   no       |+-------------------+------------+--------------+------------+| 1st directory item| DOT_OFFSET |DIRENTRY_UNIQUENESS|   no       | | non 1st directory | hash value |              |   yes      ||     item          |            |              |            |+-------------------+------------+--------------+------------+| indirect item     | offset + 1 |TYPE_INDIRECT |   if this is not the first indirect item of the object+-------------------+------------+--------------+------------+| direct item       | offset + 1 |TYPE_DIRECT   | if not this is not the first direct item of the object+-------------------+------------+--------------+------------+*/struct item_operations {    int (*bytes_number) (struct item_head * ih, int block_size);    void (*decrement_key) (struct cpu_key *);    int (*is_left_mergeable) (struct key * ih, unsigned long bsize);    void (*print_item) (struct item_head *, char * item);    void (*check_item) (struct item_head *, char * item);    int (*create_vi) (struct virtual_node * vn, struct virtual_item * vi, 		      int is_affected, int insert_size);    int (*check_left) (struct virtual_item * vi, int free, 			    int start_skip, int end_skip);    int (*check_right) (struct virtual_item * vi, int free);    int (*part_size) (struct virtual_item * vi, int from, int to);    int (*unit_num) (struct virtual_item * vi);    void (*print_vi) (struct virtual_item * vi);};extern struct item_operations stat_data_ops, indirect_ops, direct_ops,   direntry_ops;extern struct item_operations * item_ops [4];#define op_bytes_number(ih,bsize)                    item_ops[le_ih_k_type (ih)]->bytes_number (ih, bsize)#define op_is_left_mergeable(key,bsize)              item_ops[le_key_k_type (le_key_version (key), key)]->is_left_mergeable (key, bsize)#define op_print_item(ih,item)                       item_ops[le_ih_k_type (ih)]->print_item (ih, item)#define op_check_item(ih,item)                       item_ops[le_ih_k_type (ih)]->check_item (ih, item)#define op_create_vi(vn,vi,is_affected,insert_size)  item_ops[le_ih_k_type ((vi)->vi_ih)]->create_vi (vn,vi,is_affected,insert_size)#define op_check_left(vi,free,start_skip,end_skip) item_ops[(vi)->vi_index]->check_left (vi, free, start_skip, end_skip)#define op_check_right(vi,free)                      item_ops[(vi)->vi_index]->check_right (vi, free)#define op_part_size(vi,from,to)                     item_ops[(vi)->vi_index]->part_size (vi, from, to)#define op_unit_num(vi)				     item_ops[(vi)->vi_index]->unit_num (vi)#define op_print_vi(vi)                              item_ops[(vi)->vi_index]->print_vi (vi)#define COMP_KEYS comp_keys#define COMP_SHORT_KEYS comp_short_keys/*#define keys_of_same_object comp_short_keys*//* number of blocks pointed to by the indirect item */#define I_UNFM_NUM(p_s_ih)	( ih_item_len(p_s_ih) / UNFM_P_SIZE )/* the used space within the unformatted node corresponding to pos within the item pointed to by ih */#define I_POS_UNFM_SIZE(ih,pos,size) (((pos) == I_UNFM_NUM(ih) - 1 ) ? (size) - ih_free_space(ih) : (size))/* number of bytes contained by the direct item or the unformatted nodes the indirect item points to *//* get the item header */ #define B_N_PITEM_HEAD(bh,item_num) ( (struct item_head * )((bh)->b_data + BLKH_SIZE) + (item_num) )/* get key */#define B_N_PDELIM_KEY(bh,item_num) ( (struct key * )((bh)->b_data + BLKH_SIZE) + (item_num) )/* get the key */#define B_N_PKEY(bh,item_num) ( &(B_N_PITEM_HEAD(bh,item_num)->ih_key) )/* get item body */#define B_N_PITEM(bh,item_num) ( (bh)->b_data + ih_location(B_N_PITEM_HEAD((bh),(item_num))))/* get the stat data by the buffer header and the item order */#define B_N_STAT_DATA(bh,nr) \( (struct stat_data *)((bh)->b_data + ih_location(B_N_PITEM_HEAD((bh),(nr))) ) )    /* following defines use reiserfs buffer header and item header *//* get stat-data */#define B_I_STAT_DATA(bh, ih) ( (struct stat_data * )((bh)->b_data + ih_location(ih)) )// this is 3976 for size==4096#define MAX_DIRECT_ITEM_LEN(size) ((size) - BLKH_SIZE - 2*IH_SIZE - SD_SIZE - UNFM_P_SIZE)/* indirect items consist of entries which contain blocknrs, pos   indicates which entry, and B_I_POS_UNFM_POINTER resolves to the   blocknr contained by the entry pos points to */#define B_I_POS_UNFM_POINTER(bh,ih,pos) le32_to_cpu(*(((unp_t *)B_I_PITEM(bh,ih)) + (pos)))#define PUT_B_I_POS_UNFM_POINTER(bh,ih,pos, val) do {*(((unp_t *)B_I_PITEM(bh,ih)) + (pos)) = cpu_to_le32(val); } while (0)struct reiserfs_iget4_args {    __u32 objectid ;} ;/***************************************************************************//*                    FUNCTION DECLARATIONS                                *//***************************************************************************//*#ifdef __KERNEL__*//* journal.c see journal.c for all the comments here */#define JOURNAL_TRANS_HALF 1018   /* must be correct to keep the desc and commit structs at 4k *//* first block written in a commit.  */struct reiserfs_journal_desc {  __u32 j_trans_id ;			/* id of commit */  __u32 j_len ;			/* length of commit. len +1 is the commit block */  __u32 j_mount_id ;				/* mount id of this trans*/  __u32 j_realblock[JOURNAL_TRANS_HALF] ; /* real locations for each block */  char j_magic[12] ;} ;/* last block written in a commit */struct reiserfs_journal_commit {  __u32 j_trans_id ;			/* must match j_trans_id from the desc block */  __u32 j_len ;			/* ditto */  __u32 j_realblock[JOURNAL_TRANS_HALF] ; /* real locations for each block */  char j_digest[16] ;			/* md5 sum of all the blocks involved, including desc and commit. not used, kill it */} ;/* this header block gets written whenever a transaction is considered fully flushed, and is more recent than the** last fully flushed transaction.  fully flushed means all the log blocks and all the real blocks are on disk,** and this transaction does not need to be replayed.*/struct reiserfs_journal_header {  __u32 j_last_flush_trans_id ;		/* id of last fully flushed transaction */  __u32 j_first_unflushed_offset ;      /* offset in the log of where to start replay after a crash */  __u32 j_mount_id ;} ;extern task_queue reiserfs_commit_thread_tq ;extern wait_queue_head_t reiserfs_commit_thread_wait ;/* biggest tunable defines are right here */#define JOURNAL_BLOCK_COUNT 8192 /* number of blocks in the journal */#define JOURNAL_MAX_BATCH   900 /* max blocks to batch into one transaction, don't make this any bigger than 900 */#define JOURNAL_MAX_COMMIT_AGE 30 #define JOURNAL_MAX_TRANS_AGE 30#define JOURNAL_PER_BALANCE_CNT (3 * (MAX_HEIGHT-2) + 9)/* both of these can be as low as 1, or as high as you want.  The min is the** number of 4k bitmap nodes preallocated on mount. New nodes are allocated** as needed, and released when transactions are committed.  On release, if ** the current number of nodes is > max, the node is freed, otherwise, ** it is put on a free list for faster use later.*/#define REISERFS_MIN_BITMAP_NODES 10 #define REISERFS_MAX_BITMAP_NODES 100 #define JBH_HASH_SHIFT 13 /* these are based on journal hash size of 8192 */#define JBH_HASH_MASK 8191/* After several hours of tedious analysis, the following hash * function won.  Do not mess with it... -DaveM */#define _jhashfn(dev,block)	\	((((dev)<<(JBH_HASH_SHIFT - 6)) ^ ((dev)<<(JBH_HASH_SHIFT - 9))) ^ \	 (((block)<<(JBH_HASH_SHIFT - 6)) ^ ((block) >> 13) ^ ((block) << (JBH_HASH_SHIFT - 12))))#define journal_hash(t,dev,block) ((t)[_jhashfn((dev),(block)) & JBH_HASH_MASK])/* finds n'th buffer with 0 being the start of this commit.  Needs to go away, j_ap_blocks has changed** since I created this.  One chunk of code in journal.c needs changing before deleting it*/#define JOURNAL_BUFFER(j,n) ((j)->j_ap_blocks[((j)->j_start + (n)) % JOURNAL_BLOCK_COUNT])void reiserfs_commit_for_inode(struct inode *) ;void reiserfs_update_inode_transaction(struct inode *) ;void reiserfs_wait_on_write_block(struct super_block *s) ;void reiserfs_block_writes(struct reiserfs_transaction_handle *th) ;void reiserfs_allow_writes(struct super_block *s) ;void reiserfs_check_lock_depth(char *caller) ;void reiserfs_prepare_for_journal(struct super_block *, struct buffer_head *bh, int wait) ;void reiserfs_restore_prepared_buffer(struct super_block *, struct buffer_head *bh) ;int journal_init(struct super_block *) ;int journal_release(struct reiserfs_transaction_handle*, struct super_block *) ;int journal_release_error(struct reiserfs_transaction_handle*, struct super_block *) ;int journal_end(struct reiserfs_transaction_handle *, struct super_block *, unsigned long) ;int journal_end_sync(struct reiserfs_transaction_handle *, struct super_block *, unsigned long) ;int journal_mark_dirty_nolog(struct reiserfs_transaction_handle *, struct super_block *, struct buffer_head *bh) ;int journal_mark_freed(struct reiserfs_transaction_handle *, struct super_block *, unsigned long blocknr) ;int push_journal_writer(char *w) ;int pop_journal_writer(int windex) ;int journal_transaction_should_end(struct reiserfs_transaction_handle *, int) ;int reiserfs_in_journal(struct super_block *p_s_sb, kdev_t dev, unsigned long bl, int size, int searchall, unsigned long *next) ;int journal_begin(struct reiserfs_transaction_handle *, struct super_block *p_s_sb, unsigned long) ;struct super_block *reiserfs_get_super(kdev_t dev) ;void flush_async_commits(struct super_block *p_s_sb) ;int buffer_journaled(const struct buffer_head *bh) ;int mark_buffer_journal_new(struct buffer_head *bh) ;int reiserfs_sync_all_buffers(kdev_t dev, int wait) ;int reiserfs_sync_buffers(kdev_t dev, int wait) ;int reiserfs_add_page_to_flush_list(struct reiserfs_transaction_handle *,                                    struct inode *, struct buffer_head *) ;int reiserfs_remove_page_from_flush_list(struct reiserfs_transaction_handle *,                                         struct inode *) ;int reiserfs_allocate_list_bitmaps(struct super_block *s, struct reiserfs_list_bitmap *, int) ;				/* why is this kerplunked right here? */static inline int reiserfs_buffer_prepared(const struct buffer_head *bh) {  if (bh && test_bit(BH_JPrepared, ( struct buffer_head * ) &bh->b_state))    return 1 ;  else    return 0 ;}/* buffer was journaled, waiting to get to disk */static inline int buffer_journal_dirty(const struct buffer_head *bh) {  if (bh)    return test_bit(BH_JDirty_wait, ( struct buffer_head * ) &bh->b_state) ;  else    return 0 ;}static inline int mark_buffer_notjournal_dirty(struct buffer_head *bh) {  if (bh)    clear_bit(BH_JDirty_wait, &bh->b_state) ;  return 0 ;}static inline int mark_buffer_notjournal_new(struct buffer_head *bh) {  if (bh) {    clear_bit(BH_JNew, &bh->b_state) ;  }  return 0 ;}void add_save_link (struct reiserfs_transaction_handle * th,					struct inode * inode, int truncate);void remove_save_link (struct inode * inode, int truncate);/* objectid.c */__u32 reiserfs_get_unused_objectid (struct reiserfs_transaction_handle *th);void reiserfs_release_objectid (struct reiserfs_transaction_handle *th, __u32 objectid_to_release);int reiserfs_convert_objectid_map_v1(struct super_block *) ;/* stree.c */int B_IS_IN_TREE(const struct buffer_head *);extern inline void copy_short_key (void * to, const void * from);extern inline void copy_item_head(struct item_head * p_v_to, 								  const struct item_head * p_v_from);// first key is in cpu form, second - leextern inline int comp_keys (const struct key * le_key, 			     const struct cpu_key * cpu_key);extern inline int  comp_sh

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -