9p: Reduce object size with CONFIG_NET_9P_DEBUG
Reduce object size by deduplicating formats. Use vsprintf extension %pV. Rename P9_DPRINTK uses to p9_debug, align arguments. Add function for _p9_debug and macro to add __func__. Add missing "\n"s to p9_debug uses. Remove embedded function names as p9_debug adds it. Remove P9_EPRINTK macro and convert use to pr_<level>. Add and use pr_fmt and pr_<level>. $ size fs/9p/built-in.o* text data bss dec hex filename 62133 984 16000 79117 1350d fs/9p/built-in.o.new 67342 984 16928 85254 14d06 fs/9p/built-in.o.old $ size net/9p/built-in.o* text data bss dec hex filename 88792 4148 22024 114964 1c114 net/9p/built-in.o.new 94072 4148 23232 121452 1da6c net/9p/built-in.o.old Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
This commit is contained in:

committed by
Eric Van Hensbergen

szülő
a0ea787b02
commit
5d3851530d
@@ -26,6 +26,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
|
||||
#include <linux/in.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/net.h>
|
||||
@@ -145,7 +147,7 @@ static void req_done(struct virtqueue *vq)
|
||||
struct p9_req_t *req;
|
||||
unsigned long flags;
|
||||
|
||||
P9_DPRINTK(P9_DEBUG_TRANS, ": request done\n");
|
||||
p9_debug(P9_DEBUG_TRANS, ": request done\n");
|
||||
|
||||
while (1) {
|
||||
spin_lock_irqsave(&chan->lock, flags);
|
||||
@@ -158,8 +160,8 @@ static void req_done(struct virtqueue *vq)
|
||||
spin_unlock_irqrestore(&chan->lock, flags);
|
||||
/* Wakeup if anyone waiting for VirtIO ring space. */
|
||||
wake_up(chan->vc_wq);
|
||||
P9_DPRINTK(P9_DEBUG_TRANS, ": rc %p\n", rc);
|
||||
P9_DPRINTK(P9_DEBUG_TRANS, ": lookup tag %d\n", rc->tag);
|
||||
p9_debug(P9_DEBUG_TRANS, ": rc %p\n", rc);
|
||||
p9_debug(P9_DEBUG_TRANS, ": lookup tag %d\n", rc->tag);
|
||||
req = p9_tag_lookup(chan->client, rc->tag);
|
||||
req->status = REQ_STATUS_RCVD;
|
||||
p9_client_cb(chan->client, req);
|
||||
@@ -257,7 +259,7 @@ p9_virtio_request(struct p9_client *client, struct p9_req_t *req)
|
||||
unsigned long flags;
|
||||
struct virtio_chan *chan = client->trans;
|
||||
|
||||
P9_DPRINTK(P9_DEBUG_TRANS, "9p debug: virtio request\n");
|
||||
p9_debug(P9_DEBUG_TRANS, "9p debug: virtio request\n");
|
||||
|
||||
req->status = REQ_STATUS_SENT;
|
||||
req_retry:
|
||||
@@ -280,20 +282,19 @@ req_retry:
|
||||
if (err == -ERESTARTSYS)
|
||||
return err;
|
||||
|
||||
P9_DPRINTK(P9_DEBUG_TRANS, "9p:Retry virtio request\n");
|
||||
p9_debug(P9_DEBUG_TRANS, "Retry virtio request\n");
|
||||
goto req_retry;
|
||||
} else {
|
||||
spin_unlock_irqrestore(&chan->lock, flags);
|
||||
P9_DPRINTK(P9_DEBUG_TRANS,
|
||||
"9p debug: "
|
||||
"virtio rpc add_buf returned failure");
|
||||
p9_debug(P9_DEBUG_TRANS,
|
||||
"virtio rpc add_buf returned failure\n");
|
||||
return -EIO;
|
||||
}
|
||||
}
|
||||
virtqueue_kick(chan->vq);
|
||||
spin_unlock_irqrestore(&chan->lock, flags);
|
||||
|
||||
P9_DPRINTK(P9_DEBUG_TRANS, "9p debug: virtio request kicked\n");
|
||||
p9_debug(P9_DEBUG_TRANS, "virtio request kicked\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -354,7 +355,7 @@ p9_virtio_zc_request(struct p9_client *client, struct p9_req_t *req,
|
||||
struct page **in_pages = NULL, **out_pages = NULL;
|
||||
struct virtio_chan *chan = client->trans;
|
||||
|
||||
P9_DPRINTK(P9_DEBUG_TRANS, "9p debug: virtio request\n");
|
||||
p9_debug(P9_DEBUG_TRANS, "virtio request\n");
|
||||
|
||||
if (uodata) {
|
||||
out_nr_pages = p9_nr_pages(uodata, outlen);
|
||||
@@ -423,20 +424,19 @@ req_retry_pinned:
|
||||
if (err == -ERESTARTSYS)
|
||||
goto err_out;
|
||||
|
||||
P9_DPRINTK(P9_DEBUG_TRANS, "9p:Retry virtio request\n");
|
||||
p9_debug(P9_DEBUG_TRANS, "Retry virtio request\n");
|
||||
goto req_retry_pinned;
|
||||
} else {
|
||||
spin_unlock_irqrestore(&chan->lock, flags);
|
||||
P9_DPRINTK(P9_DEBUG_TRANS,
|
||||
"9p debug: "
|
||||
"virtio rpc add_buf returned failure");
|
||||
p9_debug(P9_DEBUG_TRANS,
|
||||
"virtio rpc add_buf returned failure\n");
|
||||
err = -EIO;
|
||||
goto err_out;
|
||||
}
|
||||
}
|
||||
virtqueue_kick(chan->vq);
|
||||
spin_unlock_irqrestore(&chan->lock, flags);
|
||||
P9_DPRINTK(P9_DEBUG_TRANS, "9p debug: virtio request kicked\n");
|
||||
p9_debug(P9_DEBUG_TRANS, "virtio request kicked\n");
|
||||
err = wait_event_interruptible(*req->wq,
|
||||
req->status >= REQ_STATUS_RCVD);
|
||||
/*
|
||||
@@ -491,7 +491,7 @@ static int p9_virtio_probe(struct virtio_device *vdev)
|
||||
|
||||
chan = kmalloc(sizeof(struct virtio_chan), GFP_KERNEL);
|
||||
if (!chan) {
|
||||
printk(KERN_ERR "9p: Failed to allocate virtio 9P channel\n");
|
||||
pr_err("Failed to allocate virtio 9P channel\n");
|
||||
err = -ENOMEM;
|
||||
goto fail;
|
||||
}
|
||||
@@ -592,7 +592,7 @@ p9_virtio_create(struct p9_client *client, const char *devname, char *args)
|
||||
mutex_unlock(&virtio_9p_lock);
|
||||
|
||||
if (!found) {
|
||||
printk(KERN_ERR "9p: no channels available\n");
|
||||
pr_err("no channels available\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user