aboutsummaryrefslogtreecommitdiffstats
path: root/fs/pstore
diff options
context:
space:
mode:
authorMatthew Garrett <mjg@redhat.com>2011-07-21 16:57:53 -0400
committerTony Luck <tony.luck@intel.com>2011-07-22 19:14:20 -0400
commit56280682ceeef74b692b3e21d1872049eea7c887 (patch)
tree6d00729db23dff065ad60bf2f7be3f96b6fd4008 /fs/pstore
parent638c1fd3033c76778e6d9975ad8a4a9cdd5b96d9 (diff)
pstore: Add extra context for writes and erases
EFI only provides small amounts of individual storage, and conventionally puts metadata in the storage variable name. Rather than add a metadata header to the (already limited) variable storage, it's easier for us to modify pstore to pass all the information we need to construct a unique variable name to the appropriate functions. Signed-off-by: Matthew Garrett <mjg@redhat.com> Signed-off-by: Tony Luck <tony.luck@intel.com>
Diffstat (limited to 'fs/pstore')
-rw-r--r--fs/pstore/inode.c6
-rw-r--r--fs/pstore/platform.c9
2 files changed, 9 insertions, 6 deletions
diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c
index b19884a1ba77..893b961dcfd8 100644
--- a/fs/pstore/inode.c
+++ b/fs/pstore/inode.c
@@ -39,8 +39,9 @@
39#define PSTORE_NAMELEN 64 39#define PSTORE_NAMELEN 64
40 40
41struct pstore_private { 41struct pstore_private {
42 u64 id;
43 struct pstore_info *psi; 42 struct pstore_info *psi;
43 enum pstore_type_id type;
44 u64 id;
44 ssize_t size; 45 ssize_t size;
45 char data[]; 46 char data[];
46}; 47};
@@ -73,7 +74,7 @@ static int pstore_unlink(struct inode *dir, struct dentry *dentry)
73{ 74{
74 struct pstore_private *p = dentry->d_inode->i_private; 75 struct pstore_private *p = dentry->d_inode->i_private;
75 76
76 p->psi->erase(p->id, p->psi); 77 p->psi->erase(p->type, p->id, p->psi);
77 78
78 return simple_unlink(dir, dentry); 79 return simple_unlink(dir, dentry);
79} 80}
@@ -192,6 +193,7 @@ int pstore_mkfile(enum pstore_type_id type, char *psname, u64 id,
192 private = kmalloc(sizeof *private + size, GFP_KERNEL); 193 private = kmalloc(sizeof *private + size, GFP_KERNEL);
193 if (!private) 194 if (!private)
194 goto fail_alloc; 195 goto fail_alloc;
196 private->type = type;
195 private->id = id; 197 private->id = id;
196 private->psi = psi; 198 private->psi = psi;
197 199
diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
index 221c04e5e333..163bb40511e7 100644
--- a/fs/pstore/platform.c
+++ b/fs/pstore/platform.c
@@ -78,7 +78,7 @@ static void pstore_dump(struct kmsg_dumper *dumper,
78 oopscount++; 78 oopscount++;
79 while (total < kmsg_bytes) { 79 while (total < kmsg_bytes) {
80 dst = psinfo->buf; 80 dst = psinfo->buf;
81 hsize = sprintf(dst, "%s#%d Part%d\n", why, oopscount, part++); 81 hsize = sprintf(dst, "%s#%d Part%d\n", why, oopscount, part);
82 size = psinfo->bufsize - hsize; 82 size = psinfo->bufsize - hsize;
83 dst += hsize; 83 dst += hsize;
84 84
@@ -94,8 +94,8 @@ static void pstore_dump(struct kmsg_dumper *dumper,
94 memcpy(dst, s1 + s1_start, l1_cpy); 94 memcpy(dst, s1 + s1_start, l1_cpy);
95 memcpy(dst + l1_cpy, s2 + s2_start, l2_cpy); 95 memcpy(dst + l1_cpy, s2 + s2_start, l2_cpy);
96 96
97 id = psinfo->write(PSTORE_TYPE_DMESG, hsize + l1_cpy + l2_cpy, 97 id = psinfo->write(PSTORE_TYPE_DMESG, part,
98 psinfo); 98 hsize + l1_cpy + l2_cpy, psinfo);
99 if (reason == KMSG_DUMP_OOPS && pstore_is_mounted()) 99 if (reason == KMSG_DUMP_OOPS && pstore_is_mounted())
100 pstore_mkfile(PSTORE_TYPE_DMESG, psinfo->name, id, 100 pstore_mkfile(PSTORE_TYPE_DMESG, psinfo->name, id,
101 psinfo->buf, hsize + l1_cpy + l2_cpy, 101 psinfo->buf, hsize + l1_cpy + l2_cpy,
@@ -103,6 +103,7 @@ static void pstore_dump(struct kmsg_dumper *dumper,
103 l1 -= l1_cpy; 103 l1 -= l1_cpy;
104 l2 -= l2_cpy; 104 l2 -= l2_cpy;
105 total += l1_cpy + l2_cpy; 105 total += l1_cpy + l2_cpy;
106 part++;
106 } 107 }
107 mutex_unlock(&psinfo->buf_mutex); 108 mutex_unlock(&psinfo->buf_mutex);
108} 109}
@@ -197,7 +198,7 @@ int pstore_write(enum pstore_type_id type, char *buf, size_t size)
197 198
198 mutex_lock(&psinfo->buf_mutex); 199 mutex_lock(&psinfo->buf_mutex);
199 memcpy(psinfo->buf, buf, size); 200 memcpy(psinfo->buf, buf, size);
200 id = psinfo->write(type, size, psinfo); 201 id = psinfo->write(type, 0, size, psinfo);
201 if (pstore_is_mounted()) 202 if (pstore_is_mounted())
202 pstore_mkfile(PSTORE_TYPE_DMESG, psinfo->name, id, psinfo->buf, 203 pstore_mkfile(PSTORE_TYPE_DMESG, psinfo->name, id, psinfo->buf,
203 size, CURRENT_TIME, psinfo); 204 size, CURRENT_TIME, psinfo);