Commit d0180171 authored by Andreas Gruenbacher's avatar Andreas Gruenbacher Committed by Philipp Reisner

drbd: Remove the terrible DEV hack

DRBD was using dev_err() and similar all over the code; instead of having to
write dev_err(disk_to_dev(device->vdisk), ...) to convert a drbd_device into a
kernel device, a DEV macro was used which implicitly references the device
variable.  This is terrible; introduce separate drbd_err() and similar macros
with an explicit device parameter instead.
Signed-off-by: default avatarAndreas Gruenbacher <agruen@linbit.com>
Signed-off-by: default avatarPhilipp Reisner <philipp.reisner@linbit.com>
parent c06ece6b
......@@ -137,7 +137,7 @@ void wait_until_done_or_force_detached(struct drbd_device *device, struct drbd_b
dt = wait_event_timeout(device->misc_wait,
*done || test_bit(FORCE_DETACH, &device->flags), dt);
if (dt == 0) {
dev_err(DEV, "meta-data IO operation timed out\n");
drbd_err(device, "meta-data IO operation timed out\n");
drbd_chk_io_error(device, 1, DRBD_FORCE_DETACH);
}
}
......@@ -172,7 +172,7 @@ static int _drbd_md_sync_page_io(struct drbd_device *device,
;
else if (!get_ldev_if_state(device, D_ATTACHING)) {
/* Corresponding put_ldev in drbd_md_io_complete() */
dev_err(DEV, "ASSERT FAILED: get_ldev_if_state() == 1 in _drbd_md_sync_page_io()\n");
drbd_err(device, "ASSERT FAILED: get_ldev_if_state() == 1 in _drbd_md_sync_page_io()\n");
err = -ENODEV;
goto out;
}
......@@ -202,21 +202,21 @@ int drbd_md_sync_page_io(struct drbd_device *device, struct drbd_backing_dev *bd
BUG_ON(!bdev->md_bdev);
dev_dbg(DEV, "meta_data io: %s [%d]:%s(,%llus,%s) %pS\n",
drbd_dbg(device, "meta_data io: %s [%d]:%s(,%llus,%s) %pS\n",
current->comm, current->pid, __func__,
(unsigned long long)sector, (rw & WRITE) ? "WRITE" : "READ",
(void*)_RET_IP_ );
if (sector < drbd_md_first_sector(bdev) ||
sector + 7 > drbd_md_last_sector(bdev))
dev_alert(DEV, "%s [%d]:%s(,%llus,%s) out of range md access!\n",
drbd_alert(device, "%s [%d]:%s(,%llus,%s) out of range md access!\n",
current->comm, current->pid, __func__,
(unsigned long long)sector, (rw & WRITE) ? "WRITE" : "READ");
/* we do all our meta data IO in aligned 4k blocks. */
err = _drbd_md_sync_page_io(device, bdev, iop, sector, rw, 4096);
if (err) {
dev_err(DEV, "drbd_md_sync_page_io(,%llus,%s) failed with error %d\n",
drbd_err(device, "drbd_md_sync_page_io(,%llus,%s) failed with error %d\n",
(unsigned long long)sector, (rw & WRITE) ? "WRITE" : "READ", err);
}
return err;
......@@ -404,7 +404,7 @@ int drbd_al_begin_io_nonblock(struct drbd_device *device, struct drbd_interval *
struct lc_element *al_ext;
al_ext = lc_get_cumulative(device->act_log, enr);
if (!al_ext)
dev_info(DEV, "LOGIC BUG for enr=%u\n", enr);
drbd_info(device, "LOGIC BUG for enr=%u\n", enr);
}
return 0;
}
......@@ -425,7 +425,7 @@ void drbd_al_complete_io(struct drbd_device *device, struct drbd_interval *i)
for (enr = first; enr <= last; enr++) {
extent = lc_find(device->act_log, enr);
if (!extent) {
dev_err(DEV, "al_complete_io() called on inactive extent %u\n", enr);
drbd_err(device, "al_complete_io() called on inactive extent %u\n", enr);
continue;
}
lc_put(device->act_log, extent);
......@@ -491,14 +491,14 @@ _al_write_transaction(struct drbd_device *device)
int err = 0;
if (!get_ldev(device)) {
dev_err(DEV, "disk is %s, cannot start al transaction\n",
drbd_err(device, "disk is %s, cannot start al transaction\n",
drbd_disk_str(device->state.disk));
return -EIO;
}
/* The bitmap write may have failed, causing a state change. */
if (device->state.disk < D_INCONSISTENT) {
dev_err(DEV,
drbd_err(device,
"disk is %s, cannot write al transaction\n",
drbd_disk_str(device->state.disk));
put_ldev(device);
......@@ -507,7 +507,7 @@ _al_write_transaction(struct drbd_device *device)
buffer = drbd_md_get_buffer(device); /* protects md_io_buffer, al_tr_cycle, ... */
if (!buffer) {
dev_err(DEV, "disk failed while waiting for md_io buffer\n");
drbd_err(device, "disk failed while waiting for md_io buffer\n");
put_ldev(device);
return -ENODEV;
}
......@@ -689,7 +689,7 @@ static int w_update_odbm(struct drbd_work *w, int unused)
if (!get_ldev(device)) {
if (__ratelimit(&drbd_ratelimit_state))
dev_warn(DEV, "Can not update on disk bitmap, local IO disabled.\n");
drbd_warn(device, "Can not update on disk bitmap, local IO disabled.\n");
kfree(udw);
return 0;
}
......@@ -744,7 +744,7 @@ static void drbd_try_clear_on_disk_bm(struct drbd_device *device, sector_t secto
else
ext->rs_failed += count;
if (ext->rs_left < ext->rs_failed) {
dev_warn(DEV, "BAD! sector=%llus enr=%u rs_left=%d "
drbd_warn(device, "BAD! sector=%llus enr=%u rs_left=%d "
"rs_failed=%d count=%d cstate=%s\n",
(unsigned long long)sector,
ext->lce.lc_number, ext->rs_left,
......@@ -768,14 +768,14 @@ static void drbd_try_clear_on_disk_bm(struct drbd_device *device, sector_t secto
*/
int rs_left = drbd_bm_e_weight(device, enr);
if (ext->flags != 0) {
dev_warn(DEV, "changing resync lce: %d[%u;%02lx]"
drbd_warn(device, "changing resync lce: %d[%u;%02lx]"
" -> %d[%u;00]\n",
ext->lce.lc_number, ext->rs_left,
ext->flags, enr, rs_left);
ext->flags = 0;
}
if (ext->rs_failed) {
dev_warn(DEV, "Kicking resync_lru element enr=%u "
drbd_warn(device, "Kicking resync_lru element enr=%u "
"out with rs_failed=%d\n",
ext->lce.lc_number, ext->rs_failed);
}
......@@ -798,11 +798,11 @@ static void drbd_try_clear_on_disk_bm(struct drbd_device *device, sector_t secto
udw->w.device = device;
drbd_queue_work_front(&first_peer_device(device)->connection->sender_work, &udw->w);
} else {
dev_warn(DEV, "Could not kmalloc an udw\n");
drbd_warn(device, "Could not kmalloc an udw\n");
}
}
} else {
dev_err(DEV, "lc_get() failed! locked=%d/%d flags=%lu\n",
drbd_err(device, "lc_get() failed! locked=%d/%d flags=%lu\n",
device->resync_locked,
device->resync->nr_elements,
device->resync->flags);
......@@ -843,7 +843,7 @@ void __drbd_set_in_sync(struct drbd_device *device, sector_t sector, int size,
unsigned long flags;
if (size <= 0 || !IS_ALIGNED(size, 512) || size > DRBD_MAX_BIO_SIZE) {
dev_err(DEV, "drbd_set_in_sync: sector=%llus size=%d nonsense!\n",
drbd_err(device, "drbd_set_in_sync: sector=%llus size=%d nonsense!\n",
(unsigned long long)sector, size);
return;
}
......@@ -917,7 +917,7 @@ int __drbd_set_out_of_sync(struct drbd_device *device, sector_t sector, int size
return 0;
if (size < 0 || !IS_ALIGNED(size, 512) || size > DRBD_MAX_BIO_SIZE) {
dev_err(DEV, "sector: %llus, size: %d\n",
drbd_err(device, "sector: %llus, size: %d\n",
(unsigned long long)sector, size);
return 0;
}
......@@ -988,7 +988,7 @@ struct bm_extent *_bme_get(struct drbd_device *device, unsigned int enr)
if (!bm_ext) {
if (rs_flags & LC_STARVING)
dev_warn(DEV, "Have to wait for element"
drbd_warn(device, "Have to wait for element"
" (resync LRU too small?)\n");
BUG_ON(rs_flags & LC_LOCKED);
}
......@@ -1049,7 +1049,7 @@ int drbd_rs_begin_io(struct drbd_device *device, sector_t sector)
if (schedule_timeout_interruptible(HZ/10))
return -EINTR;
if (sa && --sa == 0)
dev_warn(DEV,"drbd_rs_begin_io() stepped aside for 20sec."
drbd_warn(device, "drbd_rs_begin_io() stepped aside for 20sec."
"Resync stalled?\n");
goto retry;
}
......@@ -1101,7 +1101,7 @@ int drbd_try_rs_begin_io(struct drbd_device *device, sector_t sector)
device->resync_locked--;
wake_up(&device->al_wait);
} else {
dev_alert(DEV, "LOGIC BUG\n");
drbd_alert(device, "LOGIC BUG\n");
}
}
/* TRY. */
......@@ -1131,7 +1131,7 @@ int drbd_try_rs_begin_io(struct drbd_device *device, sector_t sector)
if (!bm_ext) {
const unsigned long rs_flags = device->resync->flags;
if (rs_flags & LC_STARVING)
dev_warn(DEV, "Have to wait for element"
drbd_warn(device, "Have to wait for element"
" (resync LRU too small?)\n");
BUG_ON(rs_flags & LC_LOCKED);
goto try_again;
......@@ -1179,13 +1179,13 @@ void drbd_rs_complete_io(struct drbd_device *device, sector_t sector)
if (!bm_ext) {
spin_unlock_irqrestore(&device->al_lock, flags);
if (__ratelimit(&drbd_ratelimit_state))
dev_err(DEV, "drbd_rs_complete_io() called, but extent not found\n");
drbd_err(device, "drbd_rs_complete_io() called, but extent not found\n");
return;
}
if (bm_ext->lce.refcnt == 0) {
spin_unlock_irqrestore(&device->al_lock, flags);
dev_err(DEV, "drbd_rs_complete_io(,%llu [=%u]) called, "
drbd_err(device, "drbd_rs_complete_io(,%llu [=%u]) called, "
"but refcnt is 0!?\n",
(unsigned long long)sector, enr);
return;
......@@ -1241,7 +1241,7 @@ int drbd_rs_del_all(struct drbd_device *device)
if (bm_ext->lce.lc_number == LC_FREE)
continue;
if (bm_ext->lce.lc_number == device->resync_wenr) {
dev_info(DEV, "dropping %u in drbd_rs_del_all, apparently"
drbd_info(device, "dropping %u in drbd_rs_del_all, apparently"
" got 'synced' by application io\n",
device->resync_wenr);
D_ASSERT(!test_bit(BME_LOCKED, &bm_ext->flags));
......@@ -1251,7 +1251,7 @@ int drbd_rs_del_all(struct drbd_device *device)
lc_put(device->resync, &bm_ext->lce);
}
if (bm_ext->lce.refcnt != 0) {
dev_info(DEV, "Retrying drbd_rs_del_all() later. "
drbd_info(device, "Retrying drbd_rs_del_all() later. "
"refcnt=%d\n", bm_ext->lce.refcnt);
put_ldev(device);
spin_unlock_irq(&device->al_lock);
......@@ -1285,7 +1285,7 @@ void drbd_rs_failed_io(struct drbd_device *device, sector_t sector, int size)
int wake_up = 0;
if (size <= 0 || !IS_ALIGNED(size, 512) || size > DRBD_MAX_BIO_SIZE) {
dev_err(DEV, "drbd_rs_failed_io: sector=%llus size=%d nonsense!\n",
drbd_err(device, "drbd_rs_failed_io: sector=%llus size=%d nonsense!\n",
(unsigned long long)sector, size);
return;
}
......
......@@ -118,7 +118,7 @@ static void __bm_print_lock_info(struct drbd_device *device, const char *func)
struct drbd_bitmap *b = device->bitmap;
if (!__ratelimit(&drbd_ratelimit_state))
return;
dev_err(DEV, "FIXME %s in %s, bitmap locked for '%s' by %s\n",
drbd_err(device, "FIXME %s in %s, bitmap locked for '%s' by %s\n",
drbd_task_to_thread_name(first_peer_device(device)->connection, current),
func, b->bm_why ?: "?",
drbd_task_to_thread_name(first_peer_device(device)->connection, b->bm_task));
......@@ -130,21 +130,21 @@ void drbd_bm_lock(struct drbd_device *device, char *why, enum bm_flag flags)
int trylock_failed;
if (!b) {
dev_err(DEV, "FIXME no bitmap in drbd_bm_lock!?\n");
drbd_err(device, "FIXME no bitmap in drbd_bm_lock!?\n");
return;
}
trylock_failed = !mutex_trylock(&b->bm_change);
if (trylock_failed) {
dev_warn(DEV, "%s going to '%s' but bitmap already locked for '%s' by %s\n",
drbd_warn(device, "%s going to '%s' but bitmap already locked for '%s' by %s\n",
drbd_task_to_thread_name(first_peer_device(device)->connection, current),
why, b->bm_why ?: "?",
drbd_task_to_thread_name(first_peer_device(device)->connection, b->bm_task));
mutex_lock(&b->bm_change);
}
if (BM_LOCKED_MASK & b->bm_flags)
dev_err(DEV, "FIXME bitmap already locked in bm_lock\n");
drbd_err(device, "FIXME bitmap already locked in bm_lock\n");
b->bm_flags |= flags & BM_LOCKED_MASK;
b->bm_why = why;
......@@ -155,12 +155,12 @@ void drbd_bm_unlock(struct drbd_device *device)
{
struct drbd_bitmap *b = device->bitmap;
if (!b) {
dev_err(DEV, "FIXME no bitmap in drbd_bm_unlock!?\n");
drbd_err(device, "FIXME no bitmap in drbd_bm_unlock!?\n");
return;
}
if (!(BM_LOCKED_MASK & device->bitmap->bm_flags))
dev_err(DEV, "FIXME bitmap not locked in bm_unlock\n");
drbd_err(device, "FIXME bitmap not locked in bm_unlock\n");
b->bm_flags &= ~BM_LOCKED_MASK;
b->bm_why = NULL;
......@@ -253,7 +253,7 @@ void drbd_bm_mark_for_writeout(struct drbd_device *device, int page_nr)
{
struct page *page;
if (page_nr >= device->bitmap->bm_number_of_pages) {
dev_warn(DEV, "BAD: page_nr: %u, number_of_pages: %u\n",
drbd_warn(device, "BAD: page_nr: %u, number_of_pages: %u\n",
page_nr, (int)device->bitmap->bm_number_of_pages);
return;
}
......@@ -645,7 +645,7 @@ int drbd_bm_resize(struct drbd_device *device, sector_t capacity, int set_new_bi
drbd_bm_lock(device, "resize", BM_LOCKED_MASK);
dev_info(DEV, "drbd_bm_resize called with capacity == %llu\n",
drbd_info(device, "drbd_bm_resize called with capacity == %llu\n",
(unsigned long long)capacity);
if (capacity == b->bm_dev_capacity)
......@@ -682,8 +682,8 @@ int drbd_bm_resize(struct drbd_device *device, sector_t capacity, int set_new_bi
u64 bits_on_disk = drbd_md_on_disk_bits(device->ldev);
put_ldev(device);
if (bits > bits_on_disk) {
dev_info(DEV, "bits = %lu\n", bits);
dev_info(DEV, "bits_on_disk = %llu\n", bits_on_disk);
drbd_info(device, "bits = %lu\n", bits);
drbd_info(device, "bits_on_disk = %llu\n", bits_on_disk);
err = -ENOSPC;
goto out;
}
......@@ -742,7 +742,7 @@ int drbd_bm_resize(struct drbd_device *device, sector_t capacity, int set_new_bi
bm_vk_free(opages, opages_vmalloced);
if (!growing)
b->bm_set = bm_count_bits(b);
dev_info(DEV, "resync bitmap: bits=%lu words=%lu pages=%lu\n", bits, words, want);
drbd_info(device, "resync bitmap: bits=%lu words=%lu pages=%lu\n", bits, words, want);
out:
drbd_bm_unlock(device);
......@@ -878,7 +878,7 @@ void drbd_bm_get_lel(struct drbd_device *device, size_t offset, size_t number,
if ((offset >= b->bm_words) ||
(end > b->bm_words) ||
(number <= 0))
dev_err(DEV, "offset=%lu number=%lu bm_words=%lu\n",
drbd_err(device, "offset=%lu number=%lu bm_words=%lu\n",
(unsigned long) offset,
(unsigned long) number,
(unsigned long) b->bm_words);
......@@ -966,7 +966,7 @@ static void bm_async_io_complete(struct bio *bio, int error)
if ((ctx->flags & BM_AIO_COPY_PAGES) == 0 &&
!bm_test_page_unchanged(b->bm_pages[idx]))
dev_warn(DEV, "bitmap page idx %u changed during IO!\n", idx);
drbd_warn(device, "bitmap page idx %u changed during IO!\n", idx);
if (error) {
/* ctx error will hold the completed-last non-zero error code,
......@@ -976,11 +976,11 @@ static void bm_async_io_complete(struct bio *bio, int error)
/* Not identical to on disk version of it.
* Is BM_PAGE_IO_ERROR enough? */
if (__ratelimit(&drbd_ratelimit_state))
dev_err(DEV, "IO ERROR %d on bitmap page idx %u\n",
drbd_err(device, "IO ERROR %d on bitmap page idx %u\n",
error, idx);
} else {
bm_clear_page_io_err(b->bm_pages[idx]);
dynamic_dev_dbg(DEV, "bitmap page idx %u completed\n", idx);
dynamic_drbd_dbg(device, "bitmap page idx %u completed\n", idx);
}
bm_page_unlock_io(device, idx);
......@@ -1081,7 +1081,7 @@ static int bm_rw(struct drbd_device *device, int rw, unsigned flags, unsigned la
};
if (!get_ldev_if_state(device, D_ATTACHING)) { /* put is in bm_aio_ctx_destroy() */
dev_err(DEV, "ASSERT FAILED: get_ldev_if_state() == 1 in bm_rw()\n");
drbd_err(device, "ASSERT FAILED: get_ldev_if_state() == 1 in bm_rw()\n");
kfree(ctx);
return -ENODEV;
}
......@@ -1106,14 +1106,14 @@ static int bm_rw(struct drbd_device *device, int rw, unsigned flags, unsigned la
if (!(flags & BM_WRITE_ALL_PAGES) &&
bm_test_page_unchanged(b->bm_pages[i])) {
dynamic_dev_dbg(DEV, "skipped bm write for idx %u\n", i);
dynamic_drbd_dbg(device, "skipped bm write for idx %u\n", i);
continue;
}
/* during lazy writeout,
* ignore those pages not marked for lazy writeout. */
if (lazy_writeout_upper_idx &&
!bm_test_page_lazy_writeout(b->bm_pages[i])) {
dynamic_dev_dbg(DEV, "skipped bm lazy write for idx %u\n", i);
dynamic_drbd_dbg(device, "skipped bm lazy write for idx %u\n", i);
continue;
}
}
......@@ -1138,12 +1138,12 @@ static int bm_rw(struct drbd_device *device, int rw, unsigned flags, unsigned la
/* summary for global bitmap IO */
if (flags == 0)
dev_info(DEV, "bitmap %s of %u pages took %lu jiffies\n",
drbd_info(device, "bitmap %s of %u pages took %lu jiffies\n",
rw == WRITE ? "WRITE" : "READ",
count, jiffies - now);
if (ctx->error) {
dev_alert(DEV, "we had at least one MD IO ERROR during bitmap IO\n");
drbd_alert(device, "we had at least one MD IO ERROR during bitmap IO\n");
drbd_chk_io_error(device, 1, DRBD_META_IO_ERROR);
err = -EIO; /* ctx->error ? */
}
......@@ -1156,13 +1156,13 @@ static int bm_rw(struct drbd_device *device, int rw, unsigned flags, unsigned la
drbd_md_flush(device);
} else /* rw == READ */ {
b->bm_set = bm_count_bits(b);
dev_info(DEV, "recounting of set bits took additional %lu jiffies\n",
drbd_info(device, "recounting of set bits took additional %lu jiffies\n",
jiffies - now);
}
now = b->bm_set;
if (flags == 0)
dev_info(DEV, "%s (%lu bits) marked out-of-sync by on disk bit-map.\n",
drbd_info(device, "%s (%lu bits) marked out-of-sync by on disk bit-map.\n",
ppsize(ppb, now << (BM_BLOCK_SHIFT-10)), now);
kref_put(&ctx->kref, &bm_aio_ctx_destroy);
......@@ -1243,7 +1243,7 @@ int drbd_bm_write_page(struct drbd_device *device, unsigned int idx) __must_hold
int err;
if (bm_test_page_unchanged(device->bitmap->bm_pages[idx])) {
dynamic_dev_dbg(DEV, "skipped bm page write for idx %u\n", idx);
dynamic_drbd_dbg(device, "skipped bm page write for idx %u\n", idx);
return 0;
}
......@@ -1261,7 +1261,7 @@ int drbd_bm_write_page(struct drbd_device *device, unsigned int idx) __must_hold
};
if (!get_ldev_if_state(device, D_ATTACHING)) { /* put is in bm_aio_ctx_destroy() */
dev_err(DEV, "ASSERT FAILED: get_ldev_if_state() == 1 in drbd_bm_write_page()\n");
drbd_err(device, "ASSERT FAILED: get_ldev_if_state() == 1 in drbd_bm_write_page()\n");
kfree(ctx);
return -ENODEV;
}
......@@ -1298,7 +1298,7 @@ static unsigned long __bm_find_next(struct drbd_device *device, unsigned long bm
if (bm_fo > b->bm_bits) {
dev_err(DEV, "bm_fo=%lu bm_bits=%lu\n", bm_fo, b->bm_bits);
drbd_err(device, "bm_fo=%lu bm_bits=%lu\n", bm_fo, b->bm_bits);
bm_fo = DRBD_END_OF_BITMAP;
} else {
while (bm_fo < b->bm_bits) {
......@@ -1393,7 +1393,7 @@ static int __bm_change_bits_to(struct drbd_device *device, const unsigned long s
int changed_total = 0;
if (e >= b->bm_bits) {
dev_err(DEV, "ASSERT FAILED: bit_s=%lu bit_e=%lu bm_bits=%lu\n",
drbd_err(device, "ASSERT FAILED: bit_s=%lu bit_e=%lu bm_bits=%lu\n",
s, e, b->bm_bits);
e = b->bm_bits ? b->bm_bits -1 : 0;
}
......@@ -1596,7 +1596,7 @@ int drbd_bm_test_bit(struct drbd_device *device, const unsigned long bitnr)
} else if (bitnr == b->bm_bits) {
i = -1;
} else { /* (bitnr > b->bm_bits) */
dev_err(DEV, "bitnr=%lu > bm_bits=%lu\n", bitnr, b->bm_bits);
drbd_err(device, "bitnr=%lu > bm_bits=%lu\n", bitnr, b->bm_bits);
i = 0;
}
......@@ -1637,7 +1637,7 @@ int drbd_bm_count_bits(struct drbd_device *device, const unsigned long s, const
if (expect(bitnr < b->bm_bits))
c += (0 != test_bit_le(bitnr - (page_nr << (PAGE_SHIFT+3)), p_addr));
else
dev_err(DEV, "bitnr=%lu bm_bits=%lu\n", bitnr, b->bm_bits);
drbd_err(device, "bitnr=%lu bm_bits=%lu\n", bitnr, b->bm_bits);
}
if (p_addr)
bm_unmap(p_addr);
......@@ -1687,7 +1687,7 @@ int drbd_bm_e_weight(struct drbd_device *device, unsigned long enr)
count += hweight_long(*bm++);
bm_unmap(p_addr);
} else {
dev_err(DEV, "start offset (%d) too large in drbd_bm_e_weight\n", s);
drbd_err(device, "start offset (%d) too large in drbd_bm_e_weight\n", s);
}
spin_unlock_irqrestore(&b->bm_lock, flags);
return count;
......
......@@ -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);
}
}
......
......@@ -871,7 +871,7 @@ void drbd_print_uuids(struct drbd_device *device, const char *text)
{
if (get_ldev_if_state(device, D_NEGOTIATING)) {
u64 *uuid = device->ldev->md.uuid;
dev_info(DEV, "%s %016llX:%016llX:%016llX:%016llX\n",
drbd_info(device, "%s %016llX:%016llX:%016llX:%016llX\n",
text,
(unsigned long long)uuid[UI_CURRENT],
(unsigned long long)uuid[UI_BITMAP],
......@@ -879,7 +879,7 @@ void drbd_print_uuids(struct drbd_device *device, const char *text)
(unsigned long long)uuid[UI_HISTORY_END]);
put_ldev(device);
} else {
dev_info(DEV, "%s effective data uuid: %016llX\n",
drbd_info(device, "%s effective data uuid: %016llX\n",
text,
(unsigned long long)device->ed_uuid);
}
......@@ -1126,7 +1126,7 @@ static int fill_bitmap_rle_bits(struct drbd_device *device,
/* paranoia: catch zero runlength.
* can only happen if bitmap is modified while we scan it. */
if (rl == 0) {
dev_err(DEV, "unexpected zero runlength while encoding bitmap "
drbd_err(device, "unexpected zero runlength while encoding bitmap "
"t:%u bo:%lu\n", toggle, c->bit_offset);
return -1;
}
......@@ -1135,7 +1135,7 @@ static int fill_bitmap_rle_bits(struct drbd_device *device,
if (bits == -ENOBUFS) /* buffer full */
break;
if (bits <= 0) {
dev_err(DEV, "error while encoding bitmap: %d\n", bits);
drbd_err(device, "error while encoding bitmap: %d\n", bits);
return 0;
}
......@@ -1238,13 +1238,13 @@ static int _drbd_send_bitmap(struct drbd_device *device)
if (get_ldev(device)) {
if (drbd_md_test_flag(device->ldev, MDF_FULL_SYNC)) {
dev_info(DEV, "Writing the whole bitmap, MDF_FullSync was set.\n");
drbd_info(device, "Writing the whole bitmap, MDF_FullSync was set.\n");
drbd_bm_set_all(device);
if (drbd_bm_write(device)) {
/* write_bm did fail! Leave full sync flag set in Meta P_DATA
* but otherwise process as per normal - need to tell other
* side that a full resync is required! */
dev_err(DEV, "Failed to write bitmap to disk!\n");
drbd_err(device, "Failed to write bitmap to disk!\n");
} else {
drbd_md_clear_flag(device, MDF_FULL_SYNC);
drbd_md_sync(device);
......@@ -1517,7 +1517,7 @@ static int _drbd_send_page(struct drbd_device *device, struct page *page,
break;
continue;
}
dev_warn(DEV, "%s: size=%d len=%d sent=%d\n",
drbd_warn(device, "%s: size=%d len=%d sent=%d\n",
__func__, (int)size, len, sent);
if (sent < 0)
err = sent;
......@@ -1663,7 +1663,7 @@ int drbd_send_dblock(struct drbd_device *device, struct drbd_request *req)
unsigned char digest[64];
drbd_csum_bio(device, first_peer_device(device)->connection->integrity_tfm, req->master_bio, digest);
if (memcmp(p + 1, digest, dgs)) {
dev_warn(DEV,
drbd_warn(device,
"Digest mismatch, buffer modified by upper layers during write: %llus +%u\n",
(unsigned long long)req->i.sector, req->i.size);
}
......@@ -1955,7 +1955,7 @@ void drbd_device_cleanup(struct drbd_device *device)
{
int i;
if (first_peer_device(device)->connection->receiver.t_state != NONE)
dev_err(DEV, "ASSERT FAILED: receiver t_state == %d expected 0.\n",
drbd_err(device, "ASSERT FAILED: receiver t_state == %d expected 0.\n",
first_peer_device(device)->connection->receiver.t_state);
device->al_writ_cnt =
......@@ -2140,23 +2140,23 @@ static void drbd_release_all_peer_reqs(struct drbd_device *device)
rr = drbd_free_peer_reqs(device, &device->active_ee);
if (rr)
dev_err(DEV, "%d EEs in active list found!\n", rr);
drbd_err(device, "%d EEs in active list found!\n", rr);
rr = drbd_free_peer_reqs(device, &device->sync_ee);
if (rr)
dev_err(DEV, "%d EEs in sync list found!\n", rr);
drbd_err(device, "%d EEs in sync list found!\n", rr);
rr = drbd_free_peer_reqs(device, &device->read_ee);
if (rr)
dev_err(DEV, "%d EEs in read list found!\n", rr);
drbd_err(device, "%d EEs in read list found!\n", rr);
rr = drbd_free_peer_reqs(device, &device->done_ee);
if (rr)
dev_err(DEV, "%d EEs in done list found!\n", rr);
drbd_err(device, "%d EEs in done list found!\n", rr);
rr = drbd_free_peer_reqs(device, &device->net_ee);
if (rr)
dev_err(DEV, "%d EEs in net list found!\n", rr);
drbd_err(device, "%d EEs in net list found!\n", rr);
}
/* caution. no locking. */
......@@ -2237,7 +2237,7 @@ static void do_retry(struct work_struct *ws)
(req->rq_state & RQ_LOCAL_ABORTED) != 0);
if (!expected)
dev_err(DEV, "req=%p completion_ref=%d rq_state=%x\n",
drbd_err(device, "req=%p completion_ref=%d rq_state=%x\n",
req, atomic_read(&req->completion_ref),
req->rq_state);
......@@ -3011,7 +3011,7 @@ void drbd_md_write(struct drbd_device *device, void *b)
if (drbd_md_sync_page_io(device, device->ldev, sector, WRITE)) {
/* this was a try anyways ... */
dev_err(DEV, "meta data update failed!\n");
drbd_err(device, "meta data update failed!\n");
drbd_chk_io_error(device, 1, DRBD_META_IO_ERROR);
}
}
......@@ -3093,7 +3093,7 @@ static int check_activity_log_stripe_size(struct drbd_device *device,
return 0;
err:
dev_err(DEV, "invalid activity log striping: al_stripes=%u, al_stripe_size_4k=%u\n",
drbd_err(device, "invalid activity log striping: al_stripes=%u, al_stripe_size_4k=%u\n",
al_stripes, al_stripe_size_4k);
return -EINVAL;
}
......@@ -3165,7 +3165,7 @@ static int check_offsets_and_sizes(struct drbd_device *device, struct drbd_backi
return 0;
err:
dev_err(DEV, "meta data offsets don't make sense: idx=%d "
drbd_err(device, "meta data offsets don't make sense: idx=%d "
"al_s=%u, al_sz4k=%u, al_offset=%d, bm_offset=%d, "
"md_size_sect=%u, la_size=%llu, md_capacity=%llu\n",
in_core->meta_dev_idx,
......@@ -3210,7 +3210,7 @@ int drbd_md_read(struct drbd_device *device, struct drbd_backing_dev *bdev)
if (drbd_md_sync_page_io(device, bdev, bdev->md.md_offset, READ)) {
/* NOTE: can't do normal error processing here as this is
called BEFORE disk is attached */
dev_err(DEV, "Error while reading metadata.\n");
drbd_err(device, "Error while reading metadata.\n");
rv = ERR_IO_MD_DISK;
goto err;
}
......@@ -3220,7 +3220,7 @@ int drbd_md_read(struct drbd_device *device, struct drbd_backing_dev *bdev)
if (magic == DRBD_MD_MAGIC_84_UNCLEAN ||
(magic == DRBD_MD_MAGIC_08 && !(flags & MDF_AL_CLEAN))) {
/* btw: that's Activity Log clean, not "all" clean. */
dev_err(DEV, "Found unclean meta data. Did you \"drbdadm apply-al\"?\n");
drbd_err(device, "Found unclean meta data. Did you \"drbdadm apply-al\"?\n");
rv = ERR_MD_UNCLEAN;
goto err;
}
......@@ -3228,14 +3228,14 @@ int drbd_md_read(struct drbd_device *device, struct drbd_backing_dev *bdev)
rv = ERR_MD_INVALID;
if (magic != DRBD_MD_MAGIC_08) {
if (magic == DRBD_MD_MAGIC_07)
dev_err(DEV, "Found old (0.7) meta data magic. Did you \"drbdadm create-md\"?\n");
drbd_err(device, "Found old (0.7) meta data magic. Did you \"drbdadm create-md\"?\n");
else
dev_err(DEV, "Meta data magic not found. Did you \"drbdadm create-md\"?\n");
drbd_err(device, "Meta data magic not found. Did you \"drbdadm create-md\"?\n");
goto err;
}
if (be32_to_cpu(buffer->bm_bytes_per_bit) != BM_BLOCK_SIZE) {
dev_err(DEV, "unexpected bm_bytes_per_bit: %u (expected %u)\n",
drbd_err(device, "unexpected bm_bytes_per_bit: %u (expected %u)\n",
be32_to_cpu(buffer->bm_bytes_per_bit), BM_BLOCK_SIZE);
goto err;
}
......@@ -3258,12 +3258,12 @@ int drbd_md_read(struct drbd_device *device, struct drbd_backing_dev *bdev)
goto err;
if (be32_to_cpu(buffer->bm_offset) != bdev->md.bm_offset) {
dev_err(DEV, "unexpected bm_offset: %d (expected %d)\n",
drbd_err(device, "unexpected bm_offset: %d (expected %d)\n",
be32_to_cpu(buffer->bm_offset), bdev->md.bm_offset);
goto err;
}
if (be32_to_cpu(buffer->md_size_sect) != bdev->md.md_size_sect) {
dev_err(DEV, "unexpected md_size: %u (expected %u)\n",
drbd_err(device, "unexpected md_size: %u (expected %u)\n",
be32_to_cpu(buffer->md_size_sect), bdev->md.md_size_sect);
goto err;
}
......@@ -3371,7 +3371,7 @@ void drbd_uuid_new_current(struct drbd_device *device) __must_hold(local)
bm_uuid = device->ldev->md.uuid[UI_BITMAP];
if (bm_uuid)
dev_warn(DEV, "bm UUID was already set: %llX\n", bm_uuid);
drbd_warn(device, "bm UUID was already set: %llX\n", bm_uuid);
device->ldev->md.uuid[UI_BITMAP] = device->ldev->md.uuid[UI_CURRENT];
__drbd_uuid_set(device, UI_CURRENT, val);
......@@ -3396,7 +3396,7 @@ void drbd_uuid_set_bm(struct drbd_device *device, u64 val) __must_hold(local)
} else {
unsigned long long bm_uuid = device->ldev->md.uuid[UI_BITMAP];
if (bm_uuid)
dev_warn(DEV, "bm UUID was already set: %llX\n", bm_uuid);
drbd_warn(device, "bm UUID was already set: %llX\n", bm_uuid);
device->ldev->md.uuid[UI_BITMAP] = val & ~((u64)1);
}
......@@ -3558,7 +3558,7 @@ void drbd_queue_bitmap_io(struct drbd_device *device,
D_ASSERT(!test_bit(BITMAP_IO, &device->flags));
D_ASSERT(list_empty(&device->bm_io_work.w.list));
if (device->bm_io_work.why)
dev_err(DEV, "FIXME going to queue '%s' but '%s' still pending?\n",
drbd_err(device, "FIXME going to queue '%s' but '%s' still pending?\n",
why, device->bm_io_work.why);
device->bm_io_work.io_fn = io_fn;
......@@ -3637,9 +3637,9 @@ static int w_md_sync(struct drbd_work *w, int unused)
{
struct drbd_device *device = w->device;
dev_warn(DEV, "md_sync_timer expired! Worker calls drbd_md_sync().\n");
drbd_warn(device, "md_sync_timer expired! Worker calls drbd_md_sync().\n");
#ifdef DEBUG
dev_warn(DEV, "last md_mark_dirty: %s:%u\n",
drbd_warn(device, "last md_mark_dirty: %s:%u\n",
device->last_md_mark_dirty.func, device->last_md_mark_dirty.line);
#endif
drbd_md_sync(device);
......@@ -3813,7 +3813,7 @@ _drbd_insert_fault(struct drbd_device *device, unsigned int type)
fault_count++;
if (__ratelimit(&drbd_ratelimit_state))
dev_warn(DEV, "***Simulating %s failure\n",
drbd_warn(device, "***Simulating %s failure\n",
_drbd_fault_str(type));
}
......
This diff is collapsed.
This diff is collapsed.
......@@ -102,7 +102,7 @@ void drbd_req_destroy(struct kref *kref)
atomic_read(&req->completion_ref) ||
(s & RQ_LOCAL_PENDING) ||
((s & RQ_NET_MASK) && !(s & RQ_NET_DONE))) {
dev_err(DEV, "drbd_req_destroy: Logic BUG rq_state = 0x%x, completion_ref = %d\n",
drbd_err(device, "drbd_req_destroy: Logic BUG rq_state = 0x%x, completion_ref = %d\n",
s, atomic_read(&req->completion_ref));
return;
}
......@@ -153,7 +153,7 @@ void drbd_req_destroy(struct kref *kref)
drbd_al_complete_io(device, &req->i);
put_ldev(device);
} else if (__ratelimit(&drbd_ratelimit_state)) {
dev_warn(DEV, "Should have called drbd_al_complete_io(, %llu, %u), "
drbd_warn(device, "Should have called drbd_al_complete_io(, %llu, %u), "
"but my Disk seems to have failed :(\n",
(unsigned long long) req->i.sector, req->i.size);
}
......@@ -227,12 +227,12 @@ void drbd_req_complete(struct drbd_request *req, struct bio_and_error *m)
if ((s & RQ_LOCAL_PENDING && !(s & RQ_LOCAL_ABORTED)) ||
(s & RQ_NET_QUEUED) || (s & RQ_NET_PENDING) ||
(s & RQ_COMPLETION_SUSP)) {
dev_err(DEV, "drbd_req_complete: Logic BUG rq_state = 0x%x\n", s);
drbd_err(device, "drbd_req_complete: Logic BUG rq_state = 0x%x\n", s);
return;
}
if (!req->master_bio) {
dev_err(DEV, "drbd_req_complete: Logic BUG, master_bio == NULL!\n");
drbd_err(device, "drbd_req_complete: Logic BUG, master_bio == NULL!\n");
return;
}
......@@ -410,7 +410,7 @@ static void mod_rq_state(struct drbd_request *req, struct bio_and_error *m,
int at_least = k_put + !!c_put;
int refcount = atomic_read(&req->kref.refcount);
if (refcount < at_least)
dev_err(DEV,
drbd_err(device,
"mod_rq_state: Logic BUG: %x -> %x: refcount = %d, should be >= %d\n",
s, req->rq_state, refcount, at_least);
}
......@@ -432,7 +432,7 @@ static void drbd_report_io_error(struct drbd_device *device, struct drbd_request
if (!__ratelimit(&drbd_ratelimit_state))
return;
dev_warn(DEV, "local %s IO error sector %llu+%u on %s\n",
drbd_warn(device, "local %s IO error sector %llu+%u on %s\n",
(req->rq_state & RQ_WRITE) ? "WRITE" : "READ",
(unsigned long long)req->i.sector,
req->i.size >> 9,
......@@ -463,7 +463,7 @@ int __req_mod(struct drbd_request *req, enum drbd_req_event what,
switch (what) {
default:
dev_err(DEV, "LOGIC BUG in %s:%u\n", __FILE__ , __LINE__);
drbd_err(device, "LOGIC BUG in %s:%u\n", __FILE__ , __LINE__);
break;
/* does not happen...
......@@ -741,7 +741,7 @@ int __req_mod(struct drbd_request *req, enum drbd_req_event what,
/* barrier came in before all requests were acked.
* this is bad, because if the connection is lost now,
* we won't be able to clean them up... */
dev_err(DEV, "FIXME (BARRIER_ACKED but pending)\n");
drbd_err(device, "FIXME (BARRIER_ACKED but pending)\n");
}
/* Allowed to complete requests, even while suspended.
* As this is called for all requests within a matching epoch,
......@@ -883,12 +883,12 @@ static void maybe_pull_ahead(struct drbd_device *device)
if (nc->cong_fill &&
atomic_read(&device->ap_in_flight) >= nc->cong_fill) {
dev_info(DEV, "Congestion-fill threshold reached\n");
drbd_info(device, "Congestion-fill threshold reached\n");
congested = true;
}
if (device->act_log->used >= nc->cong_extents) {
dev_info(DEV, "Congestion-extents threshold reached\n");
drbd_info(device, "Congestion-extents threshold reached\n");
congested = true;
}
......@@ -1046,7 +1046,7 @@ drbd_request_prepare(struct drbd_device *device, struct bio *bio, unsigned long
dec_ap_bio(device);
/* only pass the error to the upper layers.
* if user cannot handle io errors, that's not our business. */
dev_err(DEV, "could not kmalloc() req\n");
drbd_err(device, "could not kmalloc() req\n");
bio_endio(bio, -ENOMEM);
return ERR_PTR(-ENOMEM);
}
......@@ -1146,7 +1146,7 @@ static void drbd_send_and_submit(struct drbd_device *device, struct drbd_request
} else if (no_remote) {
nodata:
if (__ratelimit(&drbd_ratelimit_state))
dev_err(DEV, "IO ERROR: neither local nor remote data, sector %llu+%u\n",
drbd_err(device, "IO ERROR: neither local nor remote data, sector %llu+%u\n",
(unsigned long long)req->i.sector, req->i.size >> 9);
/* A write may have been queued for send_oos, however.
* So we can not simply free it, we must go through drbd_req_put_completion_ref() */
......@@ -1387,13 +1387,13 @@ void request_timer_fn(unsigned long data)
if (ent && req->rq_state & RQ_NET_PENDING &&
time_after(now, req->start_time + ent) &&
!time_in_range(now, connection->last_reconnect_jif, connection->last_reconnect_jif + ent)) {
dev_warn(DEV, "Remote failed to finish a request within ko-count * timeout\n");
drbd_warn(device, "Remote failed to finish a request within ko-count * timeout\n");
_drbd_set_state(_NS(device, conn, C_TIMEOUT), CS_VERBOSE | CS_HARD, NULL);
}
if (dt && req->rq_state & RQ_LOCAL_PENDING && req->w.device == device &&
time_after(now, req->start_time + dt) &&
!time_in_range(now, device->last_reattach_jif, device->last_reattach_jif + dt)) {
dev_warn(DEV, "Local backing device failed to meet the disk-timeout\n");
drbd_warn(device, "Local backing device failed to meet the disk-timeout\n");
__drbd_chk_io_error(device, DRBD_FORCE_DETACH);
}
nt = (time_after(now, req->start_time + et) ? now : req->start_time) + et;
......
......@@ -411,7 +411,7 @@ _drbd_request_state(struct drbd_device *device, union drbd_state mask,
static void print_st(struct drbd_device *device, char *name, union drbd_state ns)
{
dev_err(DEV, " %s = { cs:%s ro:%s/%s ds:%s/%s %c%c%c%c%c%c }\n",
drbd_err(device, " %s = { cs:%s ro:%s/%s ds:%s/%s %c%c%c%c%c%c }\n",
name,
drbd_conn_str(ns.conn),
drbd_role_str(ns.role),
......@@ -432,7 +432,7 @@ void print_st_err(struct drbd_device *device, union drbd_state os,
{
if (err == SS_IN_TRANSIENT_STATE)
return;
dev_err(DEV, "State change failed: %s\n", drbd_set_st_err_str(err));
drbd_err(device, "State change failed: %s\n", drbd_set_st_err_str(err));
print_st(device, " state", os);
print_st(device, "wanted", ns);
}
......@@ -490,7 +490,7 @@ static void drbd_pr_state_change(struct drbd_device *device, union drbd_state os
ns.user_isp);
if (pbp != pb)
dev_info(DEV, "%s\n", pb);
drbd_info(device, "%s\n", pb);
}
static void conn_pr_state_change(struct drbd_connection *connection, union drbd_state os, union drbd_state ns,
......@@ -726,7 +726,7 @@ static void print_sanitize_warnings(struct drbd_device *device, enum sanitize_st
};
if (warn != NO_WARNING)
dev_warn(DEV, "%s\n", msg_table[warn]);
drbd_warn(device, "%s\n", msg_table[warn]);
}
/**
......@@ -906,7 +906,7 @@ static union drbd_state sanitize_state(struct drbd_device *device, union drbd_st
void drbd_resume_al(struct drbd_device *device)
{
if (test_and_clear_bit(AL_SUSPENDED, &device->flags))
dev_info(DEV, "Resumed AL updates\n");
drbd_info(device, "Resumed AL updates\n");
}
/* helper for __drbd_set_state */
......@@ -1035,13 +1035,13 @@ __drbd_set_state(struct drbd_device *device, union drbd_state ns,
device->ov_start_sector =
BM_BIT_TO_SECT(drbd_bm_bits(device) - device->ov_left);
if (device->ov_left)
dev_info(DEV, "Online Verify reached sector %llu\n",
drbd_info(device, "Online Verify reached sector %llu\n",
(unsigned long long)device->ov_start_sector);
}
if ((os.conn == C_PAUSED_SYNC_T || os.conn == C_PAUSED_SYNC_S) &&
(ns.conn == C_SYNC_TARGET || ns.conn == C_SYNC_SOURCE)) {
dev_info(DEV, "Syncer continues.\n");
drbd_info(device, "Syncer continues.\n");
device->rs_paused += (long)jiffies
-(long)device->rs_mark_time[device->rs_last_mark];
if (ns.conn == C_SYNC_TARGET)
......@@ -1050,7 +1050,7 @@ __drbd_set_state(struct drbd_device *device, union drbd_state ns,
if ((os.conn == C_SYNC_TARGET || os.conn == C_SYNC_SOURCE) &&
(ns.conn == C_PAUSED_SYNC_T || ns.conn == C_PAUSED_SYNC_S)) {
dev_info(DEV, "Resync suspended\n");
drbd_info(device, "Resync suspended\n");
device->rs_mark_time[device->rs_last_mark] = jiffies;
}
......@@ -1074,7 +1074,7 @@ __drbd_set_state(struct drbd_device *device, union drbd_state ns,
drbd_rs_controller_reset(device);
if (ns.conn == C_VERIFY_S) {
dev_info(DEV, "Starting Online Verify from sector %llu\n",
drbd_info(device, "Starting Online Verify from sector %llu\n",
(unsigned long long)device->ov_position);
mod_timer(&device->resync_timer, jiffies);
}
......@@ -1149,7 +1149,7 @@ __drbd_set_state(struct drbd_device *device, union drbd_state ns,
ascw->done = done;
drbd_queue_work(&first_peer_device(device)->connection->sender_work, &ascw->w);
} else {
dev_err(DEV, "Could not kmalloc an ascw\n");
drbd_err(device, "Could not kmalloc an ascw\n");
}
return rv;
......@@ -1174,7 +1174,7 @@ static int w_after_state_ch(struct drbd_work *w, int unused)
static void abw_start_sync(struct drbd_device *device, int rv)
{
if (rv) {
dev_err(DEV, "Writing the bitmap failed not starting resync.\n");
drbd_err(device, "Writing the bitmap failed not starting resync.\n");
_drbd_request_state(device, NS(conn, C_CONNECTED), CS_VERBOSE);
return;
}
......@@ -1441,7 +1441,7 @@ static void after_state_ch(struct drbd_device *device, union drbd_state os,
* there is only one way out: to D_DISKLESS,
* and that may only happen after our put_ldev below. */
if (device->state.disk != D_FAILED)
dev_err(DEV,
drbd_err(device,
"ASSERT FAILED: disk is %s during detach\n",
drbd_disk_str(device->state.disk));
......@@ -1465,9 +1465,9 @@ static void after_state_ch(struct drbd_device *device, union drbd_state os,
/* We must still be diskless,
* re-attach has to be serialized with this! */
if (device->state.disk != D_DISKLESS)
dev_err(DEV,
"ASSERT FAILED: disk is %s while going diskless\n",
drbd_disk_str(device->state.disk));
drbd_err(device,
"ASSERT FAILED: disk is %s while going diskless\n",
drbd_disk_str(device->state.disk));
if (ns.conn >= C_CONNECTED)
drbd_send_state(device, ns);
......
......@@ -176,12 +176,12 @@ void drbd_peer_request_endio(struct bio *bio, int error)
int is_write = bio_data_dir(bio) == WRITE;
if (error && __ratelimit(&drbd_ratelimit_state))
dev_warn(DEV, "%s: error=%d s=%llus\n",
drbd_warn(device, "%s: error=%d s=%llus\n",
is_write ? "write" : "read", error,
(unsigned long long)peer_req->i.sector);
if (!error && !uptodate) {
if (__ratelimit(&drbd_ratelimit_state))
dev_warn(DEV, "%s: setting error to -EIO s=%llus\n",
drbd_warn(device, "%s: setting error to -EIO s=%llus\n",
is_write ? "write" : "read",
(unsigned long long)peer_req->i.sector);
/* strange behavior of some lower level drivers...
......@@ -214,7 +214,7 @@ void drbd_request_endio(struct bio *bio, int error)
int uptodate = bio_flagged(bio, BIO_UPTODATE);
if (!error && !uptodate) {
dev_warn(DEV, "p %s: setting error to -EIO\n",
drbd_warn(device, "p %s: setting error to -EIO\n",
bio_data_dir(bio) == WRITE ? "write" : "read");
/* strange behavior of some lower level drivers...
* fail the request by clearing the uptodate flag,
......@@ -253,7 +253,7 @@ void drbd_request_endio(struct bio *bio, int error)
*/
if (unlikely(req->rq_state & RQ_LOCAL_ABORTED)) {
if (__ratelimit(&drbd_ratelimit_state))
dev_emerg(DEV, "delayed completion of aborted local request; disk-timeout may be too aggressive\n");
drbd_emerg(device, "delayed completion of aborted local request; disk-timeout may be too aggressive\n");
if (!error)
panic("possible random memory corruption caused by delayed completion of aborted local request\n");
......@@ -364,7 +364,7 @@ static int w_e_send_csum(struct drbd_work *w, int cancel)
P_CSUM_RS_REQUEST);
kfree(digest);
} else {
dev_err(DEV, "kmalloc() of digest failed.\n");
drbd_err(device, "kmalloc() of digest failed.\n");
err = -ENOMEM;
}
......@@ -373,7 +373,7 @@ static int w_e_send_csum(struct drbd_work *w, int cancel)
drbd_free_peer_req(device, peer_req);
if (unlikely(err))
dev_err(DEV, "drbd_send_drequest(..., csum) failed\n");
drbd_err(device, "drbd_send_drequest(..., csum) failed\n");
return err;
}
......@@ -534,7 +534,7 @@ static int drbd_rs_controller(struct drbd_device *device)
req_sect = max_sect;
/*
dev_warn(DEV, "si=%u if=%d wa=%u co=%d st=%d cps=%d pl=%d cc=%d rs=%d\n",
drbd_warn(device, "si=%u if=%d wa=%u co=%d st=%d cps=%d pl=%d cc=%d rs=%d\n",
sect_in, device->rs_in_flight, want, correction,
steps, cps, device->rs_planed, curr_corr, req_sect);
*/
......@@ -586,7 +586,7 @@ int w_make_resync_request(struct drbd_work *w, int cancel)
get_ldev_if_state(device,D_FAILED) would be sufficient, but
to continue resync with a broken disk makes no sense at
all */
dev_err(DEV, "Disk broke down during resync!\n");
drbd_err(device, "Disk broke down during resync!\n");
return 0;
}
......@@ -699,7 +699,7 @@ int w_make_resync_request(struct drbd_work *w, int cancel)
err = drbd_send_drequest(device, P_RS_DATA_REQUEST,
sector, size, ID_SYNCER);
if (err) {
dev_err(DEV, "drbd_send_drequest() failed, aborting...\n");
drbd_err(device, "drbd_send_drequest() failed, aborting...\n");
dec_rs_pending(device);
put_ldev(device);
return err;
......@@ -835,7 +835,7 @@ int drbd_resync_finished(struct drbd_device *device)
drbd_queue_work(&first_peer_device(device)->connection->sender_work, w);
return 1;
}
dev_err(DEV, "Warn failed to drbd_rs_del_all() and to kmalloc(w).\n");
drbd_err(device, "Warn failed to drbd_rs_del_all() and to kmalloc(w).\n");
}
dt = (jiffies - device->rs_start - device->rs_paused) / HZ;
......@@ -868,7 +868,7 @@ int drbd_resync_finished(struct drbd_device *device)
ns = os;
ns.conn = C_CONNECTED;
dev_info(DEV, "%s done (total %lu sec; paused %lu sec; %lu K/sec)\n",
drbd_info(device, "%s done (total %lu sec; paused %lu sec; %lu K/sec)\n",
verify_done ? "Online verify" : "Resync",
dt + device->rs_paused, device->rs_paused, dbdt);
......@@ -876,7 +876,7 @@ int drbd_resync_finished(struct drbd_device *device)
if (os.conn == C_VERIFY_S || os.conn == C_VERIFY_T) {
if (n_oos) {
dev_alert(DEV, "Online verify found %lu %dk block out of sync!\n",
drbd_alert(device, "Online verify found %lu %dk block out of sync!\n",
n_oos, Bit2KB(1));
khelper_cmd = "out-of-sync";
}
......@@ -892,7 +892,7 @@ int drbd_resync_finished(struct drbd_device *device)
const int ratio =
(t == 0) ? 0 :
(t < 100000) ? ((s*100)/t) : (s/(t/100));
dev_info(DEV, "%u %% had equal checksums, eliminated: %luK; "
drbd_info(device, "%u %% had equal checksums, eliminated: %luK; "
"transferred %luK total %luK\n",
ratio,
Bit2KB(device->rs_same_csum),
......@@ -902,7 +902,7 @@ int drbd_resync_finished(struct drbd_device *device)
}
if (device->rs_failed) {
dev_info(DEV, " %lu failed blocks\n", device->rs_failed);
drbd_info(device, " %lu failed blocks\n", device->rs_failed);
if (os.conn == C_SYNC_TARGET || os.conn == C_PAUSED_SYNC_T) {
ns.disk = D_INCONSISTENT;
......@@ -923,7 +923,7 @@ int drbd_resync_finished(struct drbd_device *device)
drbd_uuid_set(device, UI_BITMAP, device->ldev->md.uuid[UI_CURRENT]);
_drbd_uuid_set(device, UI_CURRENT, device->p_uuid[UI_CURRENT]);
} else {
dev_err(DEV, "device->p_uuid is NULL! BUG\n");
drbd_err(device, "device->p_uuid is NULL! BUG\n");
}
}
......@@ -1001,7 +1001,7 @@ int w_e_end_data_req(struct drbd_work *w, int cancel)
err = drbd_send_block(device, P_DATA_REPLY, peer_req);
} else {
if (__ratelimit(&drbd_ratelimit_state))
dev_err(DEV, "Sending NegDReply. sector=%llus.\n",
drbd_err(device, "Sending NegDReply. sector=%llus.\n",
(unsigned long long)peer_req->i.sector);
err = drbd_send_ack(device, P_NEG_DREPLY, peer_req);
......@@ -1012,7 +1012,7 @@ int w_e_end_data_req(struct drbd_work *w, int cancel)
move_to_net_ee_or_free(device, peer_req);
if (unlikely(err))
dev_err(DEV, "drbd_send_block() failed\n");
drbd_err(device, "drbd_send_block() failed\n");
return err;
}
......@@ -1047,13 +1047,13 @@ int w_e_end_rsdata_req(struct drbd_work *w, int cancel)
err = drbd_send_block(device, P_RS_DATA_REPLY, peer_req);
} else {
if (__ratelimit(&drbd_ratelimit_state))
dev_err(DEV, "Not sending RSDataReply, "
drbd_err(device, "Not sending RSDataReply, "
"partner DISKLESS!\n");
err = 0;
}
} else {
if (__ratelimit(&drbd_ratelimit_state))
dev_err(DEV, "Sending NegRSDReply. sector %llus.\n",
drbd_err(device, "Sending NegRSDReply. sector %llus.\n",
(unsigned long long)peer_req->i.sector);
err = drbd_send_ack(device, P_NEG_RS_DREPLY, peer_req);
......@@ -1067,7 +1067,7 @@ int w_e_end_rsdata_req(struct drbd_work *w, int cancel)
move_to_net_ee_or_free(device, peer_req);
if (unlikely(err))
dev_err(DEV, "drbd_send_block() failed\n");
drbd_err(device, "drbd_send_block() failed\n");
return err;
}
......@@ -1123,14 +1123,14 @@ int w_e_end_csum_rs_req(struct drbd_work *w, int cancel)
} else {
err = drbd_send_ack(device, P_NEG_RS_DREPLY, peer_req);
if (__ratelimit(&drbd_ratelimit_state))
dev_err(DEV, "Sending NegDReply. I guess it gets messy.\n");
drbd_err(device, "Sending NegDReply. I guess it gets messy.\n");
}
dec_unacked(device);
move_to_net_ee_or_free(device, peer_req);
if (unlikely(err))
dev_err(DEV, "drbd_send_block/ack() failed\n");
drbd_err(device, "drbd_send_block/ack() failed\n");
return err;
}
......@@ -1590,7 +1590,7 @@ int w_start_resync(struct drbd_work *w, int cancel)
struct drbd_device *device = w->device;
if (atomic_read(&device->unacked_cnt) || atomic_read(&device->rs_pending_cnt)) {
dev_warn(DEV, "w_start_resync later...\n");
drbd_warn(device, "w_start_resync later...\n");
device->start_resync_timer.expires = jiffies + HZ/10;
add_timer(&device->start_resync_timer);
return 0;
......@@ -1615,7 +1615,7 @@ void drbd_start_resync(struct drbd_device *device, enum drbd_conns side)
int r;
if (device->state.conn >= C_SYNC_SOURCE && device->state.conn < C_AHEAD) {
dev_err(DEV, "Resync already running!\n");
drbd_err(device, "Resync already running!\n");
return;
}
......@@ -1627,7 +1627,7 @@ void drbd_start_resync(struct drbd_device *device, enum drbd_conns side)
r = drbd_khelper(device, "before-resync-target");
r = (r >> 8) & 0xff;
if (r > 0) {
dev_info(DEV, "before-resync-target handler returned %d, "
drbd_info(device, "before-resync-target handler returned %d, "
"dropping connection.\n", r);
conn_request_state(first_peer_device(device)->connection, NS(conn, C_DISCONNECTING), CS_HARD);
return;
......@@ -1637,10 +1637,10 @@ void drbd_start_resync(struct drbd_device *device, enum drbd_conns side)
r = (r >> 8) & 0xff;
if (r > 0) {
if (r == 3) {
dev_info(DEV, "before-resync-source handler returned %d, "
drbd_info(device, "before-resync-source handler returned %d, "
"ignoring. Old userland tools?", r);
} else {
dev_info(DEV, "before-resync-source handler returned %d, "
drbd_info(device, "before-resync-source handler returned %d, "
"dropping connection.\n", r);
conn_request_state(first_peer_device(device)->connection,
NS(conn, C_DISCONNECTING), CS_HARD);
......@@ -1715,7 +1715,7 @@ void drbd_start_resync(struct drbd_device *device, enum drbd_conns side)
* to deal with potential jiffies wrap. */
device->rs_last_bcast = jiffies - HZ;
dev_info(DEV, "Began resync as %s (will sync %lu KB [%lu bits set]).\n",
drbd_info(device, "Began resync as %s (will sync %lu KB [%lu bits set]).\n",
drbd_conn_str(ns.conn),
(unsigned long) device->rs_total << (BM_BLOCK_SHIFT-10),
(unsigned long) device->rs_total);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment