lkml.org 
[lkml]   [2012]   [Oct]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 01/26] pstore: allow for big files
On Tue, Oct 23, 2012 at 7:48 PM, Kees Cook <keescook@chromium.org> wrote:
>
> On Tue, Oct 23, 2012 at 6:47 AM, Irina Tirdea <irina.tirdea@intel.com> wrote:
> > From: Adrian Hunter <adrian.hunter@intel.com>
> >
> > pstore reads all files into memory at mount time. To allow for back ends
> > that will store arbitrarily large files, enhance pstore also to be able
> > to read from the back end as needed.
> >
> > Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
> > Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
> > ---
> > drivers/acpi/apei/erst.c | 16 +++++++++-------
> > fs/pstore/inode.c | 26 ++++++++++++++++++++------
> > fs/pstore/internal.h | 5 +++--
> > fs/pstore/platform.c | 11 +++++++----
> > fs/pstore/ram.c | 15 +++++++--------
> > include/linux/pstore.h | 7 +++++--
> > 6 files changed, 51 insertions(+), 29 deletions(-)
> >
> > diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c
> > index e4d9d24..f70ba37 100644
> > --- a/drivers/acpi/apei/erst.c
> > +++ b/drivers/acpi/apei/erst.c
> > @@ -931,9 +931,9 @@ static int erst_check_table(struct acpi_table_erst *erst_tab)
> >
> > static int erst_open_pstore(struct pstore_info *psi);
> > static int erst_close_pstore(struct pstore_info *psi);
> > -static ssize_t erst_reader(u64 *id, enum pstore_type_id *type,
> > - struct timespec *time, char **buf,
> > - struct pstore_info *psi);
> > +static int erst_reader(u64 *id, enum pstore_type_id *type,
> > + struct timespec *time, char **buf, loff_t *size,
> > + struct pstore_info *psi);
> > static int erst_writer(enum pstore_type_id type, enum kmsg_dump_reason reason,
> > u64 *id, unsigned int part,
> > size_t size, struct pstore_info *psi);
> > @@ -987,9 +987,9 @@ static int erst_close_pstore(struct pstore_info *psi)
> > return 0;
> > }
> >
> > -static ssize_t erst_reader(u64 *id, enum pstore_type_id *type,
> > - struct timespec *time, char **buf,
> > - struct pstore_info *psi)
> > +static int erst_reader(u64 *id, enum pstore_type_id *type,
> > + struct timespec *time, char **buf, loff_t *size,
> > + struct pstore_info *psi)
> > {
> > int rc;
> > ssize_t len = 0;
> > @@ -1051,7 +1051,9 @@ skip:
> >
> > out:
> > kfree(rcd);
> > - return (rc < 0) ? rc : (len - sizeof(*rcd));
> > + if (!rc)
> > + *size = len - sizeof(*rcd);
> > + return rc;
> > }
> >
> > static int erst_writer(enum pstore_type_id type, enum kmsg_dump_reason reason,
> > diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c
> > index 4ab572e..ff0970f 100644
> > --- a/fs/pstore/inode.c
> > +++ b/fs/pstore/inode.c
> > @@ -49,7 +49,8 @@ struct pstore_private {
> > struct pstore_info *psi;
> > enum pstore_type_id type;
> > u64 id;
> > - ssize_t size;
> > + loff_t size;
> > + bool big;
> > char data[];
> > };
> >
> > @@ -65,12 +66,13 @@ static void *pstore_ftrace_seq_start(struct seq_file *s, loff_t *pos)
> > {
> > struct pstore_private *ps = s->private;
> > struct pstore_ftrace_seq_data *data;
> > + loff_t size = ps->size;
> >
> > data = kzalloc(sizeof(*data), GFP_KERNEL);
> > if (!data)
> > return NULL;
> >
> > - data->off = ps->size % REC_SIZE;
> > + data->off = do_div(size, REC_SIZE);
>
> This modifies ps->size. I don't think you want that?
>
ps->size is not modified. The locally stored "size" variable is used
to avoid modifying ps->size.

Thanks,
Dragos


\
 
 \ /
  Last update: 2012-10-25 11:21    [W:0.129 / U:0.420 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site