- Subject: [PATCH 2/5] pstore: Introduce write_buf backend callback
- From: Anton Vorontsov <anton.vorontsov@xxxxxxxxxx>
- Date: Sat, 26 May 2012 06:39:06 -0700
- Cc: devel@xxxxxxxxxxxxxxxxxxxx, linaro-kernel@xxxxxxxxxxxxxxxx, Arnd Bergmann <arnd@xxxxxxxx>, patches@xxxxxxxxxx, Marco Stornelli <marco.stornelli@xxxxxxxxx>, Stephen Boyd <sboyd@xxxxxxxxxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx, arve@xxxxxxxxxxx, Jesper Juhl <jj@xxxxxxxxxxxxx>, John Stultz <john.stultz@xxxxxxxxxx>, Shuah Khan <shuahkhan@xxxxxxxxx>, Rebecca Schultz Zavin <rebecca@xxxxxxxxxxx>, WANG Cong <xiyou.wangcong@xxxxxxxxx>, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>, kernel-team@xxxxxxxxxxx, Thomas Meyer <thomas@xxxxxxxx>
- Delivered-to: devel@xxxxxxxxxxxxxxxxxxxx
- In-reply-to: <20120526133412.GA18001@lizard>
For function tracing we need to stop using pstore.buf directly, since
in a tracing callback we can't use spinlocks, and thus we can't safely
use the global buffer.
With write_buf callback, backends no longer need to access pstore.buf
directly, and thus we can pass any buffers (e.g. allocated on stack).
Signed-off-by: Anton Vorontsov <anton.vorontsov@xxxxxxxxxx>
---
fs/pstore/platform.c | 10 ++++++++++
include/linux/pstore.h | 4 ++++
2 files changed, 14 insertions(+)
diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
index be4614f..e7c0a52 100644
--- a/fs/pstore/platform.c
+++ b/fs/pstore/platform.c
@@ -198,6 +198,14 @@ static void pstore_register_console(void)
static void pstore_register_console(void) {}
#endif
+static int pstore_write_compat(enum pstore_type_id type,
+ enum kmsg_dump_reason reason,
+ u64 *id, unsigned int part,
+ size_t size, struct pstore_info *psi)
+{
+ return psi->write_buf(type, reason, id, part, psinfo->buf, size, psi);
+}
+
/*
* platform specific persistent storage driver registers with
* us here. If pstore is already mounted, call the platform
@@ -222,6 +230,8 @@ int pstore_register(struct pstore_info *psi)
return -EINVAL;
}
+ if (!psi->write)
+ psi->write = pstore_write_compat;
psinfo = psi;
mutex_init(&psinfo->read_mutex);
spin_unlock(&pstore_lock);
diff --git a/include/linux/pstore.h b/include/linux/pstore.h
index 1bd014b..b107484 100644
--- a/include/linux/pstore.h
+++ b/include/linux/pstore.h
@@ -48,6 +48,10 @@ struct pstore_info {
int (*write)(enum pstore_type_id type,
enum kmsg_dump_reason reason, u64 *id,
unsigned int part, size_t size, struct pstore_info *psi);
+ int (*write_buf)(enum pstore_type_id type,
+ enum kmsg_dump_reason reason, u64 *id,
+ unsigned int part, const char *buf, size_t size,
+ struct pstore_info *psi);
int (*erase)(enum pstore_type_id type, u64 id,
struct pstore_info *psi);
void *data;
--
1.7.9.2
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel
[Video for Linux]
[Mplayer Users]
[Linux USB Devel]
[Linux Audio Users]
[Photos]
[Yosemite Photos]
[Free Singles Community]
[Linux Kernel]
[Linux SCSI]
[XFree86]
[Devices]
[Yosemite Backpacking]