|
|
8827d3f |
From 575f0918313d593d24c40cf1839b97d7fcfebd0f Mon Sep 17 00:00:00 2001
|
|
|
8827d3f |
From: Josh Boyer <jwboyer@redhat.com>
|
|
|
8827d3f |
Date: Mon, 11 Feb 2013 18:07:48 -0500
|
|
|
8827d3f |
Subject: [PATCH] pstore: Create a convenient mount point for pstore
|
|
|
8827d3f |
|
|
|
8827d3f |
Using /dev/pstore as a mount point for the pstore filesystem is slightly
|
|
|
8827d3f |
awkward. We don't normally mount filesystems in /dev/ and the /dev/pstore
|
|
|
8827d3f |
file isn't created automatically by anything. While this method will
|
|
|
8827d3f |
still work, we can create a persistent mount point in sysfs. This will
|
|
|
8827d3f |
put pstore on par with things like cgroups and efivarfs.
|
|
|
8827d3f |
|
|
|
8827d3f |
Signed-off-by: Josh Boyer <jwboyer@redhat.com>
|
|
|
8827d3f |
---
|
|
|
8827d3f |
Documentation/ABI/testing/pstore | 10 +++++-----
|
|
|
8827d3f |
fs/pstore/inode.c | 18 +++++++++++++++++-
|
|
|
8827d3f |
2 files changed, 22 insertions(+), 6 deletions(-)
|
|
|
8827d3f |
|
|
|
8827d3f |
diff --git a/Documentation/ABI/testing/pstore b/Documentation/ABI/testing/pstore
|
|
|
8827d3f |
index ff1df4e..5fca9f5 100644
|
|
|
8827d3f |
--- a/Documentation/ABI/testing/pstore
|
|
|
8827d3f |
+++ b/Documentation/ABI/testing/pstore
|
|
|
8827d3f |
@@ -1,4 +1,4 @@
|
|
|
8827d3f |
-Where: /dev/pstore/...
|
|
|
8827d3f |
+Where: /sys/fs/pstore/... (or /dev/pstore/...)
|
|
|
8827d3f |
Date: March 2011
|
|
|
8827d3f |
Kernel Version: 2.6.39
|
|
|
8827d3f |
Contact: tony.luck@intel.com
|
|
|
8827d3f |
@@ -11,9 +11,9 @@ Description: Generic interface to platform dependent persistent storage.
|
|
|
8827d3f |
of the console log is captured, but other interesting
|
|
|
8827d3f |
data can also be saved.
|
|
|
8827d3f |
|
|
|
8827d3f |
- # mount -t pstore -o kmsg_bytes=8000 - /dev/pstore
|
|
|
8827d3f |
+ # mount -t pstore -o kmsg_bytes=8000 - /sys/fs/pstore
|
|
|
8827d3f |
|
|
|
8827d3f |
- $ ls -l /dev/pstore
|
|
|
8827d3f |
+ $ ls -l /sys/fs/pstore/
|
|
|
8827d3f |
total 0
|
|
|
8827d3f |
-r--r--r-- 1 root root 7896 Nov 30 15:38 dmesg-erst-1
|
|
|
8827d3f |
|
|
|
8827d3f |
@@ -27,9 +27,9 @@ Description: Generic interface to platform dependent persistent storage.
|
|
|
8827d3f |
the file will signal to the underlying persistent storage
|
|
|
8827d3f |
device that it can reclaim the space for later re-use.
|
|
|
8827d3f |
|
|
|
8827d3f |
- $ rm /dev/pstore/dmesg-erst-1
|
|
|
8827d3f |
+ $ rm /sys/fs/pstore/dmesg-erst-1
|
|
|
8827d3f |
|
|
|
8827d3f |
- The expectation is that all files in /dev/pstore
|
|
|
8827d3f |
+ The expectation is that all files in /sys/fs/pstore/
|
|
|
8827d3f |
will be saved elsewhere and erased from persistent store
|
|
|
8827d3f |
soon after boot to free up space ready for the next
|
|
|
8827d3f |
catastrophe.
|
|
|
8827d3f |
diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c
|
|
|
8827d3f |
index 67de74c..e4bcb2c 100644
|
|
|
8827d3f |
--- a/fs/pstore/inode.c
|
|
|
8827d3f |
+++ b/fs/pstore/inode.c
|
|
|
8827d3f |
@@ -418,9 +418,25 @@ static struct file_system_type pstore_fs_type = {
|
|
|
8827d3f |
.kill_sb = pstore_kill_sb,
|
|
|
8827d3f |
};
|
|
|
8827d3f |
|
|
|
8827d3f |
+static struct kobject *pstore_kobj;
|
|
|
8827d3f |
+
|
|
|
8827d3f |
static int __init init_pstore_fs(void)
|
|
|
8827d3f |
{
|
|
|
8827d3f |
- return register_filesystem(&pstore_fs_type);
|
|
|
8827d3f |
+ int err = 0;
|
|
|
8827d3f |
+
|
|
|
8827d3f |
+ /* Create a convenient mount point for people to access pstore */
|
|
|
8827d3f |
+ pstore_kobj = kobject_create_and_add("pstore", fs_kobj);
|
|
|
8827d3f |
+ if (!pstore_kobj) {
|
|
|
8827d3f |
+ err = -ENOMEM;
|
|
|
8827d3f |
+ goto out;
|
|
|
8827d3f |
+ }
|
|
|
8827d3f |
+
|
|
|
8827d3f |
+ err = register_filesystem(&pstore_fs_type);
|
|
|
8827d3f |
+ if (err < 0)
|
|
|
8827d3f |
+ kobject_put(pstore_kobj);
|
|
|
8827d3f |
+
|
|
|
8827d3f |
+out:
|
|
|
8827d3f |
+ return err;
|
|
|
8827d3f |
}
|
|
|
8827d3f |
module_init(init_pstore_fs)
|
|
|
8827d3f |
|
|
|
8827d3f |
--
|
|
|
8827d3f |
1.8.1.2
|
|
|
8827d3f |
|