drbd: Remove the terrible DEV hack
[deliverable/linux.git] / drivers / block / drbd / drbd_int.h
index 41dced195653cb2347714200598c4575106b20f9..d393f0bc26fb89d0097b7341c31d341244050612 100644 (file)
@@ -100,9 +100,24 @@ extern char usermode_helper[];
 struct drbd_device;
 struct drbd_connection;
 
-
-/* to shorten dev_warn(DEV, "msg"); and relatives statements */
-#define DEV (disk_to_dev(device->vdisk))
+#define drbd_printk(level, device, fmt, args...) \
+       dev_printk(level, disk_to_dev(device->vdisk), fmt, ## args)
+
+#define drbd_dbg(device, fmt, args...) \
+       drbd_printk(KERN_DEBUG, device, fmt, ## args)
+#define drbd_alert(device, fmt, args...) \
+       drbd_printk(KERN_ALERT, device, fmt, ## args)
+#define drbd_err(device, fmt, args...) \
+       drbd_printk(KERN_ERR, device, fmt, ## args)
+#define drbd_warn(device, fmt, args...) \
+       drbd_printk(KERN_WARNING, device, fmt, ## args)
+#define drbd_info(device, fmt, args...) \
+       drbd_printk(KERN_INFO, device, fmt, ## args)
+#define drbd_emerg(device, fmt, args...) \
+       drbd_printk(KERN_EMERG, device, fmt, ## args)
+
+#define dynamic_drbd_dbg(device, fmt, args...) \
+       dynamic_dev_dbg(disk_to_dev(device->vdisk), fmt, ## args)
 
 #define conn_printk(LEVEL, TCONN, FMT, ARGS...) \
        printk(LEVEL "d-con %s: " FMT, TCONN->resource->name , ## ARGS)
@@ -115,7 +130,7 @@ struct drbd_connection;
 #define conn_dbg(TCONN, FMT, ARGS...)    conn_printk(KERN_DEBUG, TCONN, FMT, ## ARGS)
 
 #define D_ASSERT(exp)  if (!(exp)) \
-        dev_err(DEV, "ASSERT( " #exp " ) in %s:%d\n", __FILE__, __LINE__)
+        drbd_err(device, "ASSERT( " #exp " ) in %s:%d\n", __FILE__, __LINE__)
 
 /**
  * expect  -  Make an assertion
@@ -125,7 +140,7 @@ struct drbd_connection;
 #define expect(exp) ({                                                         \
                bool _bool = (exp);                                             \
                if (!_bool)                                                     \
-                       dev_err(DEV, "ASSERTION %s FAILED in %s\n",             \
+                       drbd_err(device, "ASSERTION %s FAILED in %s\n",         \
                                #exp, __func__);                                \
                _bool;                                                          \
                })
@@ -1278,7 +1293,7 @@ extern void drbd_rs_controller_reset(struct drbd_device *device);
 static inline void ov_out_of_sync_print(struct drbd_device *device)
 {
        if (device->ov_last_oos_size) {
-               dev_err(DEV, "Out of sync: start=%llu, size=%lu (sectors)\n",
+               drbd_err(device, "Out of sync: start=%llu, size=%lu (sectors)\n",
                     (unsigned long long)device->ov_last_oos_start,
                     (unsigned long)device->ov_last_oos_size);
        }
@@ -1504,7 +1519,7 @@ static inline void __drbd_chk_io_error_(struct drbd_device *device,
        case EP_PASS_ON: /* FIXME would this be better named "Ignore"? */
                if (df == DRBD_READ_ERROR || df == DRBD_WRITE_ERROR) {
                        if (__ratelimit(&drbd_ratelimit_state))
-                               dev_err(DEV, "Local IO failed in %s.\n", where);
+                               drbd_err(device, "Local IO failed in %s.\n", where);
                        if (device->state.disk > D_INCONSISTENT)
                                _drbd_set_state(_NS(device, disk, D_INCONSISTENT), CS_HARD, NULL);
                        break;
@@ -1539,7 +1554,7 @@ static inline void __drbd_chk_io_error_(struct drbd_device *device,
                        set_bit(FORCE_DETACH, &device->flags);
                if (device->state.disk > D_FAILED) {
                        _drbd_set_state(_NS(device, disk, D_FAILED), CS_HARD, NULL);
-                       dev_err(DEV,
+                       drbd_err(device,
                                "Local IO failed in %s. Detaching...\n", where);
                }
                break;
@@ -1755,7 +1770,7 @@ static inline void inc_ap_pending(struct drbd_device *device)
 
 #define ERR_IF_CNT_IS_NEGATIVE(which, func, line)                      \
        if (atomic_read(&device->which) < 0)                            \
-               dev_err(DEV, "in %s:%d: " #which " = %d < 0 !\n",       \
+               drbd_err(device, "in %s:%d: " #which " = %d < 0 !\n",   \
                        func, line,                                     \
                        atomic_read(&device->which))
 
@@ -1888,7 +1903,7 @@ static inline void drbd_get_syncer_progress(struct drbd_device *device,
                 * for now, just prevent in-kernel buffer overflow.
                 */
                smp_rmb();
-               dev_warn(DEV, "cs:%s rs_left=%lu > rs_total=%lu (rs_failed %lu)\n",
+               drbd_warn(device, "cs:%s rs_left=%lu > rs_total=%lu (rs_failed %lu)\n",
                                drbd_conn_str(device->state.conn),
                                *bits_left, device->rs_total, device->rs_failed);
                *per_mil_done = 0;
@@ -2103,7 +2118,7 @@ static inline void drbd_md_flush(struct drbd_device *device)
        int r;
 
        if (device->ldev == NULL) {
-               dev_warn(DEV, "device->ldev == NULL in drbd_md_flush\n");
+               drbd_warn(device, "device->ldev == NULL in drbd_md_flush\n");
                return;
        }
 
@@ -2113,7 +2128,7 @@ static inline void drbd_md_flush(struct drbd_device *device)
        r = blkdev_issue_flush(device->ldev->md_bdev, GFP_NOIO, NULL);
        if (r) {
                set_bit(MD_NO_FUA, &device->flags);
-               dev_err(DEV, "meta data flush failed with status %d, disabling md-flushes\n", r);
+               drbd_err(device, "meta data flush failed with status %d, disabling md-flushes\n", r);
        }
 }
 
This page took 0.026632 seconds and 5 git commands to generate.