summaryrefslogtreecommitdiffstats
path: root/drivers/block/drbd/drbd_int.h
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruen@linbit.com>2011-06-27 16:23:33 +0200
committerPhilipp Reisner <philipp.reisner@linbit.com>2014-02-17 16:45:04 +0100
commit0b0ba1efc7b887bc2bd767ef822979fe2dae620e (patch)
treecb87bd0b135803615bd76eebb63ddc72bf797b20 /drivers/block/drbd/drbd_int.h
parentdrbd: Replace and remove the obsolete conn_() macros (diff)
downloadlinux-0b0ba1efc7b887bc2bd767ef822979fe2dae620e.tar.xz
linux-0b0ba1efc7b887bc2bd767ef822979fe2dae620e.zip
drbd: Add explicit device parameter to D_ASSERT
The implicit dependency on a variable inside the macro is problematic. Signed-off-by: Andreas Gruenbacher <agruen@linbit.com> Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Diffstat (limited to 'drivers/block/drbd/drbd_int.h')
-rw-r--r--drivers/block/drbd/drbd_int.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h
index 417241a14b3e..4dcad12581bd 100644
--- a/drivers/block/drbd/drbd_int.h
+++ b/drivers/block/drbd/drbd_int.h
@@ -147,8 +147,10 @@ void drbd_printk_with_wrong_object_type(void);
#define dynamic_drbd_dbg(device, fmt, args...) \
dynamic_dev_dbg(disk_to_dev(device->vdisk), fmt, ## args)
-#define D_ASSERT(exp) if (!(exp)) \
- drbd_err(device, "ASSERT( " #exp " ) in %s:%d\n", __FILE__, __LINE__)
+#define D_ASSERT(device, exp) do { \
+ if (!(exp)) \
+ drbd_err(device, "ASSERT( " #exp " ) in %s:%d\n", __FILE__, __LINE__); \
+ } while (0)
/**
* expect - Make an assertion
@@ -1863,7 +1865,7 @@ static inline void put_ldev(struct drbd_device *device)
* so we must not sleep here. */
__release(local);
- D_ASSERT(i >= 0);
+ D_ASSERT(device, i >= 0);
if (i == 0) {
if (device->state.disk == D_DISKLESS)
/* even internal references gone, safe to destroy */
@@ -2094,7 +2096,7 @@ static inline void dec_ap_bio(struct drbd_device *device)
int mxb = drbd_get_max_buffers(device);
int ap_bio = atomic_dec_return(&device->ap_bio_cnt);
- D_ASSERT(ap_bio >= 0);
+ D_ASSERT(device, ap_bio >= 0);
if (ap_bio == 0 && test_bit(BITMAP_IO, &device->flags)) {
if (!test_and_set_bit(BITMAP_IO_QUEUED, &device->flags))