btrfs: clean up transaction abort messages
PATCH v2 1/1 btrfs: clean up transaction abort messages
The transaction abort stacktrace is printed only once per module lifetime, but we'd like to see it each time it happens per mounted filesystem. Introduce a fs_state flag that records it.
Tweak the messages around abort:
* add error number to the first abort
* print the exact negative errno from btrfs_decode_error
* clean up btrfs_decode_error and callers
* no dots at the end of the messages
---v1->v2:
* drop nbuf parameter from btrfs_decode_error and update messages in callers, add 'errno=%d' to the message
fs/btrfs/ctree.h | 1 + fs/btrfs/super.c | 47 ++++++++++++++++++++++------------------------- fs/btrfs/transaction.c | 5 ++--- 3 files changed, 25 insertions(+), 28 deletions(-)
fs/btrfs/ctree.h +1 -0
@@ -340,6 +340,7 @@ static inline unsigned long btrfs_chunk_item_size(int num_stripes)*/ #define BTRFS_FS_STATE_ERROR 0#define BTRFS_FS_STATE_REMOUNTING 1 +#define BTRFS_FS_STATE_TRANS_ABORTED 2/* Super block flags */ /* Errors detected */
fs/btrfs/super.c +22 -25
113 lines not on this page · raw message
fs/btrfs/transaction.c +2 -3
@@ -1810,7 +1810,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans, ret =btrfs_write_and_wait_transaction (trans, root);if (ret) {btrfs_error (root->fs_info, ret, -"Error while writing out transaction." ); +"Error while writing out transaction" );mutex_unlock (&root->fs_info->tree_log_mutex); goto cleanup_transaction; }
@@ -1866,8 +1866,7 @@ cleanup_transaction:btrfs_qgroup_free (root, trans->qgroup_reserved); trans->qgroup_reserved =0 ; } -btrfs_printk (root->fs_info,"Skipping commit of aborted transaction.\n" ); -// WARN_ON(1); +btrfs_printk (root->fs_info,"Skipping commit of aborted transaction\n" );if (current->journal_info == trans) current->journal_info =NULL ;cleanup_transaction (trans, root, ret);
Signature · 1 line
1.7.9
Quoted 13 lines
* clean up
btrfs_decode_errorand callersfs/btrfs/super.c +2
-2-static const char *btrfs_decode_error (int errno,char nbuf[16 ]) +static const char *btrfs_decode_error (int errno) { -char *errstr =NULL ; +char *errstr ="unknown" ;switch (errno) {case -EIO :@@ -80,12 +80,6 @@ static const char *btrfs_decode_error(int errno, char nbuf[16])case -EEXIST : errstr ="Object already exists" ;
fs/btrfs/super.c static const char *btrfs_decode_error(int errno, char nbuf[16]) · line 85
Quoted 10 lines
fs/btrfs/super.c +0
-6break ; -default : -if (nbuf) { -if (snprintf (nbuf,16 ,"error %d" , -errno) >=0 ) - errstr = nbuf; - } -break ; }return errstr;
Cool, thanks for cleaning that up.
- z