All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fs: seq_file: optimize seq_pad()
@ 2014-09-10  9:20 Dmitry Voytik
  2014-09-10 13:21 ` Al Viro
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Voytik @ 2014-09-10  9:20 UTC (permalink / raw)
  To: Alexander Viro; +Cc: Tetsuo Handa, linux-kernel, linux-fsdevel, Dmitry Voytik

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-09-10 14:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-10  9:20 [PATCH] fs: seq_file: optimize seq_pad() Dmitry Voytik
2014-09-10 13:21 ` Al Viro
2014-09-10 14:20   ` Dmitry Voytik

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.