From: Josh Triplett <josht@us.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: Andrew Morton <akpm@osdl.org>,
xfs-masters@oss.sgi.com, nathans@sgi.com, xfs@oss.sgi.com
Subject: [PATCH] [xfs] Add lock annotations to xfs_trans_update_ail and xfs_trans_delete_ail
Date: Wed, 26 Jul 2006 11:25:23 -0700 [thread overview]
Message-ID: <1153938323.12517.58.camel@josh-work.beaverton.ibm.com> (raw)
xfs_trans_update_ail and xfs_trans_delete_ail get called with the AIL lock
held, and release it. Add lock annotations to these two functions (abstracted
like the AIL lock itself) so that sparse can check callers for lock pairing,
and so that sparse will not complain about these functions since they
intentionally use locks in this manner.
Signed-off-by: Josh Triplett <josh@freedesktop.org>
---
fs/xfs/xfs_inode.c | 2 +-
fs/xfs/xfs_mount.h | 3 ++-
fs/xfs/xfs_trans_ail.c | 2 ++
fs/xfs/xfs_trans_priv.h | 12 +++++++-----
4 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 86c1bf0..0d118f0 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -23,12 +23,12 @@ #include "xfs_log.h"
#include "xfs_inum.h"
#include "xfs_imap.h"
#include "xfs_trans.h"
-#include "xfs_trans_priv.h"
#include "xfs_sb.h"
#include "xfs_ag.h"
#include "xfs_dir2.h"
#include "xfs_dmapi.h"
#include "xfs_mount.h"
+#include "xfs_trans_priv.h"
#include "xfs_bmap_btree.h"
#include "xfs_alloc_btree.h"
#include "xfs_ialloc_btree.h"
diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
index b2bd4be..ed91fbb 100644
--- a/fs/xfs/xfs_mount.h
+++ b/fs/xfs/xfs_mount.h
@@ -74,7 +74,8 @@ #define AIL_LOCKINIT(x,y) spinlock_init(
#define AIL_LOCK_DESTROY(x) spinlock_destroy(x)
#define AIL_LOCK(mp,s) s=mutex_spinlock(&(mp)->m_ail_lock)
#define AIL_UNLOCK(mp,s) mutex_spinunlock(&(mp)->m_ail_lock, s)
-
+#define ACQUIRES_AIL_LOCK(mp) __acquires((mp)->m_ail_lock)
+#define RELEASES_AIL_LOCK(mp,s) __releases((mp)->m_ail_lock)
/*
* Prototypes and functions for the Data Migration subsystem.
diff --git a/fs/xfs/xfs_trans_ail.c b/fs/xfs/xfs_trans_ail.c
index 558c87f..5c64909 100644
--- a/fs/xfs/xfs_trans_ail.c
+++ b/fs/xfs/xfs_trans_ail.c
@@ -277,6 +277,7 @@ xfs_trans_update_ail(
xfs_log_item_t *lip,
xfs_lsn_t lsn,
unsigned long s)
+ RELEASES_AIL_LOCK(mp, s)
{
xfs_ail_entry_t *ailp;
xfs_log_item_t *dlip=NULL;
@@ -329,6 +330,7 @@ xfs_trans_delete_ail(
xfs_mount_t *mp,
xfs_log_item_t *lip,
unsigned long s)
+ RELEASES_AIL_LOCK(mp, s)
{
xfs_ail_entry_t *ailp;
xfs_log_item_t *dlip;
diff --git a/fs/xfs/xfs_trans_priv.h b/fs/xfs/xfs_trans_priv.h
index 13edab8..fc8c440 100644
--- a/fs/xfs/xfs_trans_priv.h
+++ b/fs/xfs/xfs_trans_priv.h
@@ -46,11 +46,13 @@ xfs_log_busy_slot_t *xfs_trans_add_busy
/*
* From xfs_trans_ail.c
*/
-void xfs_trans_update_ail(struct xfs_mount *,
- struct xfs_log_item *, xfs_lsn_t,
- unsigned long);
-void xfs_trans_delete_ail(struct xfs_mount *,
- struct xfs_log_item *, unsigned long);
+void xfs_trans_update_ail(struct xfs_mount *mp,
+ struct xfs_log_item *lip, xfs_lsn_t lsn,
+ unsigned long s)
+ RELEASES_AIL_LOCK(mp, s);
+void xfs_trans_delete_ail(struct xfs_mount *mp,
+ struct xfs_log_item *lip, unsigned long s)
+ RELEASES_AIL_LOCK(mp, s);
struct xfs_log_item *xfs_trans_first_ail(struct xfs_mount *, int *);
struct xfs_log_item *xfs_trans_next_ail(struct xfs_mount *,
struct xfs_log_item *, int *, int *);
next reply other threads:[~2006-07-26 18:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-26 18:25 Josh Triplett [this message]
2006-07-27 23:20 ` Nathan Scott
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=1153938323.12517.58.camel@josh-work.beaverton.ibm.com \
--to=josht@us.ibm.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nathans@sgi.com \
--cc=xfs-masters@oss.sgi.com \
--cc=xfs@oss.sgi.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®