diff options
author | Joe Perches <joe@perches.com> | 2011-11-28 13:40:46 -0500 |
---|---|---|
committer | Eric Van Hensbergen <ericvh@gmail.com> | 2012-01-05 11:51:44 -0500 |
commit | 5d3851530d6d68564e4e0ce04d0547d4d106fc72 (patch) | |
tree | d47065fcc1f93f00070afe597a98ab185fd13859 /net/9p/trans_virtio.c | |
parent | a0ea787b027b79cf2e01c6758e5246db06520158 (diff) |
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>
Diffstat (limited to 'net/9p/trans_virtio.c')
-rw-r--r-- | net/9p/trans_virtio.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c index 32aa9834229c..330421e54713 100644 --- a/net/9p/trans_virtio.c +++ b/net/9p/trans_virtio.c | |||
@@ -26,6 +26,8 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
30 | |||
29 | #include <linux/in.h> | 31 | #include <linux/in.h> |
30 | #include <linux/module.h> | 32 | #include <linux/module.h> |
31 | #include <linux/net.h> | 33 | #include <linux/net.h> |
@@ -145,7 +147,7 @@ static void req_done(struct virtqueue *vq) | |||
145 | struct p9_req_t *req; | 147 | struct p9_req_t *req; |
146 | unsigned long flags; | 148 | unsigned long flags; |
147 | 149 | ||
148 | P9_DPRINTK(P9_DEBUG_TRANS, ": request done\n"); | 150 | p9_debug(P9_DEBUG_TRANS, ": request done\n"); |
149 | 151 | ||
150 | while (1) { | 152 | while (1) { |
151 | spin_lock_irqsave(&chan->lock, flags); | 153 | spin_lock_irqsave(&chan->lock, flags); |
@@ -158,8 +160,8 @@ static void req_done(struct virtqueue *vq) | |||
158 | spin_unlock_irqrestore(&chan->lock, flags); | 160 | spin_unlock_irqrestore(&chan->lock, flags); |
159 | /* Wakeup if anyone waiting for VirtIO ring space. */ | 161 | /* Wakeup if anyone waiting for VirtIO ring space. */ |
160 | wake_up(chan->vc_wq); | 162 | wake_up(chan->vc_wq); |
161 | P9_DPRINTK(P9_DEBUG_TRANS, ": rc %p\n", rc); | 163 | p9_debug(P9_DEBUG_TRANS, ": rc %p\n", rc); |
162 | P9_DPRINTK(P9_DEBUG_TRANS, ": lookup tag %d\n", rc->tag); | 164 | p9_debug(P9_DEBUG_TRANS, ": lookup tag %d\n", rc->tag); |
163 | req = p9_tag_lookup(chan->client, rc->tag); | 165 | req = p9_tag_lookup(chan->client, rc->tag); |
164 | req->status = REQ_STATUS_RCVD; | 166 | req->status = REQ_STATUS_RCVD; |
165 | p9_client_cb(chan->client, req); | 167 | p9_client_cb(chan->client, req); |
@@ -257,7 +259,7 @@ p9_virtio_request(struct p9_client *client, struct p9_req_t *req) | |||
257 | unsigned long flags; | 259 | unsigned long flags; |
258 | struct virtio_chan *chan = client->trans; | 260 | struct virtio_chan *chan = client->trans; |
259 | 261 | ||
260 | P9_DPRINTK(P9_DEBUG_TRANS, "9p debug: virtio request\n"); | 262 | p9_debug(P9_DEBUG_TRANS, "9p debug: virtio request\n"); |
261 | 263 | ||
262 | req->status = REQ_STATUS_SENT; | 264 | req->status = REQ_STATUS_SENT; |
263 | req_retry: | 265 | req_retry: |
@@ -280,20 +282,19 @@ req_retry: | |||
280 | if (err == -ERESTARTSYS) | 282 | if (err == -ERESTARTSYS) |
281 | return err; | 283 | return err; |
282 | 284 | ||
283 | P9_DPRINTK(P9_DEBUG_TRANS, "9p:Retry virtio request\n"); | 285 | p9_debug(P9_DEBUG_TRANS, "Retry virtio request\n"); |
284 | goto req_retry; | 286 | goto req_retry; |
285 | } else { | 287 | } else { |
286 | spin_unlock_irqrestore(&chan->lock, flags); | 288 | spin_unlock_irqrestore(&chan->lock, flags); |
287 | P9_DPRINTK(P9_DEBUG_TRANS, | 289 | p9_debug(P9_DEBUG_TRANS, |
288 | "9p debug: " | 290 | "virtio rpc add_buf returned failure\n"); |
289 | "virtio rpc add_buf returned failure"); | ||
290 | return -EIO; | 291 | return -EIO; |
291 | } | 292 | } |
292 | } | 293 | } |
293 | virtqueue_kick(chan->vq); | 294 | virtqueue_kick(chan->vq); |
294 | spin_unlock_irqrestore(&chan->lock, flags); | 295 | spin_unlock_irqrestore(&chan->lock, flags); |
295 | 296 | ||
296 | P9_DPRINTK(P9_DEBUG_TRANS, "9p debug: virtio request kicked\n"); | 297 | p9_debug(P9_DEBUG_TRANS, "virtio request kicked\n"); |
297 | return 0; | 298 | return 0; |
298 | } | 299 | } |
299 | 300 | ||
@@ -354,7 +355,7 @@ p9_virtio_zc_request(struct p9_client *client, struct p9_req_t *req, | |||
354 | struct page **in_pages = NULL, **out_pages = NULL; | 355 | struct page **in_pages = NULL, **out_pages = NULL; |
355 | struct virtio_chan *chan = client->trans; | 356 | struct virtio_chan *chan = client->trans; |
356 | 357 | ||
357 | P9_DPRINTK(P9_DEBUG_TRANS, "9p debug: virtio request\n"); | 358 | p9_debug(P9_DEBUG_TRANS, "virtio request\n"); |
358 | 359 | ||
359 | if (uodata) { | 360 | if (uodata) { |
360 | out_nr_pages = p9_nr_pages(uodata, outlen); | 361 | out_nr_pages = p9_nr_pages(uodata, outlen); |
@@ -423,20 +424,19 @@ req_retry_pinned: | |||
423 | if (err == -ERESTARTSYS) | 424 | if (err == -ERESTARTSYS) |
424 | goto err_out; | 425 | goto err_out; |
425 | 426 | ||
426 | P9_DPRINTK(P9_DEBUG_TRANS, "9p:Retry virtio request\n"); | 427 | p9_debug(P9_DEBUG_TRANS, "Retry virtio request\n"); |
427 | goto req_retry_pinned; | 428 | goto req_retry_pinned; |
428 | } else { | 429 | } else { |
429 | spin_unlock_irqrestore(&chan->lock, flags); | 430 | spin_unlock_irqrestore(&chan->lock, flags); |
430 | P9_DPRINTK(P9_DEBUG_TRANS, | 431 | p9_debug(P9_DEBUG_TRANS, |
431 | "9p debug: " | 432 | "virtio rpc add_buf returned failure\n"); |
432 | "virtio rpc add_buf returned failure"); | ||
433 | err = -EIO; | 433 | err = -EIO; |
434 | goto err_out; | 434 | goto err_out; |
435 | } | 435 | } |
436 | } | 436 | } |
437 | virtqueue_kick(chan->vq); | 437 | virtqueue_kick(chan->vq); |
438 | spin_unlock_irqrestore(&chan->lock, flags); | 438 | spin_unlock_irqrestore(&chan->lock, flags); |
439 | P9_DPRINTK(P9_DEBUG_TRANS, "9p debug: virtio request kicked\n"); | 439 | p9_debug(P9_DEBUG_TRANS, "virtio request kicked\n"); |
440 | err = wait_event_interruptible(*req->wq, | 440 | err = wait_event_interruptible(*req->wq, |
441 | req->status >= REQ_STATUS_RCVD); | 441 | req->status >= REQ_STATUS_RCVD); |
442 | /* | 442 | /* |
@@ -491,7 +491,7 @@ static int p9_virtio_probe(struct virtio_device *vdev) | |||
491 | 491 | ||
492 | chan = kmalloc(sizeof(struct virtio_chan), GFP_KERNEL); | 492 | chan = kmalloc(sizeof(struct virtio_chan), GFP_KERNEL); |
493 | if (!chan) { | 493 | if (!chan) { |
494 | printk(KERN_ERR "9p: Failed to allocate virtio 9P channel\n"); | 494 | pr_err("Failed to allocate virtio 9P channel\n"); |
495 | err = -ENOMEM; | 495 | err = -ENOMEM; |
496 | goto fail; | 496 | goto fail; |
497 | } | 497 | } |
@@ -592,7 +592,7 @@ p9_virtio_create(struct p9_client *client, const char *devname, char *args) | |||
592 | mutex_unlock(&virtio_9p_lock); | 592 | mutex_unlock(&virtio_9p_lock); |
593 | 593 | ||
594 | if (!found) { | 594 | if (!found) { |
595 | printk(KERN_ERR "9p: no channels available\n"); | 595 | pr_err("no channels available\n"); |
596 | return ret; | 596 | return ret; |
597 | } | 597 | } |
598 | 598 | ||