Commit 1ec861eb authored by Andreas Gruenbacher's avatar Andreas Gruenbacher Committed by Philipp Reisner

drbd: Replace and remove the obsolete conn_() macros

With the polymorphic drbd_() macros, we no longer need the connection
specific variants.
Signed-off-by: default avatarAndreas Gruenbacher <agruen@linbit.com>
Signed-off-by: default avatarPhilipp Reisner <philipp.reisner@linbit.com>
parent 3b52beff
......@@ -147,16 +147,6 @@ void drbd_printk_with_wrong_object_type(void);
#define dynamic_drbd_dbg(device, fmt, args...) \
dynamic_dev_dbg(disk_to_dev(device->vdisk), fmt, ## args)
#define conn_printk(LEVEL, TCONN, FMT, ARGS...) \
printk(LEVEL "d-con %s: " FMT, TCONN->resource->name , ## ARGS)
#define conn_alert(TCONN, FMT, ARGS...) conn_printk(KERN_ALERT, TCONN, FMT, ## ARGS)
#define conn_crit(TCONN, FMT, ARGS...) conn_printk(KERN_CRIT, TCONN, FMT, ## ARGS)
#define conn_err(TCONN, FMT, ARGS...) conn_printk(KERN_ERR, TCONN, FMT, ## ARGS)
#define conn_warn(TCONN, FMT, ARGS...) conn_printk(KERN_WARNING, TCONN, FMT, ## ARGS)
#define conn_notice(TCONN, FMT, ARGS...) conn_printk(KERN_NOTICE, TCONN, FMT, ## ARGS)
#define conn_info(TCONN, FMT, ARGS...) conn_printk(KERN_INFO, TCONN, FMT, ## ARGS)
#define conn_dbg(TCONN, FMT, ARGS...) conn_printk(KERN_DEBUG, TCONN, FMT, ## ARGS)
#define D_ASSERT(exp) if (!(exp)) \
drbd_err(device, "ASSERT( " #exp " ) in %s:%d\n", __FILE__, __LINE__)
......
......@@ -227,18 +227,18 @@ void tl_release(struct drbd_connection *connection, unsigned int barrier_nr,
/* first some paranoia code */
if (req == NULL) {
conn_err(connection, "BAD! BarrierAck #%u received, but no epoch in tl!?\n",
drbd_err(connection, "BAD! BarrierAck #%u received, but no epoch in tl!?\n",
barrier_nr);
goto bail;
}
if (expect_epoch != barrier_nr) {
conn_err(connection, "BAD! BarrierAck #%u received, expected #%u!\n",
drbd_err(connection, "BAD! BarrierAck #%u received, expected #%u!\n",
barrier_nr, expect_epoch);
goto bail;
}
if (expect_size != set_size) {
conn_err(connection, "BAD! BarrierAck #%u received with n_writes=%u, expected n_writes=%u!\n",
drbd_err(connection, "BAD! BarrierAck #%u received with n_writes=%u, expected n_writes=%u!\n",
barrier_nr, set_size, expect_size);
goto bail;
}
......@@ -349,7 +349,7 @@ static int drbd_thread_setup(void *arg)
*/
if (thi->t_state == RESTARTING) {
conn_info(connection, "Restarting %s thread\n", thi->name);
drbd_info(connection, "Restarting %s thread\n", thi->name);
thi->t_state = RUNNING;
spin_unlock_irqrestore(&thi->t_lock, flags);
goto restart;
......@@ -361,7 +361,7 @@ static int drbd_thread_setup(void *arg)
complete_all(&thi->stop);
spin_unlock_irqrestore(&thi->t_lock, flags);
conn_info(connection, "Terminating %s\n", current->comm);
drbd_info(connection, "Terminating %s\n", current->comm);
/* Release mod reference taken when thread was started */
......@@ -393,12 +393,12 @@ int drbd_thread_start(struct drbd_thread *thi)
switch (thi->t_state) {
case NONE:
conn_info(connection, "Starting %s thread (from %s [%d])\n",
drbd_info(connection, "Starting %s thread (from %s [%d])\n",
thi->name, current->comm, current->pid);
/* Get ref on module for thread - this is released when thread exits */
if (!try_module_get(THIS_MODULE)) {
conn_err(connection, "Failed to get module reference in drbd_thread_start\n");
drbd_err(connection, "Failed to get module reference in drbd_thread_start\n");
spin_unlock_irqrestore(&thi->t_lock, flags);
return false;
}
......@@ -415,7 +415,7 @@ int drbd_thread_start(struct drbd_thread *thi)
"drbd_%c_%s", thi->name[0], thi->connection->resource->name);
if (IS_ERR(nt)) {
conn_err(connection, "Couldn't start thread\n");
drbd_err(connection, "Couldn't start thread\n");
kref_put(&connection->kref, drbd_destroy_connection);
module_put(THIS_MODULE);
......@@ -429,7 +429,7 @@ int drbd_thread_start(struct drbd_thread *thi)
break;
case EXITING:
thi->t_state = RESTARTING;
conn_info(connection, "Restarting %s thread (from %s [%d])\n",
drbd_info(connection, "Restarting %s thread (from %s [%d])\n",
thi->name, current->comm, current->pid);
/* fall through */
case RUNNING:
......@@ -786,7 +786,7 @@ int __drbd_send_protocol(struct drbd_connection *connection, enum drbd_packet cm
if (nc->tentative && connection->agreed_pro_version < 92) {
rcu_read_unlock();
mutex_unlock(&sock->mutex);
conn_err(connection, "--dry-run is not supported by peer");
drbd_err(connection, "--dry-run is not supported by peer");
return -EOPNOTSUPP;
}
......@@ -1435,7 +1435,7 @@ static int we_should_drop_the_connection(struct drbd_connection *connection, str
drop_it = !--connection->ko_count;
if (!drop_it) {
conn_err(connection, "[%s/%d] sock_sendmsg time expired, ko = %u\n",
drbd_err(connection, "[%s/%d] sock_sendmsg time expired, ko = %u\n",
current->comm, current->pid, connection->ko_count);
request_ping(connection);
}
......@@ -1800,7 +1800,7 @@ int drbd_send(struct drbd_connection *connection, struct socket *sock,
if (rv <= 0) {
if (rv != -EAGAIN) {
conn_err(connection, "%s_sendmsg returned %d\n",
drbd_err(connection, "%s_sendmsg returned %d\n",
sock == connection->meta.socket ? "msock" : "sock",
rv);
conn_request_state(connection, NS(conn, C_BROKEN_PIPE), CS_HARD);
......@@ -2507,7 +2507,7 @@ int set_resource_options(struct drbd_resource *resource, struct res_opts *res_op
err = bitmap_parse(res_opts->cpu_mask, 32,
cpumask_bits(new_cpu_mask), nr_cpu_ids);
if (err) {
conn_warn(connection, "bitmap_parse() failed with %d\n", err);
drbd_warn(resource, "bitmap_parse() failed with %d\n", err);
/* retcode = ERR_CPU_MASK_PARSE; */
goto fail;
}
......@@ -2630,7 +2630,7 @@ void drbd_destroy_connection(struct kref *kref)
struct drbd_resource *resource = connection->resource;
if (atomic_read(&connection->current_epoch->epoch_size) != 0)
conn_err(connection, "epoch_size:%d\n", atomic_read(&connection->current_epoch->epoch_size));
drbd_err(connection, "epoch_size:%d\n", atomic_read(&connection->current_epoch->epoch_size));
kfree(connection->current_epoch);
idr_destroy(&connection->peer_devices);
......
......@@ -392,16 +392,16 @@ static int conn_khelper(struct drbd_connection *connection, char *cmd)
setup_khelper_env(connection, envp);
conn_md_sync(connection);
conn_info(connection, "helper command: %s %s %s\n", usermode_helper, cmd, resource_name);
drbd_info(connection, "helper command: %s %s %s\n", usermode_helper, cmd, resource_name);
/* TODO: conn_bcast_event() ?? */
ret = call_usermodehelper(usermode_helper, argv, envp, UMH_WAIT_PROC);
if (ret)
conn_warn(connection, "helper command: %s %s %s exit code %u (0x%x)\n",
drbd_warn(connection, "helper command: %s %s %s exit code %u (0x%x)\n",
usermode_helper, cmd, resource_name,
(ret >> 8) & 0xff, ret);
else
conn_info(connection, "helper command: %s %s %s exit code %u (0x%x)\n",
drbd_info(connection, "helper command: %s %s %s exit code %u (0x%x)\n",
usermode_helper, cmd, resource_name,
(ret >> 8) & 0xff, ret);
/* TODO: conn_bcast_event() ?? */
......@@ -443,7 +443,7 @@ bool conn_try_outdate_peer(struct drbd_connection *connection)
int r;
if (connection->cstate >= C_WF_REPORT_PARAMS) {
conn_err(connection, "Expected cstate < C_WF_REPORT_PARAMS\n");
drbd_err(connection, "Expected cstate < C_WF_REPORT_PARAMS\n");
return false;
}
......@@ -454,7 +454,7 @@ bool conn_try_outdate_peer(struct drbd_connection *connection)
fp = highest_fencing_policy(connection);
switch (fp) {
case FP_NOT_AVAIL:
conn_warn(connection, "Not fencing peer, I'm not even Consistent myself.\n");
drbd_warn(connection, "Not fencing peer, I'm not even Consistent myself.\n");
goto out;
case FP_DONT_CARE:
return true;
......@@ -488,24 +488,24 @@ bool conn_try_outdate_peer(struct drbd_connection *connection)
* This is useful when an unconnected R_SECONDARY is asked to
* become R_PRIMARY, but finds the other peer being active. */
ex_to_string = "peer is active";
conn_warn(connection, "Peer is primary, outdating myself.\n");
drbd_warn(connection, "Peer is primary, outdating myself.\n");
mask.disk = D_MASK;
val.disk = D_OUTDATED;
break;
case 7:
if (fp != FP_STONITH)
conn_err(connection, "fence-peer() = 7 && fencing != Stonith !!!\n");
drbd_err(connection, "fence-peer() = 7 && fencing != Stonith !!!\n");
ex_to_string = "peer was stonithed";
mask.pdsk = D_MASK;
val.pdsk = D_OUTDATED;
break;
default:
/* The script is broken ... */
conn_err(connection, "fence-peer helper broken, returned %d\n", (r>>8)&0xff);
drbd_err(connection, "fence-peer helper broken, returned %d\n", (r>>8)&0xff);
return false; /* Eventually leave IO frozen */
}
conn_info(connection, "fence-peer helper returned %d (%s)\n",
drbd_info(connection, "fence-peer helper returned %d (%s)\n",
(r>>8) & 0xff, ex_to_string);
out:
......@@ -519,7 +519,7 @@ bool conn_try_outdate_peer(struct drbd_connection *connection)
if (connection->connect_cnt != connect_cnt)
/* In case the connection was established and droped
while the fence-peer handler was running, ignore it */
conn_info(connection, "Ignoring fence-peer exit code\n");
drbd_info(connection, "Ignoring fence-peer exit code\n");
else
_conn_request_state(connection, mask, val, CS_VERBOSE);
}
......@@ -545,7 +545,7 @@ void conn_try_outdate_peer_async(struct drbd_connection *connection)
kref_get(&connection->kref);
opa = kthread_run(_try_outdate_peer_async, connection, "drbd_async_h");
if (IS_ERR(opa)) {
conn_err(connection, "out of mem, failed to invoke fence-peer helper\n");
drbd_err(connection, "out of mem, failed to invoke fence-peer helper\n");
kref_put(&connection->kref, drbd_destroy_connection);
}
}
......@@ -2335,7 +2335,7 @@ static enum drbd_state_rv conn_try_disconnect(struct drbd_connection *connection
rv2 = conn_request_state(connection, NS(conn, C_STANDALONE),
CS_VERBOSE | CS_HARD);
if (rv2 < SS_SUCCESS)
conn_err(connection,
drbd_err(connection,
"unexpected rv2=%d in conn_try_disconnect()\n",
rv2);
}
......
This diff is collapsed.
......@@ -507,7 +507,7 @@ static void conn_pr_state_change(struct drbd_connection *connection, union drbd_
is_susp(ns));
if (pbp != pb)
conn_info(connection, "%s\n", pb);
drbd_info(connection, "%s\n", pb);
}
......@@ -1846,7 +1846,7 @@ _conn_request_state(struct drbd_connection *connection, union drbd_state mask, u
acscw->w.connection = connection;
drbd_queue_work(&connection->sender_work, &acscw->w);
} else {
conn_err(connection, "Could not kmalloc an acscw\n");
drbd_err(connection, "Could not kmalloc an acscw\n");
}
abort:
......@@ -1859,9 +1859,9 @@ _conn_request_state(struct drbd_connection *connection, union drbd_state mask, u
spin_lock_irq(&connection->req_lock);
}
if (rv < SS_SUCCESS && flags & CS_VERBOSE) {
conn_err(connection, "State change failed: %s\n", drbd_set_st_err_str(rv));
conn_err(connection, " mask = 0x%x val = 0x%x\n", mask.i, val.i);
conn_err(connection, " old_conn:%s wanted_conn:%s\n", drbd_conn_str(oc), drbd_conn_str(val.conn));
drbd_err(connection, "State change failed: %s\n", drbd_set_st_err_str(rv));
drbd_err(connection, " mask = 0x%x val = 0x%x\n", mask.i, val.i);
drbd_err(connection, " old_conn:%s wanted_conn:%s\n", drbd_conn_str(oc), drbd_conn_str(val.conn));
}
return rv;
}
......
......@@ -1905,7 +1905,7 @@ int drbd_worker(struct drbd_thread *thi)
if (signal_pending(current)) {
flush_signals(current);
if (get_t_state(thi) == RUNNING) {
conn_warn(connection, "Worker got an unexpected signal\n");
drbd_warn(connection, "Worker got an unexpected signal\n");
continue;
}
break;
......
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