Linux-mtd Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: David Woodhouse <dwmw2@infradead.org>,
	Brian Norris <computersforpeace@gmail.com>,
	Boris Brezillon <boris.brezillon@free-electrons.com>,
	Marek Vasut <marek.vasut@gmail.com>,
	Richard Weinberger <richard@nod.at>,
	Cyrille Pitchen <cyrille.pitchen@wedev4u.fr>,
	linux-mtd@lists.infradead.org
Cc: Chris Packham <Chris.Packham@alliedtelesis.co.nz>,
	stable@vger.kernel.org,
	Mathias Thore <Mathias.Thore@infinera.com>
Subject: Re: [PATCH v2] mtd: Fix partition alignment check on multi-erasesize devices
Date: Thu, 28 Sep 2017 11:46:44 +0200	[thread overview]
Message-ID: <20170928114644.3708886c@bbrezillon> (raw)
In-Reply-To: <20170925081957.19177-1-boris.brezillon@free-electrons.com>

On Mon, 25 Sep 2017 10:19:57 +0200
Boris Brezillon <boris.brezillon@free-electrons.com> wrote:

> Commit 1eeef2d7483a ("mtd: handle partitioning on devices with 0
> erasesize") introduced a regression on heterogeneous erase region
> devices. Alignment of the partition was tested against the master
> eraseblock size which can be bigger than the slave one, thus leading
> to some partitions being marked as read-only.
> 
> Update wr_alignment to match this slave erasesize after this erasesize
> has been determined by picking the biggest erasesize of all the regions
> embedded in the MTD partition.
> 
> Reported-by: Mathias Thore <Mathias.Thore@infinera.com>
> Fixes: 1eeef2d7483a ("mtd: handle partitioning on devices with 0 erasesize")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>

Applied.

> ---
> Changes in v2:
> - Fix build error reported by Mathias
> ---
>  drivers/mtd/mtdpart.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
> index 5736b0c90b33..a308e707392d 100644
> --- a/drivers/mtd/mtdpart.c
> +++ b/drivers/mtd/mtdpart.c
> @@ -581,6 +581,14 @@ static struct mtd_part *allocate_partition(struct mtd_info *parent,
>  		slave->mtd.erasesize = parent->erasesize;
>  	}
>  
> +	/*
> +	 * Slave erasesize might differ from the master one if the master
> +	 * exposes several regions with different erasesize. Adjust
> +	 * wr_alignment accordingly.
> +	 */
> +	if (!(slave->mtd.flags & MTD_NO_ERASE))
> +		wr_alignment = slave->mtd.erasesize;
> +
>  	tmp = slave->offset;
>  	remainder = do_div(tmp, wr_alignment);
>  	if ((slave->mtd.flags & MTD_WRITEABLE) && remainder) {

      parent reply	other threads:[~2017-09-28  9:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-25  8:19 [PATCH v2] mtd: Fix partition alignment check on multi-erasesize devices Boris Brezillon
2017-09-25 11:15 ` Mathias Thore
2017-09-28  9:46 ` Boris Brezillon [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=20170928114644.3708886c@bbrezillon \
    --to=boris.brezillon@free-electrons.com \
    --cc=Chris.Packham@alliedtelesis.co.nz \
    --cc=Mathias.Thore@infinera.com \
    --cc=computersforpeace@gmail.com \
    --cc=cyrille.pitchen@wedev4u.fr \
    --cc=dwmw2@infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marek.vasut@gmail.com \
    --cc=richard@nod.at \
    --cc=stable@vger.kernel.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