aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorWANG Cong <amwang@redhat.com>2011-08-19 08:48:22 -0400
committerJens Axboe <jaxboe@fusionio.com>2011-08-19 08:48:22 -0400
commit7f1b90f99a2d4253f8eb1221d39da072178adbc5 (patch)
tree7e8f0422677c931e7c96b0cb82dde6ec99ae66e5 /drivers/block
parent1695b87f7dd152b866f0dd867c8e599025fc4965 (diff)
nbd: replace printk KERN_ERR with dev_err()
Signed-off-by: WANG Cong <amwang@redhat.com> Cc: Paul Clements <Paul.Clements@steeleye.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/nbd.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index da98360b6463..1b8e09fffd5a 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -158,8 +158,9 @@ static int sock_xmit(struct nbd_device *lo, int send, void *buf, int size,
158 sigset_t blocked, oldset; 158 sigset_t blocked, oldset;
159 159
160 if (unlikely(!sock)) { 160 if (unlikely(!sock)) {
161 printk(KERN_ERR "%s: Attempted %s on closed socket in sock_xmit\n", 161 dev_err(disk_to_dev(lo->disk),
162 lo->disk->disk_name, (send ? "send" : "recv")); 162 "Attempted %s on closed socket in sock_xmit\n",
163 (send ? "send" : "recv"));
163 return -EINVAL; 164 return -EINVAL;
164 } 165 }
165 166
@@ -250,8 +251,8 @@ static int nbd_send_req(struct nbd_device *lo, struct request *req)
250 result = sock_xmit(lo, 1, &request, sizeof(request), 251 result = sock_xmit(lo, 1, &request, sizeof(request),
251 (nbd_cmd(req) == NBD_CMD_WRITE) ? MSG_MORE : 0); 252 (nbd_cmd(req) == NBD_CMD_WRITE) ? MSG_MORE : 0);
252 if (result <= 0) { 253 if (result <= 0) {
253 printk(KERN_ERR "%s: Send control failed (result %d)\n", 254 dev_err(disk_to_dev(lo->disk),
254 lo->disk->disk_name, result); 255 "Send control failed (result %d)\n", result);
255 goto error_out; 256 goto error_out;
256 } 257 }
257 258
@@ -270,8 +271,9 @@ static int nbd_send_req(struct nbd_device *lo, struct request *req)
270 lo->disk->disk_name, req, bvec->bv_len); 271 lo->disk->disk_name, req, bvec->bv_len);
271 result = sock_send_bvec(lo, bvec, flags); 272 result = sock_send_bvec(lo, bvec, flags);
272 if (result <= 0) { 273 if (result <= 0) {
273 printk(KERN_ERR "%s: Send data failed (result %d)\n", 274 dev_err(disk_to_dev(lo->disk),
274 lo->disk->disk_name, result); 275 "Send data failed (result %d)\n",
276 result);
275 goto error_out; 277 goto error_out;
276 } 278 }
277 } 279 }
@@ -328,14 +330,13 @@ static struct request *nbd_read_stat(struct nbd_device *lo)
328 reply.magic = 0; 330 reply.magic = 0;
329 result = sock_xmit(lo, 0, &reply, sizeof(reply), MSG_WAITALL); 331 result = sock_xmit(lo, 0, &reply, sizeof(reply), MSG_WAITALL);
330 if (result <= 0) { 332 if (result <= 0) {
331 printk(KERN_ERR "%s: Receive control failed (result %d)\n", 333 dev_err(disk_to_dev(lo->disk),
332 lo->disk->disk_name, result); 334 "Receive control failed (result %d)\n", result);
333 goto harderror; 335 goto harderror;
334 } 336 }
335 337
336 if (ntohl(reply.magic) != NBD_REPLY_MAGIC) { 338 if (ntohl(reply.magic) != NBD_REPLY_MAGIC) {
337 printk(KERN_ERR "%s: Wrong magic (0x%lx)\n", 339 dev_err(disk_to_dev(lo->disk), "Wrong magic (0x%lx)\n",
338 lo->disk->disk_name,
339 (unsigned long)ntohl(reply.magic)); 340 (unsigned long)ntohl(reply.magic));
340 result = -EPROTO; 341 result = -EPROTO;
341 goto harderror; 342 goto harderror;
@@ -347,15 +348,15 @@ static struct request *nbd_read_stat(struct nbd_device *lo)
347 if (result != -ENOENT) 348 if (result != -ENOENT)
348 goto harderror; 349 goto harderror;
349 350
350 printk(KERN_ERR "%s: Unexpected reply (%p)\n", 351 dev_err(disk_to_dev(lo->disk), "Unexpected reply (%p)\n",
351 lo->disk->disk_name, reply.handle); 352 reply.handle);
352 result = -EBADR; 353 result = -EBADR;
353 goto harderror; 354 goto harderror;
354 } 355 }
355 356
356 if (ntohl(reply.error)) { 357 if (ntohl(reply.error)) {
357 printk(KERN_ERR "%s: Other side returned error (%d)\n", 358 dev_err(disk_to_dev(lo->disk), "Other side returned error (%d)\n",
358 lo->disk->disk_name, ntohl(reply.error)); 359 ntohl(reply.error));
359 req->errors++; 360 req->errors++;
360 return req; 361 return req;
361 } 362 }
@@ -369,8 +370,8 @@ static struct request *nbd_read_stat(struct nbd_device *lo)
369 rq_for_each_segment(bvec, req, iter) { 370 rq_for_each_segment(bvec, req, iter) {
370 result = sock_recv_bvec(lo, bvec); 371 result = sock_recv_bvec(lo, bvec);
371 if (result <= 0) { 372 if (result <= 0) {
372 printk(KERN_ERR "%s: Receive data failed (result %d)\n", 373 dev_err(disk_to_dev(lo->disk), "Receive data failed (result %d)\n",
373 lo->disk->disk_name, result); 374 result);
374 req->errors++; 375 req->errors++;
375 return req; 376 return req;
376 } 377 }
@@ -408,7 +409,7 @@ static int nbd_do_it(struct nbd_device *lo)
408 lo->pid = task_pid_nr(current); 409 lo->pid = task_pid_nr(current);
409 ret = device_create_file(disk_to_dev(lo->disk), &pid_attr); 410 ret = device_create_file(disk_to_dev(lo->disk), &pid_attr);
410 if (ret) { 411 if (ret) {
411 printk(KERN_ERR "nbd: device_create_file failed!"); 412 dev_err(disk_to_dev(lo->disk), "device_create_file failed!\n");
412 lo->pid = 0; 413 lo->pid = 0;
413 return ret; 414 return ret;
414 } 415 }
@@ -457,8 +458,8 @@ static void nbd_handle_req(struct nbd_device *lo, struct request *req)
457 if (rq_data_dir(req) == WRITE) { 458 if (rq_data_dir(req) == WRITE) {
458 nbd_cmd(req) = NBD_CMD_WRITE; 459 nbd_cmd(req) = NBD_CMD_WRITE;
459 if (lo->flags & NBD_READ_ONLY) { 460 if (lo->flags & NBD_READ_ONLY) {
460 printk(KERN_ERR "%s: Write on read-only\n", 461 dev_err(disk_to_dev(lo->disk),
461 lo->disk->disk_name); 462 "Write on read-only\n");
462 goto error_out; 463 goto error_out;
463 } 464 }
464 } 465 }
@@ -468,16 +469,15 @@ static void nbd_handle_req(struct nbd_device *lo, struct request *req)
468 mutex_lock(&lo->tx_lock); 469 mutex_lock(&lo->tx_lock);
469 if (unlikely(!lo->sock)) { 470 if (unlikely(!lo->sock)) {
470 mutex_unlock(&lo->tx_lock); 471 mutex_unlock(&lo->tx_lock);
471 printk(KERN_ERR "%s: Attempted send on closed socket\n", 472 dev_err(disk_to_dev(lo->disk),
472 lo->disk->disk_name); 473 "Attempted send on closed socket\n");
473 goto error_out; 474 goto error_out;
474 } 475 }
475 476
476 lo->active_req = req; 477 lo->active_req = req;
477 478
478 if (nbd_send_req(lo, req) != 0) { 479 if (nbd_send_req(lo, req) != 0) {
479 printk(KERN_ERR "%s: Request send failed\n", 480 dev_err(disk_to_dev(lo->disk), "Request send failed\n");
480 lo->disk->disk_name);
481 req->errors++; 481 req->errors++;
482 nbd_end_request(req); 482 nbd_end_request(req);
483 } else { 483 } else {
@@ -549,8 +549,8 @@ static void do_nbd_request(struct request_queue *q)
549 BUG_ON(lo->magic != LO_MAGIC); 549 BUG_ON(lo->magic != LO_MAGIC);
550 550
551 if (unlikely(!lo->sock)) { 551 if (unlikely(!lo->sock)) {
552 printk(KERN_ERR "%s: Attempted send on closed socket\n", 552 dev_err(disk_to_dev(lo->disk),
553 lo->disk->disk_name); 553 "Attempted send on closed socket\n");
554 req->errors++; 554 req->errors++;
555 nbd_end_request(req); 555 nbd_end_request(req);
556 spin_lock_irq(q->queue_lock); 556 spin_lock_irq(q->queue_lock);