Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 345842
b: refs/heads/master
c: 49559d8
h: refs/heads/master
v: v3
  • Loading branch information
Philipp Reisner committed Oct 14, 2011
1 parent 1a3610b commit a02e4d8
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 23 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3f9cbe937ec41fca8842594e0529537f3019c775
refs/heads/master: 49559d87fdfe3ab33c684506c394681da6a746c9
51 changes: 29 additions & 22 deletions trunk/drivers/block/drbd/drbd_int.h
Original file line number Diff line number Diff line change
Expand Up @@ -1988,17 +1988,19 @@ static inline void inc_ap_pending(struct drbd_conf *mdev)
atomic_inc(&mdev->ap_pending_cnt);
}

#define ERR_IF_CNT_IS_NEGATIVE(which) \
if (atomic_read(&mdev->which) < 0) \
#define ERR_IF_CNT_IS_NEGATIVE(which, func, line) \
if (atomic_read(&mdev->which) < 0) \
dev_err(DEV, "in %s:%d: " #which " = %d < 0 !\n", \
__func__ , __LINE__ , \
atomic_read(&mdev->which))
func, line, \
atomic_read(&mdev->which))

#define dec_ap_pending(mdev) do { \
typecheck(struct drbd_conf *, mdev); \
if (atomic_dec_and_test(&mdev->ap_pending_cnt)) \
wake_up(&mdev->misc_wait); \
ERR_IF_CNT_IS_NEGATIVE(ap_pending_cnt); } while (0)
#define dec_ap_pending(mdev) _dec_ap_pending(mdev, __FUNCTION__, __LINE__)
static inline void _dec_ap_pending(struct drbd_conf *mdev, const char *func, int line)
{
if (atomic_dec_and_test(&mdev->ap_pending_cnt))
wake_up(&mdev->misc_wait);
ERR_IF_CNT_IS_NEGATIVE(ap_pending_cnt, func, line);
}

/* counts how many resync-related answers we still expect from the peer
* increase decrease
Expand All @@ -2011,10 +2013,12 @@ static inline void inc_rs_pending(struct drbd_conf *mdev)
atomic_inc(&mdev->rs_pending_cnt);
}

#define dec_rs_pending(mdev) do { \
typecheck(struct drbd_conf *, mdev); \
atomic_dec(&mdev->rs_pending_cnt); \
ERR_IF_CNT_IS_NEGATIVE(rs_pending_cnt); } while (0)
#define dec_rs_pending(mdev) _dec_rs_pending(mdev, __FUNCTION__, __LINE__)
static inline void _dec_rs_pending(struct drbd_conf *mdev, const char *func, int line)
{
atomic_dec(&mdev->rs_pending_cnt);
ERR_IF_CNT_IS_NEGATIVE(rs_pending_cnt, func, line);
}

/* counts how many answers we still need to send to the peer.
* increased on
Expand All @@ -2030,16 +2034,19 @@ static inline void inc_unacked(struct drbd_conf *mdev)
atomic_inc(&mdev->unacked_cnt);
}

#define dec_unacked(mdev) do { \
typecheck(struct drbd_conf *, mdev); \
atomic_dec(&mdev->unacked_cnt); \
ERR_IF_CNT_IS_NEGATIVE(unacked_cnt); } while (0)

#define sub_unacked(mdev, n) do { \
typecheck(struct drbd_conf *, mdev); \
atomic_sub(n, &mdev->unacked_cnt); \
ERR_IF_CNT_IS_NEGATIVE(unacked_cnt); } while (0)
#define dec_unacked(mdev) _dec_unacked(mdev, __FUNCTION__, __LINE__)
static inline void _dec_unacked(struct drbd_conf *mdev, const char *func, int line)
{
atomic_dec(&mdev->unacked_cnt);
ERR_IF_CNT_IS_NEGATIVE(unacked_cnt, func, line);
}

#define sub_unacked(mdev, n) _sub_unacked(mdev, n, __FUNCTION__, __LINE__)
static inline void _sub_unacked(struct drbd_conf *mdev, int n, const char *func, int line)
{
atomic_sub(n, &mdev->unacked_cnt);
ERR_IF_CNT_IS_NEGATIVE(unacked_cnt, func, line);
}

static inline void put_net_conf(struct drbd_tconn *tconn)
{
Expand Down

0 comments on commit a02e4d8

Please sign in to comment.