reiserfs fixups and error handling
cover reiserfs fixups and error handling
This is the first part of a series of patches I've been developing for reiserfs. I'm posting them now for review followed by submission to 2.6.23.
The first 4 patches are small fixes:
* Adding proper lockdep annotation to xattrs
* Switching to panic() instead of BUG() in reiserfs_panic()
* Making is_reusable bitmap sanity checking unconditional
* Using the first zero hint in bitmap iteration
The remaining 7 work to make reiserfs error handling more consistent and robust:
* Use consistent message prefixes for all reiserfs log output
* Add a reiserfs_info() call for multiline output that doesn't masquerade as a warning.
* Make reiserfs_warning() calls more consistent, requiring an ID, and including the device and function where the warning is occuring.
* Make reiserfs_panic() more consistent in the same manner.
* Rearrange reiserfs_journal_abort() since it was modelled after jbd's call and doesn't need to be. There's several function calls that just get optimized out anyway.
* Add a reiserfs_error() call to handle metadata errors by aborting the journal and marking the file system read-only.
* Convert 50 reiserfs_warning(), 2 reiserfs_panic(), and one BUG_ON site to use the new reiserfs_error().,
-Jeff
Signature · 2 lines
Jeff Mahoney SUSE Labs
PATCH 1/11 reiserfs: fix up lockdep warnings
This patch adds I_MUTEX_XATTR annotations to the inode locking in the reiserfs xattr code.
--- fs/reiserfs/xattr.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
fs/reiserfs/xattr.c +3 -2
@@ -478,7 +478,7 @@ reiserfs_xattr_set(struct inode *inode,/* Resize it so we're ok to write there */ newattrs.ia_size = buffer_size; newattrs.ia_valid =ATTR_SIZE |ATTR_CTIME ; -mutex_lock (&xinode->i_mutex); +mutex_lock_nested (&xinode->i_mutex,I_MUTEX_XATTR ); err =notify_change (fp->f_path.dentry, &newattrs);if (err) goto out_filp;
@@ -1217,7 +1217,8 @@ int reiserfs_xattr_init(struct super_bloif (!IS_ERR (dentry)) {if (!(mount_flags &MS_RDONLY ) && !dentry->d_inode) {struct inode *inode = dentry->d_parent->d_inode; -mutex_lock (&inode->i_mutex); +mutex_lock_nested (&inode->i_mutex, +I_MUTEX_XATTR ); err = inode->i_op->mkdir (inode, dentry,0700 );mutex_unlock (&inode->i_mutex);if (err) {
Signature · 2 lines
Jeff Mahoney SUSE Labs
PATCH 2/11 reiserfs: dont use BUG when panicking
In reply to [email protected] This patch changes reiserfs_panic() to use panic() instead of BUG(). Using BUG() ignores the configurable panic behavior, so systems that should be failing and rebooting are left hanging. This causes problems in active/standby HA scenarios.
--- fs/reiserfs/prints.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
fs/reiserfs/prints.c +1 -6
@@ -356,13 +356,8 @@ extern struct tree_balance *cur_tb;void reiserfs_panic (struct super_block *sb,const char *fmt, ...) {do_reiserfs_warning (fmt); -printk (KERN_EMERG "REISERFS: panic (device %s): %s\n" , +panic (KERN_EMERG "REISERFS: panic (device %s): %s\n" ,reiserfs_bdevname (sb), error_buf); -BUG (); - -/* this is not actually called, but makes reiserfs_panic() "noreturn" */ -panic ("REISERFS: panic (device %s): %s\n" , -reiserfs_bdevname (sb), error_buf); }void reiserfs_abort (struct super_block *sb,int errno,const char *fmt, ...)
Signature · 2 lines
Jeff Mahoney SUSE Labs
PATCH 3/11 reiserfs: use is_reusable to catch corruption
In reply to [email protected] This patch builds in is_reusable() unconditionally and uses it to catch corruption before it reaches the block freeing paths.
--
fs/reiserfs/bitmap.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-)
fs/reiserfs/bitmap.c +13 -8
@@ -56,7 +56,6 @@ static inline void get_bit_address(struc *offset = block & ((s->s_blocksize <<3 ) -1 ); } -#ifdef CONFIG_REISERFS_CHECK int is_reusable (struct super_block *s,b_blocknr_t block,int bit_value) {int bmap, offset;
@@ -106,7 +105,6 @@ int is_reusable(struct super_block *s, breturn 1 ; } -#endif /* CONFIG_REISERFS_CHECK */ /* searches in journal structures for a given block number (bmap, off). If block is found in reiserfs journal it suggests next free block candidate to test. */
@@ -434,12 +432,19 @@ void reiserfs_free_block(struct reiserfs int for_unformatted) {struct super_block *s = th->t_super; -BUG_ON (!th->t_trans_id);RFALSE (!s,"vs-4061: trying to free block on nonexistent device" ); -RFALSE (is_reusable (s, block,1 ) ==0 , -"vs-4071: can not free such block" ); +if (!is_reusable (s, block,1 )) +return ; + +if (block >sb_block_count (REISERFS_SB (s)->s_rs)) { +reiserfs_panic (th->t_super,"bitmap-4072" , +"Trying to free block outside file system " +"boundaries (%lu > %lu)" , + block,sb_block_count (REISERFS_SB (s)->s_rs)); +return ; + }/* mark it before we clear it, just in case */ journal_mark_freed (th, s, block);_reiserfs_free_block (th, inode, block, for_unformatted);
@@ -449,11 +454,11 @@ void reiserfs_free_block(struct reiserfsstatic void reiserfs_free_prealloc_block (struct reiserfs_transaction_handle *th,struct inode *inode,b_blocknr_t block) { +BUG_ON (!th->t_trans_id);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" ); -BUG_ON (!th->t_trans_id); +if (!is_reusable (th->t_super, block,1 )) +return ;_reiserfs_free_block (th, inode, block,1 ); }
Signature · 2 lines
Jeff Mahoney SUSE Labs
PATCH 4/11 reiserfs: make bitmap use cached first zero bit
In reply to [email protected]Currently, the bitmap code uses half of the hinting data gathered and cached and wastes the other half. We'll skip completely full bitmaps, but start scanning in bitmaps at locations where if we consulted the zero bit hint, we'd know there aren't any free bits available.
This patch uses the first zero hint to bump the beginning of the search window to where we know there is at least one zero bit.
---
fs/reiserfs/bitmap.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
fs/reiserfs/bitmap.c +4 -1
@@ -166,7 +166,10 @@ static int scan_bitmap_block(struct reisreturn 0 ;// No free blocks in this bitmap } -/* search for a first zero bit -- beggining of a window */ +if (*beg < bi->first_zero_hint) + *beg = bi->first_zero_hint; + +/* search for a first zero bit -- beginning of a window */ *beg =reiserfs_find_next_zero_le_bit ((unsigned long *)(bh->b_data), boundary, *beg);
Signature · 2 lines
Jeff Mahoney SUSE Labs
PATCH 5/11 reiserfs: use more consistent printk formatting
In reply to [email protected]The output format between a warning/error/panic/info/etc changes with which one is used.
The following patch makes the messages more internally consistent, but also more consistent with other Linux filesystems.
--
fs/reiserfs/prints.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)
fs/reiserfs/prints.c +14 -14
@@ -268,10 +268,10 @@ void reiserfs_warning(struct super_block {do_reiserfs_warning (fmt);if (sb) -printk (KERN_WARNING "ReiserFS: %s: warning: %s\n" , -reiserfs_bdevname (sb), error_buf); +printk (KERN_WARNING "REISERFS warning (device %s): %s\n" , + sb->s_id, error_buf);else -printk (KERN_WARNING "ReiserFS: warning: %s\n" , error_buf); +printk (KERN_WARNING "REISERFS warning: %s\n" , error_buf); }/* No newline.. reiserfs_info calls can be followed by printk's */
@@ -279,10 +279,10 @@ void reiserfs_info(struct super_block *s {do_reiserfs_warning (fmt);if (sb) -printk (KERN_NOTICE "ReiserFS: %s: %s" , -reiserfs_bdevname (sb), error_buf); +printk (KERN_NOTICE "REISERFS (device %s): %s" , + sb->s_id, error_buf);else -printk (KERN_NOTICE "ReiserFS: %s" , error_buf); +printk (KERN_NOTICE "REISERFS %s:" , error_buf); }/* No newline.. reiserfs_printk calls can be followed by printk's */
@@ -297,10 +297,10 @@ void reiserfs_debug(struct super_block *#ifdef CONFIG_REISERFS_CHECK do_reiserfs_warning (fmt);if (s) -printk (KERN_DEBUG "ReiserFS: %s: %s\n" , -reiserfs_bdevname (s), error_buf); +printk (KERN_DEBUG "REISERFS debug (device %s): %s\n" , + s->s_id, error_buf);else -printk (KERN_DEBUG "ReiserFS: %s\n" , error_buf); +printk (KERN_DEBUG "REISERFS debug: %s\n" , error_buf);#endif }
@@ -365,15 +365,15 @@ void reiserfs_abort(struct super_block *do_reiserfs_warning (fmt);if (reiserfs_error_panic (sb)) { -panic (KERN_CRIT "REISERFS: panic (device %s): %s\n" , -reiserfs_bdevname (sb), error_buf); +panic (KERN_CRIT "REISERFS panic (device %s): %s\n" , sb->s_id, + error_buf); } -if (sb->s_flags &MS_RDONLY ) +if (reiserfs_is_journal_aborted (SB_JOURNAL (sb)))return ; -printk (KERN_CRIT "REISERFS: abort (device %s): %s\n" , -reiserfs_bdevname (sb), error_buf); +printk (KERN_CRIT "REISERFS abort (device %s): %s\n" , sb->s_id, + error_buf); sb->s_flags |=MS_RDONLY ;reiserfs_journal_abort (sb, errno);
Signature · 2 lines
Jeff Mahoney SUSE Labs
PATCH 6/11 reiserfs: make some warnings informational
In reply to [email protected] In several places, reiserfs_warning is used when there is no warning, just a notice. This patch changes some of them to indicate that the message is merely informational.
--
fs/reiserfs/bitmap.c | 4 ++-- fs/reiserfs/super.c | 14 ++++++-------- fs/reiserfs/xattr.c | 10 ++++------ 3 files changed, 12 insertions(+), 16 deletions(-)
fs/reiserfs/bitmap.c +2 -2
@@ -40,7 +40,7 @@#define SET_OPTION (optname) \ do { \ - reiserfs_warning(s, "reiserfs: option \"%s\" is set", #optname); \ + reiserfs_info(s, "block allocator option \"%s\" is set", #optname); \ set_bit(_ALLOC_ ## optname , &SB_ALLOC_OPTS(s)); \ } while(0)#define TEST_OPTION (optname, s) \
@@ -633,7 +633,7 @@ int reiserfs_parse_alloc_options(structreturn 1 ; } -reiserfs_warning (s,"allocator options = [%08x]\n" ,SB_ALLOC_OPTS (s)); +reiserfs_info (s,"allocator options = [%08x]\n" ,SB_ALLOC_OPTS (s));return 0 ; }
fs/reiserfs/super.c +6 -8
@@ -1308,13 +1308,11 @@ static int read_super_block(struct super/* magic is of non-standard journal filesystem, look at s_version to find which format is in use */ if (sb_version (rs) ==REISERFS_VERSION_2 ) -reiserfs_warning (s, -"read_super_block: found reiserfs format \"3.6\"" -" with non-standard journal" ); +reiserfs_info (s,"found reiserfs format \"3.6\"" +" with non-standard journal\n" );else if (sb_version (rs) ==REISERFS_VERSION_1 ) -reiserfs_warning (s, -"read_super_block: found reiserfs format \"3.5\"" -" with non-standard journal" ); +reiserfs_info (s,"found reiserfs format \"3.5\"" +" with non-standard journal\n" );else {reiserfs_warning (s, "sh-2012: read_super_block: found unknown "
@@ -1393,8 +1391,8 @@ static __u32 find_hash_out(struct super_if (reiserfs_rupasov_hash (s)) { hash =YURA_HASH ; } -reiserfs_warning (s,"FS seems to be empty, autodetect " -"is using the default hash" ); +reiserfs_info (s,"FS seems to be empty, autodetect " +"is using the default hash\n" );break ; } r5hash =GET_HASH_VALUE (r5_hash (de.de_name, de.de_namelen));
fs/reiserfs/xattr.c +4 -6
@@ -1227,12 +1227,10 @@ int reiserfs_xattr_init(struct super_blo }if (dentry && dentry->d_inode) -reiserfs_warning (s, -"Created %s on %s - reserved for " -"xattr storage." , -PRIVROOT_NAME , -reiserfs_bdevname - (inode->i_sb)); +reiserfs_info (s,"Created %s - " +"reserved for xattr " +"storage.\n" , +PRIVROOT_NAME ); }else if (!dentry->d_inode) {dput (dentry); dentry =NULL ;
Signature · 2 lines
Jeff Mahoney SUSE Labs
PATCH 7/11 reiserfs: rework reiserfs_warning
In reply to [email protected] ReiserFS warnings can be somewhat inconsistent.
In some cases:
* a unique identifier may be associated with it
* the function name may be included
* the device may be printed separately
This patch aims to make warnings more consistent. reiserfs_warning() prints the device name, so printing it a second time is not required. The function name for a warning is always helpful in debugging, so it is now automatically inserted into the output. Hans has stated that every warning should have a unique identifier. Some cases lack them, others really shouldn't have them. reiserfs_warning() now expects an id associated with each message. In the rare case where one isn't needed, "" will suffice.
--
fs/reiserfs/bitmap.c | 50 ++++---- fs/reiserfs/do_balan.c | 39 +++--- fs/reiserfs/file.c | 11 + fs/reiserfs/fix_node.c | 14 +- fs/reiserfs/inode.c | 63 +++++------ fs/reiserfs/item_ops.c | 60 +++++----- fs/reiserfs/journal.c | 168 +++++++++++++++-------------- fs/reiserfs/lbalance.c | 12 +- fs/reiserfs/namei.c | 45 +++---- fs/reiserfs/objectid.c | 5 fs/reiserfs/prints.c | 11 + fs/reiserfs/procfs.c | 5 fs/reiserfs/stree.c | 107 ++++++++---------- fs/reiserfs/super.c | 240 ++++++++++++++++++++++-------------------- fs/reiserfs/tail_conversion.c | 6 - fs/reiserfs/xattr.c | 21 ++- include/linux/reiserfs_fs.h | 9 + 17 files changed, 444 insertions(+), 422 deletions(-)
fs/reiserfs/bitmap.c +23 -27
@@ -61,8 +61,8 @@ int is_reusable(struct super_block *s, bint bmap, offset;if (block ==0 || block >=SB_BLOCK_COUNT (s)) { -reiserfs_warning (s, -"vs-4010: is_reusable: block number is out of range %lu (%u)" , +reiserfs_warning (s,"vs-4010" , +"block number is out of range %lu (%u)" , block,SB_BLOCK_COUNT (s));return 0 ; }
@@ -75,30 +75,29 @@ int is_reusable(struct super_block *s, b &(REISERFS_SB(s)->s_properties)))) {b_blocknr_t bmap1 =REISERFS_SB (s)->s_sbh->b_blocknr +1 ;if (block >= bmap1 && block <= bmap1 +SB_BMAP_NR (s)) { -reiserfs_warning (s,"vs: 4019: is_reusable: " -"bitmap block %lu(%u) can't be freed or reused" , +reiserfs_warning (s,"vs-4019" ,"bitmap block " +"%lu(%u) can't be freed or reused" , block,SB_BMAP_NR (s));return 0 ; } } else {if (offset ==0 ) { -reiserfs_warning (s,"vs: 4020: is_reusable: " -"bitmap block %lu(%u) can't be freed or reused" , +reiserfs_warning (s,"vs-4020" ,"bitmap block " +"%lu(%u) can't be freed or reused" , block,SB_BMAP_NR (s));return 0 ; } }if (bmap >=SB_BMAP_NR (s)) { -reiserfs_warning (s, -"vs-4030: is_reusable: there is no so many bitmap blocks: " -"block=%lu, bitmap_nr=%d" , block, bmap); +reiserfs_warning (s,"vs-4030" ,"there is no so many " +"bitmap blocks: block=%lu, bitmap_nr=%d" , + block, bmap);return 0 ; }if (bit_value ==0 && block ==SB_ROOT_BLOCK (s)) { -reiserfs_warning (s, -"vs-4050: is_reusable: this is root block (%u), " +reiserfs_warning (s,"vs-4050" ,"this is root block (%u), " "it must be busy" ,SB_ROOT_BLOCK (s));return 0 ; }
@@ -150,8 +149,8 @@ static int scan_bitmap_block(struct reis/* - I mean `a window of zero bits' as in description of this function - Zam. */ if (!bi) { -reiserfs_warning (s,"NULL bitmap info pointer for bitmap %d" , - bmap_n); +reiserfs_warning (s,"jdm-4055" ,"NULL bitmap info pointer " +"for bitmap %d" , bmap_n);return 0 ; }
@@ -399,9 +398,8 @@ static void _reiserfs_free_block(structget_bit_address (s, block, &nr, &offset);if (nr >=sb_bmap_nr (rs)) { -reiserfs_warning (s,"vs-4075: reiserfs_free_block: " -"block %lu is out of range on %s" , - block,reiserfs_bdevname (s)); +reiserfs_warning (s,"vs-4075" , +"block %lu is out of range" , block);return ; }
@@ -413,9 +411,8 @@ static void _reiserfs_free_block(struct/* clear bit for the given block in bit map */ if (!reiserfs_test_and_clear_le_bit (offset, bmbh->b_data)) { -reiserfs_warning (s,"vs-4080: reiserfs_free_block: " -"free_block (%s:%lu)[dev:blocknr]: bit already cleared" , -reiserfs_bdevname (s), block); +reiserfs_warning (s,"vs-4080" , +"block %lu: bit already cleared" , block); } apbi[nr].free_count++;journal_mark_dirty (th, s, bmbh);
@@ -474,9 +471,8 @@ static void __discard_prealloc(struct reBUG_ON (!th->t_trans_id);#ifdef CONFIG_REISERFS_CHECK if (ei->i_prealloc_count <0 ) -reiserfs_warning (th->t_super, -"zam-4001:%s: inode has negative prealloc blocks count." , - __FUNCTION__); +reiserfs_warning (th->t_super,"zam-4001" , +"inode has negative prealloc blocks count." );#endif while (ei->i_prealloc_count >0 ) {reiserfs_free_prealloc_block (th, inode, ei->i_prealloc_block);
@@ -512,9 +508,9 @@ void reiserfs_discard_all_prealloc(struc i_prealloc_list);#ifdef CONFIG_REISERFS_CHECK if (!ei->i_prealloc_count) { -reiserfs_warning (th->t_super, -"zam-4001:%s: inode is in prealloc list but has no preallocated blocks." , - __FUNCTION__); +reiserfs_warning (th->t_super,"zam-4001" , +"inode is in prealloc list but has " +"no preallocated blocks." ); }#endif __discard_prealloc (th, ei);
@@ -628,8 +624,8 @@ int reiserfs_parse_alloc_options(structcontinue ; } -reiserfs_warning (s,"zam-4001: %s : unknown option - %s" , - __FUNCTION__, this_char); +reiserfs_warning (s,"zam-4001" ,"unknown option - %s" , + this_char);return 1 ; }
fs/reiserfs/do_balan.c +19 -20
@@ -1755,15 +1755,15 @@ static void store_thrown(struct tree_balint i;if (buffer_dirty (bh)) -reiserfs_warning (tb->tb_sb, -"store_thrown deals with dirty buffer" ); +reiserfs_warning (tb->tb_sb,"reiserfs-12320" , +"called with dirty buffer" );for (i =0 ; i <ARRAY_SIZE (tb->thrown); i++)if (!tb->thrown[i]) { tb->thrown[i] = bh;get_bh (bh);/* free_thrown puts this */ return ; } -reiserfs_warning (tb->tb_sb,"store_thrown: too many thrown buffers" ); +reiserfs_warning (tb->tb_sb,"reiserfs-12321" ,"too many thrown buffers" ); }static void free_thrown (struct tree_balance *tb)
@@ -1774,8 +1774,8 @@ static void free_thrown(struct tree_balaif (tb->thrown[i]) { blocknr = tb->thrown[i]->b_blocknr;if (buffer_dirty (tb->thrown[i])) -reiserfs_warning (tb->tb_sb, -"free_thrown deals with dirty buffer %d" , +reiserfs_warning (tb->tb_sb,"reiserfs-12322" , +"called with dirty buffer %d" , blocknr);brelse (tb->thrown[i]);/* incremented in store_thrown */ reiserfs_free_block(tb->transaction_handle, NULL,
@@ -1880,13 +1880,12 @@ static void check_internal_node(struct s } } -static int locked_or_not_in_tree (struct buffer_head *bh,char *which) +static int locked_or_not_in_tree (struct tree_balance *tb, +struct buffer_head *bh,char *which) {if ((!buffer_journal_prepared (bh) &&buffer_locked (bh)) || !B_IS_IN_TREE (bh)) { -reiserfs_warning (NULL , -"vs-12339: locked_or_not_in_tree: %s (%b)" , - which, bh); +reiserfs_warning (tb->tb_sb,"vs-12339" ,"%s (%b)" , which, bh);return 1 ; }return 0 ;
@@ -1905,18 +1904,19 @@ static int check_before_balancing(struct/* double check that buffers that we will modify are unlocked. (fix_nodes should already have prepped all of these for us). */ if (tb->lnum[0 ]) { - retval |=locked_or_not_in_tree (tb->L[0 ],"L[0]" ); - retval |=locked_or_not_in_tree (tb->FL[0 ],"FL[0]" ); - retval |=locked_or_not_in_tree (tb->CFL[0 ],"CFL[0]" ); + retval |=locked_or_not_in_tree (tb, tb->L[0 ],"L[0]" ); + retval |=locked_or_not_in_tree (tb, tb->FL[0 ],"FL[0]" ); + retval |=locked_or_not_in_tree (tb, tb->CFL[0 ],"CFL[0]" );check_leaf (tb->L[0 ]); }if (tb->rnum[0 ]) { - retval |=locked_or_not_in_tree (tb->R[0 ],"R[0]" ); - retval |=locked_or_not_in_tree (tb->FR[0 ],"FR[0]" ); - retval |=locked_or_not_in_tree (tb->CFR[0 ],"CFR[0]" ); + retval |=locked_or_not_in_tree (tb, tb->R[0 ],"R[0]" ); + retval |=locked_or_not_in_tree (tb, tb->FR[0 ],"FR[0]" ); + retval |=locked_or_not_in_tree (tb, tb->CFR[0 ],"CFR[0]" );check_leaf (tb->R[0 ]); } - retval |=locked_or_not_in_tree (PATH_PLAST_BUFFER (tb->tb_path),"S[0]" ); + retval |=locked_or_not_in_tree (tb,PATH_PLAST_BUFFER (tb->tb_path), +"S[0]" );check_leaf (PATH_PLAST_BUFFER (tb->tb_path));return retval;
@@ -1955,7 +1955,7 @@ static void check_after_balance_leaf(strPATH_H_POSITION (tb->tb_path, 1))));print_cur_tb ("12223" ); - reiserfs_warning(tb->tb_sb, + reiserfs_warning(tb->tb_sb, "reiserfs-12363", "B_FREE_SPACE (PATH_H_PBUFFER(tb->tb_path,0)) = %d; " "MAX_CHILD_SIZE (%d) - dc_size( %y, %d ) [%d] = %d", left,
@@ -2107,9 +2107,8 @@ void do_balance(struct tree_balance *tb, }/* if we have no real work to do */ if (!tb->insert_size[0 ]) { -reiserfs_warning (tb->tb_sb, -"PAP-12350: do_balance: insert_size == 0, mode == %c" , - flag); +reiserfs_warning (tb->tb_sb,"PAP-12350" , +"insert_size == 0, mode == %c" , flag);unfix_nodes (tb);return ; }
fs/reiserfs/file.c +6 -5
@@ -76,7 +76,7 @@ static int reiserfs_file_release(struct* and let the admin know what is going on. */ igrab (inode); -reiserfs_warning (inode->i_sb, +reiserfs_warning (inode->i_sb,"clm-9001" ,"pinning inode %lu because the " "preallocation can't be freed" , inode->i_ino);
@@ -397,7 +397,8 @@ static int reiserfs_allocate_blocks_for_if (res != -ENOSPC ) {reiserfs_warning (inode-> i_sb, -"green-9008: search_by_key (%K) returned %d" , +"green-9008" , +"search_by_key (%K) returned %d" , &key, res); }
@@ -599,7 +600,8 @@ static int reiserfs_allocate_blocks_for_occured, we need to warn user and return error */ if (res != -ENOSPC ) {reiserfs_warning (inode->i_sb, -"green-9009: search_by_key (%K) " +"green-9009" , +"search_by_key (%K) " "returned %d" , &key, res); }
@@ -1015,8 +1017,7 @@ static int reiserfs_prepare_file_region_int item_pos =-1 ;/* Position in indirect item */ if (num_pages <1 ) { -reiserfs_warning (inode->i_sb, -"green-9001: reiserfs_prepare_file_region_for_write " +reiserfs_warning (inode->i_sb,"green-9001" ,"called with zero number of pages to process" );return -EFAULT ; }
fs/reiserfs/fix_node.c +7 -7
@@ -496,8 +496,8 @@ static int get_num_ver(int mode, struct snum012[needed_nodes -1 +3 ] = units;if (needed_nodes >2 ) -reiserfs_warning (tb->tb_sb,"vs-8111: get_num_ver: " -"split_item_position is out of boundary" ); +reiserfs_warning (tb->tb_sb,"vs-8111" , +"split_item_position is out of range" ); snum012[needed_nodes -1 ]++; split_item_positions[needed_nodes -1 ] = i; needed_nodes++;
@@ -533,8 +533,8 @@ static int get_num_ver(int mode, structif (vn->vn_vi[split_item_num].vi_index !=TYPE_DIRENTRY && vn->vn_vi[split_item_num].vi_index !=TYPE_INDIRECT ) -reiserfs_warning (tb->tb_sb,"vs-8115: get_num_ver: not " -"directory or indirect item" ); +reiserfs_warning (tb->tb_sb,"vs-8115" , +"not directory or indirect item" ); }/* now we know S2bytes, calculate S1bytes */
@@ -2266,9 +2266,9 @@ static int wait_tb_buffers_until_unlocke#ifdef CONFIG_REISERFS_CHECK repeat_counter++;if ((repeat_counter %10000 ) ==0 ) { -reiserfs_warning (p_s_tb->tb_sb, -"wait_tb_buffers_until_released(): too many " -"iterations waiting for buffer to unlock " +reiserfs_warning (p_s_tb->tb_sb,"reiserfs-8200" , +"too many iterations waiting " +"for buffer to unlock " "(%b)" , locked);/* Don't loop forever. Try to recover from possible error. */
fs/reiserfs/inode.c +30 -33
157 lines not on this page · raw message
fs/reiserfs/item_ops.c +32 -28
153 lines not on this page · raw message
fs/reiserfs/journal.c +89 -79
422 lines not on this page · raw message
fs/reiserfs/lbalance.c +8 -4
@@ -1287,12 +1287,16 @@ void leaf_paste_entries(struct buffer_he prev = (i !=0 ) ?deh_location (&(deh[i -1 ])) :0 ;if (prev && prev <=deh_location (&(deh[i]))) -reiserfs_warning (NULL , -"vs-10240: leaf_paste_entries: directory item (%h) corrupted (prev %a, cur(%d) %a)" , +reiserfs_warning (NULL ,"vs-10240" , +"directory item (%h) " +"corrupted (prev %a, " +"cur(%d) %a)" , ih, deh + i -1 , i, deh + i);if (next && next >=deh_location (&(deh[i]))) -reiserfs_warning (NULL , -"vs-10250: leaf_paste_entries: directory item (%h) corrupted (cur(%d) %a, next %a)" , +reiserfs_warning (NULL ,"vs-10250" , +"directory item (%h) " +"corrupted (cur(%d) %a, " +"next %a)" , ih, i, deh + i, deh + i +1 ); } }
fs/reiserfs/namei.c +21 -24
99 lines not on this page · raw message
fs/reiserfs/objectid.c +2 -3
@@ -61,7 +61,7 @@ __u32 reiserfs_get_unused_objectid(struc/* comment needed -Hans */ unused_objectid =le32_to_cpu (map[1 ]);if (unused_objectid ==U32_MAX ) { -reiserfs_warning (s,"%s: no more object ids" , __FUNCTION__); +reiserfs_warning (s,"reiserfs-15100" ,"no more object ids" );reiserfs_restore_prepared_buffer (s,SB_BUFFER_WITH_SB (s));return 0 ; }
@@ -161,8 +161,7 @@ void reiserfs_release_objectid(struct re i +=2 ; } -reiserfs_warning (s, -"vs-15011: reiserfs_release_objectid: tried to free free object id (%lu)" , +reiserfs_warning (s,"vs-15011" ,"tried to free free object id (%lu)" , (long unsigned )objectid_to_release); }
fs/reiserfs/prints.c +7 -4
@@ -264,14 +264,17 @@ static void prepare_error_buf(const charva_end ( args );\ } -void reiserfs_warning (struct super_block *sb,const char *fmt, ...) +void __reiserfs_warning (struct super_block *sb,const char *id, +const char *function,const char *fmt, ...) {do_reiserfs_warning (fmt);if (sb) -printk (KERN_WARNING "REISERFS warning (device %s): %s\n" , - sb->s_id, error_buf); +printk (KERN_WARNING "REISERFS warning (device %s): %s%s%s: %s\n" , + sb->s_id, id ? id :"" , id ?" " :"" , + function, error_buf);else -printk (KERN_WARNING "REISERFS warning: %s\n" , error_buf); +printk (KERN_WARNING "REISERFS warning: %s%s%s: %s\n" , + id ? id :"" , id ?" " :"" , function, error_buf); }/* No newline.. reiserfs_info calls can be followed by printk's */
fs/reiserfs/procfs.c +2 -3
@@ -514,7 +514,7 @@ int reiserfs_proc_info_init(struct superadd_file (sb,"journal" , show_journal);return 0 ; } -reiserfs_warning (sb,"reiserfs: cannot create /proc/%s/%s" , +reiserfs_warning (sb,"cannot create /proc/%s/%s" , proc_info_root_name, b);return 1 ; }
@@ -570,8 +570,7 @@ int reiserfs_proc_info_global_init(void)if (proc_info_root) { proc_info_root->owner =THIS_MODULE ; }else { -reiserfs_warning (NULL , -"reiserfs: cannot create /proc/%s" , +reiserfs_warning (NULL ,"cannot create /proc/%s" , proc_info_root_name);return 1 ; }
fs/reiserfs/stree.c +50 -57
258 lines not on this page · raw message
fs/reiserfs/super.c +126 -114
561 lines not on this page · raw message
fs/reiserfs/tail_conversion.c +3 -3
@@ -48,9 +48,9 @@ int direct2indirect(struct reiserfs_tran// FIXME: we could avoid this if (search_for_position_by_key (sb, &end_key, path) ==POSITION_FOUND ) { -reiserfs_warning (sb,"PAP-14030: direct2indirect: " -"pasted or inserted byte exists in the tree %K. " -"Use fsck to repair." , &end_key); +reiserfs_warning (sb,"PAP-14030" , +"pasted or inserted byte exists in " +"the tree %K. Use fsck to repair." , &end_key);pathrelse (path);return -EIO ; }
fs/reiserfs/xattr.c +13 -8
@@ -278,7 +278,8 @@ static int __xattr_readdir(struct file * ih = de.de_ih;if (!is_direntry_le_ih (ih)) { -reiserfs_warning (inode->i_sb,"not direntry %h" , ih); +reiserfs_warning (inode->i_sb,"jdm-20000" , +"not direntry %h" , ih);break ; }copy_item_head (&tmp_ih, ih);
@@ -619,7 +620,7 @@ reiserfs_xattr_get(const struct inode *iif (rxh->h_magic !=cpu_to_le32 (REISERFS_XATTR_MAGIC )) {unlock_page (page);reiserfs_put_page (page); -reiserfs_warning (inode->i_sb, +reiserfs_warning (inode->i_sb,"jdm-20001" ,"Invalid magic for xattr (%s) " "associated with %k" , name,INODE_PKEY (inode));
@@ -639,7 +640,7 @@ reiserfs_xattr_get(const struct inode *iif (xattr_hash (buffer, isize -sizeof (struct reiserfs_xattr_header )) != hash) { -reiserfs_warning (inode->i_sb, +reiserfs_warning (inode->i_sb,"jdm-20002" ,"Invalid hash for xattr (%s) associated " "with %k" , name,INODE_PKEY (inode)); err = -EIO ;
@@ -673,7 +674,8 @@ __reiserfs_xattr_del(struct dentry *xadi goto out_file;if (!is_reiserfs_priv_object (dentry->d_inode)) { - reiserfs_warning(dir->i_sb, "OID %08x [%.*s/%.*s] doesn't have " + reiserfs_warning(dir->i_sb, "jdm-20003", + "OID %08x [%.*s/%.*s] doesn't have " "priv flag set [parent is %sset].", le32_to_cpu(INODE_PKEY(dentry->d_inode)-> k_objectid), xadir->d_name.len,
@@ -779,7 +781,7 @@ int reiserfs_delete_xattrs(struct inodereiserfs_write_unlock_xattrs (inode->i_sb);dput (root); }else { -reiserfs_warning (inode->i_sb, +reiserfs_warning (inode->i_sb,"jdm-20004" ,"Couldn't remove all entries in directory" ); }unlock_kernel ();
@@ -1199,7 +1201,8 @@ int reiserfs_xattr_init(struct super_blo }else if (reiserfs_xattrs_optional (s)) {/* Old format filesystem, but optional xattrs have been enabled * at mount time. Error out. */ -reiserfs_warning (s,"xattrs/ACLs not supported on pre v3.6 " +reiserfs_warning (s,"jdm-20005" , +"xattrs/ACLs not supported on pre v3.6 " "format filesystem. Failing mount." ); err = -EOPNOTSUPP ; goto error;
@@ -1246,8 +1249,10 @@ int reiserfs_xattr_init(struct super_blo/* If we're read-only it just means that the dir hasn't been * created. Not an error -- just no xattrs on the fs. We'll * check again if we go read-write */ -reiserfs_warning (s,"xattrs/ACLs enabled and couldn't " -"find/create .reiserfs_priv. Failing mount." ); +reiserfs_warning (s,"jdm-20006" , +"xattrs/ACLs enabled and couldn't " +"find/create .reiserfs_priv. " +"Failing mount." ); err = -EOPNOTSUPP ; } }
include/linux/reiserfs_fs.h +6 -3
@@ -77,7 +77,10 @@*/ #define REISERFS_DEBUG_CODE 5/* extra messages to help find/debug errors */ -void reiserfs_warning (struct super_block *s,const char *fmt, ...); +void __reiserfs_warning (struct super_block *s,const char *id, +const char *func,const char *fmt, ...); +#define reiserfs_warning(s, id, fmt, args...) \ + __reiserfs_warning(s, id, __FUNCTION__, fmt, ##args)/* assertions handling */ /** always check a condition and panic if it's false. */
@@ -538,7 +541,7 @@ static inline int uniqueness2type(__u32case V1_DIRENTRY_UNIQUENESS :return TYPE_DIRENTRY ;default : -reiserfs_warning (NULL ,"vs-500: unknown uniqueness %d" , +reiserfs_warning (NULL ,"vs-500" ,"unknown uniqueness %d" , uniqueness);case V1_ANY_UNIQUENESS :return TYPE_ANY ;
@@ -558,7 +561,7 @@ static inline __u32 type2uniqueness(intcase TYPE_DIRENTRY :return V1_DIRENTRY_UNIQUENESS ;default : -reiserfs_warning (NULL ,"vs-501: unknown type %d" , type); +reiserfs_warning (NULL ,"vs-501" ,"unknown type %d" , type);case TYPE_ANY :return V1_ANY_UNIQUENESS ; }
Signature · 2 lines
Jeff Mahoney SUSE Labs
PATCH 8/11 reiserfs: rework reiserfs_panic
In reply to [email protected] ReiserFS panics can be somewhat inconsistent.
In some cases:
* a unique identifier may be associated with it
* the function name may be included
* the device may be printed separately
This patch aims to make warnings more consistent. reiserfs_warning() prints the device name, so printing it a second time is not required. The function name for a warning is always helpful in debugging, so it is now automatically inserted into the output. Hans has stated that every warning should have a unique identifier. Some cases lack them, others really shouldn't have them. reiserfs_warning() now expects an id associated with each message. In the rare case where one isn't needed, "" will suffice.
--- fs/reiserfs/do_balan.c | 60 ++++++++++++++++------------------ fs/reiserfs/file.c | 32 ++++++++++-------- fs/reiserfs/fix_node.c | 74 +++++++++++++++++++++--------------------- fs/reiserfs/ibalance.c | 12 +++--- fs/reiserfs/inode.c | 3 - fs/reiserfs/item_ops.c | 8 ++-- fs/reiserfs/journal.c | 56 +++++++++++++++---------------- fs/reiserfs/lbalance.c | 27 ++++++++------- fs/reiserfs/namei.c | 18 ++++------ fs/reiserfs/objectid.c | 3 - fs/reiserfs/prints.c | 34 ++++++++++--------- fs/reiserfs/stree.c | 49 +++++++++++++-------------- fs/reiserfs/tail_conversion.c | 10 ++--- include/linux/reiserfs_fs.h | 23 ++++++++++--- 14 files changed, 212 insertions(+), 197 deletions(-)
fs/reiserfs/do_balan.c +29 -31
@@ -153,8 +153,8 @@ static int balance_leaf_when_delete(strudefault :print_cur_tb ("12040" ); - reiserfs_panic(tb->tb_sb, - "PAP-12040: balance_leaf_when_delete: unexpectable mode: %s(%d)", + reiserfs_panic(tb->tb_sb, "PAP-12040", + "unexpected mode: %s(%d)", (flag == M_PASTE) ? "PASTE" : ((flag == M_INSERT) ? "INSERT" :
@@ -722,8 +722,8 @@ static int balance_leaf(struct tree_bala }break ;default :/* cases d and t */ - reiserfs_panic(tb->tb_sb, - "PAP-12130: balance_leaf: lnum > 0: unexpectable mode: %s(%d)", + reiserfs_panic(tb->tb_sb, "PAP-12130", + "lnum > 0: unexpected mode: %s(%d)", (flag == M_DELETE) ? "DELETE" : ((flag == M_CUT)
@@ -1136,8 +1136,8 @@ static int balance_leaf(struct tree_bala }break ;default :/* cases d and t */ - reiserfs_panic(tb->tb_sb, - "PAP-12175: balance_leaf: rnum > 0: unexpectable mode: %s(%d)", + reiserfs_panic(tb->tb_sb, "PAP-12175", + "rnum > 0: unexpected mode: %s(%d)", (flag == M_DELETE) ? "DELETE" : ((flag == M_CUT) ? "CUT"
@@ -1167,8 +1167,8 @@ static int balance_leaf(struct tree_balanot set correctly */ if (tb->CFL[0 ]) {if (!tb->CFR[0 ]) -reiserfs_panic (tb->tb_sb, -"vs-12195: balance_leaf: CFR not initialized" ); +reiserfs_panic (tb->tb_sb,"vs-12195" , +"CFR not initialized" );copy_key (B_N_PDELIM_KEY (tb->CFL[0 ], tb->lkey[0 ]),B_N_PDELIM_KEY (tb->CFR[0 ], tb->rkey[0 ]));do_balance_mark_internal_dirty (tb, tb->CFL[0 ],0 );
@@ -1475,7 +1475,8 @@ static int balance_leaf(struct tree_bala && (pos_in_item != ih_item_len(ih) || tb->insert_size[0] <= 0))reiserfs_panic (tb->tb_sb, -"PAP-12235: balance_leaf: pos_in_item must be equal to ih_item_len" ); +"PAP-12235" , +"pos_in_item must be equal to ih_item_len" );#endif /* CONFIG_REISERFS_CHECK */ ret_val =
@@ -1535,8 +1536,8 @@ static int balance_leaf(struct tree_bala }break ;default :/* cases d and t */ - reiserfs_panic(tb->tb_sb, - "PAP-12245: balance_leaf: blknum > 2: unexpectable mode: %s(%d)", + reiserfs_panic(tb->tb_sb, "PAP-12245", + "blknum > 2: unexpected mode: %s(%d)", (flag == M_DELETE) ? "DELETE" : ((flag == M_CUT) ? "CUT"
@@ -1681,7 +1682,7 @@ static int balance_leaf(struct tree_balaprint_cur_tb ("12285" );reiserfs_panic (tb-> tb_sb, -"PAP-12285: balance_leaf: insert_size must be 0 (%d)" , +"PAP-12285" ,"insert_size must be 0 (%d)" , tb-> insert_size [0 ]);
@@ -1697,11 +1698,10 @@ static int balance_leaf(struct tree_balaif (flag ==M_PASTE && tb->insert_size[0 ]) {print_cur_tb ("12290" );reiserfs_panic (tb->tb_sb, -"PAP-12290: balance_leaf: insert_size is still not 0 (%d)" , - tb->insert_size[0 ]); +"PAP-12290" ,"insert_size is still not 0 (%d)" , + tb->insert_size[0 ]); }#endif /* CONFIG_REISERFS_CHECK */ -return 0 ; }/* Leaf level of the tree is balanced (end of balance_leaf) */
@@ -1732,8 +1732,7 @@ struct buffer_head *get_FEB(struct tree_break ;if (i ==MAX_FEB_SIZE ) -reiserfs_panic (tb->tb_sb, -"vs-12300: get_FEB: FEB list is empty" ); +reiserfs_panic (tb->tb_sb,"vs-12300" ,"FEB list is empty" ); bi.tb = tb; bi.bi_bh = first_b = tb->FEB[i];
@@ -1776,7 +1775,7 @@ static void free_thrown(struct tree_balaif (buffer_dirty (tb->thrown[i]))reiserfs_warning (tb->tb_sb,"reiserfs-12322" ,"called with dirty buffer %d" , - blocknr); + blocknr);brelse (tb->thrown[i]);/* incremented in store_thrown */ reiserfs_free_block (tb->transaction_handle,NULL , blocknr,0 );
@@ -1873,8 +1872,8 @@ static void check_internal_node(struct sfor (i =0 ; i <=B_NR_ITEMS (bh); i++, dc++) {if (!is_reusable (s,dc_block_number (dc),1 )) {print_cur_tb (mes); -reiserfs_panic (s, -"PAP-12338: check_internal_node: invalid child pointer %y in %b" , +reiserfs_panic (s,"PAP-12338" , +"invalid child pointer %y in %b" , dc, bh); } }
@@ -1896,9 +1895,10 @@ static int check_before_balancing(structint retval =0 ;if (cur_tb) { -reiserfs_panic (tb->tb_sb,"vs-12335: check_before_balancing: " -"suspect that schedule occurred based on cur_tb not being null at this point in code. " -"do_balance cannot properly handle schedule occurring while it runs." ); +reiserfs_panic (tb->tb_sb,"vs-12335" ,"suspect that schedule " +"occurred based on cur_tb not being null at " +"this point in code. do_balance cannot properly " +"handle schedule occurring while it runs." ); }/* double check that buffers that we will modify are unlocked. (fix_nodes should already have
@@ -1930,8 +1930,8 @@ static void check_after_balance_leaf(str dc_size(B_N_CHILD (tb->FL[0], get_left_neighbor_position(tb, 0)))) {print_cur_tb ("12221" ); -reiserfs_panic (tb->tb_sb, -"PAP-12355: check_after_balance_leaf: shift to left was incorrect" ); +reiserfs_panic (tb->tb_sb,"PAP-12355" , +"shift to left was incorrect" ); } }if (tb->rnum[0 ]) {
@@ -1940,8 +1940,8 @@ static void check_after_balance_leaf(str dc_size(B_N_CHILD (tb->FR[0], get_right_neighbor_position(tb, 0)))) {print_cur_tb ("12222" ); -reiserfs_panic (tb->tb_sb, -"PAP-12360: check_after_balance_leaf: shift to right was incorrect" ); +reiserfs_panic (tb->tb_sb,"PAP-12360" , +"shift to right was incorrect" ); } } if (PATH_H_PBUFFER(tb->tb_path, 1) &&
@@ -1966,8 +1966,7 @@ static void check_after_balance_leaf(str (PATH_H_PBUFFER (tb->tb_path,1 ), PATH_H_POSITION(tb->tb_path, 1))), right); -reiserfs_panic (tb->tb_sb, -"PAP-12365: check_after_balance_leaf: S is incorrect" ); +reiserfs_panic (tb->tb_sb,"PAP-12365" ,"S is incorrect" ); } }
@@ -2102,8 +2101,7 @@ void do_balance(struct tree_balance *tb, tb->need_balance_dirty =0 ;if (FILESYSTEM_CHANGED_TB (tb)) { -reiserfs_panic (tb->tb_sb, -"clm-6000: do_balance, fs generation has changed\n" ); +reiserfs_panic (tb->tb_sb,"clm-6000" ,"fs generation has changed" ); }/* if we have no real work to do */ if (!tb->insert_size[0 ]) {
fs/reiserfs/file.c +18 -14
@@ -413,7 +413,8 @@ static int reiserfs_allocate_blocks_for_ (char *)zeros); }else {reiserfs_panic (inode->i_sb, -"green-9011: Unexpected key type %K\n" , +"green-9011" , +"Unexpected key type %K" , &key); }if (res) {
@@ -615,9 +616,8 @@ static int reiserfs_allocate_blocks_for_ (char *)(allocated_blocks + curr_block)); }else { -reiserfs_panic (inode->i_sb, -"green-9010: unexpected item type for key %K\n" , - &key); +reiserfs_panic (inode->i_sb,"green-9010" , +"unexpected item type for key %K" , &key); } }// the caller is responsible for closing the transaction
@@ -642,15 +642,16 @@ static int reiserfs_allocate_blocks_for_int block_start, block_end;// in-page offsets for buffers. if (!page_buffers (page)) -reiserfs_panic (inode->i_sb, -"green-9005: No buffers for prepared page???" ); +reiserfs_panic (inode->i_sb,"green-9005" , +"No buffers for prepared page???" );/* For each buffer in page */ for (bh = head, block_start =0 ; bh != head || !block_start; block_start = block_end, bh = bh->b_this_page) {if (!bh) -reiserfs_panic (inode->i_sb, -"green-9006: Allocated but absent buffer for a page?" ); +reiserfs_panic (inode->i_sb,"green-9006" , +"Allocated but absent buffer " +"for a page?" ); block_end = block_start + inode->i_sb->s_blocksize;if (i ==0 && block_end <= from)/* if this buffer is before requested data to map, skip it */
@@ -1091,8 +1092,9 @@ static int reiserfs_prepare_file_region_for (bh = head, block_start =0 ; bh != head || !block_start; block_start = block_end, bh = bh->b_this_page) {if (!bh) -reiserfs_panic (inode->i_sb, -"green-9002: Allocated but absent buffer for a page?" ); +reiserfs_panic (inode->i_sb,"green-9002" , +"Allocated but absent " +"buffer for a page?" );/* Find where this buffer ends */ block_end = block_start + inode->i_sb->s_blocksize;if (i ==0 && block_end <= from)
@@ -1178,8 +1180,9 @@ static int reiserfs_prepare_file_region_ block_start = block_end, bh = bh->b_this_page) {if (!bh) -reiserfs_panic (inode->i_sb, -"green-9002: Allocated but absent buffer for a page?" ); +reiserfs_panic (inode->i_sb,"green-9002" , +"Allocated but absent " +"buffer for a page?" );/* Find where this buffer ends */ block_end = block_start + inode->i_sb->s_blocksize;if (block_end <= from)
@@ -1212,8 +1215,9 @@ static int reiserfs_prepare_file_region_ block_start = block_end, bh = bh->b_this_page) {if (!bh) -reiserfs_panic (inode->i_sb, -"green-9002: Allocated but absent buffer for a page?" ); +reiserfs_panic (inode->i_sb,"green-9002" , +"Allocated but absent " +"buffer for a page?" );/* Find where this buffer ends */ block_end = block_start + inode->i_sb->s_blocksize;if (block_start >= to)
fs/reiserfs/fix_node.c +38 -36
147 lines not on this page · raw message
fs/reiserfs/ibalance.c +6 -6
@@ -105,8 +105,8 @@ static void internal_define_dest_src_infbreak ;default : -reiserfs_panic (tb->tb_sb, -"internal_define_dest_src_infos: shift type is unknown (%d)" , +reiserfs_panic (tb->tb_sb,"ibalance-1" , +"shift type is unknown (%d)" , shift_mode); } }
@@ -702,8 +702,8 @@ static void balance_internal_when_deletereturn ; } -reiserfs_panic (tb->tb_sb, -"balance_internal_when_delete: unexpected tb->lnum[%d]==%d or tb->rnum[%d]==%d" , +reiserfs_panic (tb->tb_sb,"ibalance-2" , +"unexpected tb->lnum[%d]==%d or tb->rnum[%d]==%d" , h, tb->lnum[h], h, tb->rnum[h]); }
@@ -940,8 +940,8 @@ int balance_internal(struct tree_balancestruct block_head *blkh;if (tb->blknum[h] !=1 ) -reiserfs_panic (NULL , -"balance_internal: One new node required for creating the new root" ); +reiserfs_panic (NULL ,"ibalance-3" ,"One new node " +"required for creating the new root" );/* S[h] = empty buffer from the list FEB. */ tbSh =get_FEB (tb); blkh =B_BLK_HEAD (tbSh);
fs/reiserfs/inode.c +1 -2
@@ -1295,8 +1295,7 @@ static void update_stat_data(struct tree ih =PATH_PITEM_HEAD (path);if (!is_statdata_le_ih (ih)) -reiserfs_panic (inode->i_sb, -"vs-13065: update_stat_data: key %k, found item %h" , +reiserfs_panic (inode->i_sb,"vs-13065" ,"key %k, found item %h" ,INODE_PKEY (inode), ih);if (stat_data_v1 (ih)) {
fs/reiserfs/item_ops.c +5 -3
@@ -517,8 +517,9 @@ static int direntry_create_vi(struct vir ((is_affected && (vn->vn_mode == M_PASTE || vn->vn_mode == M_CUT)) ? insert_size : 0)) { -reiserfs_panic (NULL , -"vs-8025: set_entry_sizes: (mode==%c, insert_size==%d), invalid length of directory item" , +reiserfs_panic (NULL ,"vs-8025" ,"(mode==%c, " +"insert_size==%d), invalid length of " +"directory item" , vn->vn_mode, insert_size); } }
@@ -549,7 +550,8 @@ static int direntry_check_left(struct vi }if (entries == dir_u->entry_count) { -reiserfs_panic (NULL ,"free space %d, entry_count %d\n" , free, +reiserfs_panic (NULL ,"item_ops-1" , +"free space %d, entry_count %d" , free, dir_u->entry_count); }
fs/reiserfs/journal.c +28 -28
143 lines not on this page · raw message
fs/reiserfs/lbalance.c +15 -12
@@ -168,10 +168,11 @@ static int leaf_copy_boundary_item(strucif (bytes_or_entries ==ih_item_len (ih) &&is_indirect_le_ih (ih))if (get_ih_free_space (ih)) -reiserfs_panic (NULL , -"vs-10020: leaf_copy_boundary_item: " -"last unformatted node must be filled entirely (%h)" , - ih); +reiserfs_panic (sb_from_bi (dest_bi), +"vs-10020" , +"last unformatted node " +"must be filled " +"entirely (%h)" , ih); }#endif
@@ -622,9 +623,8 @@ static void leaf_define_dest_src_infos(ibreak ;default : -reiserfs_panic (NULL , -"vs-10250: leaf_define_dest_src_infos: shift type is unknown (%d)" , - shift_mode); +reiserfs_panic (sb_from_bi (src_bi),"vs-10250" , +"shift type is unknown (%d)" , shift_mode); } RFALSE(src_bi->bi_bh == 0 || dest_bi->bi_bh == 0, "vs-10260: mode==%d, source (%p) or dest (%p) buffer is initialized incorrectly",
@@ -674,9 +674,9 @@ int leaf_shift_left(struct tree_balance#ifdef CONFIG_REISERFS_CHECK if (tb->tb_mode ==M_PASTE || tb->tb_mode ==M_INSERT ) {print_cur_tb ("vs-10275" ); -reiserfs_panic (tb->tb_sb, -"vs-10275: leaf_shift_left: balance condition corrupted (%c)" , - tb->tb_mode); +reiserfs_panic (tb->tb_sb,"vs-10275" , +"balance condition corrupted " +"(%c)" , tb->tb_mode); }#endif
@@ -889,9 +889,12 @@ void leaf_paste_in_buffer(struct buffer_#ifdef CONFIG_REISERFS_CHECK if (zeros_number > paste_size) { +struct super_block *sb =NULL ; +if (bi && bi->tb) + sb = bi->tb->tb_sb;print_cur_tb ("10177" ); -reiserfs_panic (NULL , -"vs-10177: leaf_paste_in_buffer: ero number == %d, paste_size == %d" , +reiserfs_panic (sb,"vs-10177" , +"zeros_number == %d, paste_size == %d" , zeros_number, paste_size); }#endif /* CONFIG_REISERFS_CHECK */
fs/reiserfs/namei.c +8 -10
@@ -145,10 +145,9 @@ int search_by_entry_key(struct super_bloif (!is_direntry_le_ih (de->de_ih) ||COMP_SHORT_KEYS (&(de->de_ih->ih_key), key)) {print_block (de->de_bh,0 ,-1 ,-1 ); -reiserfs_panic (sb, -"vs-7005: search_by_entry_key: found item %h is not directory item or " -"does not belong to the same directory as key %K" , - de->de_ih, key); +reiserfs_panic (sb,"vs-7005" ,"found item %h is not directory " +"item or does not belong to the same directory " +"as key %K" , de->de_ih, key); }#endif /* CONFIG_REISERFS_CHECK */
@@ -1194,15 +1193,14 @@ static int entry_points_to_object(constif (inode) {if (!de_visible (de->de_deh + de->de_entry_num)) -reiserfs_panic (NULL , -"vs-7042: entry_points_to_object: entry must be visible" ); +reiserfs_panic (inode->i_sb,"vs-7042" , +"entry must be visible" );return (de->de_objectid == inode->i_ino) ?1 :0 ; }/* this must be added hidden entry */ if (de_visible (de->de_deh + de->de_entry_num)) -reiserfs_panic (NULL , -"vs-7043: entry_points_to_object: entry must be visible" ); +reiserfs_panic (NULL ,"vs-7043" ,"entry must be visible" );return 1 ; }
@@ -1316,8 +1314,8 @@ static int reiserfs_rename(struct inode new_dentry->d_name.len, old_inode, 0);if (retval == -EEXIST ) {if (!new_dentry_inode) { -reiserfs_panic (old_dir->i_sb, -"vs-7050: new entry is found, new inode == 0\n" ); +reiserfs_panic (old_dir->i_sb,"vs-7050" , +"new entry is found, new inode == 0" ); } }else if (retval) {int err =journal_end (&th, old_dir->i_sb, jbegin_count);
fs/reiserfs/objectid.c +1 -2
@@ -18,8 +18,7 @@static void check_objectid_map (struct super_block *s,__le32 * map) {if (le32_to_cpu (map[0 ]) !=1 ) -reiserfs_panic (s, -"vs-15010: check_objectid_map: map corrupted: %lx" , +reiserfs_panic (s,"vs-15010" ,"map corrupted: %lx" , (long unsigned int )le32_to_cpu (map[0 ]));// FIXME: add something else here
fs/reiserfs/prints.c +18 -16
@@ -356,11 +356,21 @@ void reiserfs_debug(struct super_block *extern struct tree_balance *cur_tb;#endif -void reiserfs_panic (struct super_block *sb,const char *fmt, ...) +void __reiserfs_panic (struct super_block *sb,const char *id, +const char *function,const char *fmt, ...) {do_reiserfs_warning (fmt); -panic (KERN_EMERG "REISERFS: panic (device %s): %s\n" , -reiserfs_bdevname (sb), error_buf); + +#ifdef CONFIG_REISERFS_CHECK +dump_stack (); +#endif +if (sb) +panic (KERN_WARNING "REISERFS panic (device %s): %s%s%s: %s\n" , + sb->s_id, id ? id :"" , id ?" " :"" , + function, error_buf); +else +panic (KERN_WARNING "REISERFS panic: %s%s%s: %s\n" , + id ? id :"" , id ?" " :"" , function, error_buf); }void reiserfs_abort (struct super_block *sb,int errno,const char *fmt, ...)
@@ -679,12 +689,10 @@ static void check_leaf_block_head(struct blkh =B_BLK_HEAD (bh); nr =blkh_nr_item (blkh);if (nr > (bh->b_size -BLKH_SIZE ) /IH_SIZE ) -reiserfs_panic (NULL , -"vs-6010: check_leaf_block_head: invalid item number %z" , +reiserfs_panic (NULL ,"vs-6010" ,"invalid item number %z" , bh);if (blkh_free_space (blkh) > bh->b_size -BLKH_SIZE -IH_SIZE * nr) -reiserfs_panic (NULL , -"vs-6020: check_leaf_block_head: invalid free space %z" , +reiserfs_panic (NULL ,"vs-6020" ,"invalid free space %z" , bh); }
@@ -695,21 +703,15 @@ static void check_internal_block_head(st blkh =B_BLK_HEAD (bh);if (!(B_LEVEL (bh) >DISK_LEAF_NODE_LEVEL &&B_LEVEL (bh) <=MAX_HEIGHT )) -reiserfs_panic (NULL , -"vs-6025: check_internal_block_head: invalid level %z" , - bh); +reiserfs_panic (NULL ,"vs-6025" ,"invalid level %z" , bh);if (B_NR_ITEMS (bh) > (bh->b_size -BLKH_SIZE ) /IH_SIZE ) -reiserfs_panic (NULL , -"vs-6030: check_internal_block_head: invalid item number %z" , - bh); +reiserfs_panic (NULL ,"vs-6030" ,"invalid item number %z" , bh);if (B_FREE_SPACE (bh) != bh->b_size -BLKH_SIZE -KEY_SIZE *B_NR_ITEMS (bh) -DC_SIZE * (B_NR_ITEMS (bh) +1 )) -reiserfs_panic (NULL , -"vs-6040: check_internal_block_head: invalid free space %z" , - bh); +reiserfs_panic (NULL ,"vs-6040" ,"invalid free space %z" , bh); }
fs/reiserfs/stree.c +23 -26
97 lines not on this page · raw message
fs/reiserfs/tail_conversion.c +4 -6
@@ -92,8 +92,7 @@ int direct2indirect(struct reiserfs_tranlast item of the file */ if (search_for_position_by_key (sb, &end_key, path) ==POSITION_FOUND ) -reiserfs_panic (sb, -"PAP-14050: direct2indirect: " +reiserfs_panic (sb,"PAP-14050" ,"direct item (%K) not found" , &end_key); p_le_ih =PATH_PITEM_HEAD (path); RFALSE(!is_direct_le_ih(p_le_ih),
@@ -214,8 +213,7 @@ int indirect2direct(struct reiserfs_tran/* re-search indirect item */ if (search_for_position_by_key (p_s_sb, p_s_item_key, p_s_path) ==POSITION_NOT_FOUND ) -reiserfs_panic (p_s_sb, -"PAP-5520: indirect2direct: " +reiserfs_panic (p_s_sb,"PAP-5520" ,"item to be converted %K does not exist" , p_s_item_key);copy_item_head (&s_ih,PATH_PITEM_HEAD (p_s_path));
@@ -224,8 +222,8 @@ int indirect2direct(struct reiserfs_tran (ih_item_len (&s_ih) /UNFM_P_SIZE -1 ) * p_s_sb->s_blocksize;if (pos != pos1) -reiserfs_panic (p_s_sb,"vs-5530: indirect2direct: " -"tail position changed while we were reading it" ); +reiserfs_panic (p_s_sb,"vs-5530" ,"tail position " +"changed while we were reading it" );#endif }
include/linux/reiserfs_fs.h +18 -5
@@ -84,11 +84,11 @@ void __reiserfs_warning(struct super_blo/* assertions handling */ /** always check a condition and panic if it's false. */ -#define RASSERT( cond, format, args... ) \ -if( !( cond ) ) \ - reiserfs_panic( NULL, "reiserfs[%i]: assertion " #cond " failed at " \ +#define RASSERT( cond, format, args... ) \ +if( !( cond ) ) \ + reiserfs_panic( NULL, "assertion failure", "(" #cond ") at " \ __FILE__ ":%i:%s: " format "\n", \ - in_interrupt() ? -1 : current -> pid, __LINE__ , __FUNCTION__ , ##args ) + __LINE__ , __FUNCTION__ , ##args )#if defined(CONFIG_REISERFS_CHECK ) #define RFALSE( cond, format, args... ) RASSERT( !( cond ), format, ##args )
@@ -1431,6 +1431,16 @@ struct buffer_info {int bi_position; }; +static inline struct super_block *sb_from_tb (struct tree_balance *tb) +{ +return tb ? tb->tb_sb :NULL ; +} + +static inline struct super_block *sb_from_bi (struct buffer_info *bi) +{ +return bi ?sb_from_tb (bi->tb) :NULL ; +} +/* there are 4 types of items: stat data, directory item, indirect, direct. +-------------------+------------+--------------+------------+ | | k_offset | k_uniqueness | mergeable? |
@@ -1977,8 +1987,11 @@ int fix_nodes(int n_op_mode, struct treevoid unfix_nodes (struct tree_balance *);/* prints.c */ -void reiserfs_panic (struct super_block *s,const char *fmt, ...) +void __reiserfs_panic (struct super_block *s,const char *id, +const char *function,const char *fmt, ...) __attribute__ ((noreturn)); +#define reiserfs_panic(s, id, fmt, args...) \ + __reiserfs_panic(s, id, __FUNCTION__, fmt, ##args)void reiserfs_info (struct super_block *s,const char *fmt, ...);void reiserfs_debug (struct super_block *s,int level,const char *fmt, ...);void print_indirect_item (struct buffer_head *bh,int item_num);
Signature · 2 lines
Jeff Mahoney SUSE Labs
PATCH 9/11 reiserfs: rearrange journal abort
In reply to [email protected] This patch kills off reiserfs_journal_abort as it is never called, and combines __reiserfs_journal_abort_{soft,hard} into one function called reiserfs_abort_journal, which performs the same work. It is silent as opposed to the old version, since the message was always issued after a regular 'abort' message.
--- fs/reiserfs/journal.c | 23 ++++------------------- fs/reiserfs/prints.c | 2 +- include/linux/reiserfs_fs.h | 2 +- 3 files changed, 6 insertions(+), 21 deletions(-)
fs/reiserfs/journal.c +4 -19
@@ -4256,14 +4256,15 @@ static int do_journal_end(struct reiserfreturn journal->j_errno; } -static void __reiserfs_journal_abort_hard (struct super_block *sb) +/* Send the file system read only and refuse new transactions */ +void reiserfs_abort_journal (struct super_block *sb,int errno) {struct reiserfs_journal *journal =SB_JOURNAL (sb);if (test_bit (J_ABORTED , &journal->j_state))return ; -printk (KERN_CRIT "REISERFS: Aborting journal for filesystem on %s\n" , -reiserfs_bdevname (sb)); +if (!journal->j_errno) + journal->j_errno = errno; sb->s_flags |=MS_RDONLY ;set_bit (J_ABORTED , &journal->j_state);
@@ -4273,19 +4274,3 @@ static void __reiserfs_journal_abort_har#endif } -static void __reiserfs_journal_abort_soft (struct super_block *sb,int errno) -{ -struct reiserfs_journal *journal =SB_JOURNAL (sb); -if (test_bit (J_ABORTED , &journal->j_state)) -return ; - -if (!journal->j_errno) - journal->j_errno = errno; - -__reiserfs_journal_abort_hard (sb); -} - -void reiserfs_journal_abort (struct super_block *sb,int errno) -{ -return __reiserfs_journal_abort_soft (sb, errno); -}
fs/reiserfs/prints.c +1 -1
@@ -389,7 +389,7 @@ void reiserfs_abort(struct super_block * error_buf); sb->s_flags |=MS_RDONLY ; -reiserfs_journal_abort (sb, errno); +reiserfs_abort_journal (sb, errno); }/* this prints internal nodes (4 keys/items in line) (dc_number,
include/linux/reiserfs_fs.h +1 -1
@@ -1753,7 +1753,7 @@ int journal_begin(struct reiserfs_transa struct super_block *p_s_sb, unsigned long);int journal_join_abort (struct reiserfs_transaction_handle *,struct super_block *p_s_sb,unsigned long ); -void reiserfs_journal_abort (struct super_block *sb,int errno); +void reiserfs_abort_journal (struct super_block *sb,int errno);void reiserfs_abort (struct super_block *sb,int errno,const char *fmt, ...);int reiserfs_allocate_list_bitmaps (struct super_block *s,struct reiserfs_list_bitmap *,int );
Signature · 2 lines
Jeff Mahoney SUSE Labs
PATCH 10/11 reiserfs: introduce reiserfs_error()
In reply to [email protected] Although reiserfs can currently handle severe errors such as journal failure, it cannot handle less severe errors like metadata i/o failure. The following patch adds a reiserfs_error() function akin to the one in ext3.
Subsequent patches will use this new error handler to handle errors more gracefully in general.
--
fs/reiserfs/prints.c | 23 +++++++++++++++++++++++ include/linux/reiserfs_fs.h | 3 +++ 2 files changed, 26 insertions(+)
fs/reiserfs/prints.c +23 -0
@@ -373,6 +373,29 @@ void __reiserfs_panic(struct super_block id ? id : "", id ? " " : "", function, error_buf); } +void __reiserfs_error (struct super_block *sb,const char *id, +const char *function,const char *fmt, ...) +{ +do_reiserfs_warning (fmt); + +if (reiserfs_error_panic (sb)) +__reiserfs_panic (sb, id, function, error_buf); + +if (id && id[0 ]) +printk (KERN_CRIT "REISERFS error (device %s): %s %s: %s\n" , + sb->s_id, id, function, error_buf); +else +printk (KERN_CRIT "REISERFS error (device %s): %s: %s\n" , + sb->s_id, function, error_buf); + +if (sb->s_flags &MS_RDONLY ) +return ; + +reiserfs_info (sb,"Remounting filesystem read-only\n" ); + sb->s_flags |=MS_RDONLY ; +reiserfs_abort_journal (sb, -EIO ); +} +void reiserfs_abort (struct super_block *sb,int errno,const char *fmt, ...) {do_reiserfs_warning (fmt);
include/linux/reiserfs_fs.h +3 -0
@@ -1992,6 +1992,9 @@ void __reiserfs_panic(struct super_block __attribute__ ((noreturn)); #define reiserfs_panic(s, id, fmt, args...) \ __reiserfs_panic(s, id, __FUNCTION__, fmt, ##args) +void __reiserfs_error (struct super_block *s,const char *id,const char *function,const char *fmt, ...); +#define reiserfs_error(s, id, fmt, args...) \ + __reiserfs_error(s, id, __FUNCTION__, fmt, ##args)void reiserfs_info (struct super_block *s,const char *fmt, ...);void reiserfs_debug (struct super_block *s,int level,const char *fmt, ...);void print_indirect_item (struct buffer_head *bh,int item_num);
Signature · 2 lines
Jeff Mahoney SUSE Labs
PATCH 11/11 reiserfs: use reiserfs_error()
In reply to [email protected]This patch makes many paths that are currently using warnings to handle the error.
--
fs/reiserfs/bitmap.c | 57 +++++++++++++++++----------------- fs/reiserfs/file.c | 15 ++++----- fs/reiserfs/inode.c | 43 ++++++++++++------------- fs/reiserfs/lbalance.c | 20 ++++++------ fs/reiserfs/namei.c | 24 +++++++------- fs/reiserfs/objectid.c | 4 +- fs/reiserfs/stree.c | 70 +++++++++++++++++++++--------------------- fs/reiserfs/super.c | 15 ++++----- fs/reiserfs/tail_conversion.c | 6 +-- fs/reiserfs/xattr.c | 21 ++++++------ 10 files changed, 136 insertions(+), 139 deletions(-)
fs/reiserfs/bitmap.c +29 -28
@@ -61,9 +61,9 @@ int is_reusable(struct super_block *s, bint bmap, offset;if (block ==0 || block >=SB_BLOCK_COUNT (s)) { -reiserfs_warning (s,"vs-4010" , -"block number is out of range %lu (%u)" , - block,SB_BLOCK_COUNT (s)); +reiserfs_error (s,"vs-4010" , +"block number is out of range %lu (%u)" , + block,SB_BLOCK_COUNT (s));return 0 ; }
@@ -75,30 +75,30 @@ int is_reusable(struct super_block *s, b &(REISERFS_SB(s)->s_properties)))) {b_blocknr_t bmap1 =REISERFS_SB (s)->s_sbh->b_blocknr +1 ;if (block >= bmap1 && block <= bmap1 +SB_BMAP_NR (s)) { -reiserfs_warning (s,"vs-4019" ,"bitmap block " -"%lu(%u) can't be freed or reused" , - block,SB_BMAP_NR (s)); +reiserfs_error (s,"vs-4019" ,"bitmap block " +"%lu(%u) can't be freed or reused" , + block,SB_BMAP_NR (s));return 0 ; } } else {if (offset ==0 ) { -reiserfs_warning (s,"vs-4020" ,"bitmap block " -"%lu(%u) can't be freed or reused" , - block,SB_BMAP_NR (s)); +reiserfs_error (s,"vs-4020" ,"bitmap block " +"%lu(%u) can't be freed or reused" , + block,SB_BMAP_NR (s));return 0 ; } }if (bmap >=SB_BMAP_NR (s)) { -reiserfs_warning (s,"vs-4030" ,"there is no so many " -"bitmap blocks: block=%lu, bitmap_nr=%d" , - block, bmap); +reiserfs_error (s,"vs-4030" ,"there is no so many " +"bitmap blocks: block=%lu, bitmap_nr=%d" , + block, bmap);return 0 ; }if (bit_value ==0 && block ==SB_ROOT_BLOCK (s)) { -reiserfs_warning (s,"vs-4050" ,"this is root block (%u), " -"it must be busy" ,SB_ROOT_BLOCK (s)); +reiserfs_error (s,"vs-4050" ,"this is root block (%u), " +"it must be busy" ,SB_ROOT_BLOCK (s));return 0 ; }
@@ -149,8 +149,8 @@ static int scan_bitmap_block(struct reis/* - I mean `a window of zero bits' as in description of this function - Zam. */ if (!bi) { -reiserfs_warning (s,"jdm-4055" ,"NULL bitmap info pointer " -"for bitmap %d" , bmap_n); +reiserfs_error (s,"jdm-4055" ,"NULL bitmap info pointer " +"for bitmap %d" , bmap_n);return 0 ; }
@@ -398,8 +398,8 @@ static void _reiserfs_free_block(structget_bit_address (s, block, &nr, &offset);if (nr >=sb_bmap_nr (rs)) { -reiserfs_warning (s,"vs-4075" , -"block %lu is out of range" , block); +reiserfs_error (s,"vs-4075" , +"block %lu is out of range" , block);return ; }
@@ -411,8 +411,8 @@ static void _reiserfs_free_block(struct/* clear bit for the given block in bit map */ if (!reiserfs_test_and_clear_le_bit (offset, bmbh->b_data)) { -reiserfs_warning (s,"vs-4080" , -"block %lu: bit already cleared" , block); +reiserfs_error (s,"vs-4080" , +"block %lu: bit already cleared" , block); } apbi[nr].free_count++;journal_mark_dirty (th, s, bmbh);
@@ -439,7 +439,7 @@ void reiserfs_free_block(struct reiserfsreturn ;if (block >sb_block_count (REISERFS_SB (s)->s_rs)) { -reiserfs_panic (th->t_super,"bitmap-4072" , +reiserfs_error (th->t_super,"bitmap-4072" ,"Trying to free block outside file system " "boundaries (%lu > %lu)" , block,sb_block_count (REISERFS_SB (s)->s_rs));
@@ -471,8 +471,8 @@ static void __discard_prealloc(struct reBUG_ON (!th->t_trans_id);#ifdef CONFIG_REISERFS_CHECK if (ei->i_prealloc_count <0 ) -reiserfs_warning (th->t_super,"zam-4001" , -"inode has negative prealloc blocks count." ); +reiserfs_error (th->t_super,"zam-4001" , +"inode has negative prealloc blocks count." );#endif while (ei->i_prealloc_count >0 ) {reiserfs_free_prealloc_block (th, inode, ei->i_prealloc_block);
@@ -508,9 +508,9 @@ void reiserfs_discard_all_prealloc(struc i_prealloc_list);#ifdef CONFIG_REISERFS_CHECK if (!ei->i_prealloc_count) { -reiserfs_warning (th->t_super,"zam-4001" , -"inode is in prealloc list but has " -"no preallocated blocks." ); +reiserfs_error (th->t_super,"zam-4001" , +"inode is in prealloc list but has " +"no preallocated blocks." ); }#endif __discard_prealloc (th, ei);
@@ -1287,8 +1287,9 @@ void reiserfs_cache_bitmap_metadata(stru } } } -/* The first bit must ALWAYS be 1 */ -BUG_ON (info->first_zero_hint ==0 ); +if (info->first_zero_hint ==0 ) +reiserfs_error (sb,"reiserfs-2025" ,"bitmap block %lu is " +"corrupted: first bit must be 1" , bh->b_blocknr); } struct buffer_head *reiserfs_read_bitmap_block(struct super_block *sb,
fs/reiserfs/file.c +8 -7
@@ -395,7 +395,7 @@ static int reiserfs_allocate_blocks_for_if (res !=ITEM_NOT_FOUND ) {/* item should not exist, otherwise we have error */ if (res != -ENOSPC ) { - reiserfs_warning(inode-> + reiserfs_error(inode-> i_sb, "green-9008", "search_by_key (%K) returned %d",
@@ -412,10 +412,11 @@ static int reiserfs_allocate_blocks_for_ inode, (char *)zeros); }else { -reiserfs_panic (inode->i_sb, +reiserfs_error (inode->i_sb,"green-9011" ,"Unexpected key type %K" , &key); + res = -EIO ; }if (res) {kfree (zeros);
@@ -600,11 +601,11 @@ static int reiserfs_allocate_blocks_for_/* Well, if we have found such item already, or some error occured, we need to warn user and return error */ if (res != -ENOSPC ) { -reiserfs_warning (inode->i_sb, -"green-9009" , -"search_by_key (%K) " -"returned %d" , &key, - res); +reiserfs_error (inode->i_sb, +"green-9009" , +"search_by_key (%K) " +"returned %d" , &key, + res); } res = -EIO ; goto error_exit_free_blocks;
fs/reiserfs/inode.c +20 -23
85 lines not on this page · raw message
fs/reiserfs/lbalance.c +10 -10
@@ -1290,17 +1290,17 @@ void leaf_paste_entries(struct buffer_he prev = (i !=0 ) ?deh_location (&(deh[i -1 ])) :0 ;if (prev && prev <=deh_location (&(deh[i]))) -reiserfs_warning (NULL ,"vs-10240" , -"directory item (%h) " -"corrupted (prev %a, " -"cur(%d) %a)" , - ih, deh + i -1 , i, deh + i); +reiserfs_error (NULL ,"vs-10240" , +"directory item (%h) " +"corrupted (prev %a, " +"cur(%d) %a)" , + ih, deh + i -1 , i, deh + i);if (next && next >=deh_location (&(deh[i]))) -reiserfs_warning (NULL ,"vs-10250" , -"directory item (%h) " -"corrupted (cur(%d) %a, " -"next %a)" , - ih, i, deh + i, deh + i + 1); +reiserfs_error (NULL ,"vs-10250" , +"directory item (%h) " +"corrupted (cur(%d) %a, " +"next %a)" , + ih, i, deh + i, deh + i + 1); } }#endif
fs/reiserfs/namei.c +12 -12
@@ -120,8 +120,8 @@ int search_by_entry_key(struct super_bloswitch (retval) {case ITEM_NOT_FOUND :if (!PATH_LAST_POSITION (path)) { -reiserfs_warning (sb,"vs-7000" ,"search_by_key " -"returned item position == 0" ); +reiserfs_error (sb,"vs-7000" ,"search_by_key " +"returned item position == 0" );pathrelse (path);return IO_ERROR ; }
@@ -135,7 +135,7 @@ int search_by_entry_key(struct super_blodefault :pathrelse (path); -reiserfs_warning (sb,"vs-7002" ,"no path to here" ); +reiserfs_error (sb,"vs-7002" ,"no path to here" );return IO_ERROR ; }
@@ -298,7 +298,7 @@ static int reiserfs_find_entry(struct insearch_by_entry_key (dir->i_sb, &key_to_search, path_to_entry, de);if (retval ==IO_ERROR ) { -reiserfs_warning (dir->i_sb,"zam-7001" ,"io error" ); +reiserfs_error (dir->i_sb,"zam-7001" ,"io error" );return IO_ERROR ; }
@@ -490,9 +490,9 @@ static int reiserfs_add_entry(struct rei }if (retval !=NAME_FOUND ) { -reiserfs_warning (dir->i_sb,"zam-7002" , -"reiserfs_find_entry() returned " -"unexpected value (%d)" , retval); +reiserfs_error (dir->i_sb,"zam-7002" , +"reiserfs_find_entry() returned " +"unexpected value (%d)" , retval); }return -EEXIST ;
@@ -902,9 +902,9 @@ static int reiserfs_rmdir(struct inode * goto end_rmdir;if (inode->i_nlink !=2 && inode->i_nlink !=1 ) -reiserfs_warning (inode->i_sb,"reiserfs-7040" , -"empty directory has nlink != 2 (%d)" , - inode->i_nlink); +reiserfs_error (inode->i_sb,"reiserfs-7040" , +"empty directory has nlink != 2 (%d)" , + inode->i_nlink);clear_nlink (inode); inode->i_ctime = dir->i_ctime = dir->i_mtime =CURRENT_TIME_SEC ;
@@ -1495,8 +1495,8 @@ static int reiserfs_rename(struct inodeif (reiserfs_cut_from_item (&th, &old_entry_path, &(old_de.de_entry_key), old_dir,NULL ,0 ) <0 ) -reiserfs_warning (old_dir->i_sb,"vs-7060" , -"couldn't not cut old name. Fsck later?" ); +reiserfs_error (old_dir->i_sb,"vs-7060" , +"couldn't not cut old name. Fsck later?" ); old_dir->i_size -=DEH_SIZE + old_de.de_entrylen;
fs/reiserfs/objectid.c +2 -2
@@ -160,8 +160,8 @@ void reiserfs_release_objectid(struct re i +=2 ; } -reiserfs_warning (s,"vs-15011" ,"tried to free free object id (%lu)" , - (long unsigned )objectid_to_release); +reiserfs_error (s,"vs-15011" ,"tried to free free object id (%lu)" , + (long unsigned )objectid_to_release); }int reiserfs_convert_objectid_map_v1 (struct super_block *s)
fs/reiserfs/stree.c +35 -35
159 lines not on this page · raw message
fs/reiserfs/super.c +7 -8
@@ -190,9 +190,8 @@ static int finish_unfinished(struct supewhile (!retval) { retval =search_item (s, &max_cpu_key, &path);if (retval !=ITEM_NOT_FOUND ) { -reiserfs_warning (s,"vs-2140" , -"search_by_key returned %d" , - retval); +reiserfs_error (s,"vs-2140" , +"search_by_key returned %d" , retval);break ; }
@@ -362,9 +361,9 @@ void add_save_link(struct reiserfs_trans retval =search_item (inode->i_sb, &key, &path);if (retval !=ITEM_NOT_FOUND ) {if (retval != -ENOSPC ) -reiserfs_warning (inode->i_sb,"vs-2100" , -"search_by_key (%K) returned %d" , &key, - retval); +reiserfs_error (inode->i_sb,"vs-2100" , +"search_by_key (%K) returned %d" , &key, + retval);pathrelse (&path);return ; }
@@ -377,8 +376,8 @@ void add_save_link(struct reiserfs_transreiserfs_insert_item (th, &path, &key, &ih,NULL , (char *)&link);if (retval) {if (retval != -ENOSPC ) -reiserfs_warning (inode->i_sb,"vs-2120" , -"insert_item returned %d" , retval); +reiserfs_error (inode->i_sb,"vs-2120" , +"insert_item returned %d" , retval); }else {if (truncate) REISERFS_I(inode)->i_flags |=
fs/reiserfs/tail_conversion.c +3 -3
@@ -48,9 +48,9 @@ int direct2indirect(struct reiserfs_tran// FIXME: we could avoid this if (search_for_position_by_key (sb, &end_key, path) ==POSITION_FOUND ) { -reiserfs_warning (sb,"PAP-14030" , -"pasted or inserted byte exists in " -"the tree %K. Use fsck to repair." , &end_key); +reiserfs_error (sb,"PAP-14030" , +"pasted or inserted byte exists in " +"the tree %K. Use fsck to repair." , &end_key);pathrelse (path);return -EIO ; }
fs/reiserfs/xattr.c +10 -11
@@ -278,8 +278,8 @@ static int __xattr_readdir(struct file * ih = de.de_ih;if (!is_direntry_le_ih (ih)) { -reiserfs_warning (inode->i_sb,"jdm-20000" , -"not direntry %h" , ih); +reiserfs_error (inode->i_sb,"jdm-20000" , +"not direntry %h" , ih);break ; }copy_item_head (&tmp_ih, ih);
@@ -674,15 +674,14 @@ __reiserfs_xattr_del(struct dentry *xadi goto out_file;if (!is_reiserfs_priv_object (dentry->d_inode)) { -reiserfs_warning (dir->i_sb,"jdm-20003" , -"OID %08x [%.*s/%.*s] doesn't have " -"priv flag set [parent is %sset]." , -le32_to_cpu (INODE_PKEY (dentry->d_inode)-> - k_objectid), xadir->d_name.len, - xadir->d_name.name, namelen, name, -is_reiserfs_priv_object (xadir-> - d_inode) ?"" : -"not " ); +reiserfs_error (dir->i_sb,"jdm-20003" , +"OID %08x [%.*s/%.*s] doesn't have " +"priv flag set [parent is %sset]." , +le32_to_cpu (INODE_PKEY (dentry->d_inode)-> + k_objectid), xadir->d_name.len, + xadir->d_name.name, namelen, name, +is_reiserfs_priv_object (xadir-> d_inode) ?"" : +"not " );dput (dentry);return -EIO ; }
Signature · 2 lines
Jeff Mahoney SUSE Labs
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 21 lines · [email protected] wrote:
This is the first part of a series of patches I've been developing for reiserfs. I'm posting them now for review followed by submission to 2.6.23.
The first 4 patches are small fixes:
* Adding proper lockdep annotation to xattrs
* Switching topanic()instead ofBUG()inreiserfs_panic()
* Makingis_reusablebitmap sanity checking unconditional
* Using the first zero hint in bitmap iterationThe remaining 7 work to make reiserfs error handling more consistent and robust:
* Use consistent message prefixes for all reiserfs log output
* Add areiserfs_info()call for multiline output that doesn't masquerade as a warning.
* Makereiserfs_warning()calls more consistent, requiring an ID, and including the device and function where the warning is occuring.
* Makereiserfs_panic()more consistent in the same manner.
* Rearrangereiserfs_journal_abort()since it was modelled after jbd's call and doesn't need to be. There's several function calls that just get optimized out anyway.
Quoted 7 lines
* Add a
reiserfs_error()call to handle metadata errors by aborting the journal and marking the file system read-only.
* Convert 50reiserfs_warning(), 2reiserfs_panic(), and oneBUG_ONsite to use the newreiserfs_error().,-Jeff
Apologies for the double post. I had the wrong to: address in the headers, but gave the correct address to formail, so they got sent out but any replies would be thrown into oblivion.
- -Jeff
- --
Jeff Mahoney
SUSE Labs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org
iD8DBQFGloVvLPWxlyuTD7IRAllBAJ9Fyn3JpICyNxh49hcPOx55VmM/OwCeOWy/ RWYW8hUaGdKYVOpSjDC9H9c=
=vFGK
-----END PGP SIGNATURE-----