some reiser3 cleanups
PATCH 1/1 some reiser3 cleanups
The patch below contains some cleanups for reiser3. It consists of:
- removal of unused code
- making needlessly global code static
Please review this patch.
diffstat output:
fs/reiserfs/bitmap.c | 2 fs/reiserfs/dir.c | 4 - fs/reiserfs/do_balan.c | 6 +- fs/reiserfs/file.c | 14 ++--- fs/reiserfs/fix_node.c | 2 fs/reiserfs/ibalance.c | 4 - fs/reiserfs/inode.c | 18 +------ fs/reiserfs/ioctl.c | 4 + fs/reiserfs/item_ops.c | 10 +-- fs/reiserfs/journal.c | 25 ++------- fs/reiserfs/prints.c | 75 ----------------------------- fs/reiserfs/stree.c | 84 +++------------------------------ fs/reiserfs/super.c | 32 ++---------- fs/reiserfs/xattr_acl.c | 4 + include/linux/reiserfs_acl.h | 2 include/linux/reiserfs_fs.h | 32 ------------ include/linux/reiserfs_fs_sb.h | 1 17 files changed, 56 insertions(+), 263 deletions(-)
Signed-off-by Adrian Bunk <[email protected]>
include/linux/reiserfs_fs.h renamed from include/linux/reiserfs_fs.h.old +0 -32
@@ -243,10 +243,6 @@#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 @@ }; -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 @@ - - -#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 )
@@ -1828,23 +1818,14 @@/* 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 *);
@@ -1874,8 +1855,6 @@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)
@@ -1944,7 +1923,6 @@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);
@@ -1960,9 +1938,6 @@ 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);
@@ -2061,15 +2036,12 @@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);
@@ -2079,7 +2051,6 @@#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);*/
@@ -2120,8 +2091,6 @@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 *);
@@ -2246,7 +2215,6 @@/* 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)
include/linux/reiserfs_fs_sb.h renamed from include/linux/reiserfs_fs_sb.h.old +0 -1
@@ -497,7 +497,6 @@#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;
fs/reiserfs/bitmap.c renamed from fs/reiserfs/bitmap.c.old +1 -1
@@ -405,7 +405,7 @@ }/* 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" );
fs/reiserfs/dir.c renamed from fs/reiserfs/dir.c.old +2 -2
@@ -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 @@ .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);
fs/reiserfs/do_balan.c renamed from fs/reiserfs/do_balan.c.old +3 -3
@@ -1382,7 +1382,7 @@ } -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_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;
fs/reiserfs/file.c renamed from fs/reiserfs/file.c.old +7 -7
@@ -147,7 +147,7 @@/* 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 @@ }/* 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 @@/* 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 @@/* 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 @@/* 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 @@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 @@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 */
fs/reiserfs/fix_node.c renamed from fs/reiserfs/fix_node.c.old +1 -1
@@ -724,7 +724,7 @@ } -void free_buffers_in_tb ( +static void free_buffers_in_tb (struct tree_balance * p_s_tb ) {int n_counter;
fs/reiserfs/ibalance.c renamed from fs/reiserfs/ibalance.c.old +2 -2
@@ -698,7 +698,7 @@/* 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 @@/* 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
fs/reiserfs/inode.c renamed from fs/reiserfs/inode.c.old +5 -13
@@ -32,6 +32,8 @@ struct buffer_head * bh_result, int create);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) {
@@ -408,8 +410,8 @@// 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 ;
@@ -1567,16 +1569,6 @@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,
@@ -2414,7 +2406,7 @@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;
fs/reiserfs/ioctl.c renamed from fs/reiserfs/ioctl.c.old +3 -1
@@ -9,6 +9,8 @@#include <linux/pagemap.h> #include <linux/smp_lock.h> +static int reiserfs_unpack (struct inode * inode,struct file * filp); +/* ** reiserfs_ioctl - handler for ioctl for inode ** supported commands:
@@ -87,7 +89,7 @@** 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 ;
fs/reiserfs/item_ops.c renamed from fs/reiserfs/item_ops.c.old +5 -5
@@ -110,7 +110,7 @@ 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 @@ 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 @@ 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 @@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 @@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,
fs/reiserfs/journal.c renamed from fs/reiserfs/journal.c.old +6 -19
@@ -436,19 +436,6 @@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 @@/* 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 @@ } -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 @@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 @@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 @@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 @@#endif } -void +static void __reiserfs_journal_abort_soft (struct super_block *sb,int errno) {struct reiserfs_journal *journal =SB_JOURNAL (sb);
fs/reiserfs/prints.c renamed from fs/reiserfs/prints.c.old +2 -73
99 lines not on this page · raw message
fs/reiserfs/stree.c renamed from fs/reiserfs/stree.c.old +9 -75
156 lines not on this page · raw message
fs/reiserfs/super.c renamed from fs/reiserfs/super.c.old +7 -25
@@ -28,9 +28,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) {
@@ -102,7 +102,7 @@reiserfs_write_unlock (s); } -void reiserfs_unlockfs (struct super_block *s) { +static void reiserfs_unlockfs (struct super_block *s) {reiserfs_allow_writes (s) ; }
@@ -516,7 +516,7 @@REISERFS_I (inode)->i_acl_default =NULL ; } -struct super_operations reiserfs_sops = +static struct super_operations reiserfs_sops = { .alloc_inode = reiserfs_alloc_inode, .destroy_inode = reiserfs_destroy_inode,
@@ -1125,24 +1125,6 @@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;
@@ -1266,7 +1248,7 @@// 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;
@@ -1397,7 +1379,7 @@ }// 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 ;
include/linux/reiserfs_acl.h renamed from include/linux/reiserfs_acl.h.old +0 -2
@@ -50,7 +50,6 @@#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 posix_acl_access_handler;#else -#define reiserfs_set_acl NULL#define reiserfs_get_acl NULL#define reiserfs_cache_default_acl (inode) 0
fs/reiserfs/xattr_acl.c renamed from fs/reiserfs/xattr_acl.c.old +3 -1
@@ -9,6 +9,8 @@#include <linux/reiserfs_acl.h> #include <asm/uaccess.h> +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 @@* 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;