From: Sascha Hauer <s.hauer@pengutronix.de>
To: Ladislav Michl <ladis@linux-mips.org>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] state: backend_bucket_circular: fix for non power of 2 writesize
Date: Wed, 26 Sep 2018 08:57:22 +0200 [thread overview]
Message-ID: <20180926065722.GQ4097@pengutronix.de> (raw)
In-Reply-To: <20180925105845.GA15416@lenoch>
On Tue, Sep 25, 2018 at 12:58:45PM +0200, Ladislav Michl wrote:
> backend_bucket_circular currently assumes writesize is power of 2,
> which makes it fail on dataflash devices, where this assumption
> is false.
>
> Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
> ---
> common/state/backend_bucket_circular.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Applied, thanks
Sascha
>
> diff --git a/common/state/backend_bucket_circular.c b/common/state/backend_bucket_circular.c
> index 933493e22..0529421a2 100644
> --- a/common/state/backend_bucket_circular.c
> +++ b/common/state/backend_bucket_circular.c
> @@ -248,7 +248,7 @@ static int state_backend_bucket_circular_read(struct state_backend_storage_bucke
> circ->write_area = 0;
> dev_info(circ->dev, "Detected old on-storage format\n");
> } else if (circ->last_written_length > circ->write_area
> - || !IS_ALIGNED(circ->last_written_length, circ->writesize)) {
> + || (circ->last_written_length % circ->writesize != 0)) {
> circ->write_area = 0;
> dev_err(circ->dev, "Error, invalid number of bytes written last time %d\n",
> circ->last_written_length);
> @@ -295,7 +295,7 @@ static int state_backend_bucket_circular_write(struct state_backend_storage_buck
> get_bucket_circular(bucket);
> off_t offset;
> struct state_backend_storage_bucket_circular_meta *meta;
> - uint32_t written_length = ALIGN(len + sizeof(*meta), circ->writesize);
> + uint32_t written_length = roundup(len + sizeof(*meta), circ->writesize);
> int ret;
> void *write_buf;
>
> --
> 2.19.0
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
prev parent reply other threads:[~2018-09-26 6:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-25 10:58 Ladislav Michl
2018-09-26 6:57 ` Sascha Hauer [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180926065722.GQ4097@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=ladis@linux-mips.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox