lkml.org 
[lkml]   [2014]   [Sep]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] fs: seq_file: optimize seq_pad()
Date
Use seq_putc() instead of seq_printf() in seq_pad() because the
former is faster.

Signed-off-by: Dmitry Voytik <voytikd@gmail.com>
---
fs/seq_file.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/seq_file.c b/fs/seq_file.c
index 3857b72..fef338e 100644
--- a/fs/seq_file.c
+++ b/fs/seq_file.c
@@ -787,8 +787,10 @@ EXPORT_SYMBOL(seq_write);
void seq_pad(struct seq_file *m, char c)
{
int size = m->pad_until - m->count;
- if (size > 0)
- seq_printf(m, "%*s", size, "");
+
+ while (size-- > 0)
+ if (unlikely(seq_putc(m, ' ')))
+ return;
if (c)
seq_putc(m, c);
}
--
1.9.1


\
 
 \ /
  Last update: 2014-09-10 12:01    [W:0.047 / U:0.244 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site