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); ...@@ -147,16 +147,6 @@ void drbd_printk_with_wrong_object_type(void);
#define dynamic_drbd_dbg(device, fmt, args...) \ #define dynamic_drbd_dbg(device, fmt, args...) \
dynamic_dev_dbg(disk_to_dev(device->vdisk), 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)) \ #define D_ASSERT(exp) if (!(exp)) \
drbd_err(device, "ASSERT( " #exp " ) in %s:%d\n", __FILE__, __LINE__) 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, ...@@ -227,18 +227,18 @@ void tl_release(struct drbd_connection *connection, unsigned int barrier_nr,
/* first some paranoia code */ /* first some paranoia code */
if (req == NULL) { 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); barrier_nr);
goto bail; goto bail;
} }
if (expect_epoch != barrier_nr) { 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); barrier_nr, expect_epoch);
goto bail; goto bail;
} }
if (expect_size != set_size) { 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); barrier_nr, set_size, expect_size);
goto bail; goto bail;
} }
...@@ -349,7 +349,7 @@ static int drbd_thread_setup(void *arg) ...@@ -349,7 +349,7 @@ static int drbd_thread_setup(void *arg)
*/ */
if (thi->t_state == RESTARTING) { 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; thi->t_state = RUNNING;
spin_unlock_irqrestore(&thi->t_lock, flags); spin_unlock_irqrestore(&thi->t_lock, flags);
goto restart; goto restart;
...@@ -361,7 +361,7 @@ static int drbd_thread_setup(void *arg) ...@@ -361,7 +361,7 @@ static int drbd_thread_setup(void *arg)
complete_all(&thi->stop); complete_all(&thi->stop);
spin_unlock_irqrestore(&thi->t_lock, flags); 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 */ /* Release mod reference taken when thread was started */
...@@ -393,12 +393,12 @@ int drbd_thread_start(struct drbd_thread *thi) ...@@ -393,12 +393,12 @@ int drbd_thread_start(struct drbd_thread *thi)
switch (thi->t_state) { switch (thi->t_state) {
case NONE: 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); thi->name, current->comm, current->pid);
/* Get ref on module for thread - this is released when thread exits */ /* Get ref on module for thread - this is released when thread exits */
if (!try_module_get(THIS_MODULE)) { 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); spin_unlock_irqrestore(&thi->t_lock, flags);
return false; return false;
} }
...@@ -415,7 +415,7 @@ int drbd_thread_start(struct drbd_thread *thi) ...@@ -415,7 +415,7 @@ int drbd_thread_start(struct drbd_thread *thi)
"drbd_%c_%s", thi->name[0], thi->connection->resource->name); "drbd_%c_%s", thi->name[0], thi->connection->resource->name);
if (IS_ERR(nt)) { 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); kref_put(&connection->kref, drbd_destroy_connection);
module_put(THIS_MODULE); module_put(THIS_MODULE);
...@@ -429,7 +429,7 @@ int drbd_thread_start(struct drbd_thread *thi) ...@@ -429,7 +429,7 @@ int drbd_thread_start(struct drbd_thread *thi)
break; break;
case EXITING: case EXITING:
thi->t_state = RESTARTING; 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); thi->name, current->comm, current->pid);
/* fall through */ /* fall through */
case RUNNING: case RUNNING:
...@@ -786,7 +786,7 @@ int __drbd_send_protocol(struct drbd_connection *connection, enum drbd_packet cm ...@@ -786,7 +786,7 @@ int __drbd_send_protocol(struct drbd_connection *connection, enum drbd_packet cm
if (nc->tentative && connection->agreed_pro_version < 92) { if (nc->tentative && connection->agreed_pro_version < 92) {
rcu_read_unlock(); rcu_read_unlock();
mutex_unlock(&sock->mutex); 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; return -EOPNOTSUPP;
} }
...@@ -1435,7 +1435,7 @@ static int we_should_drop_the_connection(struct drbd_connection *connection, str ...@@ -1435,7 +1435,7 @@ static int we_should_drop_the_connection(struct drbd_connection *connection, str
drop_it = !--connection->ko_count; drop_it = !--connection->ko_count;
if (!drop_it) { 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); current->comm, current->pid, connection->ko_count);
request_ping(connection); request_ping(connection);
} }
...@@ -1800,7 +1800,7 @@ int drbd_send(struct drbd_connection *connection, struct socket *sock, ...@@ -1800,7 +1800,7 @@ int drbd_send(struct drbd_connection *connection, struct socket *sock,
if (rv <= 0) { if (rv <= 0) {
if (rv != -EAGAIN) { 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", sock == connection->meta.socket ? "msock" : "sock",
rv); rv);
conn_request_state(connection, NS(conn, C_BROKEN_PIPE), CS_HARD); 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 ...@@ -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, err = bitmap_parse(res_opts->cpu_mask, 32,
cpumask_bits(new_cpu_mask), nr_cpu_ids); cpumask_bits(new_cpu_mask), nr_cpu_ids);
if (err) { 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; */ /* retcode = ERR_CPU_MASK_PARSE; */
goto fail; goto fail;
} }
...@@ -2630,7 +2630,7 @@ void drbd_destroy_connection(struct kref *kref) ...@@ -2630,7 +2630,7 @@ void drbd_destroy_connection(struct kref *kref)
struct drbd_resource *resource = connection->resource; struct drbd_resource *resource = connection->resource;
if (atomic_read(&connection->current_epoch->epoch_size) != 0) 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); kfree(connection->current_epoch);
idr_destroy(&connection->peer_devices); idr_destroy(&connection->peer_devices);
......
...@@ -392,16 +392,16 @@ static int conn_khelper(struct drbd_connection *connection, char *cmd) ...@@ -392,16 +392,16 @@ static int conn_khelper(struct drbd_connection *connection, char *cmd)
setup_khelper_env(connection, envp); setup_khelper_env(connection, envp);
conn_md_sync(connection); 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() ?? */ /* TODO: conn_bcast_event() ?? */
ret = call_usermodehelper(usermode_helper, argv, envp, UMH_WAIT_PROC); ret = call_usermodehelper(usermode_helper, argv, envp, UMH_WAIT_PROC);
if (ret) 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, usermode_helper, cmd, resource_name,
(ret >> 8) & 0xff, ret); (ret >> 8) & 0xff, ret);
else 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, usermode_helper, cmd, resource_name,
(ret >> 8) & 0xff, ret); (ret >> 8) & 0xff, ret);
/* TODO: conn_bcast_event() ?? */ /* TODO: conn_bcast_event() ?? */
...@@ -443,7 +443,7 @@ bool conn_try_outdate_peer(struct drbd_connection *connection) ...@@ -443,7 +443,7 @@ bool conn_try_outdate_peer(struct drbd_connection *connection)
int r; int r;
if (connection->cstate >= C_WF_REPORT_PARAMS) { 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; return false;
} }
...@@ -454,7 +454,7 @@ bool conn_try_outdate_peer(struct drbd_connection *connection) ...@@ -454,7 +454,7 @@ bool conn_try_outdate_peer(struct drbd_connection *connection)
fp = highest_fencing_policy(connection); fp = highest_fencing_policy(connection);
switch (fp) { switch (fp) {
case FP_NOT_AVAIL: 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; goto out;
case FP_DONT_CARE: case FP_DONT_CARE:
return true; return true;
...@@ -488,24 +488,24 @@ bool conn_try_outdate_peer(struct drbd_connection *connection) ...@@ -488,24 +488,24 @@ bool conn_try_outdate_peer(struct drbd_connection *connection)
* This is useful when an unconnected R_SECONDARY is asked to * This is useful when an unconnected R_SECONDARY is asked to
* become R_PRIMARY, but finds the other peer being active. */ * become R_PRIMARY, but finds the other peer being active. */
ex_to_string = "peer is 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; mask.disk = D_MASK;
val.disk = D_OUTDATED; val.disk = D_OUTDATED;
break; break;
case 7: case 7:
if (fp != FP_STONITH) 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"; ex_to_string = "peer was stonithed";
mask.pdsk = D_MASK; mask.pdsk = D_MASK;
val.pdsk = D_OUTDATED; val.pdsk = D_OUTDATED;
break; break;
default: default:
/* The script is broken ... */ /* 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 */ 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); (r>>8) & 0xff, ex_to_string);
out: out:
...@@ -519,7 +519,7 @@ bool conn_try_outdate_peer(struct drbd_connection *connection) ...@@ -519,7 +519,7 @@ bool conn_try_outdate_peer(struct drbd_connection *connection)
if (connection->connect_cnt != connect_cnt) if (connection->connect_cnt != connect_cnt)
/* In case the connection was established and droped /* In case the connection was established and droped
while the fence-peer handler was running, ignore it */ 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 else
_conn_request_state(connection, mask, val, CS_VERBOSE); _conn_request_state(connection, mask, val, CS_VERBOSE);
} }
...@@ -545,7 +545,7 @@ void conn_try_outdate_peer_async(struct drbd_connection *connection) ...@@ -545,7 +545,7 @@ void conn_try_outdate_peer_async(struct drbd_connection *connection)
kref_get(&connection->kref); kref_get(&connection->kref);
opa = kthread_run(_try_outdate_peer_async, connection, "drbd_async_h"); opa = kthread_run(_try_outdate_peer_async, connection, "drbd_async_h");
if (IS_ERR(opa)) { 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); kref_put(&connection->kref, drbd_destroy_connection);
} }
} }
...@@ -2335,7 +2335,7 @@ static enum drbd_state_rv conn_try_disconnect(struct drbd_connection *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), rv2 = conn_request_state(connection, NS(conn, C_STANDALONE),
CS_VERBOSE | CS_HARD); CS_VERBOSE | CS_HARD);
if (rv2 < SS_SUCCESS) if (rv2 < SS_SUCCESS)
conn_err(connection, drbd_err(connection,
"unexpected rv2=%d in conn_try_disconnect()\n", "unexpected rv2=%d in conn_try_disconnect()\n",
rv2); rv2);
} }
......
This diff is collapsed.
...@@ -507,7 +507,7 @@ static void conn_pr_state_change(struct drbd_connection *connection, union drbd_ ...@@ -507,7 +507,7 @@ static void conn_pr_state_change(struct drbd_connection *connection, union drbd_
is_susp(ns)); is_susp(ns));
if (pbp != pb) 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 ...@@ -1846,7 +1846,7 @@ _conn_request_state(struct drbd_connection *connection, union drbd_state mask, u
acscw->w.connection = connection; acscw->w.connection = connection;
drbd_queue_work(&connection->sender_work, &acscw->w); drbd_queue_work(&connection->sender_work, &acscw->w);
} else { } else {
conn_err(connection, "Could not kmalloc an acscw\n"); drbd_err(connection, "Could not kmalloc an acscw\n");
} }
abort: abort:
...@@ -1859,9 +1859,9 @@ _conn_request_state(struct drbd_connection *connection, union drbd_state mask, u ...@@ -1859,9 +1859,9 @@ _conn_request_state(struct drbd_connection *connection, union drbd_state mask, u
spin_lock_irq(&connection->req_lock); spin_lock_irq(&connection->req_lock);
} }
if (rv < SS_SUCCESS && flags & CS_VERBOSE) { if (rv < SS_SUCCESS && flags & CS_VERBOSE) {
conn_err(connection, "State change failed: %s\n", drbd_set_st_err_str(rv)); drbd_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); drbd_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, " old_conn:%s wanted_conn:%s\n", drbd_conn_str(oc), drbd_conn_str(val.conn));
} }
return rv; return rv;
} }
......
...@@ -1905,7 +1905,7 @@ int drbd_worker(struct drbd_thread *thi) ...@@ -1905,7 +1905,7 @@ int drbd_worker(struct drbd_thread *thi)
if (signal_pending(current)) { if (signal_pending(current)) {
flush_signals(current); flush_signals(current);
if (get_t_state(thi) == RUNNING) { 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; continue;
} }
break; 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