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 ...@@ -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, dt = wait_event_timeout(device->misc_wait,
*done || test_bit(FORCE_DETACH, &device->flags), dt); *done || test_bit(FORCE_DETACH, &device->flags), dt);
if (dt == 0) { 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); drbd_chk_io_error(device, 1, DRBD_FORCE_DETACH);
} }
} }
...@@ -172,7 +172,7 @@ static int _drbd_md_sync_page_io(struct drbd_device *device, ...@@ -172,7 +172,7 @@ static int _drbd_md_sync_page_io(struct drbd_device *device,
; ;
else if (!get_ldev_if_state(device, D_ATTACHING)) { else if (!get_ldev_if_state(device, D_ATTACHING)) {
/* Corresponding put_ldev in drbd_md_io_complete() */ /* 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; err = -ENODEV;
goto out; goto out;
} }
...@@ -202,21 +202,21 @@ int drbd_md_sync_page_io(struct drbd_device *device, struct drbd_backing_dev *bd ...@@ -202,21 +202,21 @@ int drbd_md_sync_page_io(struct drbd_device *device, struct drbd_backing_dev *bd
BUG_ON(!bdev->md_bdev); 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__, current->comm, current->pid, __func__,
(unsigned long long)sector, (rw & WRITE) ? "WRITE" : "READ", (unsigned long long)sector, (rw & WRITE) ? "WRITE" : "READ",
(void*)_RET_IP_ ); (void*)_RET_IP_ );
if (sector < drbd_md_first_sector(bdev) || if (sector < drbd_md_first_sector(bdev) ||
sector + 7 > drbd_md_last_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__, current->comm, current->pid, __func__,
(unsigned long long)sector, (rw & WRITE) ? "WRITE" : "READ"); (unsigned long long)sector, (rw & WRITE) ? "WRITE" : "READ");
/* we do all our meta data IO in aligned 4k blocks. */ /* we do all our meta data IO in aligned 4k blocks. */
err = _drbd_md_sync_page_io(device, bdev, iop, sector, rw, 4096); err = _drbd_md_sync_page_io(device, bdev, iop, sector, rw, 4096);
if (err) { 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); (unsigned long long)sector, (rw & WRITE) ? "WRITE" : "READ", err);
} }
return err; return err;
...@@ -404,7 +404,7 @@ int drbd_al_begin_io_nonblock(struct drbd_device *device, struct drbd_interval * ...@@ -404,7 +404,7 @@ int drbd_al_begin_io_nonblock(struct drbd_device *device, struct drbd_interval *
struct lc_element *al_ext; struct lc_element *al_ext;
al_ext = lc_get_cumulative(device->act_log, enr); al_ext = lc_get_cumulative(device->act_log, enr);
if (!al_ext) 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; return 0;
} }
...@@ -425,7 +425,7 @@ void drbd_al_complete_io(struct drbd_device *device, struct drbd_interval *i) ...@@ -425,7 +425,7 @@ void drbd_al_complete_io(struct drbd_device *device, struct drbd_interval *i)
for (enr = first; enr <= last; enr++) { for (enr = first; enr <= last; enr++) {
extent = lc_find(device->act_log, enr); extent = lc_find(device->act_log, enr);
if (!extent) { 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; continue;
} }
lc_put(device->act_log, extent); lc_put(device->act_log, extent);
...@@ -491,14 +491,14 @@ _al_write_transaction(struct drbd_device *device) ...@@ -491,14 +491,14 @@ _al_write_transaction(struct drbd_device *device)
int err = 0; int err = 0;
if (!get_ldev(device)) { 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)); drbd_disk_str(device->state.disk));
return -EIO; return -EIO;
} }
/* The bitmap write may have failed, causing a state change. */ /* The bitmap write may have failed, causing a state change. */
if (device->state.disk < D_INCONSISTENT) { if (device->state.disk < D_INCONSISTENT) {
dev_err(DEV, drbd_err(device,
"disk is %s, cannot write al transaction\n", "disk is %s, cannot write al transaction\n",
drbd_disk_str(device->state.disk)); drbd_disk_str(device->state.disk));
put_ldev(device); put_ldev(device);
...@@ -507,7 +507,7 @@ _al_write_transaction(struct drbd_device *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, ... */ buffer = drbd_md_get_buffer(device); /* protects md_io_buffer, al_tr_cycle, ... */
if (!buffer) { 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); put_ldev(device);
return -ENODEV; return -ENODEV;
} }
...@@ -689,7 +689,7 @@ static int w_update_odbm(struct drbd_work *w, int unused) ...@@ -689,7 +689,7 @@ static int w_update_odbm(struct drbd_work *w, int unused)
if (!get_ldev(device)) { if (!get_ldev(device)) {
if (__ratelimit(&drbd_ratelimit_state)) 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); kfree(udw);
return 0; return 0;
} }
...@@ -744,7 +744,7 @@ static void drbd_try_clear_on_disk_bm(struct drbd_device *device, sector_t secto ...@@ -744,7 +744,7 @@ static void drbd_try_clear_on_disk_bm(struct drbd_device *device, sector_t secto
else else
ext->rs_failed += count; ext->rs_failed += count;
if (ext->rs_left < ext->rs_failed) { 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", "rs_failed=%d count=%d cstate=%s\n",
(unsigned long long)sector, (unsigned long long)sector,
ext->lce.lc_number, ext->rs_left, 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 ...@@ -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); int rs_left = drbd_bm_e_weight(device, enr);
if (ext->flags != 0) { 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", " -> %d[%u;00]\n",
ext->lce.lc_number, ext->rs_left, ext->lce.lc_number, ext->rs_left,
ext->flags, enr, rs_left); ext->flags, enr, rs_left);
ext->flags = 0; ext->flags = 0;
} }
if (ext->rs_failed) { 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", "out with rs_failed=%d\n",
ext->lce.lc_number, ext->rs_failed); 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 ...@@ -798,11 +798,11 @@ static void drbd_try_clear_on_disk_bm(struct drbd_device *device, sector_t secto
udw->w.device = device; udw->w.device = device;
drbd_queue_work_front(&first_peer_device(device)->connection->sender_work, &udw->w); drbd_queue_work_front(&first_peer_device(device)->connection->sender_work, &udw->w);
} else { } else {
dev_warn(DEV, "Could not kmalloc an udw\n"); drbd_warn(device, "Could not kmalloc an udw\n");
} }
} }
} else { } 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_locked,
device->resync->nr_elements, device->resync->nr_elements,
device->resync->flags); device->resync->flags);
...@@ -843,7 +843,7 @@ void __drbd_set_in_sync(struct drbd_device *device, sector_t sector, int size, ...@@ -843,7 +843,7 @@ void __drbd_set_in_sync(struct drbd_device *device, sector_t sector, int size,
unsigned long flags; unsigned long flags;
if (size <= 0 || !IS_ALIGNED(size, 512) || size > DRBD_MAX_BIO_SIZE) { 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); (unsigned long long)sector, size);
return; return;
} }
...@@ -917,7 +917,7 @@ int __drbd_set_out_of_sync(struct drbd_device *device, sector_t sector, int size ...@@ -917,7 +917,7 @@ int __drbd_set_out_of_sync(struct drbd_device *device, sector_t sector, int size
return 0; return 0;
if (size < 0 || !IS_ALIGNED(size, 512) || size > DRBD_MAX_BIO_SIZE) { 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); (unsigned long long)sector, size);
return 0; return 0;
} }
...@@ -988,7 +988,7 @@ struct bm_extent *_bme_get(struct drbd_device *device, unsigned int enr) ...@@ -988,7 +988,7 @@ struct bm_extent *_bme_get(struct drbd_device *device, unsigned int enr)
if (!bm_ext) { if (!bm_ext) {
if (rs_flags & LC_STARVING) 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"); " (resync LRU too small?)\n");
BUG_ON(rs_flags & LC_LOCKED); BUG_ON(rs_flags & LC_LOCKED);
} }
...@@ -1049,7 +1049,7 @@ int drbd_rs_begin_io(struct drbd_device *device, sector_t sector) ...@@ -1049,7 +1049,7 @@ int drbd_rs_begin_io(struct drbd_device *device, sector_t sector)
if (schedule_timeout_interruptible(HZ/10)) if (schedule_timeout_interruptible(HZ/10))
return -EINTR; return -EINTR;
if (sa && --sa == 0) 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"); "Resync stalled?\n");
goto retry; goto retry;
} }
...@@ -1101,7 +1101,7 @@ int drbd_try_rs_begin_io(struct drbd_device *device, sector_t sector) ...@@ -1101,7 +1101,7 @@ int drbd_try_rs_begin_io(struct drbd_device *device, sector_t sector)
device->resync_locked--; device->resync_locked--;
wake_up(&device->al_wait); wake_up(&device->al_wait);
} else { } else {
dev_alert(DEV, "LOGIC BUG\n"); drbd_alert(device, "LOGIC BUG\n");
} }
} }
/* TRY. */ /* TRY. */
...@@ -1131,7 +1131,7 @@ int drbd_try_rs_begin_io(struct drbd_device *device, sector_t sector) ...@@ -1131,7 +1131,7 @@ int drbd_try_rs_begin_io(struct drbd_device *device, sector_t sector)
if (!bm_ext) { if (!bm_ext) {
const unsigned long rs_flags = device->resync->flags; const unsigned long rs_flags = device->resync->flags;
if (rs_flags & LC_STARVING) 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"); " (resync LRU too small?)\n");
BUG_ON(rs_flags & LC_LOCKED); BUG_ON(rs_flags & LC_LOCKED);
goto try_again; goto try_again;
...@@ -1179,13 +1179,13 @@ void drbd_rs_complete_io(struct drbd_device *device, sector_t sector) ...@@ -1179,13 +1179,13 @@ void drbd_rs_complete_io(struct drbd_device *device, sector_t sector)
if (!bm_ext) { if (!bm_ext) {
spin_unlock_irqrestore(&device->al_lock, flags); spin_unlock_irqrestore(&device->al_lock, flags);
if (__ratelimit(&drbd_ratelimit_state)) 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; return;
} }
if (bm_ext->lce.refcnt == 0) { if (bm_ext->lce.refcnt == 0) {
spin_unlock_irqrestore(&device->al_lock, flags); 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", "but refcnt is 0!?\n",
(unsigned long long)sector, enr); (unsigned long long)sector, enr);
return; return;
...@@ -1241,7 +1241,7 @@ int drbd_rs_del_all(struct drbd_device *device) ...@@ -1241,7 +1241,7 @@ int drbd_rs_del_all(struct drbd_device *device)
if (bm_ext->lce.lc_number == LC_FREE) if (bm_ext->lce.lc_number == LC_FREE)
continue; continue;
if (bm_ext->lce.lc_number == device->resync_wenr) { 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", " got 'synced' by application io\n",
device->resync_wenr); device->resync_wenr);
D_ASSERT(!test_bit(BME_LOCKED, &bm_ext->flags)); D_ASSERT(!test_bit(BME_LOCKED, &bm_ext->flags));
...@@ -1251,7 +1251,7 @@ int drbd_rs_del_all(struct drbd_device *device) ...@@ -1251,7 +1251,7 @@ int drbd_rs_del_all(struct drbd_device *device)
lc_put(device->resync, &bm_ext->lce); lc_put(device->resync, &bm_ext->lce);
} }
if (bm_ext->lce.refcnt != 0) { 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); "refcnt=%d\n", bm_ext->lce.refcnt);
put_ldev(device); put_ldev(device);
spin_unlock_irq(&device->al_lock); spin_unlock_irq(&device->al_lock);
...@@ -1285,7 +1285,7 @@ void drbd_rs_failed_io(struct drbd_device *device, sector_t sector, int size) ...@@ -1285,7 +1285,7 @@ void drbd_rs_failed_io(struct drbd_device *device, sector_t sector, int size)
int wake_up = 0; int wake_up = 0;
if (size <= 0 || !IS_ALIGNED(size, 512) || size > DRBD_MAX_BIO_SIZE) { 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); (unsigned long long)sector, size);
return; return;
} }
......
...@@ -118,7 +118,7 @@ static void __bm_print_lock_info(struct drbd_device *device, const char *func) ...@@ -118,7 +118,7 @@ static void __bm_print_lock_info(struct drbd_device *device, const char *func)
struct drbd_bitmap *b = device->bitmap; struct drbd_bitmap *b = device->bitmap;
if (!__ratelimit(&drbd_ratelimit_state)) if (!__ratelimit(&drbd_ratelimit_state))
return; 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), drbd_task_to_thread_name(first_peer_device(device)->connection, current),
func, b->bm_why ?: "?", func, b->bm_why ?: "?",
drbd_task_to_thread_name(first_peer_device(device)->connection, b->bm_task)); 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) ...@@ -130,21 +130,21 @@ void drbd_bm_lock(struct drbd_device *device, char *why, enum bm_flag flags)
int trylock_failed; int trylock_failed;
if (!b) { 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; return;
} }
trylock_failed = !mutex_trylock(&b->bm_change); trylock_failed = !mutex_trylock(&b->bm_change);
if (trylock_failed) { 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), drbd_task_to_thread_name(first_peer_device(device)->connection, current),
why, b->bm_why ?: "?", why, b->bm_why ?: "?",
drbd_task_to_thread_name(first_peer_device(device)->connection, b->bm_task)); drbd_task_to_thread_name(first_peer_device(device)->connection, b->bm_task));
mutex_lock(&b->bm_change); mutex_lock(&b->bm_change);
} }
if (BM_LOCKED_MASK & b->bm_flags) 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_flags |= flags & BM_LOCKED_MASK;
b->bm_why = why; b->bm_why = why;
...@@ -155,12 +155,12 @@ void drbd_bm_unlock(struct drbd_device *device) ...@@ -155,12 +155,12 @@ void drbd_bm_unlock(struct drbd_device *device)
{ {
struct drbd_bitmap *b = device->bitmap; struct drbd_bitmap *b = device->bitmap;
if (!b) { 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; return;
} }
if (!(BM_LOCKED_MASK & device->bitmap->bm_flags)) 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_flags &= ~BM_LOCKED_MASK;
b->bm_why = NULL; b->bm_why = NULL;
...@@ -253,7 +253,7 @@ void drbd_bm_mark_for_writeout(struct drbd_device *device, int page_nr) ...@@ -253,7 +253,7 @@ void drbd_bm_mark_for_writeout(struct drbd_device *device, int page_nr)
{ {
struct page *page; struct page *page;
if (page_nr >= device->bitmap->bm_number_of_pages) { 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); page_nr, (int)device->bitmap->bm_number_of_pages);
return; return;
} }
...@@ -645,7 +645,7 @@ int drbd_bm_resize(struct drbd_device *device, sector_t capacity, int set_new_bi ...@@ -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); 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); (unsigned long long)capacity);
if (capacity == b->bm_dev_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 ...@@ -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); u64 bits_on_disk = drbd_md_on_disk_bits(device->ldev);
put_ldev(device); put_ldev(device);
if (bits > bits_on_disk) { if (bits > bits_on_disk) {
dev_info(DEV, "bits = %lu\n", bits); drbd_info(device, "bits = %lu\n", bits);
dev_info(DEV, "bits_on_disk = %llu\n", bits_on_disk); drbd_info(device, "bits_on_disk = %llu\n", bits_on_disk);
err = -ENOSPC; err = -ENOSPC;
goto out; goto out;
} }
...@@ -742,7 +742,7 @@ int drbd_bm_resize(struct drbd_device *device, sector_t capacity, int set_new_bi ...@@ -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); bm_vk_free(opages, opages_vmalloced);
if (!growing) if (!growing)
b->bm_set = bm_count_bits(b); 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: out:
drbd_bm_unlock(device); drbd_bm_unlock(device);
...@@ -878,7 +878,7 @@ void drbd_bm_get_lel(struct drbd_device *device, size_t offset, size_t number, ...@@ -878,7 +878,7 @@ void drbd_bm_get_lel(struct drbd_device *device, size_t offset, size_t number,
if ((offset >= b->bm_words) || if ((offset >= b->bm_words) ||
(end > b->bm_words) || (end > b->bm_words) ||
(number <= 0)) (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) offset,
(unsigned long) number, (unsigned long) number,
(unsigned long) b->bm_words); (unsigned long) b->bm_words);
...@@ -966,7 +966,7 @@ static void bm_async_io_complete(struct bio *bio, int error) ...@@ -966,7 +966,7 @@ static void bm_async_io_complete(struct bio *bio, int error)
if ((ctx->flags & BM_AIO_COPY_PAGES) == 0 && if ((ctx->flags & BM_AIO_COPY_PAGES) == 0 &&
!bm_test_page_unchanged(b->bm_pages[idx])) !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) { if (error) {
/* ctx error will hold the completed-last non-zero error code, /* 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) ...@@ -976,11 +976,11 @@ static void bm_async_io_complete(struct bio *bio, int error)
/* Not identical to on disk version of it. /* Not identical to on disk version of it.
* Is BM_PAGE_IO_ERROR enough? */ * Is BM_PAGE_IO_ERROR enough? */
if (__ratelimit(&drbd_ratelimit_state)) 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); error, idx);
} else { } else {
bm_clear_page_io_err(b->bm_pages[idx]); 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); bm_page_unlock_io(device, idx);
...@@ -1081,7 +1081,7 @@ static int bm_rw(struct drbd_device *device, int rw, unsigned flags, unsigned la ...@@ -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() */ 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); kfree(ctx);
return -ENODEV; return -ENODEV;
} }
...@@ -1106,14 +1106,14 @@ static int bm_rw(struct drbd_device *device, int rw, unsigned flags, unsigned la ...@@ -1106,14 +1106,14 @@ static int bm_rw(struct drbd_device *device, int rw, unsigned flags, unsigned la
if (!(flags & BM_WRITE_ALL_PAGES) && if (!(flags & BM_WRITE_ALL_PAGES) &&
bm_test_page_unchanged(b->bm_pages[i])) { 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; continue;
} }
/* during lazy writeout, /* during lazy writeout,
* ignore those pages not marked for lazy writeout. */ * ignore those pages not marked for lazy writeout. */
if (lazy_writeout_upper_idx && if (lazy_writeout_upper_idx &&
!bm_test_page_lazy_writeout(b->bm_pages[i])) { !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; continue;
} }
} }
...@@ -1138,12 +1138,12 @@ static int bm_rw(struct drbd_device *device, int rw, unsigned flags, unsigned la ...@@ -1138,12 +1138,12 @@ static int bm_rw(struct drbd_device *device, int rw, unsigned flags, unsigned la
/* summary for global bitmap IO */ /* summary for global bitmap IO */
if (flags == 0) 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", rw == WRITE ? "WRITE" : "READ",
count, jiffies - now); count, jiffies - now);
if (ctx->error) { 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); drbd_chk_io_error(device, 1, DRBD_META_IO_ERROR);
err = -EIO; /* ctx->error ? */ err = -EIO; /* ctx->error ? */
} }
...@@ -1156,13 +1156,13 @@ static int bm_rw(struct drbd_device *device, int rw, unsigned flags, unsigned la ...@@ -1156,13 +1156,13 @@ static int bm_rw(struct drbd_device *device, int rw, unsigned flags, unsigned la
drbd_md_flush(device); drbd_md_flush(device);
} else /* rw == READ */ { } else /* rw == READ */ {
b->bm_set = bm_count_bits(b); 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); jiffies - now);
} }
now = b->bm_set; now = b->bm_set;
if (flags == 0) 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); ppsize(ppb, now << (BM_BLOCK_SHIFT-10)), now);
kref_put(&ctx->kref, &bm_aio_ctx_destroy); 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 ...@@ -1243,7 +1243,7 @@ int drbd_bm_write_page(struct drbd_device *device, unsigned int idx) __must_hold
int err; int err;
if (bm_test_page_unchanged(device->bitmap->bm_pages[idx])) { 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; return 0;
} }
...@@ -1261,7 +1261,7 @@ int drbd_bm_write_page(struct drbd_device *device, unsigned int idx) __must_hold ...@@ -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() */ 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); kfree(ctx);
return -ENODEV; return -ENODEV;
} }
...@@ -1298,7 +1298,7 @@ static unsigned long __bm_find_next(struct drbd_device *device, unsigned long bm ...@@ -1298,7 +1298,7 @@ static unsigned long __bm_find_next(struct drbd_device *device, unsigned long bm
if (bm_fo > b->bm_bits) { 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; bm_fo = DRBD_END_OF_BITMAP;
} else { } else {
while (bm_fo < b->bm_bits) { while (bm_fo < b->bm_bits) {
...@@ -1393,7 +1393,7 @@ static int __bm_change_bits_to(struct drbd_device *device, const unsigned long s ...@@ -1393,7 +1393,7 @@ static int __bm_change_bits_to(struct drbd_device *device, const unsigned long s
int changed_total = 0; int changed_total = 0;
if (e >= b->bm_bits) { 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); s, e, b->bm_bits);
e = b->bm_bits ? b->bm_bits -1 : 0; 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) ...@@ -1596,7 +1596,7 @@ int drbd_bm_test_bit(struct drbd_device *device, const unsigned long bitnr)
} else if (bitnr == b->bm_bits) { } else if (bitnr == b->bm_bits) {
i = -1; i = -1;
} else { /* (bitnr > b->bm_bits) */ } 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; i = 0;
} }
...@@ -1637,7 +1637,7 @@ int drbd_bm_count_bits(struct drbd_device *device, const unsigned long s, const ...@@ -1637,7 +1637,7 @@ int drbd_bm_count_bits(struct drbd_device *device, const unsigned long s, const
if (expect(bitnr < b->bm_bits)) if (expect(bitnr < b->bm_bits))
c += (0 != test_bit_le(bitnr - (page_nr << (PAGE_SHIFT+3)), p_addr)); c += (0 != test_bit_le(bitnr - (page_nr << (PAGE_SHIFT+3)), p_addr));
else 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) if (p_addr)
bm_unmap(p_addr); bm_unmap(p_addr);
...@@ -1687,7 +1687,7 @@ int drbd_bm_e_weight(struct drbd_device *device, unsigned long enr) ...@@ -1687,7 +1687,7 @@ int drbd_bm_e_weight(struct drbd_device *device, unsigned long enr)
count += hweight_long(*bm++); count += hweight_long(*bm++);
bm_unmap(p_addr); bm_unmap(p_addr);
} else { } 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); spin_unlock_irqrestore(&b->bm_lock, flags);
return count; return count;
......
...@@ -100,9 +100,24 @@ extern char usermode_helper[]; ...@@ -100,9 +100,24 @@ extern char usermode_helper[];
struct drbd_device; struct drbd_device;
struct drbd_connection; struct drbd_connection;
#define drbd_printk(level, device, fmt, args...) \
/* to shorten dev_warn(DEV, "msg"); and relatives statements */ dev_printk(level, disk_to_dev(device->vdisk), fmt, ## args)
#define DEV (disk_to_dev(device->vdisk))
#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...) \ #define conn_printk(LEVEL, TCONN, FMT, ARGS...) \
printk(LEVEL "d-con %s: " FMT, TCONN->resource->name , ## ARGS) printk(LEVEL "d-con %s: " FMT, TCONN->resource->name , ## ARGS)
...@@ -115,7 +130,7 @@ struct drbd_connection; ...@@ -115,7 +130,7 @@ struct drbd_connection;
#define conn_dbg(TCONN, FMT, ARGS...) conn_printk(KERN_DEBUG, TCONN, FMT, ## ARGS) #define conn_dbg(TCONN, FMT, ARGS...) conn_printk(KERN_DEBUG, TCONN, FMT, ## ARGS)
#define D_ASSERT(exp) if (!(exp)) \ #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 * expect - Make an assertion
...@@ -125,7 +140,7 @@ struct drbd_connection; ...@@ -125,7 +140,7 @@ struct drbd_connection;
#define expect(exp) ({ \ #define expect(exp) ({ \
bool _bool = (exp); \ bool _bool = (exp); \
if (!_bool) \ if (!_bool) \
dev_err(DEV, "ASSERTION %s FAILED in %s\n", \ drbd_err(device, "ASSERTION %s FAILED in %s\n", \
#exp, __func__); \ #exp, __func__); \
_bool; \ _bool; \
}) })
...@@ -1278,7 +1293,7 @@ extern void drbd_rs_controller_reset(struct drbd_device *device); ...@@ -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) static inline void ov_out_of_sync_print(struct drbd_device *device)
{ {
if (device->ov_last_oos_size) { 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 long)device->ov_last_oos_start,
(unsigned long)device->ov_last_oos_size); (unsigned long)device->ov_last_oos_size);
} }
...@@ -1504,7 +1519,7 @@ static inline void __drbd_chk_io_error_(struct drbd_device *device, ...@@ -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"? */ case EP_PASS_ON: /* FIXME would this be better named "Ignore"? */
if (df == DRBD_READ_ERROR || df == DRBD_WRITE_ERROR) { if (df == DRBD_READ_ERROR || df == DRBD_WRITE_ERROR) {
if (__ratelimit(&drbd_ratelimit_state)) 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) if (device->state.disk > D_INCONSISTENT)
_drbd_set_state(_NS(device, disk, D_INCONSISTENT), CS_HARD, NULL); _drbd_set_state(_NS(device, disk, D_INCONSISTENT), CS_HARD, NULL);
break; break;
...@@ -1539,7 +1554,7 @@ static inline void __drbd_chk_io_error_(struct drbd_device *device, ...@@ -1539,7 +1554,7 @@ static inline void __drbd_chk_io_error_(struct drbd_device *device,
set_bit(FORCE_DETACH, &device->flags); set_bit(FORCE_DETACH, &device->flags);
if (device->state.disk > D_FAILED) { if (device->state.disk > D_FAILED) {
_drbd_set_state(_NS(device, disk, D_FAILED), CS_HARD, NULL); _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); "Local IO failed in %s. Detaching...\n", where);
} }
break; break;
...@@ -1755,7 +1770,7 @@ static inline void inc_ap_pending(struct drbd_device *device) ...@@ -1755,7 +1770,7 @@ static inline void inc_ap_pending(struct drbd_device *device)
#define ERR_IF_CNT_IS_NEGATIVE(which, func, line) \ #define ERR_IF_CNT_IS_NEGATIVE(which, func, line) \
if (atomic_read(&device->which) < 0) \ 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, \ func, line, \
atomic_read(&device->which)) atomic_read(&device->which))
...@@ -1888,7 +1903,7 @@ static inline void drbd_get_syncer_progress(struct drbd_device *device, ...@@ -1888,7 +1903,7 @@ static inline void drbd_get_syncer_progress(struct drbd_device *device,
* for now, just prevent in-kernel buffer overflow. * for now, just prevent in-kernel buffer overflow.
*/ */
smp_rmb(); 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), drbd_conn_str(device->state.conn),
*bits_left, device->rs_total, device->rs_failed); *bits_left, device->rs_total, device->rs_failed);
*per_mil_done = 0; *per_mil_done = 0;
...@@ -2103,7 +2118,7 @@ static inline void drbd_md_flush(struct drbd_device *device) ...@@ -2103,7 +2118,7 @@ static inline void drbd_md_flush(struct drbd_device *device)
int r; int r;
if (device->ldev == NULL) { 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; return;
} }
...@@ -2113,7 +2128,7 @@ static inline void drbd_md_flush(struct drbd_device *device) ...@@ -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); r = blkdev_issue_flush(device->ldev->md_bdev, GFP_NOIO, NULL);
if (r) { if (r) {
set_bit(MD_NO_FUA, &device->flags); 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) ...@@ -871,7 +871,7 @@ void drbd_print_uuids(struct drbd_device *device, const char *text)
{ {
if (get_ldev_if_state(device, D_NEGOTIATING)) { if (get_ldev_if_state(device, D_NEGOTIATING)) {
u64 *uuid = device->ldev->md.uuid; 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, text,
(unsigned long long)uuid[UI_CURRENT], (unsigned long long)uuid[UI_CURRENT],
(unsigned long long)uuid[UI_BITMAP], (unsigned long long)uuid[UI_BITMAP],
...@@ -879,7 +879,7 @@ void drbd_print_uuids(struct drbd_device *device, const char *text) ...@@ -879,7 +879,7 @@ void drbd_print_uuids(struct drbd_device *device, const char *text)
(unsigned long long)uuid[UI_HISTORY_END]); (unsigned long long)uuid[UI_HISTORY_END]);
put_ldev(device); put_ldev(device);
} else { } else {
dev_info(DEV, "%s effective data uuid: %016llX\n", drbd_info(device, "%s effective data uuid: %016llX\n",
text, text,
(unsigned long long)device->ed_uuid); (unsigned long long)device->ed_uuid);
} }
...@@ -1126,7 +1126,7 @@ static int fill_bitmap_rle_bits(struct drbd_device *device, ...@@ -1126,7 +1126,7 @@ static int fill_bitmap_rle_bits(struct drbd_device *device,
/* paranoia: catch zero runlength. /* paranoia: catch zero runlength.
* can only happen if bitmap is modified while we scan it. */ * can only happen if bitmap is modified while we scan it. */
if (rl == 0) { 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); "t:%u bo:%lu\n", toggle, c->bit_offset);
return -1; return -1;
} }
...@@ -1135,7 +1135,7 @@ static int fill_bitmap_rle_bits(struct drbd_device *device, ...@@ -1135,7 +1135,7 @@ static int fill_bitmap_rle_bits(struct drbd_device *device,
if (bits == -ENOBUFS) /* buffer full */ if (bits == -ENOBUFS) /* buffer full */
break; break;
if (bits <= 0) { 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; return 0;
} }
...@@ -1238,13 +1238,13 @@ static int _drbd_send_bitmap(struct drbd_device *device) ...@@ -1238,13 +1238,13 @@ static int _drbd_send_bitmap(struct drbd_device *device)
if (get_ldev(device)) { if (get_ldev(device)) {
if (drbd_md_test_flag(device->ldev, MDF_FULL_SYNC)) { 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); drbd_bm_set_all(device);
if (drbd_bm_write(device)) { if (drbd_bm_write(device)) {
/* write_bm did fail! Leave full sync flag set in Meta P_DATA /* write_bm did fail! Leave full sync flag set in Meta P_DATA
* but otherwise process as per normal - need to tell other * but otherwise process as per normal - need to tell other
* side that a full resync is required! */ * 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 { } else {
drbd_md_clear_flag(device, MDF_FULL_SYNC); drbd_md_clear_flag(device, MDF_FULL_SYNC);
drbd_md_sync(device); drbd_md_sync(device);
...@@ -1517,7 +1517,7 @@ static int _drbd_send_page(struct drbd_device *device, struct page *page, ...@@ -1517,7 +1517,7 @@ static int _drbd_send_page(struct drbd_device *device, struct page *page,
break; break;
continue; 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); __func__, (int)size, len, sent);
if (sent < 0) if (sent < 0)
err = sent; err = sent;
...@@ -1663,7 +1663,7 @@ int drbd_send_dblock(struct drbd_device *device, struct drbd_request *req) ...@@ -1663,7 +1663,7 @@ int drbd_send_dblock(struct drbd_device *device, struct drbd_request *req)
unsigned char digest[64]; unsigned char digest[64];
drbd_csum_bio(device, first_peer_device(device)->connection->integrity_tfm, req->master_bio, digest); drbd_csum_bio(device, first_peer_device(device)->connection->integrity_tfm, req->master_bio, digest);
if (memcmp(p + 1, digest, dgs)) { if (memcmp(p + 1, digest, dgs)) {
dev_warn(DEV, drbd_warn(device,
"Digest mismatch, buffer modified by upper layers during write: %llus +%u\n", "Digest mismatch, buffer modified by upper layers during write: %llus +%u\n",
(unsigned long long)req->i.sector, req->i.size); (unsigned long long)req->i.sector, req->i.size);
} }
...@@ -1955,7 +1955,7 @@ void drbd_device_cleanup(struct drbd_device *device) ...@@ -1955,7 +1955,7 @@ void drbd_device_cleanup(struct drbd_device *device)
{ {
int i; int i;
if (first_peer_device(device)->connection->receiver.t_state != NONE) 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); first_peer_device(device)->connection->receiver.t_state);
device->al_writ_cnt = device->al_writ_cnt =
...@@ -2140,23 +2140,23 @@ static void drbd_release_all_peer_reqs(struct drbd_device *device) ...@@ -2140,23 +2140,23 @@ static void drbd_release_all_peer_reqs(struct drbd_device *device)
rr = drbd_free_peer_reqs(device, &device->active_ee); rr = drbd_free_peer_reqs(device, &device->active_ee);
if (rr) 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); rr = drbd_free_peer_reqs(device, &device->sync_ee);
if (rr) 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); rr = drbd_free_peer_reqs(device, &device->read_ee);
if (rr) 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); rr = drbd_free_peer_reqs(device, &device->done_ee);
if (rr) 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); rr = drbd_free_peer_reqs(device, &device->net_ee);
if (rr) 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. */ /* caution. no locking. */
...@@ -2237,7 +2237,7 @@ static void do_retry(struct work_struct *ws) ...@@ -2237,7 +2237,7 @@ static void do_retry(struct work_struct *ws)
(req->rq_state & RQ_LOCAL_ABORTED) != 0); (req->rq_state & RQ_LOCAL_ABORTED) != 0);
if (!expected) 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, atomic_read(&req->completion_ref),
req->rq_state); req->rq_state);
...@@ -3011,7 +3011,7 @@ void drbd_md_write(struct drbd_device *device, void *b) ...@@ -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)) { if (drbd_md_sync_page_io(device, device->ldev, sector, WRITE)) {
/* this was a try anyways ... */ /* 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); 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, ...@@ -3093,7 +3093,7 @@ static int check_activity_log_stripe_size(struct drbd_device *device,
return 0; return 0;
err: 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); al_stripes, al_stripe_size_4k);
return -EINVAL; return -EINVAL;
} }
...@@ -3165,7 +3165,7 @@ static int check_offsets_and_sizes(struct drbd_device *device, struct drbd_backi ...@@ -3165,7 +3165,7 @@ static int check_offsets_and_sizes(struct drbd_device *device, struct drbd_backi
return 0; return 0;
err: 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, " "al_s=%u, al_sz4k=%u, al_offset=%d, bm_offset=%d, "
"md_size_sect=%u, la_size=%llu, md_capacity=%llu\n", "md_size_sect=%u, la_size=%llu, md_capacity=%llu\n",
in_core->meta_dev_idx, in_core->meta_dev_idx,
...@@ -3210,7 +3210,7 @@ int drbd_md_read(struct drbd_device *device, struct drbd_backing_dev *bdev) ...@@ -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)) { if (drbd_md_sync_page_io(device, bdev, bdev->md.md_offset, READ)) {
/* NOTE: can't do normal error processing here as this is /* NOTE: can't do normal error processing here as this is
called BEFORE disk is attached */ 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; rv = ERR_IO_MD_DISK;
goto err; goto err;
} }
...@@ -3220,7 +3220,7 @@ int drbd_md_read(struct drbd_device *device, struct drbd_backing_dev *bdev) ...@@ -3220,7 +3220,7 @@ int drbd_md_read(struct drbd_device *device, struct drbd_backing_dev *bdev)
if (magic == DRBD_MD_MAGIC_84_UNCLEAN || if (magic == DRBD_MD_MAGIC_84_UNCLEAN ||
(magic == DRBD_MD_MAGIC_08 && !(flags & MDF_AL_CLEAN))) { (magic == DRBD_MD_MAGIC_08 && !(flags & MDF_AL_CLEAN))) {
/* btw: that's Activity Log clean, not "all" 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; rv = ERR_MD_UNCLEAN;
goto err; goto err;
} }
...@@ -3228,14 +3228,14 @@ int drbd_md_read(struct drbd_device *device, struct drbd_backing_dev *bdev) ...@@ -3228,14 +3228,14 @@ int drbd_md_read(struct drbd_device *device, struct drbd_backing_dev *bdev)
rv = ERR_MD_INVALID; rv = ERR_MD_INVALID;
if (magic != DRBD_MD_MAGIC_08) { if (magic != DRBD_MD_MAGIC_08) {
if (magic == DRBD_MD_MAGIC_07) 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 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; goto err;
} }
if (be32_to_cpu(buffer->bm_bytes_per_bit) != BM_BLOCK_SIZE) { 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); be32_to_cpu(buffer->bm_bytes_per_bit), BM_BLOCK_SIZE);
goto err; goto err;
} }
...@@ -3258,12 +3258,12 @@ int drbd_md_read(struct drbd_device *device, struct drbd_backing_dev *bdev) ...@@ -3258,12 +3258,12 @@ int drbd_md_read(struct drbd_device *device, struct drbd_backing_dev *bdev)
goto err; goto err;
if (be32_to_cpu(buffer->bm_offset) != bdev->md.bm_offset) { 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); be32_to_cpu(buffer->bm_offset), bdev->md.bm_offset);
goto err; goto err;
} }
if (be32_to_cpu(buffer->md_size_sect) != bdev->md.md_size_sect) { 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); be32_to_cpu(buffer->md_size_sect), bdev->md.md_size_sect);
goto err; goto err;
} }
...@@ -3371,7 +3371,7 @@ void drbd_uuid_new_current(struct drbd_device *device) __must_hold(local) ...@@ -3371,7 +3371,7 @@ void drbd_uuid_new_current(struct drbd_device *device) __must_hold(local)
bm_uuid = device->ldev->md.uuid[UI_BITMAP]; bm_uuid = device->ldev->md.uuid[UI_BITMAP];
if (bm_uuid) 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]; device->ldev->md.uuid[UI_BITMAP] = device->ldev->md.uuid[UI_CURRENT];
__drbd_uuid_set(device, UI_CURRENT, val); __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) ...@@ -3396,7 +3396,7 @@ void drbd_uuid_set_bm(struct drbd_device *device, u64 val) __must_hold(local)
} else { } else {
unsigned long long bm_uuid = device->ldev->md.uuid[UI_BITMAP]; unsigned long long bm_uuid = device->ldev->md.uuid[UI_BITMAP];
if (bm_uuid) 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); device->ldev->md.uuid[UI_BITMAP] = val & ~((u64)1);
} }
...@@ -3558,7 +3558,7 @@ void drbd_queue_bitmap_io(struct drbd_device *device, ...@@ -3558,7 +3558,7 @@ void drbd_queue_bitmap_io(struct drbd_device *device,
D_ASSERT(!test_bit(BITMAP_IO, &device->flags)); D_ASSERT(!test_bit(BITMAP_IO, &device->flags));
D_ASSERT(list_empty(&device->bm_io_work.w.list)); D_ASSERT(list_empty(&device->bm_io_work.w.list));
if (device->bm_io_work.why) 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); why, device->bm_io_work.why);
device->bm_io_work.io_fn = io_fn; device->bm_io_work.io_fn = io_fn;
...@@ -3637,9 +3637,9 @@ static int w_md_sync(struct drbd_work *w, int unused) ...@@ -3637,9 +3637,9 @@ static int w_md_sync(struct drbd_work *w, int unused)
{ {
struct drbd_device *device = w->device; 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 #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); device->last_md_mark_dirty.func, device->last_md_mark_dirty.line);
#endif #endif
drbd_md_sync(device); drbd_md_sync(device);
...@@ -3813,7 +3813,7 @@ _drbd_insert_fault(struct drbd_device *device, unsigned int type) ...@@ -3813,7 +3813,7 @@ _drbd_insert_fault(struct drbd_device *device, unsigned int type)
fault_count++; fault_count++;
if (__ratelimit(&drbd_ratelimit_state)) if (__ratelimit(&drbd_ratelimit_state))
dev_warn(DEV, "***Simulating %s failure\n", drbd_warn(device, "***Simulating %s failure\n",
_drbd_fault_str(type)); _drbd_fault_str(type));
} }
......
...@@ -351,17 +351,17 @@ int drbd_khelper(struct drbd_device *device, char *cmd) ...@@ -351,17 +351,17 @@ int drbd_khelper(struct drbd_device *device, char *cmd)
* write out any unsynced meta data changes now */ * write out any unsynced meta data changes now */
drbd_md_sync(device); drbd_md_sync(device);
dev_info(DEV, "helper command: %s %s %s\n", usermode_helper, cmd, mb); drbd_info(device, "helper command: %s %s %s\n", usermode_helper, cmd, mb);
sib.sib_reason = SIB_HELPER_PRE; sib.sib_reason = SIB_HELPER_PRE;
sib.helper_name = cmd; sib.helper_name = cmd;
drbd_bcast_event(device, &sib); drbd_bcast_event(device, &sib);
ret = call_usermodehelper(usermode_helper, argv, envp, UMH_WAIT_PROC); ret = call_usermodehelper(usermode_helper, argv, envp, UMH_WAIT_PROC);
if (ret) if (ret)
dev_warn(DEV, "helper command: %s %s %s exit code %u (0x%x)\n", drbd_warn(device, "helper command: %s %s %s exit code %u (0x%x)\n",
usermode_helper, cmd, mb, usermode_helper, cmd, mb,
(ret >> 8) & 0xff, ret); (ret >> 8) & 0xff, ret);
else else
dev_info(DEV, "helper command: %s %s %s exit code %u (0x%x)\n", drbd_info(device, "helper command: %s %s %s exit code %u (0x%x)\n",
usermode_helper, cmd, mb, usermode_helper, cmd, mb,
(ret >> 8) & 0xff, ret); (ret >> 8) & 0xff, ret);
sib.sib_reason = SIB_HELPER_POST; sib.sib_reason = SIB_HELPER_POST;
...@@ -603,7 +603,7 @@ drbd_set_role(struct drbd_device *device, enum drbd_role new_role, int force) ...@@ -603,7 +603,7 @@ drbd_set_role(struct drbd_device *device, enum drbd_role new_role, int force)
goto out; goto out;
if (rv == SS_PRIMARY_NOP && mask.pdsk == 0) { if (rv == SS_PRIMARY_NOP && mask.pdsk == 0) {
if (!conn_try_outdate_peer(first_peer_device(device)->connection) && force) { if (!conn_try_outdate_peer(first_peer_device(device)->connection) && force) {
dev_warn(DEV, "Forced into split brain situation!\n"); drbd_warn(device, "Forced into split brain situation!\n");
mask.pdsk = D_MASK; mask.pdsk = D_MASK;
val.pdsk = D_OUTDATED; val.pdsk = D_OUTDATED;
...@@ -636,7 +636,7 @@ drbd_set_role(struct drbd_device *device, enum drbd_role new_role, int force) ...@@ -636,7 +636,7 @@ drbd_set_role(struct drbd_device *device, enum drbd_role new_role, int force)
goto out; goto out;
if (forced) if (forced)
dev_warn(DEV, "Forced to consider local data as UpToDate!\n"); drbd_warn(device, "Forced to consider local data as UpToDate!\n");
/* Wait until nothing is on the fly :) */ /* Wait until nothing is on the fly :) */
wait_event(device->misc_wait, atomic_read(&device->ap_pending_cnt) == 0); wait_event(device->misc_wait, atomic_read(&device->ap_pending_cnt) == 0);
...@@ -905,7 +905,7 @@ drbd_determine_dev_size(struct drbd_device *device, enum dds_flags flags, struct ...@@ -905,7 +905,7 @@ drbd_determine_dev_size(struct drbd_device *device, enum dds_flags flags, struct
if (rs && u_size == 0) { if (rs && u_size == 0) {
/* Remove "rs &&" later. This check should always be active, but /* Remove "rs &&" later. This check should always be active, but
right now the receiver expects the permissive behavior */ right now the receiver expects the permissive behavior */
dev_warn(DEV, "Implicit shrink not allowed. " drbd_warn(device, "Implicit shrink not allowed. "
"Use --size=%llus for explicit shrink.\n", "Use --size=%llus for explicit shrink.\n",
(unsigned long long)size); (unsigned long long)size);
rv = DS_ERROR_SHRINK; rv = DS_ERROR_SHRINK;
...@@ -924,10 +924,10 @@ drbd_determine_dev_size(struct drbd_device *device, enum dds_flags flags, struct ...@@ -924,10 +924,10 @@ drbd_determine_dev_size(struct drbd_device *device, enum dds_flags flags, struct
/* currently there is only one error: ENOMEM! */ /* currently there is only one error: ENOMEM! */
size = drbd_bm_capacity(device)>>1; size = drbd_bm_capacity(device)>>1;
if (size == 0) { if (size == 0) {
dev_err(DEV, "OUT OF MEMORY! " drbd_err(device, "OUT OF MEMORY! "
"Could not allocate bitmap!\n"); "Could not allocate bitmap!\n");
} else { } else {
dev_err(DEV, "BM resizing failed. " drbd_err(device, "BM resizing failed. "
"Leaving size unchanged at size = %lu KB\n", "Leaving size unchanged at size = %lu KB\n",
(unsigned long)size); (unsigned long)size);
} }
...@@ -936,7 +936,7 @@ drbd_determine_dev_size(struct drbd_device *device, enum dds_flags flags, struct ...@@ -936,7 +936,7 @@ drbd_determine_dev_size(struct drbd_device *device, enum dds_flags flags, struct
/* racy, see comments above. */ /* racy, see comments above. */
drbd_set_my_capacity(device, size); drbd_set_my_capacity(device, size);
device->ldev->md.la_size_sect = size; device->ldev->md.la_size_sect = size;
dev_info(DEV, "size = %s (%llu KB)\n", ppsize(ppb, size>>1), drbd_info(device, "size = %s (%llu KB)\n", ppsize(ppb, size>>1),
(unsigned long long)size>>1); (unsigned long long)size>>1);
} }
if (rv <= DS_ERROR) if (rv <= DS_ERROR)
...@@ -956,7 +956,7 @@ drbd_determine_dev_size(struct drbd_device *device, enum dds_flags flags, struct ...@@ -956,7 +956,7 @@ drbd_determine_dev_size(struct drbd_device *device, enum dds_flags flags, struct
md->flags &= ~MDF_PRIMARY_IND; md->flags &= ~MDF_PRIMARY_IND;
drbd_md_write(device, buffer); drbd_md_write(device, buffer);
dev_info(DEV, "Writing the whole bitmap, %s\n", drbd_info(device, "Writing the whole bitmap, %s\n",
la_size_changed && md_moved ? "size changed and md moved" : la_size_changed && md_moved ? "size changed and md moved" :
la_size_changed ? "size changed" : "md moved"); la_size_changed ? "size changed" : "md moved");
/* next line implicitly does drbd_suspend_io()+drbd_resume_io() */ /* next line implicitly does drbd_suspend_io()+drbd_resume_io() */
...@@ -968,7 +968,7 @@ drbd_determine_dev_size(struct drbd_device *device, enum dds_flags flags, struct ...@@ -968,7 +968,7 @@ drbd_determine_dev_size(struct drbd_device *device, enum dds_flags flags, struct
drbd_md_write(device, buffer); drbd_md_write(device, buffer);
if (rs) if (rs)
dev_info(DEV, "Changed AL layout to al-stripes = %d, al-stripe-size-kB = %d\n", drbd_info(device, "Changed AL layout to al-stripes = %d, al-stripe-size-kB = %d\n",
md->al_stripes, md->al_stripe_size_4k * 4); md->al_stripes, md->al_stripe_size_4k * 4);
} }
...@@ -1007,7 +1007,7 @@ drbd_new_dev_size(struct drbd_device *device, struct drbd_backing_dev *bdev, ...@@ -1007,7 +1007,7 @@ drbd_new_dev_size(struct drbd_device *device, struct drbd_backing_dev *bdev,
m_size = drbd_get_max_capacity(bdev); m_size = drbd_get_max_capacity(bdev);
if (device->state.conn < C_CONNECTED && assume_peer_has_space) { if (device->state.conn < C_CONNECTED && assume_peer_has_space) {
dev_warn(DEV, "Resize while not connected was forced by the user!\n"); drbd_warn(device, "Resize while not connected was forced by the user!\n");
p_size = m_size; p_size = m_size;
} }
...@@ -1029,11 +1029,11 @@ drbd_new_dev_size(struct drbd_device *device, struct drbd_backing_dev *bdev, ...@@ -1029,11 +1029,11 @@ drbd_new_dev_size(struct drbd_device *device, struct drbd_backing_dev *bdev,
} }
if (size == 0) if (size == 0)
dev_err(DEV, "Both nodes diskless!\n"); drbd_err(device, "Both nodes diskless!\n");
if (u_size) { if (u_size) {
if (u_size > size) if (u_size > size)
dev_err(DEV, "Requested disk size is too big (%lu > %lu)\n", drbd_err(device, "Requested disk size is too big (%lu > %lu)\n",
(unsigned long)u_size>>1, (unsigned long)size>>1); (unsigned long)u_size>>1, (unsigned long)size>>1);
else else
size = u_size; size = u_size;
...@@ -1067,7 +1067,7 @@ static int drbd_check_al_size(struct drbd_device *device, struct disk_conf *dc) ...@@ -1067,7 +1067,7 @@ static int drbd_check_al_size(struct drbd_device *device, struct disk_conf *dc)
dc->al_extents, sizeof(struct lc_element), 0); dc->al_extents, sizeof(struct lc_element), 0);
if (n == NULL) { if (n == NULL) {
dev_err(DEV, "Cannot allocate act_log lru!\n"); drbd_err(device, "Cannot allocate act_log lru!\n");
return -ENOMEM; return -ENOMEM;
} }
spin_lock_irq(&device->al_lock); spin_lock_irq(&device->al_lock);
...@@ -1075,7 +1075,7 @@ static int drbd_check_al_size(struct drbd_device *device, struct disk_conf *dc) ...@@ -1075,7 +1075,7 @@ static int drbd_check_al_size(struct drbd_device *device, struct disk_conf *dc)
for (i = 0; i < t->nr_elements; i++) { for (i = 0; i < t->nr_elements; i++) {
e = lc_element_by_index(t, i); e = lc_element_by_index(t, i);
if (e->refcnt) if (e->refcnt)
dev_err(DEV, "refcnt(%d)==%d\n", drbd_err(device, "refcnt(%d)==%d\n",
e->lc_number, e->refcnt); e->lc_number, e->refcnt);
in_use += e->refcnt; in_use += e->refcnt;
} }
...@@ -1084,7 +1084,7 @@ static int drbd_check_al_size(struct drbd_device *device, struct disk_conf *dc) ...@@ -1084,7 +1084,7 @@ static int drbd_check_al_size(struct drbd_device *device, struct disk_conf *dc)
device->act_log = n; device->act_log = n;
spin_unlock_irq(&device->al_lock); spin_unlock_irq(&device->al_lock);
if (in_use) { if (in_use) {
dev_err(DEV, "Activity log still in use!\n"); drbd_err(device, "Activity log still in use!\n");
lc_destroy(n); lc_destroy(n);
return -EBUSY; return -EBUSY;
} else { } else {
...@@ -1123,7 +1123,7 @@ static void drbd_setup_queue_param(struct drbd_device *device, unsigned int max_ ...@@ -1123,7 +1123,7 @@ static void drbd_setup_queue_param(struct drbd_device *device, unsigned int max_
blk_queue_stack_limits(q, b); blk_queue_stack_limits(q, b);
if (q->backing_dev_info.ra_pages != b->backing_dev_info.ra_pages) { if (q->backing_dev_info.ra_pages != b->backing_dev_info.ra_pages) {
dev_info(DEV, "Adjusting my ra_pages to backing device's (%lu -> %lu)\n", drbd_info(device, "Adjusting my ra_pages to backing device's (%lu -> %lu)\n",
q->backing_dev_info.ra_pages, q->backing_dev_info.ra_pages,
b->backing_dev_info.ra_pages); b->backing_dev_info.ra_pages);
q->backing_dev_info.ra_pages = b->backing_dev_info.ra_pages; q->backing_dev_info.ra_pages = b->backing_dev_info.ra_pages;
...@@ -1165,10 +1165,10 @@ void drbd_reconsider_max_bio_size(struct drbd_device *device) ...@@ -1165,10 +1165,10 @@ void drbd_reconsider_max_bio_size(struct drbd_device *device)
new = min(local, peer); new = min(local, peer);
if (device->state.role == R_PRIMARY && new < now) if (device->state.role == R_PRIMARY && new < now)
dev_err(DEV, "ASSERT FAILED new < now; (%u < %u)\n", new, now); drbd_err(device, "ASSERT FAILED new < now; (%u < %u)\n", new, now);
if (new != now) if (new != now)
dev_info(DEV, "max BIO size = %u\n", new); drbd_info(device, "max BIO size = %u\n", new);
drbd_setup_queue_param(device, new); drbd_setup_queue_param(device, new);
} }
...@@ -1202,7 +1202,7 @@ static void drbd_suspend_al(struct drbd_device *device) ...@@ -1202,7 +1202,7 @@ static void drbd_suspend_al(struct drbd_device *device)
int s = 0; int s = 0;
if (!lc_try_lock(device->act_log)) { if (!lc_try_lock(device->act_log)) {
dev_warn(DEV, "Failed to lock al in drbd_suspend_al()\n"); drbd_warn(device, "Failed to lock al in drbd_suspend_al()\n");
return; return;
} }
...@@ -1214,7 +1214,7 @@ static void drbd_suspend_al(struct drbd_device *device) ...@@ -1214,7 +1214,7 @@ static void drbd_suspend_al(struct drbd_device *device)
lc_unlock(device->act_log); lc_unlock(device->act_log);
if (s) if (s)
dev_info(DEV, "Suspended AL updates\n"); drbd_info(device, "Suspended AL updates\n");
} }
...@@ -1309,7 +1309,7 @@ int drbd_adm_disk_opts(struct sk_buff *skb, struct genl_info *info) ...@@ -1309,7 +1309,7 @@ int drbd_adm_disk_opts(struct sk_buff *skb, struct genl_info *info)
if (fifo_size != device->rs_plan_s->size) { if (fifo_size != device->rs_plan_s->size) {
new_plan = fifo_alloc(fifo_size); new_plan = fifo_alloc(fifo_size);
if (!new_plan) { if (!new_plan) {
dev_err(DEV, "kmalloc of fifo_buffer failed"); drbd_err(device, "kmalloc of fifo_buffer failed");
retcode = ERR_NOMEM; retcode = ERR_NOMEM;
goto fail_unlock; goto fail_unlock;
} }
...@@ -1485,7 +1485,7 @@ int drbd_adm_attach(struct sk_buff *skb, struct genl_info *info) ...@@ -1485,7 +1485,7 @@ int drbd_adm_attach(struct sk_buff *skb, struct genl_info *info)
bdev = blkdev_get_by_path(new_disk_conf->backing_dev, bdev = blkdev_get_by_path(new_disk_conf->backing_dev,
FMODE_READ | FMODE_WRITE | FMODE_EXCL, device); FMODE_READ | FMODE_WRITE | FMODE_EXCL, device);
if (IS_ERR(bdev)) { if (IS_ERR(bdev)) {
dev_err(DEV, "open(\"%s\") failed with %ld\n", new_disk_conf->backing_dev, drbd_err(device, "open(\"%s\") failed with %ld\n", new_disk_conf->backing_dev,
PTR_ERR(bdev)); PTR_ERR(bdev));
retcode = ERR_OPEN_DISK; retcode = ERR_OPEN_DISK;
goto fail; goto fail;
...@@ -1505,7 +1505,7 @@ int drbd_adm_attach(struct sk_buff *skb, struct genl_info *info) ...@@ -1505,7 +1505,7 @@ int drbd_adm_attach(struct sk_buff *skb, struct genl_info *info)
(new_disk_conf->meta_dev_idx < 0) ? (new_disk_conf->meta_dev_idx < 0) ?
(void *)device : (void *)drbd_m_holder); (void *)device : (void *)drbd_m_holder);
if (IS_ERR(bdev)) { if (IS_ERR(bdev)) {
dev_err(DEV, "open(\"%s\") failed with %ld\n", new_disk_conf->meta_dev, drbd_err(device, "open(\"%s\") failed with %ld\n", new_disk_conf->meta_dev,
PTR_ERR(bdev)); PTR_ERR(bdev));
retcode = ERR_OPEN_MD_DISK; retcode = ERR_OPEN_MD_DISK;
goto fail; goto fail;
...@@ -1539,7 +1539,7 @@ int drbd_adm_attach(struct sk_buff *skb, struct genl_info *info) ...@@ -1539,7 +1539,7 @@ int drbd_adm_attach(struct sk_buff *skb, struct genl_info *info)
new_disk_conf->al_extents = drbd_al_extents_max(nbc); new_disk_conf->al_extents = drbd_al_extents_max(nbc);
if (drbd_get_max_capacity(nbc) < new_disk_conf->disk_size) { if (drbd_get_max_capacity(nbc) < new_disk_conf->disk_size) {
dev_err(DEV, "max capacity %llu smaller than disk size %llu\n", drbd_err(device, "max capacity %llu smaller than disk size %llu\n",
(unsigned long long) drbd_get_max_capacity(nbc), (unsigned long long) drbd_get_max_capacity(nbc),
(unsigned long long) new_disk_conf->disk_size); (unsigned long long) new_disk_conf->disk_size);
retcode = ERR_DISK_TOO_SMALL; retcode = ERR_DISK_TOO_SMALL;
...@@ -1557,7 +1557,7 @@ int drbd_adm_attach(struct sk_buff *skb, struct genl_info *info) ...@@ -1557,7 +1557,7 @@ int drbd_adm_attach(struct sk_buff *skb, struct genl_info *info)
if (drbd_get_capacity(nbc->md_bdev) < min_md_device_sectors) { if (drbd_get_capacity(nbc->md_bdev) < min_md_device_sectors) {
retcode = ERR_MD_DISK_TOO_SMALL; retcode = ERR_MD_DISK_TOO_SMALL;
dev_warn(DEV, "refusing attach: md-device too small, " drbd_warn(device, "refusing attach: md-device too small, "
"at least %llu sectors needed for this meta-disk type\n", "at least %llu sectors needed for this meta-disk type\n",
(unsigned long long) min_md_device_sectors); (unsigned long long) min_md_device_sectors);
goto fail; goto fail;
...@@ -1574,11 +1574,11 @@ int drbd_adm_attach(struct sk_buff *skb, struct genl_info *info) ...@@ -1574,11 +1574,11 @@ int drbd_adm_attach(struct sk_buff *skb, struct genl_info *info)
nbc->known_size = drbd_get_capacity(nbc->backing_bdev); nbc->known_size = drbd_get_capacity(nbc->backing_bdev);
if (nbc->known_size > max_possible_sectors) { if (nbc->known_size > max_possible_sectors) {
dev_warn(DEV, "==> truncating very big lower level device " drbd_warn(device, "==> truncating very big lower level device "
"to currently maximum possible %llu sectors <==\n", "to currently maximum possible %llu sectors <==\n",
(unsigned long long) max_possible_sectors); (unsigned long long) max_possible_sectors);
if (new_disk_conf->meta_dev_idx >= 0) if (new_disk_conf->meta_dev_idx >= 0)
dev_warn(DEV, "==>> using internal or flexible " drbd_warn(device, "==>> using internal or flexible "
"meta data may help <<==\n"); "meta data may help <<==\n");
} }
...@@ -1613,7 +1613,7 @@ int drbd_adm_attach(struct sk_buff *skb, struct genl_info *info) ...@@ -1613,7 +1613,7 @@ int drbd_adm_attach(struct sk_buff *skb, struct genl_info *info)
if (device->state.conn < C_CONNECTED && if (device->state.conn < C_CONNECTED &&
device->state.role == R_PRIMARY && device->state.role == R_PRIMARY &&
(device->ed_uuid & ~((u64)1)) != (nbc->md.uuid[UI_CURRENT] & ~((u64)1))) { (device->ed_uuid & ~((u64)1)) != (nbc->md.uuid[UI_CURRENT] & ~((u64)1))) {
dev_err(DEV, "Can only attach to data with current UUID=%016llX\n", drbd_err(device, "Can only attach to data with current UUID=%016llX\n",
(unsigned long long)device->ed_uuid); (unsigned long long)device->ed_uuid);
retcode = ERR_DATA_NOT_CURRENT; retcode = ERR_DATA_NOT_CURRENT;
goto force_diskless_dec; goto force_diskless_dec;
...@@ -1628,7 +1628,7 @@ int drbd_adm_attach(struct sk_buff *skb, struct genl_info *info) ...@@ -1628,7 +1628,7 @@ int drbd_adm_attach(struct sk_buff *skb, struct genl_info *info)
/* Prevent shrinking of consistent devices ! */ /* Prevent shrinking of consistent devices ! */
if (drbd_md_test_flag(nbc, MDF_CONSISTENT) && if (drbd_md_test_flag(nbc, MDF_CONSISTENT) &&
drbd_new_dev_size(device, nbc, nbc->disk_conf->disk_size, 0) < nbc->md.la_size_sect) { drbd_new_dev_size(device, nbc, nbc->disk_conf->disk_size, 0) < nbc->md.la_size_sect) {
dev_warn(DEV, "refusing to truncate a consistent device\n"); drbd_warn(device, "refusing to truncate a consistent device\n");
retcode = ERR_DISK_TOO_SMALL; retcode = ERR_DISK_TOO_SMALL;
goto force_diskless_dec; goto force_diskless_dec;
} }
...@@ -1702,7 +1702,7 @@ int drbd_adm_attach(struct sk_buff *skb, struct genl_info *info) ...@@ -1702,7 +1702,7 @@ int drbd_adm_attach(struct sk_buff *skb, struct genl_info *info)
if (drbd_md_test_flag(device->ldev, MDF_FULL_SYNC) || if (drbd_md_test_flag(device->ldev, MDF_FULL_SYNC) ||
(test_bit(CRASHED_PRIMARY, &device->flags) && (test_bit(CRASHED_PRIMARY, &device->flags) &&
drbd_md_test_flag(device->ldev, MDF_AL_DISABLED))) { drbd_md_test_flag(device->ldev, MDF_AL_DISABLED))) {
dev_info(DEV, "Assuming that all blocks are out of sync " drbd_info(device, "Assuming that all blocks are out of sync "
"(aka FullSync)\n"); "(aka FullSync)\n");
if (drbd_bitmap_io(device, &drbd_bmio_set_n_write, if (drbd_bitmap_io(device, &drbd_bmio_set_n_write,
"set_n_write from attaching", BM_LOCKED_MASK)) { "set_n_write from attaching", BM_LOCKED_MASK)) {
...@@ -2381,7 +2381,7 @@ void resync_after_online_grow(struct drbd_device *device) ...@@ -2381,7 +2381,7 @@ void resync_after_online_grow(struct drbd_device *device)
{ {
int iass; /* I am sync source */ int iass; /* I am sync source */
dev_info(DEV, "Resync of new storage after online grow\n"); drbd_info(device, "Resync of new storage after online grow\n");
if (device->state.role != device->state.peer) if (device->state.role != device->state.peer)
iass = (device->state.role == R_PRIMARY); iass = (device->state.role == R_PRIMARY);
else else
...@@ -3203,7 +3203,7 @@ int drbd_adm_new_c_uuid(struct sk_buff *skb, struct genl_info *info) ...@@ -3203,7 +3203,7 @@ int drbd_adm_new_c_uuid(struct sk_buff *skb, struct genl_info *info)
if (device->state.conn == C_CONNECTED && if (device->state.conn == C_CONNECTED &&
first_peer_device(device)->connection->agreed_pro_version >= 90 && first_peer_device(device)->connection->agreed_pro_version >= 90 &&
device->ldev->md.uuid[UI_CURRENT] == UUID_JUST_CREATED && args.clear_bm) { device->ldev->md.uuid[UI_CURRENT] == UUID_JUST_CREATED && args.clear_bm) {
dev_info(DEV, "Preparing to skip initial sync\n"); drbd_info(device, "Preparing to skip initial sync\n");
skip_initial_sync = 1; skip_initial_sync = 1;
} else if (device->state.conn != C_STANDALONE) { } else if (device->state.conn != C_STANDALONE) {
retcode = ERR_CONNECTED; retcode = ERR_CONNECTED;
...@@ -3217,7 +3217,7 @@ int drbd_adm_new_c_uuid(struct sk_buff *skb, struct genl_info *info) ...@@ -3217,7 +3217,7 @@ int drbd_adm_new_c_uuid(struct sk_buff *skb, struct genl_info *info)
err = drbd_bitmap_io(device, &drbd_bmio_clear_n_write, err = drbd_bitmap_io(device, &drbd_bmio_clear_n_write,
"clear_n_write from new_c_uuid", BM_LOCKED_MASK); "clear_n_write from new_c_uuid", BM_LOCKED_MASK);
if (err) { if (err) {
dev_err(DEV, "Writing bitmap failed with %d\n",err); drbd_err(device, "Writing bitmap failed with %d\n", err);
retcode = ERR_IO_MD_DISK; retcode = ERR_IO_MD_DISK;
} }
if (skip_initial_sync) { if (skip_initial_sync) {
...@@ -3513,7 +3513,7 @@ void drbd_bcast_event(struct drbd_device *device, const struct sib_info *sib) ...@@ -3513,7 +3513,7 @@ void drbd_bcast_event(struct drbd_device *device, const struct sib_info *sib)
nla_put_failure: nla_put_failure:
nlmsg_free(msg); nlmsg_free(msg);
failed: failed:
dev_err(DEV, "Error %d while broadcasting event. " drbd_err(device, "Error %d while broadcasting event. "
"Event seq:%u sib_reason:%u\n", "Event seq:%u sib_reason:%u\n",
err, seq, sib->sib_reason); err, seq, sib->sib_reason);
} }
...@@ -274,7 +274,7 @@ struct page *drbd_alloc_pages(struct drbd_device *device, unsigned int number, ...@@ -274,7 +274,7 @@ struct page *drbd_alloc_pages(struct drbd_device *device, unsigned int number,
break; break;
if (signal_pending(current)) { if (signal_pending(current)) {
dev_warn(DEV, "drbd_alloc_pages interrupted!\n"); drbd_warn(device, "drbd_alloc_pages interrupted!\n");
break; break;
} }
...@@ -311,7 +311,7 @@ static void drbd_free_pages(struct drbd_device *device, struct page *page, int i ...@@ -311,7 +311,7 @@ static void drbd_free_pages(struct drbd_device *device, struct page *page, int i
} }
i = atomic_sub_return(i, a); i = atomic_sub_return(i, a);
if (i < 0) if (i < 0)
dev_warn(DEV, "ASSERTION FAILED: %s: %d < 0\n", drbd_warn(device, "ASSERTION FAILED: %s: %d < 0\n",
is_net ? "pp_in_use_by_net" : "pp_in_use", i); is_net ? "pp_in_use_by_net" : "pp_in_use", i);
wake_up(&drbd_pp_wait); wake_up(&drbd_pp_wait);
} }
...@@ -344,7 +344,7 @@ drbd_alloc_peer_req(struct drbd_device *device, u64 id, sector_t sector, ...@@ -344,7 +344,7 @@ drbd_alloc_peer_req(struct drbd_device *device, u64 id, sector_t sector,
peer_req = mempool_alloc(drbd_ee_mempool, gfp_mask & ~__GFP_HIGHMEM); peer_req = mempool_alloc(drbd_ee_mempool, gfp_mask & ~__GFP_HIGHMEM);
if (!peer_req) { if (!peer_req) {
if (!(gfp_mask & __GFP_NOWARN)) if (!(gfp_mask & __GFP_NOWARN))
dev_err(DEV, "%s: allocation failed\n", __func__); drbd_err(device, "%s: allocation failed\n", __func__);
return NULL; return NULL;
} }
...@@ -1162,7 +1162,7 @@ static void drbd_flush(struct drbd_connection *connection) ...@@ -1162,7 +1162,7 @@ static void drbd_flush(struct drbd_connection *connection)
rv = blkdev_issue_flush(device->ldev->backing_bdev, rv = blkdev_issue_flush(device->ldev->backing_bdev,
GFP_NOIO, NULL); GFP_NOIO, NULL);
if (rv) { if (rv) {
dev_info(DEV, "local disk flush failed with status %d\n", rv); drbd_info(device, "local disk flush failed with status %d\n", rv);
/* would rather check on EOPNOTSUPP, but that is not reliable. /* would rather check on EOPNOTSUPP, but that is not reliable.
* don't try again for ANY return value != 0 * don't try again for ANY return value != 0
* if (rv == -EOPNOTSUPP) */ * if (rv == -EOPNOTSUPP) */
...@@ -1335,7 +1335,7 @@ int drbd_submit_peer_request(struct drbd_device *device, ...@@ -1335,7 +1335,7 @@ int drbd_submit_peer_request(struct drbd_device *device,
next_bio: next_bio:
bio = bio_alloc(GFP_NOIO, nr_pages); bio = bio_alloc(GFP_NOIO, nr_pages);
if (!bio) { if (!bio) {
dev_err(DEV, "submit_ee: Allocation of a bio failed\n"); drbd_err(device, "submit_ee: Allocation of a bio failed\n");
goto fail; goto fail;
} }
/* > peer_req->i.sector, unless this is the first bio */ /* > peer_req->i.sector, unless this is the first bio */
...@@ -1356,7 +1356,7 @@ int drbd_submit_peer_request(struct drbd_device *device, ...@@ -1356,7 +1356,7 @@ int drbd_submit_peer_request(struct drbd_device *device,
* But in case it fails anyways, * But in case it fails anyways,
* we deal with it, and complain (below). */ * we deal with it, and complain (below). */
if (bio->bi_vcnt == 0) { if (bio->bi_vcnt == 0) {
dev_err(DEV, drbd_err(device,
"bio_add_page failed for len=%u, " "bio_add_page failed for len=%u, "
"bi_vcnt=0 (bi_sector=%llu)\n", "bi_vcnt=0 (bi_sector=%llu)\n",
len, (uint64_t)bio->bi_iter.bi_sector); len, (uint64_t)bio->bi_iter.bi_sector);
...@@ -1524,7 +1524,7 @@ read_in_block(struct drbd_device *device, u64 id, sector_t sector, ...@@ -1524,7 +1524,7 @@ read_in_block(struct drbd_device *device, u64 id, sector_t sector,
/* even though we trust out peer, /* even though we trust out peer,
* we sometimes have to double check. */ * we sometimes have to double check. */
if (sector + (data_size>>9) > capacity) { if (sector + (data_size>>9) > capacity) {
dev_err(DEV, "request from peer beyond end of local disk: " drbd_err(device, "request from peer beyond end of local disk: "
"capacity: %llus < sector: %llus + size: %u\n", "capacity: %llus < sector: %llus + size: %u\n",
(unsigned long long)capacity, (unsigned long long)capacity,
(unsigned long long)sector, data_size); (unsigned long long)sector, data_size);
...@@ -1548,7 +1548,7 @@ read_in_block(struct drbd_device *device, u64 id, sector_t sector, ...@@ -1548,7 +1548,7 @@ read_in_block(struct drbd_device *device, u64 id, sector_t sector,
data = kmap(page); data = kmap(page);
err = drbd_recv_all_warn(first_peer_device(device)->connection, data, len); err = drbd_recv_all_warn(first_peer_device(device)->connection, data, len);
if (drbd_insert_fault(device, DRBD_FAULT_RECEIVE)) { if (drbd_insert_fault(device, DRBD_FAULT_RECEIVE)) {
dev_err(DEV, "Fault injection: Corrupting data on receive\n"); drbd_err(device, "Fault injection: Corrupting data on receive\n");
data[0] = data[0] ^ (unsigned long)-1; data[0] = data[0] ^ (unsigned long)-1;
} }
kunmap(page); kunmap(page);
...@@ -1562,7 +1562,7 @@ read_in_block(struct drbd_device *device, u64 id, sector_t sector, ...@@ -1562,7 +1562,7 @@ read_in_block(struct drbd_device *device, u64 id, sector_t sector,
if (dgs) { if (dgs) {
drbd_csum_ee(device, first_peer_device(device)->connection->peer_integrity_tfm, peer_req, dig_vv); drbd_csum_ee(device, first_peer_device(device)->connection->peer_integrity_tfm, peer_req, dig_vv);
if (memcmp(dig_in, dig_vv, dgs)) { if (memcmp(dig_in, dig_vv, dgs)) {
dev_err(DEV, "Digest integrity check FAILED: %llus +%u\n", drbd_err(device, "Digest integrity check FAILED: %llus +%u\n",
(unsigned long long)sector, data_size); (unsigned long long)sector, data_size);
drbd_free_peer_req(device, peer_req); drbd_free_peer_req(device, peer_req);
return NULL; return NULL;
...@@ -1639,7 +1639,7 @@ static int recv_dless_read(struct drbd_device *device, struct drbd_request *req, ...@@ -1639,7 +1639,7 @@ static int recv_dless_read(struct drbd_device *device, struct drbd_request *req,
if (dgs) { if (dgs) {
drbd_csum_bio(device, first_peer_device(device)->connection->peer_integrity_tfm, bio, dig_vv); drbd_csum_bio(device, first_peer_device(device)->connection->peer_integrity_tfm, bio, dig_vv);
if (memcmp(dig_in, dig_vv, dgs)) { if (memcmp(dig_in, dig_vv, dgs)) {
dev_err(DEV, "Digest integrity check FAILED. Broken NICs?\n"); drbd_err(device, "Digest integrity check FAILED. Broken NICs?\n");
return -EINVAL; return -EINVAL;
} }
} }
...@@ -1701,7 +1701,7 @@ static int recv_resync_read(struct drbd_device *device, sector_t sector, int dat ...@@ -1701,7 +1701,7 @@ static int recv_resync_read(struct drbd_device *device, sector_t sector, int dat
return 0; return 0;
/* don't care for the reason here */ /* don't care for the reason here */
dev_err(DEV, "submit failed, triggering re-connect\n"); drbd_err(device, "submit failed, triggering re-connect\n");
spin_lock_irq(&first_peer_device(device)->connection->req_lock); spin_lock_irq(&first_peer_device(device)->connection->req_lock);
list_del(&peer_req->w.list); list_del(&peer_req->w.list);
spin_unlock_irq(&first_peer_device(device)->connection->req_lock); spin_unlock_irq(&first_peer_device(device)->connection->req_lock);
...@@ -1723,7 +1723,7 @@ find_request(struct drbd_device *device, struct rb_root *root, u64 id, ...@@ -1723,7 +1723,7 @@ find_request(struct drbd_device *device, struct rb_root *root, u64 id,
if (drbd_contains_interval(root, sector, &req->i) && req->i.local) if (drbd_contains_interval(root, sector, &req->i) && req->i.local)
return req; return req;
if (!missing_ok) { if (!missing_ok) {
dev_err(DEV, "%s: failed to find request 0x%lx, sector %llus\n", func, drbd_err(device, "%s: failed to find request 0x%lx, sector %llus\n", func,
(unsigned long)id, (unsigned long long)sector); (unsigned long)id, (unsigned long long)sector);
} }
return NULL; return NULL;
...@@ -1783,7 +1783,7 @@ static int receive_RSDataReply(struct drbd_connection *connection, struct packet ...@@ -1783,7 +1783,7 @@ static int receive_RSDataReply(struct drbd_connection *connection, struct packet
err = recv_resync_read(device, sector, pi->size); err = recv_resync_read(device, sector, pi->size);
} else { } else {
if (__ratelimit(&drbd_ratelimit_state)) if (__ratelimit(&drbd_ratelimit_state))
dev_err(DEV, "Can not write resync data to local disk.\n"); drbd_err(device, "Can not write resync data to local disk.\n");
err = drbd_drain_block(device, pi->size); err = drbd_drain_block(device, pi->size);
...@@ -1997,7 +1997,7 @@ static int wait_for_and_update_peer_seq(struct drbd_device *device, const u32 pe ...@@ -1997,7 +1997,7 @@ static int wait_for_and_update_peer_seq(struct drbd_device *device, const u32 pe
spin_lock(&device->peer_seq_lock); spin_lock(&device->peer_seq_lock);
if (!timeout) { if (!timeout) {
ret = -ETIMEDOUT; ret = -ETIMEDOUT;
dev_err(DEV, "Timed out waiting for missing ack packets; disconnecting\n"); drbd_err(device, "Timed out waiting for missing ack packets; disconnecting\n");
break; break;
} }
} }
...@@ -2088,7 +2088,7 @@ static int handle_write_conflicts(struct drbd_device *device, ...@@ -2088,7 +2088,7 @@ static int handle_write_conflicts(struct drbd_device *device,
(i->size >> 9) >= sector + (size >> 9); (i->size >> 9) >= sector + (size >> 9);
if (!equal) if (!equal)
dev_alert(DEV, "Concurrent writes detected: " drbd_alert(device, "Concurrent writes detected: "
"local=%llus +%u, remote=%llus +%u, " "local=%llus +%u, remote=%llus +%u, "
"assuming %s came first\n", "assuming %s came first\n",
(unsigned long long)i->sector, i->size, (unsigned long long)i->sector, i->size,
...@@ -2108,7 +2108,7 @@ static int handle_write_conflicts(struct drbd_device *device, ...@@ -2108,7 +2108,7 @@ static int handle_write_conflicts(struct drbd_device *device,
container_of(i, struct drbd_request, i); container_of(i, struct drbd_request, i);
if (!equal) if (!equal)
dev_alert(DEV, "Concurrent writes detected: " drbd_alert(device, "Concurrent writes detected: "
"local=%llus +%u, remote=%llus +%u\n", "local=%llus +%u, remote=%llus +%u\n",
(unsigned long long)i->sector, i->size, (unsigned long long)i->sector, i->size,
(unsigned long long)sector, size); (unsigned long long)sector, size);
...@@ -2277,7 +2277,7 @@ static int receive_Data(struct drbd_connection *connection, struct packet_info * ...@@ -2277,7 +2277,7 @@ static int receive_Data(struct drbd_connection *connection, struct packet_info *
return 0; return 0;
/* don't care for the reason here */ /* don't care for the reason here */
dev_err(DEV, "submit failed, triggering re-connect\n"); drbd_err(device, "submit failed, triggering re-connect\n");
spin_lock_irq(&first_peer_device(device)->connection->req_lock); spin_lock_irq(&first_peer_device(device)->connection->req_lock);
list_del(&peer_req->w.list); list_del(&peer_req->w.list);
drbd_remove_epoch_entry_interval(device, peer_req); drbd_remove_epoch_entry_interval(device, peer_req);
...@@ -2384,12 +2384,12 @@ static int receive_DataRequest(struct drbd_connection *connection, struct packet ...@@ -2384,12 +2384,12 @@ static int receive_DataRequest(struct drbd_connection *connection, struct packet
size = be32_to_cpu(p->blksize); size = be32_to_cpu(p->blksize);
if (size <= 0 || !IS_ALIGNED(size, 512) || size > DRBD_MAX_BIO_SIZE) { if (size <= 0 || !IS_ALIGNED(size, 512) || size > DRBD_MAX_BIO_SIZE) {
dev_err(DEV, "%s:%d: sector: %llus, size: %u\n", __FILE__, __LINE__, drbd_err(device, "%s:%d: sector: %llus, size: %u\n", __FILE__, __LINE__,
(unsigned long long)sector, size); (unsigned long long)sector, size);
return -EINVAL; return -EINVAL;
} }
if (sector + (size>>9) > capacity) { if (sector + (size>>9) > capacity) {
dev_err(DEV, "%s:%d: sector: %llus, size: %u\n", __FILE__, __LINE__, drbd_err(device, "%s:%d: sector: %llus, size: %u\n", __FILE__, __LINE__,
(unsigned long long)sector, size); (unsigned long long)sector, size);
return -EINVAL; return -EINVAL;
} }
...@@ -2414,7 +2414,7 @@ static int receive_DataRequest(struct drbd_connection *connection, struct packet ...@@ -2414,7 +2414,7 @@ static int receive_DataRequest(struct drbd_connection *connection, struct packet
BUG(); BUG();
} }
if (verb && __ratelimit(&drbd_ratelimit_state)) if (verb && __ratelimit(&drbd_ratelimit_state))
dev_err(DEV, "Can not satisfy peer's read request, " drbd_err(device, "Can not satisfy peer's read request, "
"no local data.\n"); "no local data.\n");
/* drain possibly payload */ /* drain possibly payload */
...@@ -2489,7 +2489,7 @@ static int receive_DataRequest(struct drbd_connection *connection, struct packet ...@@ -2489,7 +2489,7 @@ static int receive_DataRequest(struct drbd_connection *connection, struct packet
device->rs_mark_left[i] = device->ov_left; device->rs_mark_left[i] = device->ov_left;
device->rs_mark_time[i] = now; device->rs_mark_time[i] = now;
} }
dev_info(DEV, "Online Verify start sector: %llu\n", drbd_info(device, "Online Verify start sector: %llu\n",
(unsigned long long)sector); (unsigned long long)sector);
} }
peer_req->w.cb = w_e_end_ov_req; peer_req->w.cb = w_e_end_ov_req;
...@@ -2540,7 +2540,7 @@ static int receive_DataRequest(struct drbd_connection *connection, struct packet ...@@ -2540,7 +2540,7 @@ static int receive_DataRequest(struct drbd_connection *connection, struct packet
return 0; return 0;
/* don't care for the reason here */ /* don't care for the reason here */
dev_err(DEV, "submit failed, triggering re-connect\n"); drbd_err(device, "submit failed, triggering re-connect\n");
spin_lock_irq(&first_peer_device(device)->connection->req_lock); spin_lock_irq(&first_peer_device(device)->connection->req_lock);
list_del(&peer_req->w.list); list_del(&peer_req->w.list);
spin_unlock_irq(&first_peer_device(device)->connection->req_lock); spin_unlock_irq(&first_peer_device(device)->connection->req_lock);
...@@ -2572,7 +2572,7 @@ static int drbd_asb_recover_0p(struct drbd_device *device) __must_hold(local) ...@@ -2572,7 +2572,7 @@ static int drbd_asb_recover_0p(struct drbd_device *device) __must_hold(local)
case ASB_DISCARD_SECONDARY: case ASB_DISCARD_SECONDARY:
case ASB_CALL_HELPER: case ASB_CALL_HELPER:
case ASB_VIOLENTLY: case ASB_VIOLENTLY:
dev_err(DEV, "Configuration error.\n"); drbd_err(device, "Configuration error.\n");
break; break;
case ASB_DISCONNECT: case ASB_DISCONNECT:
break; break;
...@@ -2596,7 +2596,7 @@ static int drbd_asb_recover_0p(struct drbd_device *device) __must_hold(local) ...@@ -2596,7 +2596,7 @@ static int drbd_asb_recover_0p(struct drbd_device *device) __must_hold(local)
break; break;
} }
/* Else fall through to one of the other strategies... */ /* Else fall through to one of the other strategies... */
dev_warn(DEV, "Discard younger/older primary did not find a decision\n" drbd_warn(device, "Discard younger/older primary did not find a decision\n"
"Using discard-least-changes instead\n"); "Using discard-least-changes instead\n");
case ASB_DISCARD_ZERO_CHG: case ASB_DISCARD_ZERO_CHG:
if (ch_peer == 0 && ch_self == 0) { if (ch_peer == 0 && ch_self == 0) {
...@@ -2644,7 +2644,7 @@ static int drbd_asb_recover_1p(struct drbd_device *device) __must_hold(local) ...@@ -2644,7 +2644,7 @@ static int drbd_asb_recover_1p(struct drbd_device *device) __must_hold(local)
case ASB_DISCARD_LOCAL: case ASB_DISCARD_LOCAL:
case ASB_DISCARD_REMOTE: case ASB_DISCARD_REMOTE:
case ASB_DISCARD_ZERO_CHG: case ASB_DISCARD_ZERO_CHG:
dev_err(DEV, "Configuration error.\n"); drbd_err(device, "Configuration error.\n");
break; break;
case ASB_DISCONNECT: case ASB_DISCONNECT:
break; break;
...@@ -2672,7 +2672,7 @@ static int drbd_asb_recover_1p(struct drbd_device *device) __must_hold(local) ...@@ -2672,7 +2672,7 @@ static int drbd_asb_recover_1p(struct drbd_device *device) __must_hold(local)
if (rv2 != SS_SUCCESS) { if (rv2 != SS_SUCCESS) {
drbd_khelper(device, "pri-lost-after-sb"); drbd_khelper(device, "pri-lost-after-sb");
} else { } else {
dev_warn(DEV, "Successfully gave up primary role.\n"); drbd_warn(device, "Successfully gave up primary role.\n");
rv = hg; rv = hg;
} }
} else } else
...@@ -2699,7 +2699,7 @@ static int drbd_asb_recover_2p(struct drbd_device *device) __must_hold(local) ...@@ -2699,7 +2699,7 @@ static int drbd_asb_recover_2p(struct drbd_device *device) __must_hold(local)
case ASB_CONSENSUS: case ASB_CONSENSUS:
case ASB_DISCARD_SECONDARY: case ASB_DISCARD_SECONDARY:
case ASB_DISCARD_ZERO_CHG: case ASB_DISCARD_ZERO_CHG:
dev_err(DEV, "Configuration error.\n"); drbd_err(device, "Configuration error.\n");
break; break;
case ASB_VIOLENTLY: case ASB_VIOLENTLY:
rv = drbd_asb_recover_0p(device); rv = drbd_asb_recover_0p(device);
...@@ -2718,7 +2718,7 @@ static int drbd_asb_recover_2p(struct drbd_device *device) __must_hold(local) ...@@ -2718,7 +2718,7 @@ static int drbd_asb_recover_2p(struct drbd_device *device) __must_hold(local)
if (rv2 != SS_SUCCESS) { if (rv2 != SS_SUCCESS) {
drbd_khelper(device, "pri-lost-after-sb"); drbd_khelper(device, "pri-lost-after-sb");
} else { } else {
dev_warn(DEV, "Successfully gave up primary role.\n"); drbd_warn(device, "Successfully gave up primary role.\n");
rv = hg; rv = hg;
} }
} else } else
...@@ -2732,10 +2732,10 @@ static void drbd_uuid_dump(struct drbd_device *device, char *text, u64 *uuid, ...@@ -2732,10 +2732,10 @@ static void drbd_uuid_dump(struct drbd_device *device, char *text, u64 *uuid,
u64 bits, u64 flags) u64 bits, u64 flags)
{ {
if (!uuid) { if (!uuid) {
dev_info(DEV, "%s uuid info vanished while I was looking!\n", text); drbd_info(device, "%s uuid info vanished while I was looking!\n", text);
return; return;
} }
dev_info(DEV, "%s %016llX:%016llX:%016llX:%016llX bits:%llu flags:%llX\n", drbd_info(device, "%s %016llX:%016llX:%016llX:%016llX bits:%llu flags:%llX\n",
text, text,
(unsigned long long)uuid[UI_CURRENT], (unsigned long long)uuid[UI_CURRENT],
(unsigned long long)uuid[UI_BITMAP], (unsigned long long)uuid[UI_BITMAP],
...@@ -2789,7 +2789,7 @@ static int drbd_uuid_compare(struct drbd_device *device, int *rule_nr) __must_ho ...@@ -2789,7 +2789,7 @@ static int drbd_uuid_compare(struct drbd_device *device, int *rule_nr) __must_ho
if ((device->ldev->md.uuid[UI_BITMAP] & ~((u64)1)) == (device->p_uuid[UI_HISTORY_START] & ~((u64)1)) && if ((device->ldev->md.uuid[UI_BITMAP] & ~((u64)1)) == (device->p_uuid[UI_HISTORY_START] & ~((u64)1)) &&
(device->ldev->md.uuid[UI_HISTORY_START] & ~((u64)1)) == (device->p_uuid[UI_HISTORY_START + 1] & ~((u64)1))) { (device->ldev->md.uuid[UI_HISTORY_START] & ~((u64)1)) == (device->p_uuid[UI_HISTORY_START + 1] & ~((u64)1))) {
dev_info(DEV, "was SyncSource, missed the resync finished event, corrected myself:\n"); drbd_info(device, "was SyncSource, missed the resync finished event, corrected myself:\n");
drbd_uuid_move_history(device); drbd_uuid_move_history(device);
device->ldev->md.uuid[UI_HISTORY_START] = device->ldev->md.uuid[UI_BITMAP]; device->ldev->md.uuid[UI_HISTORY_START] = device->ldev->md.uuid[UI_BITMAP];
device->ldev->md.uuid[UI_BITMAP] = 0; device->ldev->md.uuid[UI_BITMAP] = 0;
...@@ -2798,7 +2798,7 @@ static int drbd_uuid_compare(struct drbd_device *device, int *rule_nr) __must_ho ...@@ -2798,7 +2798,7 @@ static int drbd_uuid_compare(struct drbd_device *device, int *rule_nr) __must_ho
device->state.disk >= D_NEGOTIATING ? drbd_bm_total_weight(device) : 0, 0); device->state.disk >= D_NEGOTIATING ? drbd_bm_total_weight(device) : 0, 0);
*rule_nr = 34; *rule_nr = 34;
} else { } else {
dev_info(DEV, "was SyncSource (peer failed to write sync_uuid)\n"); drbd_info(device, "was SyncSource (peer failed to write sync_uuid)\n");
*rule_nr = 36; *rule_nr = 36;
} }
...@@ -2812,7 +2812,7 @@ static int drbd_uuid_compare(struct drbd_device *device, int *rule_nr) __must_ho ...@@ -2812,7 +2812,7 @@ static int drbd_uuid_compare(struct drbd_device *device, int *rule_nr) __must_ho
if ((device->ldev->md.uuid[UI_HISTORY_START] & ~((u64)1)) == (device->p_uuid[UI_BITMAP] & ~((u64)1)) && if ((device->ldev->md.uuid[UI_HISTORY_START] & ~((u64)1)) == (device->p_uuid[UI_BITMAP] & ~((u64)1)) &&
(device->ldev->md.uuid[UI_HISTORY_START + 1] & ~((u64)1)) == (device->p_uuid[UI_HISTORY_START] & ~((u64)1))) { (device->ldev->md.uuid[UI_HISTORY_START + 1] & ~((u64)1)) == (device->p_uuid[UI_HISTORY_START] & ~((u64)1))) {
dev_info(DEV, "was SyncTarget, peer missed the resync finished event, corrected peer:\n"); drbd_info(device, "was SyncTarget, peer missed the resync finished event, corrected peer:\n");
device->p_uuid[UI_HISTORY_START + 1] = device->p_uuid[UI_HISTORY_START]; device->p_uuid[UI_HISTORY_START + 1] = device->p_uuid[UI_HISTORY_START];
device->p_uuid[UI_HISTORY_START] = device->p_uuid[UI_BITMAP]; device->p_uuid[UI_HISTORY_START] = device->p_uuid[UI_BITMAP];
...@@ -2821,7 +2821,7 @@ static int drbd_uuid_compare(struct drbd_device *device, int *rule_nr) __must_ho ...@@ -2821,7 +2821,7 @@ static int drbd_uuid_compare(struct drbd_device *device, int *rule_nr) __must_ho
drbd_uuid_dump(device, "peer", device->p_uuid, device->p_uuid[UI_SIZE], device->p_uuid[UI_FLAGS]); drbd_uuid_dump(device, "peer", device->p_uuid, device->p_uuid[UI_SIZE], device->p_uuid[UI_FLAGS]);
*rule_nr = 35; *rule_nr = 35;
} else { } else {
dev_info(DEV, "was SyncTarget (failed to write sync_uuid)\n"); drbd_info(device, "was SyncTarget (failed to write sync_uuid)\n");
*rule_nr = 37; *rule_nr = 37;
} }
...@@ -2866,7 +2866,7 @@ static int drbd_uuid_compare(struct drbd_device *device, int *rule_nr) __must_ho ...@@ -2866,7 +2866,7 @@ static int drbd_uuid_compare(struct drbd_device *device, int *rule_nr) __must_ho
device->p_uuid[UI_BITMAP] = device->p_uuid[UI_HISTORY_START]; device->p_uuid[UI_BITMAP] = device->p_uuid[UI_HISTORY_START];
device->p_uuid[UI_HISTORY_START] = device->p_uuid[UI_HISTORY_START + 1]; device->p_uuid[UI_HISTORY_START] = device->p_uuid[UI_HISTORY_START + 1];
dev_info(DEV, "Lost last syncUUID packet, corrected:\n"); drbd_info(device, "Lost last syncUUID packet, corrected:\n");
drbd_uuid_dump(device, "peer", device->p_uuid, device->p_uuid[UI_SIZE], device->p_uuid[UI_FLAGS]); drbd_uuid_dump(device, "peer", device->p_uuid, device->p_uuid[UI_SIZE], device->p_uuid[UI_FLAGS]);
return -1; return -1;
...@@ -2903,7 +2903,7 @@ static int drbd_uuid_compare(struct drbd_device *device, int *rule_nr) __must_ho ...@@ -2903,7 +2903,7 @@ static int drbd_uuid_compare(struct drbd_device *device, int *rule_nr) __must_ho
__drbd_uuid_set(device, UI_BITMAP, device->ldev->md.uuid[UI_HISTORY_START]); __drbd_uuid_set(device, UI_BITMAP, device->ldev->md.uuid[UI_HISTORY_START]);
__drbd_uuid_set(device, UI_HISTORY_START, device->ldev->md.uuid[UI_HISTORY_START + 1]); __drbd_uuid_set(device, UI_HISTORY_START, device->ldev->md.uuid[UI_HISTORY_START + 1]);
dev_info(DEV, "Last syncUUID did not get through, corrected:\n"); drbd_info(device, "Last syncUUID did not get through, corrected:\n");
drbd_uuid_dump(device, "self", device->ldev->md.uuid, drbd_uuid_dump(device, "self", device->ldev->md.uuid,
device->state.disk >= D_NEGOTIATING ? drbd_bm_total_weight(device) : 0, 0); device->state.disk >= D_NEGOTIATING ? drbd_bm_total_weight(device) : 0, 0);
...@@ -2954,7 +2954,7 @@ static enum drbd_conns drbd_sync_handshake(struct drbd_device *device, enum drbd ...@@ -2954,7 +2954,7 @@ static enum drbd_conns drbd_sync_handshake(struct drbd_device *device, enum drbd
if (mydisk == D_NEGOTIATING) if (mydisk == D_NEGOTIATING)
mydisk = device->new_state_tmp.disk; mydisk = device->new_state_tmp.disk;
dev_info(DEV, "drbd_sync_handshake:\n"); drbd_info(device, "drbd_sync_handshake:\n");
spin_lock_irq(&device->ldev->md.uuid_lock); spin_lock_irq(&device->ldev->md.uuid_lock);
drbd_uuid_dump(device, "self", device->ldev->md.uuid, device->comm_bm_set, 0); drbd_uuid_dump(device, "self", device->ldev->md.uuid, device->comm_bm_set, 0);
...@@ -2964,14 +2964,14 @@ static enum drbd_conns drbd_sync_handshake(struct drbd_device *device, enum drbd ...@@ -2964,14 +2964,14 @@ static enum drbd_conns drbd_sync_handshake(struct drbd_device *device, enum drbd
hg = drbd_uuid_compare(device, &rule_nr); hg = drbd_uuid_compare(device, &rule_nr);
spin_unlock_irq(&device->ldev->md.uuid_lock); spin_unlock_irq(&device->ldev->md.uuid_lock);
dev_info(DEV, "uuid_compare()=%d by rule %d\n", hg, rule_nr); drbd_info(device, "uuid_compare()=%d by rule %d\n", hg, rule_nr);
if (hg == -1000) { if (hg == -1000) {
dev_alert(DEV, "Unrelated data, aborting!\n"); drbd_alert(device, "Unrelated data, aborting!\n");
return C_MASK; return C_MASK;
} }
if (hg < -1000) { if (hg < -1000) {
dev_alert(DEV, "To resolve this both sides have to support at least protocol %d\n", -hg - 1000); drbd_alert(device, "To resolve this both sides have to support at least protocol %d\n", -hg - 1000);
return C_MASK; return C_MASK;
} }
...@@ -2981,7 +2981,7 @@ static enum drbd_conns drbd_sync_handshake(struct drbd_device *device, enum drbd ...@@ -2981,7 +2981,7 @@ static enum drbd_conns drbd_sync_handshake(struct drbd_device *device, enum drbd
hg = mydisk > D_INCONSISTENT ? 1 : -1; hg = mydisk > D_INCONSISTENT ? 1 : -1;
if (f) if (f)
hg = hg*2; hg = hg*2;
dev_info(DEV, "Becoming sync %s due to disk states.\n", drbd_info(device, "Becoming sync %s due to disk states.\n",
hg > 0 ? "source" : "target"); hg > 0 ? "source" : "target");
} }
...@@ -3008,11 +3008,11 @@ static enum drbd_conns drbd_sync_handshake(struct drbd_device *device, enum drbd ...@@ -3008,11 +3008,11 @@ static enum drbd_conns drbd_sync_handshake(struct drbd_device *device, enum drbd
break; break;
} }
if (abs(hg) < 100) { if (abs(hg) < 100) {
dev_warn(DEV, "Split-Brain detected, %d primaries, " drbd_warn(device, "Split-Brain detected, %d primaries, "
"automatically solved. Sync from %s node\n", "automatically solved. Sync from %s node\n",
pcount, (hg < 0) ? "peer" : "this"); pcount, (hg < 0) ? "peer" : "this");
if (forced) { if (forced) {
dev_warn(DEV, "Doing a full sync, since" drbd_warn(device, "Doing a full sync, since"
" UUIDs where ambiguous.\n"); " UUIDs where ambiguous.\n");
hg = hg*2; hg = hg*2;
} }
...@@ -3026,7 +3026,7 @@ static enum drbd_conns drbd_sync_handshake(struct drbd_device *device, enum drbd ...@@ -3026,7 +3026,7 @@ static enum drbd_conns drbd_sync_handshake(struct drbd_device *device, enum drbd
hg = 1; hg = 1;
if (abs(hg) < 100) if (abs(hg) < 100)
dev_warn(DEV, "Split-Brain detected, manually solved. " drbd_warn(device, "Split-Brain detected, manually solved. "
"Sync from %s node\n", "Sync from %s node\n",
(hg < 0) ? "peer" : "this"); (hg < 0) ? "peer" : "this");
} }
...@@ -3039,13 +3039,13 @@ static enum drbd_conns drbd_sync_handshake(struct drbd_device *device, enum drbd ...@@ -3039,13 +3039,13 @@ static enum drbd_conns drbd_sync_handshake(struct drbd_device *device, enum drbd
* after an attempted attach on a diskless node. * after an attempted attach on a diskless node.
* We just refuse to attach -- well, we drop the "connection" * We just refuse to attach -- well, we drop the "connection"
* to that disk, in a way... */ * to that disk, in a way... */
dev_alert(DEV, "Split-Brain detected but unresolved, dropping connection!\n"); drbd_alert(device, "Split-Brain detected but unresolved, dropping connection!\n");
drbd_khelper(device, "split-brain"); drbd_khelper(device, "split-brain");
return C_MASK; return C_MASK;
} }
if (hg > 0 && mydisk <= D_INCONSISTENT) { if (hg > 0 && mydisk <= D_INCONSISTENT) {
dev_err(DEV, "I shall become SyncSource, but I am inconsistent!\n"); drbd_err(device, "I shall become SyncSource, but I am inconsistent!\n");
return C_MASK; return C_MASK;
} }
...@@ -3056,26 +3056,26 @@ static enum drbd_conns drbd_sync_handshake(struct drbd_device *device, enum drbd ...@@ -3056,26 +3056,26 @@ static enum drbd_conns drbd_sync_handshake(struct drbd_device *device, enum drbd
drbd_khelper(device, "pri-lost"); drbd_khelper(device, "pri-lost");
/* fall through */ /* fall through */
case ASB_DISCONNECT: case ASB_DISCONNECT:
dev_err(DEV, "I shall become SyncTarget, but I am primary!\n"); drbd_err(device, "I shall become SyncTarget, but I am primary!\n");
return C_MASK; return C_MASK;
case ASB_VIOLENTLY: case ASB_VIOLENTLY:
dev_warn(DEV, "Becoming SyncTarget, violating the stable-data" drbd_warn(device, "Becoming SyncTarget, violating the stable-data"
"assumption\n"); "assumption\n");
} }
} }
if (tentative || test_bit(CONN_DRY_RUN, &first_peer_device(device)->connection->flags)) { if (tentative || test_bit(CONN_DRY_RUN, &first_peer_device(device)->connection->flags)) {
if (hg == 0) if (hg == 0)
dev_info(DEV, "dry-run connect: No resync, would become Connected immediately.\n"); drbd_info(device, "dry-run connect: No resync, would become Connected immediately.\n");
else else
dev_info(DEV, "dry-run connect: Would become %s, doing a %s resync.", drbd_info(device, "dry-run connect: Would become %s, doing a %s resync.",
drbd_conn_str(hg > 0 ? C_SYNC_SOURCE : C_SYNC_TARGET), drbd_conn_str(hg > 0 ? C_SYNC_SOURCE : C_SYNC_TARGET),
abs(hg) >= 2 ? "full" : "bit-map based"); abs(hg) >= 2 ? "full" : "bit-map based");
return C_MASK; return C_MASK;
} }
if (abs(hg) >= 2) { if (abs(hg) >= 2) {
dev_info(DEV, "Writing the whole bitmap, full sync required after drbd_sync_handshake.\n"); drbd_info(device, "Writing the whole bitmap, full sync required after drbd_sync_handshake.\n");
if (drbd_bitmap_io(device, &drbd_bmio_set_n_write, "set_n_write from sync_handshake", if (drbd_bitmap_io(device, &drbd_bmio_set_n_write, "set_n_write from sync_handshake",
BM_LOCKED_SET_ALLOWED)) BM_LOCKED_SET_ALLOWED))
return C_MASK; return C_MASK;
...@@ -3088,7 +3088,7 @@ static enum drbd_conns drbd_sync_handshake(struct drbd_device *device, enum drbd ...@@ -3088,7 +3088,7 @@ static enum drbd_conns drbd_sync_handshake(struct drbd_device *device, enum drbd
} else { } else {
rv = C_CONNECTED; rv = C_CONNECTED;
if (drbd_bm_total_weight(device)) { if (drbd_bm_total_weight(device)) {
dev_info(DEV, "No resync, but %lu bits in bitmap!\n", drbd_info(device, "No resync, but %lu bits in bitmap!\n",
drbd_bm_total_weight(device)); drbd_bm_total_weight(device));
} }
} }
...@@ -3276,7 +3276,7 @@ struct crypto_hash *drbd_crypto_alloc_digest_safe(const struct drbd_device *devi ...@@ -3276,7 +3276,7 @@ struct crypto_hash *drbd_crypto_alloc_digest_safe(const struct drbd_device *devi
tfm = crypto_alloc_hash(alg, 0, CRYPTO_ALG_ASYNC); tfm = crypto_alloc_hash(alg, 0, CRYPTO_ALG_ASYNC);
if (IS_ERR(tfm)) { if (IS_ERR(tfm)) {
dev_err(DEV, "Can not allocate \"%s\" as %s (reason: %ld)\n", drbd_err(device, "Can not allocate \"%s\" as %s (reason: %ld)\n",
alg, name, PTR_ERR(tfm)); alg, name, PTR_ERR(tfm));
return tfm; return tfm;
} }
...@@ -3346,7 +3346,7 @@ static int receive_SyncParam(struct drbd_connection *connection, struct packet_i ...@@ -3346,7 +3346,7 @@ static int receive_SyncParam(struct drbd_connection *connection, struct packet_i
: /* apv >= 95 */ sizeof(struct p_rs_param_95); : /* apv >= 95 */ sizeof(struct p_rs_param_95);
if (pi->size > exp_max_sz) { if (pi->size > exp_max_sz) {
dev_err(DEV, "SyncParam packet too long: received %u, expected <= %u bytes\n", drbd_err(device, "SyncParam packet too long: received %u, expected <= %u bytes\n",
pi->size, exp_max_sz); pi->size, exp_max_sz);
return -EIO; return -EIO;
} }
...@@ -3379,7 +3379,7 @@ static int receive_SyncParam(struct drbd_connection *connection, struct packet_i ...@@ -3379,7 +3379,7 @@ static int receive_SyncParam(struct drbd_connection *connection, struct packet_i
if (!new_disk_conf) { if (!new_disk_conf) {
put_ldev(device); put_ldev(device);
mutex_unlock(&first_peer_device(device)->connection->conf_update); mutex_unlock(&first_peer_device(device)->connection->conf_update);
dev_err(DEV, "Allocation of new disk_conf failed\n"); drbd_err(device, "Allocation of new disk_conf failed\n");
return -ENOMEM; return -ENOMEM;
} }
...@@ -3392,7 +3392,7 @@ static int receive_SyncParam(struct drbd_connection *connection, struct packet_i ...@@ -3392,7 +3392,7 @@ static int receive_SyncParam(struct drbd_connection *connection, struct packet_i
if (apv >= 88) { if (apv >= 88) {
if (apv == 88) { if (apv == 88) {
if (data_size > SHARED_SECRET_MAX || data_size == 0) { if (data_size > SHARED_SECRET_MAX || data_size == 0) {
dev_err(DEV, "verify-alg of wrong size, " drbd_err(device, "verify-alg of wrong size, "
"peer wants %u, accepting only up to %u byte\n", "peer wants %u, accepting only up to %u byte\n",
data_size, SHARED_SECRET_MAX); data_size, SHARED_SECRET_MAX);
err = -EIO; err = -EIO;
...@@ -3418,7 +3418,7 @@ static int receive_SyncParam(struct drbd_connection *connection, struct packet_i ...@@ -3418,7 +3418,7 @@ static int receive_SyncParam(struct drbd_connection *connection, struct packet_i
if (strcmp(old_net_conf->verify_alg, p->verify_alg)) { if (strcmp(old_net_conf->verify_alg, p->verify_alg)) {
if (device->state.conn == C_WF_REPORT_PARAMS) { if (device->state.conn == C_WF_REPORT_PARAMS) {
dev_err(DEV, "Different verify-alg settings. me=\"%s\" peer=\"%s\"\n", drbd_err(device, "Different verify-alg settings. me=\"%s\" peer=\"%s\"\n",
old_net_conf->verify_alg, p->verify_alg); old_net_conf->verify_alg, p->verify_alg);
goto disconnect; goto disconnect;
} }
...@@ -3432,7 +3432,7 @@ static int receive_SyncParam(struct drbd_connection *connection, struct packet_i ...@@ -3432,7 +3432,7 @@ static int receive_SyncParam(struct drbd_connection *connection, struct packet_i
if (apv >= 89 && strcmp(old_net_conf->csums_alg, p->csums_alg)) { if (apv >= 89 && strcmp(old_net_conf->csums_alg, p->csums_alg)) {
if (device->state.conn == C_WF_REPORT_PARAMS) { if (device->state.conn == C_WF_REPORT_PARAMS) {
dev_err(DEV, "Different csums-alg settings. me=\"%s\" peer=\"%s\"\n", drbd_err(device, "Different csums-alg settings. me=\"%s\" peer=\"%s\"\n",
old_net_conf->csums_alg, p->csums_alg); old_net_conf->csums_alg, p->csums_alg);
goto disconnect; goto disconnect;
} }
...@@ -3454,7 +3454,7 @@ static int receive_SyncParam(struct drbd_connection *connection, struct packet_i ...@@ -3454,7 +3454,7 @@ static int receive_SyncParam(struct drbd_connection *connection, struct packet_i
if (fifo_size != device->rs_plan_s->size) { if (fifo_size != device->rs_plan_s->size) {
new_plan = fifo_alloc(fifo_size); new_plan = fifo_alloc(fifo_size);
if (!new_plan) { if (!new_plan) {
dev_err(DEV, "kmalloc of fifo_buffer failed"); drbd_err(device, "kmalloc of fifo_buffer failed");
put_ldev(device); put_ldev(device);
goto disconnect; goto disconnect;
} }
...@@ -3464,7 +3464,7 @@ static int receive_SyncParam(struct drbd_connection *connection, struct packet_i ...@@ -3464,7 +3464,7 @@ static int receive_SyncParam(struct drbd_connection *connection, struct packet_i
if (verify_tfm || csums_tfm) { if (verify_tfm || csums_tfm) {
new_net_conf = kzalloc(sizeof(struct net_conf), GFP_KERNEL); new_net_conf = kzalloc(sizeof(struct net_conf), GFP_KERNEL);
if (!new_net_conf) { if (!new_net_conf) {
dev_err(DEV, "Allocation of new net_conf failed\n"); drbd_err(device, "Allocation of new net_conf failed\n");
goto disconnect; goto disconnect;
} }
...@@ -3475,14 +3475,14 @@ static int receive_SyncParam(struct drbd_connection *connection, struct packet_i ...@@ -3475,14 +3475,14 @@ static int receive_SyncParam(struct drbd_connection *connection, struct packet_i
new_net_conf->verify_alg_len = strlen(p->verify_alg) + 1; new_net_conf->verify_alg_len = strlen(p->verify_alg) + 1;
crypto_free_hash(first_peer_device(device)->connection->verify_tfm); crypto_free_hash(first_peer_device(device)->connection->verify_tfm);
first_peer_device(device)->connection->verify_tfm = verify_tfm; first_peer_device(device)->connection->verify_tfm = verify_tfm;
dev_info(DEV, "using verify-alg: \"%s\"\n", p->verify_alg); drbd_info(device, "using verify-alg: \"%s\"\n", p->verify_alg);
} }
if (csums_tfm) { if (csums_tfm) {
strcpy(new_net_conf->csums_alg, p->csums_alg); strcpy(new_net_conf->csums_alg, p->csums_alg);
new_net_conf->csums_alg_len = strlen(p->csums_alg) + 1; new_net_conf->csums_alg_len = strlen(p->csums_alg) + 1;
crypto_free_hash(first_peer_device(device)->connection->csums_tfm); crypto_free_hash(first_peer_device(device)->connection->csums_tfm);
first_peer_device(device)->connection->csums_tfm = csums_tfm; first_peer_device(device)->connection->csums_tfm = csums_tfm;
dev_info(DEV, "using csums-alg: \"%s\"\n", p->csums_alg); drbd_info(device, "using csums-alg: \"%s\"\n", p->csums_alg);
} }
rcu_assign_pointer(connection->net_conf, new_net_conf); rcu_assign_pointer(connection->net_conf, new_net_conf);
} }
...@@ -3540,7 +3540,7 @@ static void warn_if_differ_considerably(struct drbd_device *device, ...@@ -3540,7 +3540,7 @@ static void warn_if_differ_considerably(struct drbd_device *device,
return; return;
d = (a > b) ? (a - b) : (b - a); d = (a > b) ? (a - b) : (b - a);
if (d > (a>>3) || d > (b>>3)) if (d > (a>>3) || d > (b>>3))
dev_warn(DEV, "Considerable difference in %s: %llus vs. %llus\n", s, drbd_warn(device, "Considerable difference in %s: %llus vs. %llus\n", s,
(unsigned long long)a, (unsigned long long)b); (unsigned long long)a, (unsigned long long)b);
} }
...@@ -3585,7 +3585,7 @@ static int receive_sizes(struct drbd_connection *connection, struct packet_info ...@@ -3585,7 +3585,7 @@ static int receive_sizes(struct drbd_connection *connection, struct packet_info
drbd_get_capacity(device->this_bdev) && drbd_get_capacity(device->this_bdev) &&
device->state.disk >= D_OUTDATED && device->state.disk >= D_OUTDATED &&
device->state.conn < C_CONNECTED) { device->state.conn < C_CONNECTED) {
dev_err(DEV, "The peer's disk size is too small!\n"); drbd_err(device, "The peer's disk size is too small!\n");
conn_request_state(first_peer_device(device)->connection, NS(conn, C_DISCONNECTING), CS_HARD); conn_request_state(first_peer_device(device)->connection, NS(conn, C_DISCONNECTING), CS_HARD);
put_ldev(device); put_ldev(device);
return -EIO; return -EIO;
...@@ -3596,7 +3596,7 @@ static int receive_sizes(struct drbd_connection *connection, struct packet_info ...@@ -3596,7 +3596,7 @@ static int receive_sizes(struct drbd_connection *connection, struct packet_info
new_disk_conf = kzalloc(sizeof(struct disk_conf), GFP_KERNEL); new_disk_conf = kzalloc(sizeof(struct disk_conf), GFP_KERNEL);
if (!new_disk_conf) { if (!new_disk_conf) {
dev_err(DEV, "Allocation of new disk_conf failed\n"); drbd_err(device, "Allocation of new disk_conf failed\n");
put_ldev(device); put_ldev(device);
return -ENOMEM; return -ENOMEM;
} }
...@@ -3611,7 +3611,7 @@ static int receive_sizes(struct drbd_connection *connection, struct packet_info ...@@ -3611,7 +3611,7 @@ static int receive_sizes(struct drbd_connection *connection, struct packet_info
synchronize_rcu(); synchronize_rcu();
kfree(old_disk_conf); kfree(old_disk_conf);
dev_info(DEV, "Peer sets u_size to %lu sectors\n", drbd_info(device, "Peer sets u_size to %lu sectors\n",
(unsigned long)my_usize); (unsigned long)my_usize);
} }
...@@ -3654,7 +3654,7 @@ static int receive_sizes(struct drbd_connection *connection, struct packet_info ...@@ -3654,7 +3654,7 @@ static int receive_sizes(struct drbd_connection *connection, struct packet_info
if (device->state.pdsk >= D_INCONSISTENT && if (device->state.pdsk >= D_INCONSISTENT &&
device->state.disk >= D_INCONSISTENT) { device->state.disk >= D_INCONSISTENT) {
if (ddsf & DDSF_NO_RESYNC) if (ddsf & DDSF_NO_RESYNC)
dev_info(DEV, "Resync of new storage suppressed with --assume-clean\n"); drbd_info(device, "Resync of new storage suppressed with --assume-clean\n");
else else
resync_after_online_grow(device); resync_after_online_grow(device);
} else } else
...@@ -3678,7 +3678,7 @@ static int receive_uuids(struct drbd_connection *connection, struct packet_info ...@@ -3678,7 +3678,7 @@ static int receive_uuids(struct drbd_connection *connection, struct packet_info
p_uuid = kmalloc(sizeof(u64)*UI_EXTENDED_SIZE, GFP_NOIO); p_uuid = kmalloc(sizeof(u64)*UI_EXTENDED_SIZE, GFP_NOIO);
if (!p_uuid) { if (!p_uuid) {
dev_err(DEV, "kmalloc of p_uuid failed\n"); drbd_err(device, "kmalloc of p_uuid failed\n");
return false; return false;
} }
...@@ -3692,7 +3692,7 @@ static int receive_uuids(struct drbd_connection *connection, struct packet_info ...@@ -3692,7 +3692,7 @@ static int receive_uuids(struct drbd_connection *connection, struct packet_info
device->state.disk < D_INCONSISTENT && device->state.disk < D_INCONSISTENT &&
device->state.role == R_PRIMARY && device->state.role == R_PRIMARY &&
(device->ed_uuid & ~((u64)1)) != (p_uuid[UI_CURRENT] & ~((u64)1))) { (device->ed_uuid & ~((u64)1)) != (p_uuid[UI_CURRENT] & ~((u64)1))) {
dev_err(DEV, "Can only connect to data with current UUID=%016llX\n", drbd_err(device, "Can only connect to data with current UUID=%016llX\n",
(unsigned long long)device->ed_uuid); (unsigned long long)device->ed_uuid);
conn_request_state(first_peer_device(device)->connection, NS(conn, C_DISCONNECTING), CS_HARD); conn_request_state(first_peer_device(device)->connection, NS(conn, C_DISCONNECTING), CS_HARD);
return -EIO; return -EIO;
...@@ -3705,7 +3705,7 @@ static int receive_uuids(struct drbd_connection *connection, struct packet_info ...@@ -3705,7 +3705,7 @@ static int receive_uuids(struct drbd_connection *connection, struct packet_info
device->ldev->md.uuid[UI_CURRENT] == UUID_JUST_CREATED && device->ldev->md.uuid[UI_CURRENT] == UUID_JUST_CREATED &&
(p_uuid[UI_FLAGS] & 8); (p_uuid[UI_FLAGS] & 8);
if (skip_initial_sync) { if (skip_initial_sync) {
dev_info(DEV, "Accepted new current UUID, preparing to skip initial sync\n"); drbd_info(device, "Accepted new current UUID, preparing to skip initial sync\n");
drbd_bitmap_io(device, &drbd_bmio_clear_n_write, drbd_bitmap_io(device, &drbd_bmio_clear_n_write,
"clear_n_write from receive_uuids", "clear_n_write from receive_uuids",
BM_LOCKED_TEST_ALLOWED); BM_LOCKED_TEST_ALLOWED);
...@@ -3843,7 +3843,7 @@ static int receive_state(struct drbd_connection *connection, struct packet_info ...@@ -3843,7 +3843,7 @@ static int receive_state(struct drbd_connection *connection, struct packet_info
real_peer_disk = peer_state.disk; real_peer_disk = peer_state.disk;
if (peer_state.disk == D_NEGOTIATING) { if (peer_state.disk == D_NEGOTIATING) {
real_peer_disk = device->p_uuid[UI_FLAGS] & 4 ? D_INCONSISTENT : D_CONSISTENT; real_peer_disk = device->p_uuid[UI_FLAGS] & 4 ? D_INCONSISTENT : D_CONSISTENT;
dev_info(DEV, "real peer disk state = %s\n", drbd_disk_str(real_peer_disk)); drbd_info(device, "real peer disk state = %s\n", drbd_disk_str(real_peer_disk));
} }
spin_lock_irq(&first_peer_device(device)->connection->req_lock); spin_lock_irq(&first_peer_device(device)->connection->req_lock);
...@@ -3939,7 +3939,7 @@ static int receive_state(struct drbd_connection *connection, struct packet_info ...@@ -3939,7 +3939,7 @@ static int receive_state(struct drbd_connection *connection, struct packet_info
if (device->state.disk == D_NEGOTIATING) { if (device->state.disk == D_NEGOTIATING) {
drbd_force_state(device, NS(disk, D_FAILED)); drbd_force_state(device, NS(disk, D_FAILED));
} else if (peer_state.disk == D_NEGOTIATING) { } else if (peer_state.disk == D_NEGOTIATING) {
dev_err(DEV, "Disk attach process on the peer node was aborted.\n"); drbd_err(device, "Disk attach process on the peer node was aborted.\n");
peer_state.disk = D_DISKLESS; peer_state.disk = D_DISKLESS;
real_peer_disk = D_DISKLESS; real_peer_disk = D_DISKLESS;
} else { } else {
...@@ -3967,7 +3967,7 @@ static int receive_state(struct drbd_connection *connection, struct packet_info ...@@ -3967,7 +3967,7 @@ static int receive_state(struct drbd_connection *connection, struct packet_info
/* Do not allow tl_restart(RESEND) for a rebooted peer. We can only allow this /* Do not allow tl_restart(RESEND) for a rebooted peer. We can only allow this
for temporal network outages! */ for temporal network outages! */
spin_unlock_irq(&first_peer_device(device)->connection->req_lock); spin_unlock_irq(&first_peer_device(device)->connection->req_lock);
dev_err(DEV, "Aborting Connect, can not thaw IO with an only Consistent peer\n"); drbd_err(device, "Aborting Connect, can not thaw IO with an only Consistent peer\n");
tl_clear(first_peer_device(device)->connection); tl_clear(first_peer_device(device)->connection);
drbd_uuid_new_current(device); drbd_uuid_new_current(device);
clear_bit(NEW_CUR_UUID, &device->flags); clear_bit(NEW_CUR_UUID, &device->flags);
...@@ -4029,7 +4029,7 @@ static int receive_sync_uuid(struct drbd_connection *connection, struct packet_i ...@@ -4029,7 +4029,7 @@ static int receive_sync_uuid(struct drbd_connection *connection, struct packet_i
put_ldev(device); put_ldev(device);
} else } else
dev_err(DEV, "Ignoring SyncUUID packet!\n"); drbd_err(device, "Ignoring SyncUUID packet!\n");
return 0; return 0;
} }
...@@ -4052,7 +4052,7 @@ receive_bitmap_plain(struct drbd_device *device, unsigned int size, ...@@ -4052,7 +4052,7 @@ receive_bitmap_plain(struct drbd_device *device, unsigned int size,
int err; int err;
if (want != size) { if (want != size) {
dev_err(DEV, "%s:want (%u) != size (%u)\n", __func__, want, size); drbd_err(device, "%s:want (%u) != size (%u)\n", __func__, want, size);
return -EIO; return -EIO;
} }
if (want == 0) if (want == 0)
...@@ -4122,14 +4122,14 @@ recv_bm_rle_bits(struct drbd_device *device, ...@@ -4122,14 +4122,14 @@ recv_bm_rle_bits(struct drbd_device *device,
if (toggle) { if (toggle) {
e = s + rl -1; e = s + rl -1;
if (e >= c->bm_bits) { if (e >= c->bm_bits) {
dev_err(DEV, "bitmap overflow (e:%lu) while decoding bm RLE packet\n", e); drbd_err(device, "bitmap overflow (e:%lu) while decoding bm RLE packet\n", e);
return -EIO; return -EIO;
} }
_drbd_bm_set_bits(device, s, e); _drbd_bm_set_bits(device, s, e);
} }
if (have < bits) { if (have < bits) {
dev_err(DEV, "bitmap decoding error: h:%d b:%d la:0x%08llx l:%u/%u\n", drbd_err(device, "bitmap decoding error: h:%d b:%d la:0x%08llx l:%u/%u\n",
have, bits, look_ahead, have, bits, look_ahead,
(unsigned int)(bs.cur.b - p->code), (unsigned int)(bs.cur.b - p->code),
(unsigned int)bs.buf_len); (unsigned int)bs.buf_len);
...@@ -4174,7 +4174,7 @@ decode_bitmap_c(struct drbd_device *device, ...@@ -4174,7 +4174,7 @@ decode_bitmap_c(struct drbd_device *device,
* but have been dropped as this one turned out to be "best" * but have been dropped as this one turned out to be "best"
* during all our tests. */ * during all our tests. */
dev_err(DEV, "receive_bitmap_c: unknown encoding %u\n", p->encoding); drbd_err(device, "receive_bitmap_c: unknown encoding %u\n", p->encoding);
conn_request_state(first_peer_device(device)->connection, NS(conn, C_PROTOCOL_ERROR), CS_HARD); conn_request_state(first_peer_device(device)->connection, NS(conn, C_PROTOCOL_ERROR), CS_HARD);
return -EIO; return -EIO;
} }
...@@ -4207,7 +4207,7 @@ void INFO_bm_xfer_stats(struct drbd_device *device, ...@@ -4207,7 +4207,7 @@ void INFO_bm_xfer_stats(struct drbd_device *device,
r = 1000; r = 1000;
r = 1000 - r; r = 1000 - r;
dev_info(DEV, "%s bitmap stats [Bytes(packets)]: plain %u(%u), RLE %u(%u), " drbd_info(device, "%s bitmap stats [Bytes(packets)]: plain %u(%u), RLE %u(%u), "
"total %u; compression: %u.%u%%\n", "total %u; compression: %u.%u%%\n",
direction, direction,
c->bytes[1], c->packets[1], c->bytes[1], c->packets[1],
...@@ -4251,12 +4251,12 @@ static int receive_bitmap(struct drbd_connection *connection, struct packet_info ...@@ -4251,12 +4251,12 @@ static int receive_bitmap(struct drbd_connection *connection, struct packet_info
struct p_compressed_bm *p = pi->data; struct p_compressed_bm *p = pi->data;
if (pi->size > DRBD_SOCKET_BUFFER_SIZE - drbd_header_size(connection)) { if (pi->size > DRBD_SOCKET_BUFFER_SIZE - drbd_header_size(connection)) {
dev_err(DEV, "ReportCBitmap packet too large\n"); drbd_err(device, "ReportCBitmap packet too large\n");
err = -EIO; err = -EIO;
goto out; goto out;
} }
if (pi->size <= sizeof(*p)) { if (pi->size <= sizeof(*p)) {
dev_err(DEV, "ReportCBitmap packet too small (l:%u)\n", pi->size); drbd_err(device, "ReportCBitmap packet too small (l:%u)\n", pi->size);
err = -EIO; err = -EIO;
goto out; goto out;
} }
...@@ -4265,7 +4265,7 @@ static int receive_bitmap(struct drbd_connection *connection, struct packet_info ...@@ -4265,7 +4265,7 @@ static int receive_bitmap(struct drbd_connection *connection, struct packet_info
goto out; goto out;
err = decode_bitmap_c(device, p, &c, pi->size); err = decode_bitmap_c(device, p, &c, pi->size);
} else { } else {
dev_warn(DEV, "receive_bitmap: cmd neither ReportBitMap nor ReportCBitMap (is 0x%x)", pi->cmd); drbd_warn(device, "receive_bitmap: cmd neither ReportBitMap nor ReportCBitMap (is 0x%x)", pi->cmd);
err = -EIO; err = -EIO;
goto out; goto out;
} }
...@@ -4297,7 +4297,7 @@ static int receive_bitmap(struct drbd_connection *connection, struct packet_info ...@@ -4297,7 +4297,7 @@ static int receive_bitmap(struct drbd_connection *connection, struct packet_info
} else if (device->state.conn != C_WF_BITMAP_S) { } else if (device->state.conn != C_WF_BITMAP_S) {
/* admin may have requested C_DISCONNECTING, /* admin may have requested C_DISCONNECTING,
* other threads may have noticed network errors */ * other threads may have noticed network errors */
dev_info(DEV, "unexpected cstate (%s) in receive_bitmap\n", drbd_info(device, "unexpected cstate (%s) in receive_bitmap\n",
drbd_conn_str(device->state.conn)); drbd_conn_str(device->state.conn));
} }
err = 0; err = 0;
...@@ -4341,7 +4341,7 @@ static int receive_out_of_sync(struct drbd_connection *connection, struct packet ...@@ -4341,7 +4341,7 @@ static int receive_out_of_sync(struct drbd_connection *connection, struct packet
case C_BEHIND: case C_BEHIND:
break; break;
default: default:
dev_err(DEV, "ASSERT FAILED cstate = %s, expected: WFSyncUUID|WFBitMapT|Behind\n", drbd_err(device, "ASSERT FAILED cstate = %s, expected: WFSyncUUID|WFBitMapT|Behind\n",
drbd_conn_str(device->state.conn)); drbd_conn_str(device->state.conn));
} }
...@@ -4561,13 +4561,13 @@ static int drbd_disconnected(struct drbd_device *device) ...@@ -4561,13 +4561,13 @@ static int drbd_disconnected(struct drbd_device *device)
*/ */
i = drbd_free_peer_reqs(device, &device->net_ee); i = drbd_free_peer_reqs(device, &device->net_ee);
if (i) if (i)
dev_info(DEV, "net_ee not empty, killed %u entries\n", i); drbd_info(device, "net_ee not empty, killed %u entries\n", i);
i = atomic_read(&device->pp_in_use_by_net); i = atomic_read(&device->pp_in_use_by_net);
if (i) if (i)
dev_info(DEV, "pp_in_use_by_net = %d, expected 0\n", i); drbd_info(device, "pp_in_use_by_net = %d, expected 0\n", i);
i = atomic_read(&device->pp_in_use); i = atomic_read(&device->pp_in_use);
if (i) if (i)
dev_info(DEV, "pp_in_use = %d, expected 0\n", i); drbd_info(device, "pp_in_use = %d, expected 0\n", i);
D_ASSERT(list_empty(&device->read_ee)); D_ASSERT(list_empty(&device->read_ee));
D_ASSERT(list_empty(&device->active_ee)); D_ASSERT(list_empty(&device->active_ee));
...@@ -4910,7 +4910,7 @@ static int got_RqSReply(struct drbd_connection *connection, struct packet_info * ...@@ -4910,7 +4910,7 @@ static int got_RqSReply(struct drbd_connection *connection, struct packet_info *
set_bit(CL_ST_CHG_SUCCESS, &device->flags); set_bit(CL_ST_CHG_SUCCESS, &device->flags);
} else { } else {
set_bit(CL_ST_CHG_FAIL, &device->flags); set_bit(CL_ST_CHG_FAIL, &device->flags);
dev_err(DEV, "Requested state change failed by peer: %s (%d)\n", drbd_err(device, "Requested state change failed by peer: %s (%d)\n",
drbd_set_st_err_str(retcode), retcode); drbd_set_st_err_str(retcode), retcode);
} }
wake_up(&device->state_wait); wake_up(&device->state_wait);
...@@ -5074,7 +5074,7 @@ static int got_NegDReply(struct drbd_connection *connection, struct packet_info ...@@ -5074,7 +5074,7 @@ static int got_NegDReply(struct drbd_connection *connection, struct packet_info
update_peer_seq(device, be32_to_cpu(p->seq_num)); update_peer_seq(device, be32_to_cpu(p->seq_num));
dev_err(DEV, "Got NegDReply; Sector %llus, len %u.\n", drbd_err(device, "Got NegDReply; Sector %llus, len %u.\n",
(unsigned long long)sector, be32_to_cpu(p->blksize)); (unsigned long long)sector, be32_to_cpu(p->blksize));
return validate_req_change_req_state(device, p->block_id, sector, return validate_req_change_req_state(device, p->block_id, sector,
...@@ -5181,7 +5181,7 @@ static int got_OVResult(struct drbd_connection *connection, struct packet_info * ...@@ -5181,7 +5181,7 @@ static int got_OVResult(struct drbd_connection *connection, struct packet_info *
w->device = device; w->device = device;
drbd_queue_work(&first_peer_device(device)->connection->sender_work, w); drbd_queue_work(&first_peer_device(device)->connection->sender_work, w);
} else { } else {
dev_err(DEV, "kmalloc(w) failed."); drbd_err(device, "kmalloc(w) failed.");
ov_out_of_sync_print(device); ov_out_of_sync_print(device);
drbd_resync_finished(device); drbd_resync_finished(device);
} }
......
...@@ -102,7 +102,7 @@ void drbd_req_destroy(struct kref *kref) ...@@ -102,7 +102,7 @@ void drbd_req_destroy(struct kref *kref)
atomic_read(&req->completion_ref) || atomic_read(&req->completion_ref) ||
(s & RQ_LOCAL_PENDING) || (s & RQ_LOCAL_PENDING) ||
((s & RQ_NET_MASK) && !(s & RQ_NET_DONE))) { ((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)); s, atomic_read(&req->completion_ref));
return; return;
} }
...@@ -153,7 +153,7 @@ void drbd_req_destroy(struct kref *kref) ...@@ -153,7 +153,7 @@ void drbd_req_destroy(struct kref *kref)
drbd_al_complete_io(device, &req->i); drbd_al_complete_io(device, &req->i);
put_ldev(device); put_ldev(device);
} else if (__ratelimit(&drbd_ratelimit_state)) { } 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", "but my Disk seems to have failed :(\n",
(unsigned long long) req->i.sector, req->i.size); (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) ...@@ -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)) || if ((s & RQ_LOCAL_PENDING && !(s & RQ_LOCAL_ABORTED)) ||
(s & RQ_NET_QUEUED) || (s & RQ_NET_PENDING) || (s & RQ_NET_QUEUED) || (s & RQ_NET_PENDING) ||
(s & RQ_COMPLETION_SUSP)) { (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; return;
} }
if (!req->master_bio) { 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; return;
} }
...@@ -410,7 +410,7 @@ static void mod_rq_state(struct drbd_request *req, struct bio_and_error *m, ...@@ -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 at_least = k_put + !!c_put;
int refcount = atomic_read(&req->kref.refcount); int refcount = atomic_read(&req->kref.refcount);
if (refcount < at_least) if (refcount < at_least)
dev_err(DEV, drbd_err(device,
"mod_rq_state: Logic BUG: %x -> %x: refcount = %d, should be >= %d\n", "mod_rq_state: Logic BUG: %x -> %x: refcount = %d, should be >= %d\n",
s, req->rq_state, refcount, at_least); s, req->rq_state, refcount, at_least);
} }
...@@ -432,7 +432,7 @@ static void drbd_report_io_error(struct drbd_device *device, struct drbd_request ...@@ -432,7 +432,7 @@ static void drbd_report_io_error(struct drbd_device *device, struct drbd_request
if (!__ratelimit(&drbd_ratelimit_state)) if (!__ratelimit(&drbd_ratelimit_state))
return; 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", (req->rq_state & RQ_WRITE) ? "WRITE" : "READ",
(unsigned long long)req->i.sector, (unsigned long long)req->i.sector,
req->i.size >> 9, req->i.size >> 9,
...@@ -463,7 +463,7 @@ int __req_mod(struct drbd_request *req, enum drbd_req_event what, ...@@ -463,7 +463,7 @@ int __req_mod(struct drbd_request *req, enum drbd_req_event what,
switch (what) { switch (what) {
default: default:
dev_err(DEV, "LOGIC BUG in %s:%u\n", __FILE__ , __LINE__); drbd_err(device, "LOGIC BUG in %s:%u\n", __FILE__ , __LINE__);
break; break;
/* does not happen... /* does not happen...
...@@ -741,7 +741,7 @@ int __req_mod(struct drbd_request *req, enum drbd_req_event what, ...@@ -741,7 +741,7 @@ int __req_mod(struct drbd_request *req, enum drbd_req_event what,
/* barrier came in before all requests were acked. /* barrier came in before all requests were acked.
* this is bad, because if the connection is lost now, * this is bad, because if the connection is lost now,
* we won't be able to clean them up... */ * 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. /* Allowed to complete requests, even while suspended.
* As this is called for all requests within a matching epoch, * As this is called for all requests within a matching epoch,
...@@ -883,12 +883,12 @@ static void maybe_pull_ahead(struct drbd_device *device) ...@@ -883,12 +883,12 @@ static void maybe_pull_ahead(struct drbd_device *device)
if (nc->cong_fill && if (nc->cong_fill &&
atomic_read(&device->ap_in_flight) >= 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; congested = true;
} }
if (device->act_log->used >= nc->cong_extents) { 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; congested = true;
} }
...@@ -1046,7 +1046,7 @@ drbd_request_prepare(struct drbd_device *device, struct bio *bio, unsigned long ...@@ -1046,7 +1046,7 @@ drbd_request_prepare(struct drbd_device *device, struct bio *bio, unsigned long
dec_ap_bio(device); dec_ap_bio(device);
/* only pass the error to the upper layers. /* only pass the error to the upper layers.
* if user cannot handle io errors, that's not our business. */ * 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); bio_endio(bio, -ENOMEM);
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
} }
...@@ -1146,7 +1146,7 @@ static void drbd_send_and_submit(struct drbd_device *device, struct drbd_request ...@@ -1146,7 +1146,7 @@ static void drbd_send_and_submit(struct drbd_device *device, struct drbd_request
} else if (no_remote) { } else if (no_remote) {
nodata: nodata:
if (__ratelimit(&drbd_ratelimit_state)) 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); (unsigned long long)req->i.sector, req->i.size >> 9);
/* A write may have been queued for send_oos, however. /* 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() */ * 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) ...@@ -1387,13 +1387,13 @@ void request_timer_fn(unsigned long data)
if (ent && req->rq_state & RQ_NET_PENDING && if (ent && req->rq_state & RQ_NET_PENDING &&
time_after(now, req->start_time + ent) && time_after(now, req->start_time + ent) &&
!time_in_range(now, connection->last_reconnect_jif, connection->last_reconnect_jif + 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); _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 && if (dt && req->rq_state & RQ_LOCAL_PENDING && req->w.device == device &&
time_after(now, req->start_time + dt) && time_after(now, req->start_time + dt) &&
!time_in_range(now, device->last_reattach_jif, device->last_reattach_jif + 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); __drbd_chk_io_error(device, DRBD_FORCE_DETACH);
} }
nt = (time_after(now, req->start_time + et) ? now : req->start_time) + et; 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, ...@@ -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) 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, name,
drbd_conn_str(ns.conn), drbd_conn_str(ns.conn),
drbd_role_str(ns.role), drbd_role_str(ns.role),
...@@ -432,7 +432,7 @@ void print_st_err(struct drbd_device *device, union drbd_state os, ...@@ -432,7 +432,7 @@ void print_st_err(struct drbd_device *device, union drbd_state os,
{ {
if (err == SS_IN_TRANSIENT_STATE) if (err == SS_IN_TRANSIENT_STATE)
return; 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, " state", os);
print_st(device, "wanted", ns); print_st(device, "wanted", ns);
} }
...@@ -490,7 +490,7 @@ static void drbd_pr_state_change(struct drbd_device *device, union drbd_state os ...@@ -490,7 +490,7 @@ static void drbd_pr_state_change(struct drbd_device *device, union drbd_state os
ns.user_isp); ns.user_isp);
if (pbp != pb) 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, 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 ...@@ -726,7 +726,7 @@ static void print_sanitize_warnings(struct drbd_device *device, enum sanitize_st
}; };
if (warn != NO_WARNING) 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 ...@@ -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) void drbd_resume_al(struct drbd_device *device)
{ {
if (test_and_clear_bit(AL_SUSPENDED, &device->flags)) 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 */ /* helper for __drbd_set_state */
...@@ -1035,13 +1035,13 @@ __drbd_set_state(struct drbd_device *device, union drbd_state ns, ...@@ -1035,13 +1035,13 @@ __drbd_set_state(struct drbd_device *device, union drbd_state ns,
device->ov_start_sector = device->ov_start_sector =
BM_BIT_TO_SECT(drbd_bm_bits(device) - device->ov_left); BM_BIT_TO_SECT(drbd_bm_bits(device) - device->ov_left);
if (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); (unsigned long long)device->ov_start_sector);
} }
if ((os.conn == C_PAUSED_SYNC_T || os.conn == C_PAUSED_SYNC_S) && if ((os.conn == C_PAUSED_SYNC_T || os.conn == C_PAUSED_SYNC_S) &&
(ns.conn == C_SYNC_TARGET || ns.conn == C_SYNC_SOURCE)) { (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 device->rs_paused += (long)jiffies
-(long)device->rs_mark_time[device->rs_last_mark]; -(long)device->rs_mark_time[device->rs_last_mark];
if (ns.conn == C_SYNC_TARGET) if (ns.conn == C_SYNC_TARGET)
...@@ -1050,7 +1050,7 @@ __drbd_set_state(struct drbd_device *device, union drbd_state ns, ...@@ -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) && if ((os.conn == C_SYNC_TARGET || os.conn == C_SYNC_SOURCE) &&
(ns.conn == C_PAUSED_SYNC_T || ns.conn == C_PAUSED_SYNC_S)) { (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; device->rs_mark_time[device->rs_last_mark] = jiffies;
} }
...@@ -1074,7 +1074,7 @@ __drbd_set_state(struct drbd_device *device, union drbd_state ns, ...@@ -1074,7 +1074,7 @@ __drbd_set_state(struct drbd_device *device, union drbd_state ns,
drbd_rs_controller_reset(device); drbd_rs_controller_reset(device);
if (ns.conn == C_VERIFY_S) { 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); (unsigned long long)device->ov_position);
mod_timer(&device->resync_timer, jiffies); mod_timer(&device->resync_timer, jiffies);
} }
...@@ -1149,7 +1149,7 @@ __drbd_set_state(struct drbd_device *device, union drbd_state ns, ...@@ -1149,7 +1149,7 @@ __drbd_set_state(struct drbd_device *device, union drbd_state ns,
ascw->done = done; ascw->done = done;
drbd_queue_work(&first_peer_device(device)->connection->sender_work, &ascw->w); drbd_queue_work(&first_peer_device(device)->connection->sender_work, &ascw->w);
} else { } else {
dev_err(DEV, "Could not kmalloc an ascw\n"); drbd_err(device, "Could not kmalloc an ascw\n");
} }
return rv; return rv;
...@@ -1174,7 +1174,7 @@ static int w_after_state_ch(struct drbd_work *w, int unused) ...@@ -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) static void abw_start_sync(struct drbd_device *device, int rv)
{ {
if (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); _drbd_request_state(device, NS(conn, C_CONNECTED), CS_VERBOSE);
return; return;
} }
...@@ -1441,7 +1441,7 @@ static void after_state_ch(struct drbd_device *device, union drbd_state os, ...@@ -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, * there is only one way out: to D_DISKLESS,
* and that may only happen after our put_ldev below. */ * and that may only happen after our put_ldev below. */
if (device->state.disk != D_FAILED) if (device->state.disk != D_FAILED)
dev_err(DEV, drbd_err(device,
"ASSERT FAILED: disk is %s during detach\n", "ASSERT FAILED: disk is %s during detach\n",
drbd_disk_str(device->state.disk)); drbd_disk_str(device->state.disk));
...@@ -1465,7 +1465,7 @@ static void after_state_ch(struct drbd_device *device, union drbd_state os, ...@@ -1465,7 +1465,7 @@ static void after_state_ch(struct drbd_device *device, union drbd_state os,
/* We must still be diskless, /* We must still be diskless,
* re-attach has to be serialized with this! */ * re-attach has to be serialized with this! */
if (device->state.disk != D_DISKLESS) if (device->state.disk != D_DISKLESS)
dev_err(DEV, drbd_err(device,
"ASSERT FAILED: disk is %s while going diskless\n", "ASSERT FAILED: disk is %s while going diskless\n",
drbd_disk_str(device->state.disk)); drbd_disk_str(device->state.disk));
......
...@@ -176,12 +176,12 @@ void drbd_peer_request_endio(struct bio *bio, int error) ...@@ -176,12 +176,12 @@ void drbd_peer_request_endio(struct bio *bio, int error)
int is_write = bio_data_dir(bio) == WRITE; int is_write = bio_data_dir(bio) == WRITE;
if (error && __ratelimit(&drbd_ratelimit_state)) 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, is_write ? "write" : "read", error,
(unsigned long long)peer_req->i.sector); (unsigned long long)peer_req->i.sector);
if (!error && !uptodate) { if (!error && !uptodate) {
if (__ratelimit(&drbd_ratelimit_state)) 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", is_write ? "write" : "read",
(unsigned long long)peer_req->i.sector); (unsigned long long)peer_req->i.sector);
/* strange behavior of some lower level drivers... /* strange behavior of some lower level drivers...
...@@ -214,7 +214,7 @@ void drbd_request_endio(struct bio *bio, int error) ...@@ -214,7 +214,7 @@ void drbd_request_endio(struct bio *bio, int error)
int uptodate = bio_flagged(bio, BIO_UPTODATE); int uptodate = bio_flagged(bio, BIO_UPTODATE);
if (!error && !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"); bio_data_dir(bio) == WRITE ? "write" : "read");
/* strange behavior of some lower level drivers... /* strange behavior of some lower level drivers...
* fail the request by clearing the uptodate flag, * fail the request by clearing the uptodate flag,
...@@ -253,7 +253,7 @@ void drbd_request_endio(struct bio *bio, int error) ...@@ -253,7 +253,7 @@ void drbd_request_endio(struct bio *bio, int error)
*/ */
if (unlikely(req->rq_state & RQ_LOCAL_ABORTED)) { if (unlikely(req->rq_state & RQ_LOCAL_ABORTED)) {
if (__ratelimit(&drbd_ratelimit_state)) 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) if (!error)
panic("possible random memory corruption caused by delayed completion of aborted local request\n"); 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) ...@@ -364,7 +364,7 @@ static int w_e_send_csum(struct drbd_work *w, int cancel)
P_CSUM_RS_REQUEST); P_CSUM_RS_REQUEST);
kfree(digest); kfree(digest);
} else { } else {
dev_err(DEV, "kmalloc() of digest failed.\n"); drbd_err(device, "kmalloc() of digest failed.\n");
err = -ENOMEM; err = -ENOMEM;
} }
...@@ -373,7 +373,7 @@ static int w_e_send_csum(struct drbd_work *w, int cancel) ...@@ -373,7 +373,7 @@ static int w_e_send_csum(struct drbd_work *w, int cancel)
drbd_free_peer_req(device, peer_req); drbd_free_peer_req(device, peer_req);
if (unlikely(err)) if (unlikely(err))
dev_err(DEV, "drbd_send_drequest(..., csum) failed\n"); drbd_err(device, "drbd_send_drequest(..., csum) failed\n");
return err; return err;
} }
...@@ -534,7 +534,7 @@ static int drbd_rs_controller(struct drbd_device *device) ...@@ -534,7 +534,7 @@ static int drbd_rs_controller(struct drbd_device *device)
req_sect = max_sect; 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, sect_in, device->rs_in_flight, want, correction,
steps, cps, device->rs_planed, curr_corr, req_sect); steps, cps, device->rs_planed, curr_corr, req_sect);
*/ */
...@@ -586,7 +586,7 @@ int w_make_resync_request(struct drbd_work *w, int cancel) ...@@ -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 get_ldev_if_state(device,D_FAILED) would be sufficient, but
to continue resync with a broken disk makes no sense at to continue resync with a broken disk makes no sense at
all */ all */
dev_err(DEV, "Disk broke down during resync!\n"); drbd_err(device, "Disk broke down during resync!\n");
return 0; return 0;
} }
...@@ -699,7 +699,7 @@ int w_make_resync_request(struct drbd_work *w, int cancel) ...@@ -699,7 +699,7 @@ int w_make_resync_request(struct drbd_work *w, int cancel)
err = drbd_send_drequest(device, P_RS_DATA_REQUEST, err = drbd_send_drequest(device, P_RS_DATA_REQUEST,
sector, size, ID_SYNCER); sector, size, ID_SYNCER);
if (err) { if (err) {
dev_err(DEV, "drbd_send_drequest() failed, aborting...\n"); drbd_err(device, "drbd_send_drequest() failed, aborting...\n");
dec_rs_pending(device); dec_rs_pending(device);
put_ldev(device); put_ldev(device);
return err; return err;
...@@ -835,7 +835,7 @@ int drbd_resync_finished(struct drbd_device *device) ...@@ -835,7 +835,7 @@ int drbd_resync_finished(struct drbd_device *device)
drbd_queue_work(&first_peer_device(device)->connection->sender_work, w); drbd_queue_work(&first_peer_device(device)->connection->sender_work, w);
return 1; 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; dt = (jiffies - device->rs_start - device->rs_paused) / HZ;
...@@ -868,7 +868,7 @@ int drbd_resync_finished(struct drbd_device *device) ...@@ -868,7 +868,7 @@ int drbd_resync_finished(struct drbd_device *device)
ns = os; ns = os;
ns.conn = C_CONNECTED; 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", verify_done ? "Online verify" : "Resync",
dt + device->rs_paused, device->rs_paused, dbdt); dt + device->rs_paused, device->rs_paused, dbdt);
...@@ -876,7 +876,7 @@ int drbd_resync_finished(struct drbd_device *device) ...@@ -876,7 +876,7 @@ int drbd_resync_finished(struct drbd_device *device)
if (os.conn == C_VERIFY_S || os.conn == C_VERIFY_T) { if (os.conn == C_VERIFY_S || os.conn == C_VERIFY_T) {
if (n_oos) { 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)); n_oos, Bit2KB(1));
khelper_cmd = "out-of-sync"; khelper_cmd = "out-of-sync";
} }
...@@ -892,7 +892,7 @@ int drbd_resync_finished(struct drbd_device *device) ...@@ -892,7 +892,7 @@ int drbd_resync_finished(struct drbd_device *device)
const int ratio = const int ratio =
(t == 0) ? 0 : (t == 0) ? 0 :
(t < 100000) ? ((s*100)/t) : (s/(t/100)); (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", "transferred %luK total %luK\n",
ratio, ratio,
Bit2KB(device->rs_same_csum), Bit2KB(device->rs_same_csum),
...@@ -902,7 +902,7 @@ int drbd_resync_finished(struct drbd_device *device) ...@@ -902,7 +902,7 @@ int drbd_resync_finished(struct drbd_device *device)
} }
if (device->rs_failed) { 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) { if (os.conn == C_SYNC_TARGET || os.conn == C_PAUSED_SYNC_T) {
ns.disk = D_INCONSISTENT; ns.disk = D_INCONSISTENT;
...@@ -923,7 +923,7 @@ int drbd_resync_finished(struct drbd_device *device) ...@@ -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_BITMAP, device->ldev->md.uuid[UI_CURRENT]);
_drbd_uuid_set(device, UI_CURRENT, device->p_uuid[UI_CURRENT]); _drbd_uuid_set(device, UI_CURRENT, device->p_uuid[UI_CURRENT]);
} else { } 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) ...@@ -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); err = drbd_send_block(device, P_DATA_REPLY, peer_req);
} else { } else {
if (__ratelimit(&drbd_ratelimit_state)) 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); (unsigned long long)peer_req->i.sector);
err = drbd_send_ack(device, P_NEG_DREPLY, peer_req); 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) ...@@ -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); move_to_net_ee_or_free(device, peer_req);
if (unlikely(err)) if (unlikely(err))
dev_err(DEV, "drbd_send_block() failed\n"); drbd_err(device, "drbd_send_block() failed\n");
return err; return err;
} }
...@@ -1047,13 +1047,13 @@ int w_e_end_rsdata_req(struct drbd_work *w, int cancel) ...@@ -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); err = drbd_send_block(device, P_RS_DATA_REPLY, peer_req);
} else { } else {
if (__ratelimit(&drbd_ratelimit_state)) if (__ratelimit(&drbd_ratelimit_state))
dev_err(DEV, "Not sending RSDataReply, " drbd_err(device, "Not sending RSDataReply, "
"partner DISKLESS!\n"); "partner DISKLESS!\n");
err = 0; err = 0;
} }
} else { } else {
if (__ratelimit(&drbd_ratelimit_state)) 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); (unsigned long long)peer_req->i.sector);
err = drbd_send_ack(device, P_NEG_RS_DREPLY, peer_req); 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) ...@@ -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); move_to_net_ee_or_free(device, peer_req);
if (unlikely(err)) if (unlikely(err))
dev_err(DEV, "drbd_send_block() failed\n"); drbd_err(device, "drbd_send_block() failed\n");
return err; return err;
} }
...@@ -1123,14 +1123,14 @@ int w_e_end_csum_rs_req(struct drbd_work *w, int cancel) ...@@ -1123,14 +1123,14 @@ int w_e_end_csum_rs_req(struct drbd_work *w, int cancel)
} else { } else {
err = drbd_send_ack(device, P_NEG_RS_DREPLY, peer_req); err = drbd_send_ack(device, P_NEG_RS_DREPLY, peer_req);
if (__ratelimit(&drbd_ratelimit_state)) 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); dec_unacked(device);
move_to_net_ee_or_free(device, peer_req); move_to_net_ee_or_free(device, peer_req);
if (unlikely(err)) if (unlikely(err))
dev_err(DEV, "drbd_send_block/ack() failed\n"); drbd_err(device, "drbd_send_block/ack() failed\n");
return err; return err;
} }
...@@ -1590,7 +1590,7 @@ int w_start_resync(struct drbd_work *w, int cancel) ...@@ -1590,7 +1590,7 @@ int w_start_resync(struct drbd_work *w, int cancel)
struct drbd_device *device = w->device; struct drbd_device *device = w->device;
if (atomic_read(&device->unacked_cnt) || atomic_read(&device->rs_pending_cnt)) { 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; device->start_resync_timer.expires = jiffies + HZ/10;
add_timer(&device->start_resync_timer); add_timer(&device->start_resync_timer);
return 0; return 0;
...@@ -1615,7 +1615,7 @@ void drbd_start_resync(struct drbd_device *device, enum drbd_conns side) ...@@ -1615,7 +1615,7 @@ void drbd_start_resync(struct drbd_device *device, enum drbd_conns side)
int r; int r;
if (device->state.conn >= C_SYNC_SOURCE && device->state.conn < C_AHEAD) { 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; return;
} }
...@@ -1627,7 +1627,7 @@ void drbd_start_resync(struct drbd_device *device, enum drbd_conns side) ...@@ -1627,7 +1627,7 @@ void drbd_start_resync(struct drbd_device *device, enum drbd_conns side)
r = drbd_khelper(device, "before-resync-target"); r = drbd_khelper(device, "before-resync-target");
r = (r >> 8) & 0xff; r = (r >> 8) & 0xff;
if (r > 0) { 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); "dropping connection.\n", r);
conn_request_state(first_peer_device(device)->connection, NS(conn, C_DISCONNECTING), CS_HARD); conn_request_state(first_peer_device(device)->connection, NS(conn, C_DISCONNECTING), CS_HARD);
return; return;
...@@ -1637,10 +1637,10 @@ void drbd_start_resync(struct drbd_device *device, enum drbd_conns side) ...@@ -1637,10 +1637,10 @@ void drbd_start_resync(struct drbd_device *device, enum drbd_conns side)
r = (r >> 8) & 0xff; r = (r >> 8) & 0xff;
if (r > 0) { if (r > 0) {
if (r == 3) { 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); "ignoring. Old userland tools?", r);
} else { } else {
dev_info(DEV, "before-resync-source handler returned %d, " drbd_info(device, "before-resync-source handler returned %d, "
"dropping connection.\n", r); "dropping connection.\n", r);
conn_request_state(first_peer_device(device)->connection, conn_request_state(first_peer_device(device)->connection,
NS(conn, C_DISCONNECTING), CS_HARD); NS(conn, C_DISCONNECTING), CS_HARD);
...@@ -1715,7 +1715,7 @@ void drbd_start_resync(struct drbd_device *device, enum drbd_conns side) ...@@ -1715,7 +1715,7 @@ void drbd_start_resync(struct drbd_device *device, enum drbd_conns side)
* to deal with potential jiffies wrap. */ * to deal with potential jiffies wrap. */
device->rs_last_bcast = jiffies - HZ; 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), drbd_conn_str(ns.conn),
(unsigned long) device->rs_total << (BM_BLOCK_SHIFT-10), (unsigned long) device->rs_total << (BM_BLOCK_SHIFT-10),
(unsigned long) device->rs_total); (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