All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Mahoney <jeffm@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: [patch 05/10] btrfs: Add BTRFS_UERROR for unhandled errors
Date: Wed, 04 Nov 2009 14:03:51 -0500	[thread overview]
Message-ID: <20091104190433.477436095@suse.com> (raw)
In-Reply-To: 20091104190346.971762946@suse.com

 This patch adds a BTRFS_UERROR macro to indicate than an error is
 unhandled but should be. This is to differentiate between internal
 logic errors and runtime errors so that we can go through later
 more easily to locate and fix them. It currently BUGs after
 printing a message indicating where the failure occured and what
 the failure condition was.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>

---

 fs/btrfs/ctree.h |    8 ++++++++
 fs/btrfs/super.c |    8 ++++++++
 2 files changed, 16 insertions(+)

--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -1951,6 +1951,13 @@ static inline struct dentry *fdentry(str
 	return file->f_path.dentry;
 }
 
+#define BTRFS_UERROR(condition) \
+	do { \
+		if (condition) \
+			btrfs_unhandled_error(__FILE__, __LINE__, \
+					      #condition); \
+	} while(0);
+
 /* extent-tree.c */
 void btrfs_put_block_group(struct btrfs_block_group_cache *cache);
 int btrfs_run_delayed_refs(struct btrfs_trans_handle *trans,
@@ -2373,6 +2380,7 @@ ssize_t btrfs_listxattr(struct dentry *d
 u64 btrfs_parse_size(char *str);
 int btrfs_parse_options(struct btrfs_root *root, char *options);
 int btrfs_sync_fs(struct super_block *sb, int wait);
+void btrfs_unhandled_error(const char *file, int line, const char *condition);
 
 /* acl.c */
 #ifdef CONFIG_BTRFS_FS_POSIX_ACL
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -51,6 +51,14 @@
 #include "export.h"
 #include "compression.h"
 
+void btrfs_unhandled_error(const char *file, int line, const char *msg)
+{
+	printk(KERN_CRIT "btrfs: Unhandled error at %s:%d: %s\n",
+	       file, line, msg);
+
+	BUG();
+}
+
 static struct super_operations btrfs_super_ops;
 
 static void btrfs_put_super(struct super_block *sb)


  parent reply	other threads:[~2009-11-04 19:03 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-04 19:03 [patch 00/10] btrfs: Error handling/propagation queue Jeff Mahoney
2009-11-04 19:03 ` [patch 01/10] btrfs: fix btrfs_read_block_groups return value Jeff Mahoney
2009-11-04 19:03 ` [patch 02/10] btrfs: fix memleak in btrfs_init_new_device Jeff Mahoney
2009-11-04 19:03 ` [patch 03/10] btrfs: fix btrfs_read_fs_root* return values Jeff Mahoney
2009-11-04 19:03 ` [patch 04/10] btrfs: btrfs_sync_file should return -EIO not EIO Jeff Mahoney
2009-11-04 19:03 ` Jeff Mahoney [this message]
2009-11-04 19:03 ` [patch 06/10] btrfs: annotate kmalloc failures Jeff Mahoney
2009-11-04 19:03 ` [patch 07/10] btrfs: handle kmalloc call path failures Jeff Mahoney
2009-11-04 19:03 ` [patch 08/10] btrfs: annotate btrfs_{start,join}_transaction failures Jeff Mahoney
2009-11-04 19:03 ` [patch 09/10] btrfs: handle btrfs_{start,join}_transaction call path failures Jeff Mahoney
2009-11-04 19:03 ` [patch 10/10] btrfs: annotate btrfs_alloc_path failures Jeff Mahoney
2009-11-04 19:43 ` [patch 00/10] btrfs: Error handling/propagation queue Jeff Mahoney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091104190433.477436095@suse.com \
    --to=jeffm@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.