[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJ_JQ2V=8htqwEL3tP9F3V2e1K_cni48jgYQCJa_QF1kE5wPEw@mail.gmail.com>
Date: Thu, 25 Oct 2012 11:54:43 +0300
From: "Tatulea, Dragos" <dragos.tatulea@...el.com>
To: Kees Cook <keescook@...omium.org>
Cc: Irina Tirdea <irina.tirdea@...el.com>,
Anton Vorontsov <cbouatmailru@...il.com>,
Colin Cross <ccross@...roid.com>,
Tony Luck <tony.luck@...el.com>, Chris Ball <cjb@...top.org>,
linux-kernel@...r.kernel.org,
Adrian Hunter <adrian.hunter@...el.com>,
Octavian Purdila <octavian.purdila@...el.com>
Subject: Re: [PATCH 01/26] pstore: allow for big files
On Tue, Oct 23, 2012 at 7:48 PM, Kees Cook <keescook@...omium.org> wrote:
>
> On Tue, Oct 23, 2012 at 6:47 AM, Irina Tirdea <irina.tirdea@...el.com> wrote:
> > From: Adrian Hunter <adrian.hunter@...el.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@...el.com>
> > Signed-off-by: Irina Tirdea <irina.tirdea@...el.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists