aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirk McKusick <mckusick@FreeBSD.org>2019-05-27 06:22:43 +0000
committerKirk McKusick <mckusick@FreeBSD.org>2019-05-27 06:22:43 +0000
commit298184acb8067d925ddf686278e6c9c3cc6de660 (patch)
tree781e74aa0085e6c1c21ae222ce9810fcc77b1f06
parenta5868885fa8c919edc2f01d1816ce6e08896b59e (diff)
downloadsrc-298184acb8067d925ddf686278e6c9c3cc6de660.tar.gz
src-298184acb8067d925ddf686278e6c9c3cc6de660.zip
Add function name and line number debugging information to softupdates
worklist structures to help track their movement between work lists. No functional change to the operation of soft updates intended.
Notes
Notes: svn path=/head/; revision=348300
-rw-r--r--sys/ufs/ffs/ffs_softdep.c49
-rw-r--r--sys/ufs/ffs/softdep.h4
2 files changed, 38 insertions, 15 deletions
diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c
index af7f0f740dac..c0303bb2e6c2 100644
--- a/sys/ufs/ffs/ffs_softdep.c
+++ b/sys/ufs/ffs/ffs_softdep.c
@@ -1011,42 +1011,59 @@ MTX_SYSINIT(softdep_lock, &lk, "Global Softdep Lock", MTX_DEF);
#define WORKLIST_REMOVE_UNLOCKED WORKLIST_REMOVE
#else /* DEBUG */
-static void worklist_insert(struct workhead *, struct worklist *, int);
-static void worklist_remove(struct worklist *, int);
-
-#define WORKLIST_INSERT(head, item) worklist_insert(head, item, 1)
-#define WORKLIST_INSERT_UNLOCKED(head, item) worklist_insert(head, item, 0)
-#define WORKLIST_REMOVE(item) worklist_remove(item, 1)
-#define WORKLIST_REMOVE_UNLOCKED(item) worklist_remove(item, 0)
+static void worklist_insert(struct workhead *, struct worklist *, int,
+ const char *, int);
+static void worklist_remove(struct worklist *, int, const char *, int);
+
+#define WORKLIST_INSERT(head, item) \
+ worklist_insert(head, item, 1, __func__, __LINE__)
+#define WORKLIST_INSERT_UNLOCKED(head, item)\
+ worklist_insert(head, item, 0, __func__, __LINE__)
+#define WORKLIST_REMOVE(item)\
+ worklist_remove(item, 1, __func__, __LINE__)
+#define WORKLIST_REMOVE_UNLOCKED(item)\
+ worklist_remove(item, 0, __func__, __LINE__)
static void
-worklist_insert(head, item, locked)
+worklist_insert(head, item, locked, func, line)
struct workhead *head;
struct worklist *item;
int locked;
+ const char *func;
+ int line;
{
if (locked)
LOCK_OWNED(VFSTOUFS(item->wk_mp));
if (item->wk_state & ONWORKLIST)
- panic("worklist_insert: %p %s(0x%X) already on list",
- item, TYPENAME(item->wk_type), item->wk_state);
+ panic("worklist_insert: %p %s(0x%X) already on list, "
+ "added in function %s at line %d",
+ item, TYPENAME(item->wk_type), item->wk_state,
+ item->wk_func, item->wk_line);
item->wk_state |= ONWORKLIST;
+ item->wk_func = func;
+ item->wk_line = line;
LIST_INSERT_HEAD(head, item, wk_list);
}
static void
-worklist_remove(item, locked)
+worklist_remove(item, locked, func, line)
struct worklist *item;
int locked;
+ const char *func;
+ int line;
{
if (locked)
LOCK_OWNED(VFSTOUFS(item->wk_mp));
if ((item->wk_state & ONWORKLIST) == 0)
- panic("worklist_remove: %p %s(0x%X) not on list",
- item, TYPENAME(item->wk_type), item->wk_state);
+ panic("worklist_remove: %p %s(0x%X) not on list, "
+ "removed in function %s at line %d",
+ item, TYPENAME(item->wk_type), item->wk_state,
+ item->wk_func, item->wk_line);
item->wk_state &= ~ONWORKLIST;
+ item->wk_func = func;
+ item->wk_line = line;
LIST_REMOVE(item, wk_list);
}
#endif /* DEBUG */
@@ -1172,8 +1189,10 @@ workitem_free(item, type)
#ifdef DEBUG
if (item->wk_state & ONWORKLIST)
- panic("workitem_free: %s(0x%X) still on list",
- TYPENAME(item->wk_type), item->wk_state);
+ panic("workitem_free: %s(0x%X) still on list, "
+ "added in function %s at line %d",
+ TYPENAME(item->wk_type), item->wk_state,
+ item->wk_func, item->wk_line);
if (item->wk_type != type && type != D_NEWBLK)
panic("workitem_free: type mismatch %s != %s",
TYPENAME(item->wk_type), TYPENAME(type));
diff --git a/sys/ufs/ffs/softdep.h b/sys/ufs/ffs/softdep.h
index 1e2946ab9fb9..9b1b4c4a7a81 100644
--- a/sys/ufs/ffs/softdep.h
+++ b/sys/ufs/ffs/softdep.h
@@ -213,6 +213,10 @@ struct worklist {
struct mount *wk_mp; /* Mount we live in */
unsigned int wk_type:8, /* type of request */
wk_state:24; /* state flags */
+#ifdef DEBUG
+ const char *wk_func; /* func where added / removed */
+ int wk_line; /* line where added / removed */
+#endif
};
#define WK_DATA(wk) ((void *)(wk))
#define WK_PAGEDEP(wk) ((struct pagedep *)(wk))