linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Rodrigo Freire <rfreire@redhat.com>
To: "Jörn Engel" <joern@logfs.org>
Cc: nbd@openwrt.org, herton@redhat.com, linux-kernel@vger.kernel.org,
	linux-mtd@lists.infradead.org, computersforpeace@gmail.com,
	dwmw2 <dwmw2@infradead.org>
Subject: Re: [PATCH] block2mtd: mtd: Present block2mtd timely on boot time
Date: Wed, 17 Sep 2014 16:18:33 -0400 (EDT)	[thread overview]
Message-ID: <1761405154.40124217.1410985113708.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <20140909170231.GA14429@logfs.org>

Hi Jörn,

----- Original Message ----- 
From: "Jörn Engel" <joern@logfs.org> 
> On Mon, 8 September 2014 16:04:40 -0400, Rodrigo Freire wrote: 
> > 
> > @@ -257,13 +281,15 @@ static struct block2mtd_dev *add_device( 
> > 
> > /* Setup the MTD structure */ 
> > /* make the name contain the block device in */ 
> > - name = kasprintf(GFP_KERNEL, "block2mtd: %s", devname); 
> > + if (!mtdname) 
> > + mtdname = devname; 
> > + name = kmalloc(strlen(mtdname) + 1, GFP_KERNEL); 
> > if (!name) 
> > goto err_destroy_mutex; 
> > 
> > + strcpy(name, mtdname); 
> kstrdup. 
> And see below for the ABI change. 

Thanks for pointing. Fixed.


> >  	dev->mtd.name = name;
> > -
> > -	dev->mtd.size = dev->blkdev->bd_inode->i_size & PAGE_MASK;
> > +	dev->mtd.size = dev->blkdev->bd_inode->i_size & PAGE_MASK & ~(erase_size - 1);
> 
> PAGE_MASK is no longer needed with the new term.  Or does anyone
> seriously want to support erase_size < PAGE_SIZE?

Makes sense. I was talking to Felix and indeed there are some MTD devices 
which have 4k erase page size. Unheard of something smaller.
But it is on the MTD land and not block2mtd.


> Timeout has a default value, but name defaults to NULL. Add three 
> devices without specifying the name and you get funny results. 
> If we handled the NULL case by doing what the driver used to do before 
> this patch, I think this would be fine. 

Please see the fragment below:

@@ -257,13 +281,15 @@ static struct block2mtd_dev *add_device(
 
 	/* Setup the MTD structure */
 	/* make the name contain the block device in */
-	name = kasprintf(GFP_KERNEL, "block2mtd: %s", devname);
+	if (!mtdname)
+		mtdname = devname;
+	name = kstrdup(mtdname, GFP_KERNEL);
 	if (!name)
 		goto err_destroy_mutex;

If the name is a NULL or not provided, the mtdname will then become the mtd device name.
I also tried mounting several partitions, with both specified name and not and everything seemed to work nicely.

See a V2 patch on the next message.

  reply	other threads:[~2014-09-17 20:18 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <371358190.34795877.1410204429882.JavaMail.zimbra@redhat.com>
2014-09-08 20:04 ` [PATCH] block2mtd: mtd: Present block2mtd timely on boot time Rodrigo Freire
2014-09-09 17:02   ` Jörn Engel
2014-09-17 20:18     ` Rodrigo Freire [this message]
2014-09-17 20:28     ` [PATCH V2] mtd: block2mtd: " Rodrigo Freire
2014-09-17 21:21       ` Ezequiel Garcia
2014-09-17 21:41         ` Rodrigo Freire
2014-10-09 15:07       ` [RESEND PATCH " Rodrigo Freire
2014-11-01 13:33         ` Rodrigo Freire
2014-11-07  9:44           ` Artem Bityutskiy
2014-11-07 20:05             ` Brian Norris
2014-11-05 20:01         ` Brian Norris
2014-11-05 20:23       ` [PATCH " Brian Norris
2014-11-07 14:59         ` Artem Bityutskiy
2014-11-07 15:20           ` Felix Fietkau
2014-11-07 15:30             ` Artem Bityutskiy
2014-11-09 12:18         ` Rodrigo Freire
2014-11-26  3:33           ` Brian Norris
2014-11-26 13:32             ` Rodrigo Freire
2015-02-11 15:09               ` Rodrigo Freire
2014-11-09 12:18         ` [PATCH v3 0/3] mtd: block2mtd: wait for device enumeration, add name support Rodrigo Freire
2014-11-09 12:21           ` [PATCH v3 1/3] mtd: block2mtd: Ensure that block2mtd is triggered after block devices are presented Rodrigo Freire
2015-02-24  7:45             ` Brian Norris
2014-11-09 12:22           ` [PATCH v3 2/3] mtd: block2mtd: Adds a mtd name and a block device timeout option Rodrigo Freire
2015-02-24  8:05             ` Brian Norris
2014-11-09 12:23           ` [PATCH v3 3/3] mtd: block2mtd: Removes PAGE_MASK as a index to partition size Rodrigo Freire
2014-11-26  7:21             ` Brian Norris
2014-11-26 13:19               ` Rodrigo Freire
2015-02-24  8:07                 ` Brian Norris
2015-02-24  8:20                   ` Felix Fietkau
2015-02-24  8:27                     ` Brian Norris
2015-02-24  8:30                       ` Felix Fietkau
2015-02-24  8:40                         ` Brian Norris

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=1761405154.40124217.1410985113708.JavaMail.zimbra@redhat.com \
    --to=rfreire@redhat.com \
    --cc=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=herton@redhat.com \
    --cc=joern@logfs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=nbd@openwrt.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;
as well as URLs for NNTP newsgroup(s).