From: Adrian Bunk The patch below contains some cleanups for reiser3. It consists of: - removal of unused code - making needlessly global code static Signed-off-by: Adrian Bunk Signed-off-by: Andrew Morton --- 25-akpm/fs/reiserfs/bitmap.c | 2 25-akpm/fs/reiserfs/dir.c | 4 - 25-akpm/fs/reiserfs/do_balan.c | 6 +- 25-akpm/fs/reiserfs/file.c | 14 ++--- 25-akpm/fs/reiserfs/fix_node.c | 2 25-akpm/fs/reiserfs/ibalance.c | 4 - 25-akpm/fs/reiserfs/inode.c | 18 +------ 25-akpm/fs/reiserfs/ioctl.c | 4 + 25-akpm/fs/reiserfs/item_ops.c | 10 +-- 25-akpm/fs/reiserfs/journal.c | 25 ++------- 25-akpm/fs/reiserfs/prints.c | 75 ----------------------------- 25-akpm/fs/reiserfs/stree.c | 84 +++------------------------------ 25-akpm/fs/reiserfs/super.c | 32 ++---------- 25-akpm/fs/reiserfs/xattr_acl.c | 4 + 25-akpm/include/linux/reiserfs_acl.h | 2 25-akpm/include/linux/reiserfs_fs.h | 32 ------------ 25-akpm/include/linux/reiserfs_fs_sb.h | 1 17 files changed, 56 insertions(+), 263 deletions(-) diff -puN fs/reiserfs/bitmap.c~reiser3-cleanups fs/reiserfs/bitmap.c --- 25/fs/reiserfs/bitmap.c~reiser3-cleanups 2004-11-30 01:24:26.945549376 -0800 +++ 25-akpm/fs/reiserfs/bitmap.c 2004-11-30 01:24:26.975544816 -0800 @@ -405,7 +405,7 @@ void reiserfs_free_block (struct reiserf } /* preallocated blocks don't need to be run through journal_mark_freed */ -void reiserfs_free_prealloc_block (struct reiserfs_transaction_handle *th, +static void reiserfs_free_prealloc_block (struct reiserfs_transaction_handle *th, struct inode *inode, b_blocknr_t block) { RFALSE(!th->t_super, "vs-4060: trying to free block on nonexistent device"); RFALSE(is_reusable (th->t_super, block, 1) == 0, "vs-4070: can not free such block"); diff -puN fs/reiserfs/dir.c~reiser3-cleanups fs/reiserfs/dir.c --- 25/fs/reiserfs/dir.c~reiser3-cleanups 2004-11-30 01:24:26.947549072 -0800 +++ 25-akpm/fs/reiserfs/dir.c 2004-11-30 01:24:26.976544664 -0800 @@ -15,7 +15,7 @@ extern struct reiserfs_key MIN_KEY; static int reiserfs_readdir (struct file *, void *, filldir_t); -int reiserfs_dir_fsync(struct file *filp, struct dentry *dentry, int datasync) ; +static int reiserfs_dir_fsync(struct file *filp, struct dentry *dentry, int datasync) ; struct file_operations reiserfs_dir_operations = { .read = generic_read_dir, @@ -24,7 +24,7 @@ struct file_operations reiserfs_dir_oper .ioctl = reiserfs_ioctl, }; -int reiserfs_dir_fsync(struct file *filp, struct dentry *dentry, int datasync) { +static int reiserfs_dir_fsync(struct file *filp, struct dentry *dentry, int datasync) { struct inode *inode = dentry->d_inode; int err; reiserfs_write_lock(inode->i_sb); diff -puN fs/reiserfs/do_balan.c~reiser3-cleanups fs/reiserfs/do_balan.c --- 25/fs/reiserfs/do_balan.c~reiser3-cleanups 2004-11-30 01:24:26.949548768 -0800 +++ 25-akpm/fs/reiserfs/do_balan.c 2004-11-30 01:24:26.977544512 -0800 @@ -1382,7 +1382,7 @@ static int check_before_balancing (struc } -void check_after_balance_leaf (struct tree_balance * tb) +static void check_after_balance_leaf (struct tree_balance * tb) { if (tb->lnum[0]) { if (B_FREE_SPACE (tb->L[0]) != @@ -1422,14 +1422,14 @@ void check_after_balance_leaf (struct tr } -void check_leaf_level (struct tree_balance * tb) +static void check_leaf_level (struct tree_balance * tb) { check_leaf (tb->L[0]); check_leaf (tb->R[0]); check_leaf (PATH_PLAST_BUFFER (tb->tb_path)); } -void check_internal_levels (struct tree_balance * tb) +static void check_internal_levels (struct tree_balance * tb) { int h; diff -puN fs/reiserfs/file.c~reiser3-cleanups fs/reiserfs/file.c --- 25/fs/reiserfs/file.c~reiser3-cleanups 2004-11-30 01:24:26.950548616 -0800 +++ 25-akpm/fs/reiserfs/file.c 2004-11-30 01:24:26.979544208 -0800 @@ -147,7 +147,7 @@ static int reiserfs_sync_file( /* Allocates blocks for a file to fulfil write request. Maps all unmapped but prepared pages from the list. Updates metadata with newly allocated blocknumbers as needed */ -int reiserfs_allocate_blocks_for_region( +static int reiserfs_allocate_blocks_for_region( struct reiserfs_transaction_handle *th, struct inode *inode, /* Inode we work with */ loff_t pos, /* Writing position */ @@ -587,7 +587,7 @@ error_exit: } /* Unlock pages prepared by reiserfs_prepare_file_region_for_write */ -void reiserfs_unprepare_pages(struct page **prepared_pages, /* list of locked pages */ +static void reiserfs_unprepare_pages(struct page **prepared_pages, /* list of locked pages */ int num_pages /* amount of pages */) { int i; // loop counter @@ -602,7 +602,7 @@ void reiserfs_unprepare_pages(struct pag /* This function will copy data from userspace to specified pages within supplied byte range */ -int reiserfs_copy_from_user_to_file_region( +static int reiserfs_copy_from_user_to_file_region( loff_t pos, /* In-file position */ int num_pages, /* Number of pages affected */ int write_bytes, /* Amount of bytes to write */ @@ -714,7 +714,7 @@ drop_write_lock: /* Submit pages for write. This was separated from actual file copying because we might want to allocate block numbers in-between. This function assumes that caller will adjust file size to correct value. */ -int reiserfs_submit_file_region_for_write( +static int reiserfs_submit_file_region_for_write( struct reiserfs_transaction_handle *th, struct inode *inode, loff_t pos, /* Writing position offset */ @@ -795,7 +795,7 @@ int reiserfs_submit_file_region_for_writ /* Look if passed writing region is going to touch file's tail (if it is present). And if it is, convert the tail to unformatted node */ -int reiserfs_check_for_tail_and_convert( struct inode *inode, /* inode to deal with */ +static int reiserfs_check_for_tail_and_convert( struct inode *inode, /* inode to deal with */ loff_t pos, /* Writing position */ int write_bytes /* amount of bytes to write */ ) @@ -851,7 +851,7 @@ int reiserfs_check_for_tail_and_convert( append), it is zeroed, then. Returns number of unallocated blocks that should be allocated to cover new file data.*/ -int reiserfs_prepare_file_region_for_write( +static int reiserfs_prepare_file_region_for_write( struct inode *inode /* Inode of the file */, loff_t pos, /* position in the file */ int num_pages, /* number of pages to @@ -1148,7 +1148,7 @@ failed_read: Future Features: providing search_by_key with hints. */ -ssize_t reiserfs_file_write( struct file *file, /* the file we are going to write into */ +static ssize_t reiserfs_file_write( struct file *file, /* the file we are going to write into */ const char __user *buf, /* pointer to user supplied data (in userspace) */ size_t count, /* amount of bytes to write */ diff -puN fs/reiserfs/fix_node.c~reiser3-cleanups fs/reiserfs/fix_node.c --- 25/fs/reiserfs/fix_node.c~reiser3-cleanups 2004-11-30 01:24:26.952548312 -0800 +++ 25-akpm/fs/reiserfs/fix_node.c 2004-11-30 01:24:26.981543904 -0800 @@ -724,7 +724,7 @@ else \ } -void free_buffers_in_tb ( +static void free_buffers_in_tb ( struct tree_balance * p_s_tb ) { int n_counter; diff -puN fs/reiserfs/ibalance.c~reiser3-cleanups fs/reiserfs/ibalance.c --- 25/fs/reiserfs/ibalance.c~reiser3-cleanups 2004-11-30 01:24:26.954548008 -0800 +++ 25-akpm/fs/reiserfs/ibalance.c 2004-11-30 01:24:26.982543752 -0800 @@ -698,7 +698,7 @@ static void balance_internal_when_delete /* Replace delimiting key of buffers L[h] and S[h] by the given key.*/ -void replace_lkey ( +static void replace_lkey ( struct tree_balance * tb, int h, struct item_head * key @@ -718,7 +718,7 @@ void replace_lkey ( /* Replace delimiting key of buffers S[h] and R[h] by the given key.*/ -void replace_rkey ( +static void replace_rkey ( struct tree_balance * tb, int h, struct item_head * key diff -puN fs/reiserfs/inode.c~reiser3-cleanups fs/reiserfs/inode.c --- 25/fs/reiserfs/inode.c~reiser3-cleanups 2004-11-30 01:24:26.956547704 -0800 +++ 25-akpm/fs/reiserfs/inode.c 2004-11-30 01:24:26.985543296 -0800 @@ -22,6 +22,8 @@ extern int reiserfs_default_io_size; /* static int reiserfs_commit_write(struct file *f, struct page *page, unsigned from, unsigned to); +static int reiserfs_prepare_write(struct file *f, struct page *page, + unsigned from, unsigned to); void reiserfs_delete_inode (struct inode * inode) { @@ -403,8 +405,8 @@ finished: // this is called to create file map. So, _get_block_create_0 will not // read direct item -int reiserfs_bmap (struct inode * inode, sector_t block, - struct buffer_head * bh_result, int create) +static int reiserfs_bmap (struct inode * inode, sector_t block, + struct buffer_head * bh_result, int create) { if (!file_capable (inode, block)) return -EFBIG; @@ -1563,16 +1565,6 @@ int reiserfs_write_inode (struct inode * return 0; } -/* FIXME: no need any more. right? */ -int reiserfs_sync_inode (struct reiserfs_transaction_handle *th, struct inode * inode) -{ - int err = 0; - - reiserfs_update_sd (th, inode); - return err; -} - - /* stat data of new object is inserted already, this inserts the item containing "." and ".." entries */ static int reiserfs_new_directory (struct reiserfs_transaction_handle *th, @@ -2420,7 +2412,7 @@ static int reiserfs_writepage (struct pa return reiserfs_write_full_page(page, wbc) ; } -int reiserfs_prepare_write(struct file *f, struct page *page, +static int reiserfs_prepare_write(struct file *f, struct page *page, unsigned from, unsigned to) { struct inode *inode = page->mapping->host ; int ret; diff -puN fs/reiserfs/ioctl.c~reiser3-cleanups fs/reiserfs/ioctl.c --- 25/fs/reiserfs/ioctl.c~reiser3-cleanups 2004-11-30 01:24:26.957547552 -0800 +++ 25-akpm/fs/reiserfs/ioctl.c 2004-11-30 01:24:26.985543296 -0800 @@ -9,6 +9,8 @@ #include #include +static int reiserfs_unpack (struct inode * inode, struct file * filp); + /* ** reiserfs_ioctl - handler for ioctl for inode ** supported commands: @@ -87,7 +89,7 @@ int reiserfs_ioctl (struct inode * inode ** Function try to convert tail from direct item into indirect. ** It set up nopack attribute in the REISERFS_I(inode)->nopack */ -int reiserfs_unpack (struct inode * inode, struct file * filp) +static int reiserfs_unpack (struct inode * inode, struct file * filp) { int retval = 0; int index ; diff -puN fs/reiserfs/item_ops.c~reiser3-cleanups fs/reiserfs/item_ops.c --- 25/fs/reiserfs/item_ops.c~reiser3-cleanups 2004-11-30 01:24:26.959547248 -0800 +++ 25-akpm/fs/reiserfs/item_ops.c 2004-11-30 01:24:26.986543144 -0800 @@ -110,7 +110,7 @@ static void sd_print_vi (struct virtual_ vi->vi_index, vi->vi_type, vi->vi_ih); } -struct item_operations stat_data_ops = { +static struct item_operations stat_data_ops = { .bytes_number = sd_bytes_number, .decrement_key = sd_decrement_key, .is_left_mergeable = sd_is_left_mergeable, @@ -213,7 +213,7 @@ static void direct_print_vi (struct virt vi->vi_index, vi->vi_type, vi->vi_ih); } -struct item_operations direct_ops = { +static struct item_operations direct_ops = { .bytes_number = direct_bytes_number, .decrement_key = direct_decrement_key, .is_left_mergeable = direct_is_left_mergeable, @@ -367,7 +367,7 @@ static void indirect_print_vi (struct vi vi->vi_index, vi->vi_type, vi->vi_ih); } -struct item_operations indirect_ops = { +static struct item_operations indirect_ops = { .bytes_number = indirect_bytes_number, .decrement_key = indirect_decrement_key, .is_left_mergeable = indirect_is_left_mergeable, @@ -660,7 +660,7 @@ static void direntry_print_vi (struct vi printk ("\n"); } -struct item_operations direntry_ops = { +static struct item_operations direntry_ops = { .bytes_number = direntry_bytes_number, .decrement_key = direntry_decrement_key, .is_left_mergeable = direntry_is_left_mergeable, @@ -750,7 +750,7 @@ static void errcatch_print_vi (struct vi reiserfs_warning (NULL, "green-16011: Invalid item type observed, run fsck ASAP"); } -struct item_operations errcatch_ops = { +static struct item_operations errcatch_ops = { errcatch_bytes_number, errcatch_decrement_key, errcatch_is_left_mergeable, diff -puN fs/reiserfs/journal.c~reiser3-cleanups fs/reiserfs/journal.c --- 25/fs/reiserfs/journal.c~reiser3-cleanups 2004-11-30 01:24:26.960547096 -0800 +++ 25-akpm/fs/reiserfs/journal.c 2004-11-30 01:24:26.990542536 -0800 @@ -436,19 +436,6 @@ get_journal_hash_dev(struct super_block return (struct reiserfs_journal_cnode *)0 ; } -/* returns a cnode with same size, block number and dev as bh in the current transaction hash. NULL if not found */ -static inline struct reiserfs_journal_cnode *get_journal_hash(struct super_block *p_s_sb, struct buffer_head *bh) { - struct reiserfs_journal *journal = SB_JOURNAL (p_s_sb); - struct reiserfs_journal_cnode *cn ; - if (bh) { - cn = get_journal_hash_dev(p_s_sb, journal->j_hash_table, bh->b_blocknr); - } - else { - return (struct reiserfs_journal_cnode *)0 ; - } - return cn ; -} - /* ** this actually means 'can this block be reallocated yet?'. If you set search_all, a block can only be allocated ** if it is not in the current transaction, was not freed by the current transaction, and has no chance of ever @@ -516,7 +503,7 @@ int reiserfs_in_journal(struct super_blo /* insert cn into table */ -inline void insert_journal_hash(struct reiserfs_journal_cnode **table, struct reiserfs_journal_cnode *cn) { +static inline void insert_journal_hash(struct reiserfs_journal_cnode **table, struct reiserfs_journal_cnode *cn) { struct reiserfs_journal_cnode *cn_orig ; cn_orig = journal_hash(table, cn->sb, cn->blocknr) ; @@ -693,7 +680,7 @@ static int add_to_chunk(struct buffer_ch } -atomic_t nr_reiserfs_jh = ATOMIC_INIT(0); +static atomic_t nr_reiserfs_jh = ATOMIC_INIT(0); static struct reiserfs_jh *alloc_jh(void) { struct reiserfs_jh *jh; while(1) { @@ -1090,7 +1077,7 @@ static struct reiserfs_journal_list *fin return NULL ; } -void remove_journal_hash(struct super_block *, struct reiserfs_journal_cnode **, +static void remove_journal_hash(struct super_block *, struct reiserfs_journal_cnode **, struct reiserfs_journal_list *, unsigned long, int); /* @@ -2028,7 +2015,7 @@ abort_replay: Right now it is only used from journal code. But later we might use it from other places. Note: Do not use journal_getblk/sb_getblk functions here! */ -struct buffer_head * reiserfs_breada (struct block_device *dev, int block, int bufsize, +static struct buffer_head * reiserfs_breada (struct block_device *dev, int block, int bufsize, unsigned int max_block) { struct buffer_head * bhlist[BUFNR]; @@ -3848,7 +3835,7 @@ out: return journal->j_errno; } -void +static void __reiserfs_journal_abort_hard (struct super_block *sb) { struct reiserfs_journal *journal = SB_JOURNAL (sb); @@ -3866,7 +3853,7 @@ __reiserfs_journal_abort_hard (struct su #endif } -void +static void __reiserfs_journal_abort_soft (struct super_block *sb, int errno) { struct reiserfs_journal *journal = SB_JOURNAL (sb); diff -puN fs/reiserfs/prints.c~reiser3-cleanups fs/reiserfs/prints.c --- 25/fs/reiserfs/prints.c~reiser3-cleanups 2004-11-30 01:24:26.962546792 -0800 +++ 25-akpm/fs/reiserfs/prints.c 2004-11-30 01:24:26.991542384 -0800 @@ -286,7 +286,7 @@ void reiserfs_info (struct super_block * } /* No newline.. reiserfs_printk calls can be followed by printk's */ -void reiserfs_printk (const char * fmt, ...) +static void reiserfs_printk (const char * fmt, ...) { do_reiserfs_warning(fmt); printk (error_buf); @@ -366,30 +366,6 @@ void reiserfs_panic (struct super_block reiserfs_bdevname (sb), error_buf); } -static void -do_handle_error (struct super_block *sb, int errno) -{ - if (reiserfs_error_panic (sb)) { - panic ("REISERFS: panic (device %s): Panic forced after error\n", - reiserfs_bdevname (sb)); - } - - if (reiserfs_error_ro (sb)) { - printk (KERN_CRIT "REISERFS: error (device %s): Re-mounting fs " - "readonly\n", reiserfs_bdevname (sb)); - reiserfs_journal_abort (sb, errno); - } -} - -void -reiserfs_error (struct super_block * sb, int errno, const char *fmt, ...) -{ - do_reiserfs_warning (fmt); - printk (KERN_CRIT "REISERFS: error (device %s): %s\n", - reiserfs_bdevname (sb), error_buf); - do_handle_error (sb, errno); -} - void reiserfs_abort (struct super_block *sb, int errno, const char *fmt, ...) { @@ -410,53 +386,6 @@ reiserfs_abort (struct super_block *sb, reiserfs_journal_abort (sb, errno); } -void print_virtual_node (struct virtual_node * vn) -{ - int i; - struct virtual_item * vi; - - printk ("VIRTUAL NODE CONTAINS %d items, has size %d,%s,%s, ITEM_POS=%d POS_IN_ITEM=%d MODE=\'%c\'\n", - vn->vn_nr_item, vn->vn_size, - (vn->vn_vi[0].vi_type & VI_TYPE_LEFT_MERGEABLE )? "left mergeable" : "", - (vn->vn_vi[vn->vn_nr_item - 1].vi_type & VI_TYPE_RIGHT_MERGEABLE) ? "right mergeable" : "", - vn->vn_affected_item_num, vn->vn_pos_in_item, vn->vn_mode); - - vi = vn->vn_vi; - for (i = 0; i < vn->vn_nr_item; i ++, vi ++) - op_print_vi (vi); - -} - - -void print_path (struct tree_balance * tb, struct path * path) -{ - int h = 0; - struct buffer_head * bh; - - if (tb) { - while (tb->insert_size[h]) { - bh = PATH_H_PBUFFER (path, h); - printk ("block %llu (level=%d), position %d\n", bh ? (unsigned long long)bh->b_blocknr : 0LL, - bh ? B_LEVEL (bh) : 0, PATH_H_POSITION (path, h)); - h ++; - } - } else { - int offset = path->path_length; - struct buffer_head * bh; - printk ("Offset Bh (b_blocknr, b_count) Position Nr_item\n"); - while ( offset > ILLEGAL_PATH_ELEMENT_OFFSET ) { - bh = PATH_OFFSET_PBUFFER (path, offset); - printk ("%6d %10p (%9llu, %7d) %8d %7d\n", offset, - bh, bh ? (unsigned long long)bh->b_blocknr : 0LL, bh ? atomic_read (&(bh->b_count)) : 0, - PATH_OFFSET_POSITION (path, offset), bh ? B_NR_ITEMS (bh) : -1); - - offset --; - } - } - -} - - /* this prints internal nodes (4 keys/items in line) (dc_number, dc_size)[k_dirid, k_objectid, k_offset, k_uniqueness](dc_number, dc_size)...*/ @@ -648,7 +577,7 @@ void print_block (struct buffer_head * b -char print_tb_buf[2048]; +static char print_tb_buf[2048]; /* this stores initial state of tree balance in the print_tb_buf */ void store_print_tb (struct tree_balance * tb) diff -puN fs/reiserfs/stree.c~reiser3-cleanups fs/reiserfs/stree.c --- 25/fs/reiserfs/stree.c~reiser3-cleanups 2004-11-30 01:24:26.964546488 -0800 +++ 25-akpm/fs/reiserfs/stree.c 2004-11-30 01:24:26.994541928 -0800 @@ -12,14 +12,10 @@ * This file contains functions dealing with S+tree * * B_IS_IN_TREE - * copy_short_key * copy_item_head * comp_short_keys * comp_keys - * comp_cpu_keys * comp_short_le_keys - * comp_short_cpu_keys - * cpu_key2cpu_key * le_key2cpu_key * comp_le_keys * bin_search @@ -72,11 +68,6 @@ inline int B_IS_IN_TREE (const struct bu return ( B_LEVEL (p_s_bh) != FREE_LEVEL ); } -inline void copy_short_key (void * to, const void * from) -{ - memcpy (to, from, SHORT_KEY_SIZE); -} - // // to gets item head in le form // @@ -117,7 +108,7 @@ inline int comp_short_keys (const struc Compare keys using all 4 key fields. Returns: -1 if key1 < key2 0 if key1 = key2 1 if key1 > key2 */ -inline int comp_keys (const struct reiserfs_key * le_key, const struct cpu_key * cpu_key) +static inline int comp_keys (const struct reiserfs_key * le_key, const struct cpu_key * cpu_key) { int retval; @@ -143,37 +134,6 @@ inline int comp_keys (const struct reis } -// -// FIXME: not used yet -// -inline int comp_cpu_keys (const struct cpu_key * key1, - const struct cpu_key * key2) -{ - if (key1->on_disk_key.k_dir_id < key2->on_disk_key.k_dir_id) - return -1; - if (key1->on_disk_key.k_dir_id > key2->on_disk_key.k_dir_id) - return 1; - - if (key1->on_disk_key.k_objectid < key2->on_disk_key.k_objectid) - return -1; - if (key1->on_disk_key.k_objectid > key2->on_disk_key.k_objectid) - return 1; - - if (cpu_key_k_offset (key1) < cpu_key_k_offset (key2)) - return -1; - if (cpu_key_k_offset (key1) > cpu_key_k_offset (key2)) - return 1; - - reiserfs_warning (NULL, "comp_cpu_keys: type are compared for %K and %K", - key1, key2); - - if (cpu_key_k_type (key1) < cpu_key_k_type (key2)) - return -1; - if (cpu_key_k_type (key1) > cpu_key_k_type (key2)) - return 1; - return 0; -} - inline int comp_short_le_keys (const struct reiserfs_key * key1, const struct reiserfs_key * key2) { __u32 * p_s_1_u32, * p_s_2_u32; @@ -190,32 +150,6 @@ inline int comp_short_le_keys (const str return 0; } -inline int comp_short_cpu_keys (const struct cpu_key * key1, - const struct cpu_key * key2) -{ - __u32 * p_s_1_u32, * p_s_2_u32; - int n_key_length = REISERFS_SHORT_KEY_LEN; - - p_s_1_u32 = (__u32 *)key1; - p_s_2_u32 = (__u32 *)key2; - - for( ; n_key_length--; ++p_s_1_u32, ++p_s_2_u32 ) { - if ( *p_s_1_u32 < *p_s_2_u32 ) - return -1; - if ( *p_s_1_u32 > *p_s_2_u32 ) - return 1; - } - return 0; -} - - - -inline void cpu_key2cpu_key (struct cpu_key * to, const struct cpu_key * from) -{ - memcpy (to, from, sizeof (struct cpu_key)); -} - - inline void le_key2cpu_key (struct cpu_key * to, const struct reiserfs_key * from) { to->on_disk_key.k_dir_id = le32_to_cpu (from->k_dir_id); @@ -255,7 +189,7 @@ inline int comp_le_keys (const struct re there are no possible items, and we have not found it. With each examination we cut the number of possible items it could be by one more than half rounded down, or we find it. */ -inline int bin_search ( +static inline int bin_search ( const void * p_v_key, /* Key to search for. */ const void * p_v_base,/* First item in the array. */ int p_n_num, /* Number of items in the array. */ @@ -272,7 +206,7 @@ inline int bin_search ( int n_rbound, n_lbound, n_j; for ( n_j = ((n_rbound = p_n_num - 1) + (n_lbound = 0))/2; n_lbound <= n_rbound; n_j = (n_rbound + n_lbound)/2 ) - switch( COMP_KEYS((struct reiserfs_key *)((char * )p_v_base + n_j * p_n_width), (struct cpu_key *)p_v_key) ) { + switch( comp_keys((struct reiserfs_key *)((char * )p_v_base + n_j * p_n_width), (struct cpu_key *)p_v_key) ) { case -1: n_lbound = n_j + 1; continue; case 1: n_rbound = n_j - 1; continue; case 0: *p_n_pos = n_j; return ITEM_FOUND; /* Key found in the array. */ @@ -301,7 +235,7 @@ const struct reiserfs_key MAX_KEY = {0x of the path, and going upwards. We must check the path's validity at each step. If the key is not in the path, there is no delimiting key in the tree (buffer is first or last buffer in tree), and in this case we return a special key, either MIN_KEY or MAX_KEY. */ -inline const struct reiserfs_key * get_lkey ( +static inline const struct reiserfs_key * get_lkey ( const struct path * p_s_chk_path, const struct super_block * p_s_sb ) { @@ -396,11 +330,11 @@ static inline int key_in_buffer ( RFALSE( !PATH_PLAST_BUFFER(p_s_chk_path)->b_bdev, "PAP-5060: device must not be NODEV"); - if ( COMP_KEYS(get_lkey(p_s_chk_path, p_s_sb), p_s_key) == 1 ) + if ( comp_keys(get_lkey(p_s_chk_path, p_s_sb), p_s_key) == 1 ) /* left delimiting key is bigger, that the key we look for */ return 0; - // if ( COMP_KEYS(p_s_key, get_rkey(p_s_chk_path, p_s_sb)) != -1 ) - if ( COMP_KEYS(get_rkey(p_s_chk_path, p_s_sb), p_s_key) != 1 ) + // if ( comp_keys(p_s_key, get_rkey(p_s_chk_path, p_s_sb)) != -1 ) + if ( comp_keys(get_rkey(p_s_chk_path, p_s_sb), p_s_key) != 1 ) /* p_s_key must be less than right delimitiing key */ return 0; return 1; @@ -745,7 +679,7 @@ io_error: /* only check that the key is in the buffer if p_s_key is not equal to the MAX_KEY. Latter case is only possible in "finish_unfinished()" processing during mount. */ - RFALSE( COMP_KEYS( &MAX_KEY, p_s_key ) && + RFALSE( comp_keys( &MAX_KEY, p_s_key ) && ! key_in_buffer(p_s_search_path, p_s_key, p_s_sb), "PAP-5130: key is not in the buffer"); #ifdef CONFIG_REISERFS_CHECK @@ -1192,7 +1126,7 @@ static char prepare_for_delete_or_cut( } /* Calculate number of bytes which will be deleted or cut during balance */ -int calc_deleted_bytes_number( +static int calc_deleted_bytes_number( struct tree_balance * p_s_tb, char c_mode ) { diff -puN fs/reiserfs/super.c~reiser3-cleanups fs/reiserfs/super.c --- 25/fs/reiserfs/super.c~reiser3-cleanups 2004-11-30 01:24:26.965546336 -0800 +++ 25-akpm/fs/reiserfs/super.c 2004-11-30 01:24:26.996541624 -0800 @@ -31,9 +31,9 @@ struct file_system_type reiserfs_fs_type; -const char reiserfs_3_5_magic_string[] = REISERFS_SUPER_MAGIC_STRING; -const char reiserfs_3_6_magic_string[] = REISER2FS_SUPER_MAGIC_STRING; -const char reiserfs_jr_magic_string[] = REISER2FS_JR_SUPER_MAGIC_STRING; +static const char reiserfs_3_5_magic_string[] = REISERFS_SUPER_MAGIC_STRING; +static const char reiserfs_3_6_magic_string[] = REISER2FS_SUPER_MAGIC_STRING; +static const char reiserfs_jr_magic_string[] = REISER2FS_JR_SUPER_MAGIC_STRING; int is_reiserfs_3_5 (struct reiserfs_super_block * rs) { @@ -106,7 +106,7 @@ static void reiserfs_write_super_lockfs reiserfs_write_unlock(s); } -void reiserfs_unlockfs(struct super_block *s) { +static void reiserfs_unlockfs(struct super_block *s) { reiserfs_allow_writes(s) ; } @@ -554,7 +554,7 @@ static ssize_t reiserfs_quota_write(stru static ssize_t reiserfs_quota_read(struct super_block *, int, char *, size_t, loff_t); #endif -struct super_operations reiserfs_sops = +static struct super_operations reiserfs_sops = { .alloc_inode = reiserfs_alloc_inode, .destroy_inode = reiserfs_destroy_inode, @@ -1277,24 +1277,6 @@ static int read_old_bitmaps (struct supe return 0; } -void check_bitmap (struct super_block * s) -{ - int i = 0; - int free = 0; - char * buf; - - while (i < SB_BLOCK_COUNT (s)) { - buf = SB_AP_BITMAP (s)[i / (s->s_blocksize * 8)].bh->b_data; - if (!reiserfs_test_le_bit (i % (s->s_blocksize * 8), buf)) - free ++; - i ++; - } - - if (free != SB_FREE_BLOCKS (s)) - reiserfs_warning (s,"vs-4000: check_bitmap: %d free blocks, must be %d", - free, SB_FREE_BLOCKS (s)); -} - static int read_super_block (struct super_block * s, int offset) { struct buffer_head * bh; @@ -1422,7 +1404,7 @@ static int reread_meta_blocks(struct sup // FIXME: we look for only one name in a directory. If tea and yura // bith have the same value - we ask user to send report to the // mailing list -__u32 find_hash_out (struct super_block * s) +static __u32 find_hash_out (struct super_block * s) { int retval; struct inode * inode; @@ -1553,7 +1535,7 @@ static hashf_t hash_function (struct sup } // this is used to set up correct value for old partitions -int function2code (hashf_t func) +static int function2code (hashf_t func) { if (func == keyed_hash) return TEA_HASH; diff -puN fs/reiserfs/xattr_acl.c~reiser3-cleanups fs/reiserfs/xattr_acl.c --- 25/fs/reiserfs/xattr_acl.c~reiser3-cleanups 2004-11-30 01:24:26.967546032 -0800 +++ 25-akpm/fs/reiserfs/xattr_acl.c 2004-11-30 01:24:26.997541472 -0800 @@ -9,6 +9,8 @@ #include #include +static int reiserfs_set_acl(struct inode *inode, int type, struct posix_acl *acl); + static int xattr_set_acl(struct inode *inode, int type, const void *value, size_t size) { @@ -243,7 +245,7 @@ reiserfs_get_acl(struct inode *inode, in * inode->i_sem: down * BKL held [before 2.5.x] */ -int +static int reiserfs_set_acl(struct inode *inode, int type, struct posix_acl *acl) { char *name; diff -puN include/linux/reiserfs_acl.h~reiser3-cleanups include/linux/reiserfs_acl.h --- 25/include/linux/reiserfs_acl.h~reiser3-cleanups 2004-11-30 01:24:26.968545880 -0800 +++ 25-akpm/include/linux/reiserfs_acl.h 2004-11-30 01:24:26.997541472 -0800 @@ -50,7 +50,6 @@ static inline int reiserfs_acl_count(siz #ifdef CONFIG_REISERFS_FS_POSIX_ACL struct posix_acl * reiserfs_get_acl(struct inode *inode, int type); -int reiserfs_set_acl(struct inode *inode, int type, struct posix_acl *acl); int reiserfs_acl_chmod (struct inode *inode); int reiserfs_inherit_default_acl (struct inode *dir, struct dentry *dentry, struct inode *inode); int reiserfs_cache_default_acl (struct inode *dir); @@ -60,7 +59,6 @@ extern struct reiserfs_xattr_handler pos extern struct reiserfs_xattr_handler posix_acl_access_handler; #else -#define reiserfs_set_acl NULL #define reiserfs_get_acl NULL #define reiserfs_cache_default_acl(inode) 0 diff -puN include/linux/reiserfs_fs.h~reiser3-cleanups include/linux/reiserfs_fs.h --- 25/include/linux/reiserfs_fs.h~reiser3-cleanups 2004-11-30 01:24:26.970545576 -0800 +++ 25-akpm/include/linux/reiserfs_fs.h 2004-11-30 01:24:27.000541016 -0800 @@ -243,10 +243,6 @@ struct reiserfs_super_block #define REISER2FS_SUPER_MAGIC_STRING "ReIsEr2Fs" #define REISER2FS_JR_SUPER_MAGIC_STRING "ReIsEr3Fs" -extern const char reiserfs_3_5_magic_string[]; -extern const char reiserfs_3_6_magic_string[]; -extern const char reiserfs_jr_magic_string[]; - int is_reiserfs_3_5 (struct reiserfs_super_block * rs); int is_reiserfs_3_6 (struct reiserfs_super_block * rs); int is_reiserfs_jr (struct reiserfs_super_block * rs); @@ -1559,8 +1555,6 @@ struct item_operations { }; -extern struct item_operations stat_data_ops, indirect_ops, direct_ops, - direntry_ops; extern struct item_operations * item_ops [TYPE_ANY + 1]; #define op_bytes_number(ih,bsize) item_ops[le_ih_k_type (ih)]->bytes_number (ih, bsize) @@ -1576,11 +1570,7 @@ extern struct item_operations * item_ops - - -#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 ) @@ -1835,23 +1825,14 @@ int reiserfs_convert_objectid_map_v1(str /* stree.c */ int B_IS_IN_TREE(const struct buffer_head *); -extern inline void copy_short_key (void * to, const void * from); extern void copy_item_head(struct item_head * p_v_to, const struct item_head * p_v_from); // first key is in cpu form, second - le -extern int comp_keys (const struct reiserfs_key * le_key, - const struct cpu_key * cpu_key); extern int comp_short_keys (const struct reiserfs_key * le_key, const struct cpu_key * cpu_key); extern void le_key2cpu_key (struct cpu_key * to, const struct reiserfs_key * from); -// both are cpu keys -extern int comp_cpu_keys (const struct cpu_key *, const struct cpu_key *); -extern int comp_short_cpu_keys (const struct cpu_key *, - const struct cpu_key *); -extern void cpu_key2cpu_key (struct cpu_key *, const struct cpu_key *); - // both are in le form extern int comp_le_keys (const struct reiserfs_key *, const struct reiserfs_key *); extern int comp_short_le_keys (const struct reiserfs_key *, const struct reiserfs_key *); @@ -1881,8 +1862,6 @@ static inline void copy_key (struct reis int comp_items (const struct item_head * stored_ih, const struct path * p_s_path); const struct reiserfs_key * get_rkey (const struct path * p_s_chk_path, const struct super_block * p_s_sb); -inline int bin_search (const void * p_v_key, const void * p_v_base, - int p_n_num, int p_n_width, int * p_n_pos); int search_by_key (struct super_block *, const struct cpu_key *, struct path *, int); #define search_item(s,key,path) search_by_key (s, key, path, DISK_LEAF_NODE_LEVEL) @@ -1960,7 +1939,6 @@ struct dentry *reiserfs_decode_fh(struct int reiserfs_encode_fh( struct dentry *dentry, __u32 *data, int *lenp, int connectable ); -int reiserfs_prepare_write(struct file *, struct page *, unsigned, unsigned) ; int reiserfs_truncate_file(struct inode *, int update_timestamps) ; void make_cpu_key (struct cpu_key * cpu_key, struct inode * inode, loff_t offset, int type, int key_length); @@ -1976,9 +1954,6 @@ int reiserfs_new_inode (struct reiserfs_ const char * symname, loff_t i_size, struct dentry *dentry, struct inode *inode); -int reiserfs_sync_inode (struct reiserfs_transaction_handle *th, - struct inode * inode); - void reiserfs_update_sd_size (struct reiserfs_transaction_handle *th, struct inode * inode, loff_t size); @@ -2077,15 +2052,12 @@ static inline void reiserfs_kfree(const int fix_nodes (int n_op_mode, struct tree_balance * p_s_tb, struct item_head * p_s_ins_ih, const void *); void unfix_nodes (struct tree_balance *); -void free_buffers_in_tb (struct tree_balance * p_s_tb); /* prints.c */ void reiserfs_panic (struct super_block * s, const char * fmt, ...) __attribute__ ( ( noreturn ) ); void reiserfs_info (struct super_block *s, const char * fmt, ...); -void reiserfs_printk (const char * fmt, ...); void reiserfs_debug (struct super_block *s, int level, const char * fmt, ...); -void print_virtual_node (struct virtual_node * vn); void print_indirect_item (struct buffer_head * bh, int item_num); void store_print_tb (struct tree_balance * tb); void print_cur_tb (char * mes); @@ -2095,7 +2067,6 @@ void print_bi (struct buffer_info * bi, #define PRINT_DIRECTORY_ITEMS 2 /* print directory items */ #define PRINT_DIRECT_ITEMS 4 /* print contents of direct items */ void print_block (struct buffer_head * bh, ...); -void print_path (struct tree_balance * tb, struct path * path); void print_bmap (struct super_block * s, int silent); void print_bmap_block (int i, char * data, int size, int silent); /*void print_super_block (struct super_block * s, char * mes);*/ @@ -2136,8 +2107,6 @@ void reiserfs_invalidate_buffer (struct int get_left_neighbor_position (struct tree_balance * tb, int h); int get_right_neighbor_position (struct tree_balance * tb, int h); void replace_key (struct tree_balance * tb, struct buffer_head *, int, struct buffer_head *, int); -void replace_lkey (struct tree_balance *, int, struct item_head *); -void replace_rkey (struct tree_balance *, int, struct item_head *); void make_empty_node (struct buffer_info *); struct buffer_head * get_FEB (struct tree_balance *); @@ -2262,7 +2231,6 @@ __u32 r5_hash (const signed char *msg, i /* prototypes from ioctl.c */ int reiserfs_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, unsigned long arg); -int reiserfs_unpack (struct inode * inode, struct file * filp); /* ioctl's command */ #define REISERFS_IOC_UNPACK _IOW(0xCD,1,long) diff -puN include/linux/reiserfs_fs_sb.h~reiser3-cleanups include/linux/reiserfs_fs_sb.h --- 25/include/linux/reiserfs_fs_sb.h~reiser3-cleanups 2004-11-30 01:24:26.971545424 -0800 +++ 25-akpm/include/linux/reiserfs_fs_sb.h 2004-11-30 01:24:27.001540864 -0800 @@ -501,7 +501,6 @@ enum reiserfs_mount_options { #define reiserfs_error_panic(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_ERROR_PANIC)) #define reiserfs_error_ro(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_ERROR_RO)) -#define reiserfs_error_continue(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_ERROR_CONTINUE)) void reiserfs_file_buffer (struct buffer_head * bh, int list); extern struct file_system_type reiserfs_fs_type; _