[PATCH 04/12] printk: reuse reclaimed continuation buffer immediately

From: Jan H. SchÃnherr
Date: Tue Nov 13 2012 - 18:16:15 EST


cont_add() might flush the continuation buffer before appending
anything. If that happens, the function returns immediately, forcing the
calling function to store the message elsewhere. This is not always
necessary.

When the continuation buffer was reclaimed (and not just marked as
"flushed"), then we can reuse it immediately instead of returning false.

Signed-off-by: Jan H. SchÃnherr <schnhrr@xxxxxxxxxxxxxxx>
---
kernel/printk.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/printk.c b/kernel/printk.c
index ba9494b..42e5eaf 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -1431,7 +1431,8 @@ static bool cont_add(int facility, int level, enum log_flags flags,
if (cont.len + len > sizeof(cont.buf)) {
/* the line gets too long, split it up in separate records */
cont_flush(0);
- return false;
+ if (cont.len)
+ return false;
}

if (!cont.len) {
--
1.8.0.316.g291341c.dirty

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/