mirror of
https://github.com/torvalds/linux.git
synced 2024-11-26 06:02:05 +00:00
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>
This commit is contained in:
parent
1695b87f7d
commit
7f1b90f99a
@ -158,8 +158,9 @@ static int sock_xmit(struct nbd_device *lo, int send, void *buf, int size,
|
|||||||
sigset_t blocked, oldset;
|
sigset_t blocked, oldset;
|
||||||
|
|
||||||
if (unlikely(!sock)) {
|
if (unlikely(!sock)) {
|
||||||
printk(KERN_ERR "%s: Attempted %s on closed socket in sock_xmit\n",
|
dev_err(disk_to_dev(lo->disk),
|
||||||
lo->disk->disk_name, (send ? "send" : "recv"));
|
"Attempted %s on closed socket in sock_xmit\n",
|
||||||
|
(send ? "send" : "recv"));
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -250,8 +251,8 @@ static int nbd_send_req(struct nbd_device *lo, struct request *req)
|
|||||||
result = sock_xmit(lo, 1, &request, sizeof(request),
|
result = sock_xmit(lo, 1, &request, sizeof(request),
|
||||||
(nbd_cmd(req) == NBD_CMD_WRITE) ? MSG_MORE : 0);
|
(nbd_cmd(req) == NBD_CMD_WRITE) ? MSG_MORE : 0);
|
||||||
if (result <= 0) {
|
if (result <= 0) {
|
||||||
printk(KERN_ERR "%s: Send control failed (result %d)\n",
|
dev_err(disk_to_dev(lo->disk),
|
||||||
lo->disk->disk_name, result);
|
"Send control failed (result %d)\n", result);
|
||||||
goto error_out;
|
goto error_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -270,8 +271,9 @@ static int nbd_send_req(struct nbd_device *lo, struct request *req)
|
|||||||
lo->disk->disk_name, req, bvec->bv_len);
|
lo->disk->disk_name, req, bvec->bv_len);
|
||||||
result = sock_send_bvec(lo, bvec, flags);
|
result = sock_send_bvec(lo, bvec, flags);
|
||||||
if (result <= 0) {
|
if (result <= 0) {
|
||||||
printk(KERN_ERR "%s: Send data failed (result %d)\n",
|
dev_err(disk_to_dev(lo->disk),
|
||||||
lo->disk->disk_name, result);
|
"Send data failed (result %d)\n",
|
||||||
|
result);
|
||||||
goto error_out;
|
goto error_out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -328,14 +330,13 @@ static struct request *nbd_read_stat(struct nbd_device *lo)
|
|||||||
reply.magic = 0;
|
reply.magic = 0;
|
||||||
result = sock_xmit(lo, 0, &reply, sizeof(reply), MSG_WAITALL);
|
result = sock_xmit(lo, 0, &reply, sizeof(reply), MSG_WAITALL);
|
||||||
if (result <= 0) {
|
if (result <= 0) {
|
||||||
printk(KERN_ERR "%s: Receive control failed (result %d)\n",
|
dev_err(disk_to_dev(lo->disk),
|
||||||
lo->disk->disk_name, result);
|
"Receive control failed (result %d)\n", result);
|
||||||
goto harderror;
|
goto harderror;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ntohl(reply.magic) != NBD_REPLY_MAGIC) {
|
if (ntohl(reply.magic) != NBD_REPLY_MAGIC) {
|
||||||
printk(KERN_ERR "%s: Wrong magic (0x%lx)\n",
|
dev_err(disk_to_dev(lo->disk), "Wrong magic (0x%lx)\n",
|
||||||
lo->disk->disk_name,
|
|
||||||
(unsigned long)ntohl(reply.magic));
|
(unsigned long)ntohl(reply.magic));
|
||||||
result = -EPROTO;
|
result = -EPROTO;
|
||||||
goto harderror;
|
goto harderror;
|
||||||
@ -347,15 +348,15 @@ static struct request *nbd_read_stat(struct nbd_device *lo)
|
|||||||
if (result != -ENOENT)
|
if (result != -ENOENT)
|
||||||
goto harderror;
|
goto harderror;
|
||||||
|
|
||||||
printk(KERN_ERR "%s: Unexpected reply (%p)\n",
|
dev_err(disk_to_dev(lo->disk), "Unexpected reply (%p)\n",
|
||||||
lo->disk->disk_name, reply.handle);
|
reply.handle);
|
||||||
result = -EBADR;
|
result = -EBADR;
|
||||||
goto harderror;
|
goto harderror;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ntohl(reply.error)) {
|
if (ntohl(reply.error)) {
|
||||||
printk(KERN_ERR "%s: Other side returned error (%d)\n",
|
dev_err(disk_to_dev(lo->disk), "Other side returned error (%d)\n",
|
||||||
lo->disk->disk_name, ntohl(reply.error));
|
ntohl(reply.error));
|
||||||
req->errors++;
|
req->errors++;
|
||||||
return req;
|
return req;
|
||||||
}
|
}
|
||||||
@ -369,8 +370,8 @@ static struct request *nbd_read_stat(struct nbd_device *lo)
|
|||||||
rq_for_each_segment(bvec, req, iter) {
|
rq_for_each_segment(bvec, req, iter) {
|
||||||
result = sock_recv_bvec(lo, bvec);
|
result = sock_recv_bvec(lo, bvec);
|
||||||
if (result <= 0) {
|
if (result <= 0) {
|
||||||
printk(KERN_ERR "%s: Receive data failed (result %d)\n",
|
dev_err(disk_to_dev(lo->disk), "Receive data failed (result %d)\n",
|
||||||
lo->disk->disk_name, result);
|
result);
|
||||||
req->errors++;
|
req->errors++;
|
||||||
return req;
|
return req;
|
||||||
}
|
}
|
||||||
@ -408,7 +409,7 @@ static int nbd_do_it(struct nbd_device *lo)
|
|||||||
lo->pid = task_pid_nr(current);
|
lo->pid = task_pid_nr(current);
|
||||||
ret = device_create_file(disk_to_dev(lo->disk), &pid_attr);
|
ret = device_create_file(disk_to_dev(lo->disk), &pid_attr);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
printk(KERN_ERR "nbd: device_create_file failed!");
|
dev_err(disk_to_dev(lo->disk), "device_create_file failed!\n");
|
||||||
lo->pid = 0;
|
lo->pid = 0;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -457,8 +458,8 @@ static void nbd_handle_req(struct nbd_device *lo, struct request *req)
|
|||||||
if (rq_data_dir(req) == WRITE) {
|
if (rq_data_dir(req) == WRITE) {
|
||||||
nbd_cmd(req) = NBD_CMD_WRITE;
|
nbd_cmd(req) = NBD_CMD_WRITE;
|
||||||
if (lo->flags & NBD_READ_ONLY) {
|
if (lo->flags & NBD_READ_ONLY) {
|
||||||
printk(KERN_ERR "%s: Write on read-only\n",
|
dev_err(disk_to_dev(lo->disk),
|
||||||
lo->disk->disk_name);
|
"Write on read-only\n");
|
||||||
goto error_out;
|
goto error_out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -468,16 +469,15 @@ static void nbd_handle_req(struct nbd_device *lo, struct request *req)
|
|||||||
mutex_lock(&lo->tx_lock);
|
mutex_lock(&lo->tx_lock);
|
||||||
if (unlikely(!lo->sock)) {
|
if (unlikely(!lo->sock)) {
|
||||||
mutex_unlock(&lo->tx_lock);
|
mutex_unlock(&lo->tx_lock);
|
||||||
printk(KERN_ERR "%s: Attempted send on closed socket\n",
|
dev_err(disk_to_dev(lo->disk),
|
||||||
lo->disk->disk_name);
|
"Attempted send on closed socket\n");
|
||||||
goto error_out;
|
goto error_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
lo->active_req = req;
|
lo->active_req = req;
|
||||||
|
|
||||||
if (nbd_send_req(lo, req) != 0) {
|
if (nbd_send_req(lo, req) != 0) {
|
||||||
printk(KERN_ERR "%s: Request send failed\n",
|
dev_err(disk_to_dev(lo->disk), "Request send failed\n");
|
||||||
lo->disk->disk_name);
|
|
||||||
req->errors++;
|
req->errors++;
|
||||||
nbd_end_request(req);
|
nbd_end_request(req);
|
||||||
} else {
|
} else {
|
||||||
@ -549,8 +549,8 @@ static void do_nbd_request(struct request_queue *q)
|
|||||||
BUG_ON(lo->magic != LO_MAGIC);
|
BUG_ON(lo->magic != LO_MAGIC);
|
||||||
|
|
||||||
if (unlikely(!lo->sock)) {
|
if (unlikely(!lo->sock)) {
|
||||||
printk(KERN_ERR "%s: Attempted send on closed socket\n",
|
dev_err(disk_to_dev(lo->disk),
|
||||||
lo->disk->disk_name);
|
"Attempted send on closed socket\n");
|
||||||
req->errors++;
|
req->errors++;
|
||||||
nbd_end_request(req);
|
nbd_end_request(req);
|
||||||
spin_lock_irq(q->queue_lock);
|
spin_lock_irq(q->queue_lock);
|
||||||
|
Loading…
Reference in New Issue
Block a user