From: Brian Norris <computersforpeace@gmail.com> To: Rodrigo Freire <rfreire@redhat.com> Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, "Jörn Engel" <joern@logfs.org>, "Felix Fietkau" <nbd@openwrt.org>, dwmw2@infradead.org, "Herton Krzesinski" <hkrzesin@redhat.com> Subject: Re: [PATCH v3 1/3] mtd: block2mtd: Ensure that block2mtd is triggered after block devices are presented. Date: Mon, 23 Feb 2015 23:45:41 -0800 [thread overview] Message-ID: <20150224074541.GD24441@norris-Latitude-E6410> (raw) In-Reply-To: <573958808.7454775.1415535673904.JavaMail.zimbra@redhat.com> You asked for review again... I guess I forgot about this patch series for some time. I think this patch is OK, except for a trivial comment below. But I have some comments on the next few. On Sun, Nov 09, 2014 at 07:21:13AM -0500, Rodrigo Freire wrote: > From: Felix Fietkau <nbd@openwrt.org> > > mtd: block2mtd: Ensure that block2mtd is triggered after block devices are presented. > > Ensures that block2mtd is triggered after the block devices are enumerated > at boot time. > This issue is seen on BCM2835 (Raspberry Pi) systems when mounting JFFS2 > block2mtd filesystems, probably because of the delay on enumerating a USB > MMC card reader. > > Signed-off-by: Felix Fietkau <nbd@openwrt.org> > Signed-off-by: Rodrigo Freire <rfreire@redhat.com> > Signed-off-by: Herton Krzesinski <herton@redhat.com> > --- > V3: Separated on a single patch, fixes a compiling warning, cosmethic changes > V2: Uses kstrdup, removed PAGE_MASK. > --- a/drivers/mtd/devices/block2mtd.c 2014-11-07 16:40:14.638676860 -0200 > +++ b/drivers/mtd/devices/block2mtd.c 2014-11-07 17:44:45.277769924 -0200 [...] > @@ -225,15 +237,28 @@ static struct block2mtd_dev *add_device( > > /* Get a handle on the device */ > bdev = blkdev_get_by_path(devname, mode, dev); > -#ifndef MODULE > - if (IS_ERR(bdev)) { > > - /* We might not have rootfs mounted at this point. Try > - to resolve the device name by other means. */ > +#ifndef MODULE > +/* > + * We might not have the root device mounted at this point. > + * Try to resolve the device name by other means. > + */ That's some interesting comment indentation. > + for (i = 0; IS_ERR(bdev) && i <= timeout; i++) { > + dev_t devt; > > - dev_t devt = name_to_dev_t(devname); > - if (devt) > - bdev = blkdev_get_by_dev(devt, mode, dev); > + if (i) > + /* > + * Calling wait_for_device_probe in the first loop > + * was not enough, sleep for a bit in subsequent > + * go-arounds. > + */ > + msleep(1000); > + wait_for_device_probe(); > + > + devt = name_to_dev_t(devname); > + if (!devt) > + continue; > + bdev = blkdev_get_by_dev(devt, mode, dev); > } > #endif > > @@ -280,6 +305,7 @@ static struct block2mtd_dev *add_device( > /* Device didn't get added, so free the entry */ > goto err_destroy_mutex; > } > + > list_add(&dev->list, &blkmtd_device_list); > pr_info("mtd%d: [%s] erase_size = %dKiB [%d]\n", > dev->mtd.index, > @@ -348,16 +374,19 @@ static inline void kill_final_newline(ch > > #ifndef MODULE > static int block2mtd_init_called = 0; > -static char block2mtd_paramline[80 + 12]; /* 80 for device, 12 for erase size */ > +/* 80 for device, 12 for erase size */ > +static char block2mtd_paramline[80 + 12]; > #endif > > static int block2mtd_setup2(const char *val) > { > - char buf[80 + 12]; /* 80 for device, 12 for erase size */ > + /* 80 for device, 12 for erase size, 80 for name, 8 for timeout */ > + char buf[80 + 12 + 80 + 8]; > char *str = buf; > char *token[2]; > char *name; > size_t erase_size = PAGE_SIZE; > + unsigned long timeout = MTD_DEFAULT_TIMEOUT; > int i, ret; > > if (strnlen(val, sizeof(buf)) >= sizeof(buf)) { > @@ -395,7 +424,7 @@ static int block2mtd_setup2(const char * > } > } > > - add_device(name, erase_size); > + add_device(name, erase_size, timeout); > > return 0; > } > @@ -463,8 +492,7 @@ static void block2mtd_exit(void) > } > } > > - > -module_init(block2mtd_init); > +late_initcall(block2mtd_init); This technically could have problems if you want to use block2mtd with UBI, now, since it also uses late_initcall(), and it can add UBI attachments via module parameters too (ubi.mtd=<mtd-name>). I'm not too worried about this, though, since block2mtd is really not meant for serious use (despite your usage here). > module_exit(block2mtd_exit); > > MODULE_LICENSE("GPL"); Pushed this patch to l2-mtd.git, with comment fixups. Brian
WARNING: multiple messages have this Message-ID (diff)
From: Brian Norris <computersforpeace@gmail.com> To: Rodrigo Freire <rfreire@redhat.com> Cc: "Felix Fietkau" <nbd@openwrt.org>, "Jörn Engel" <joern@logfs.org>, "Herton Krzesinski" <hkrzesin@redhat.com>, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, dwmw2@infradead.org Subject: Re: [PATCH v3 1/3] mtd: block2mtd: Ensure that block2mtd is triggered after block devices are presented. Date: Mon, 23 Feb 2015 23:45:41 -0800 [thread overview] Message-ID: <20150224074541.GD24441@norris-Latitude-E6410> (raw) In-Reply-To: <573958808.7454775.1415535673904.JavaMail.zimbra@redhat.com> You asked for review again... I guess I forgot about this patch series for some time. I think this patch is OK, except for a trivial comment below. But I have some comments on the next few. On Sun, Nov 09, 2014 at 07:21:13AM -0500, Rodrigo Freire wrote: > From: Felix Fietkau <nbd@openwrt.org> > > mtd: block2mtd: Ensure that block2mtd is triggered after block devices are presented. > > Ensures that block2mtd is triggered after the block devices are enumerated > at boot time. > This issue is seen on BCM2835 (Raspberry Pi) systems when mounting JFFS2 > block2mtd filesystems, probably because of the delay on enumerating a USB > MMC card reader. > > Signed-off-by: Felix Fietkau <nbd@openwrt.org> > Signed-off-by: Rodrigo Freire <rfreire@redhat.com> > Signed-off-by: Herton Krzesinski <herton@redhat.com> > --- > V3: Separated on a single patch, fixes a compiling warning, cosmethic changes > V2: Uses kstrdup, removed PAGE_MASK. > --- a/drivers/mtd/devices/block2mtd.c 2014-11-07 16:40:14.638676860 -0200 > +++ b/drivers/mtd/devices/block2mtd.c 2014-11-07 17:44:45.277769924 -0200 [...] > @@ -225,15 +237,28 @@ static struct block2mtd_dev *add_device( > > /* Get a handle on the device */ > bdev = blkdev_get_by_path(devname, mode, dev); > -#ifndef MODULE > - if (IS_ERR(bdev)) { > > - /* We might not have rootfs mounted at this point. Try > - to resolve the device name by other means. */ > +#ifndef MODULE > +/* > + * We might not have the root device mounted at this point. > + * Try to resolve the device name by other means. > + */ That's some interesting comment indentation. > + for (i = 0; IS_ERR(bdev) && i <= timeout; i++) { > + dev_t devt; > > - dev_t devt = name_to_dev_t(devname); > - if (devt) > - bdev = blkdev_get_by_dev(devt, mode, dev); > + if (i) > + /* > + * Calling wait_for_device_probe in the first loop > + * was not enough, sleep for a bit in subsequent > + * go-arounds. > + */ > + msleep(1000); > + wait_for_device_probe(); > + > + devt = name_to_dev_t(devname); > + if (!devt) > + continue; > + bdev = blkdev_get_by_dev(devt, mode, dev); > } > #endif > > @@ -280,6 +305,7 @@ static struct block2mtd_dev *add_device( > /* Device didn't get added, so free the entry */ > goto err_destroy_mutex; > } > + > list_add(&dev->list, &blkmtd_device_list); > pr_info("mtd%d: [%s] erase_size = %dKiB [%d]\n", > dev->mtd.index, > @@ -348,16 +374,19 @@ static inline void kill_final_newline(ch > > #ifndef MODULE > static int block2mtd_init_called = 0; > -static char block2mtd_paramline[80 + 12]; /* 80 for device, 12 for erase size */ > +/* 80 for device, 12 for erase size */ > +static char block2mtd_paramline[80 + 12]; > #endif > > static int block2mtd_setup2(const char *val) > { > - char buf[80 + 12]; /* 80 for device, 12 for erase size */ > + /* 80 for device, 12 for erase size, 80 for name, 8 for timeout */ > + char buf[80 + 12 + 80 + 8]; > char *str = buf; > char *token[2]; > char *name; > size_t erase_size = PAGE_SIZE; > + unsigned long timeout = MTD_DEFAULT_TIMEOUT; > int i, ret; > > if (strnlen(val, sizeof(buf)) >= sizeof(buf)) { > @@ -395,7 +424,7 @@ static int block2mtd_setup2(const char * > } > } > > - add_device(name, erase_size); > + add_device(name, erase_size, timeout); > > return 0; > } > @@ -463,8 +492,7 @@ static void block2mtd_exit(void) > } > } > > - > -module_init(block2mtd_init); > +late_initcall(block2mtd_init); This technically could have problems if you want to use block2mtd with UBI, now, since it also uses late_initcall(), and it can add UBI attachments via module parameters too (ubi.mtd=<mtd-name>). I'm not too worried about this, though, since block2mtd is really not meant for serious use (despite your usage here). > module_exit(block2mtd_exit); > > MODULE_LICENSE("GPL"); Pushed this patch to l2-mtd.git, with comment fixups. Brian
next prev parent reply other threads:[~2015-02-24 7:45 UTC|newest] Thread overview: 63+ 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-09 17:02 ` Jörn Engel 2014-09-17 20:18 ` Rodrigo Freire 2014-09-17 20:18 ` Rodrigo Freire 2014-09-17 20:28 ` [PATCH V2] mtd: block2mtd: " Rodrigo Freire 2014-09-17 20:28 ` Rodrigo Freire 2014-09-17 21:21 ` Ezequiel Garcia 2014-09-17 21:21 ` Ezequiel Garcia 2014-09-17 21:41 ` Rodrigo Freire 2014-09-17 21:41 ` Rodrigo Freire 2014-10-09 15:07 ` [RESEND PATCH " Rodrigo Freire 2014-10-09 15:07 ` Rodrigo Freire 2014-11-01 13:33 ` Rodrigo Freire 2014-11-01 13:33 ` Rodrigo Freire 2014-11-07 9:44 ` Artem Bityutskiy 2014-11-07 9:44 ` Artem Bityutskiy 2014-11-07 20:05 ` Brian Norris 2014-11-07 20:05 ` Brian Norris 2014-11-05 20:01 ` Brian Norris 2014-11-05 20:01 ` Brian Norris 2014-11-05 20:23 ` [PATCH " Brian Norris 2014-11-05 20:23 ` Brian Norris 2014-11-07 14:59 ` Artem Bityutskiy 2014-11-07 14:59 ` Artem Bityutskiy 2014-11-07 15:20 ` Felix Fietkau 2014-11-07 15:20 ` Felix Fietkau 2014-11-07 15:30 ` Artem Bityutskiy 2014-11-07 15:30 ` Artem Bityutskiy 2014-11-09 12:18 ` Rodrigo Freire 2014-11-09 12:18 ` Rodrigo Freire 2014-11-26 3:33 ` Brian Norris 2014-11-26 3:33 ` Brian Norris 2014-11-26 13:32 ` Rodrigo Freire 2014-11-26 13:32 ` Rodrigo Freire 2015-02-11 15:09 ` 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:18 ` 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 2014-11-09 12:21 ` Rodrigo Freire 2015-02-24 7:45 ` Brian Norris [this message] 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 2014-11-09 12:22 ` Rodrigo Freire 2015-02-24 8:05 ` Brian Norris 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-09 12:23 ` Rodrigo Freire 2014-11-26 7:21 ` Brian Norris 2014-11-26 7:21 ` Brian Norris 2014-11-26 13:19 ` Rodrigo Freire 2014-11-26 13:19 ` Rodrigo Freire 2015-02-24 8:07 ` Brian Norris 2015-02-24 8:07 ` Brian Norris 2015-02-24 8:20 ` Felix Fietkau 2015-02-24 8:20 ` Felix Fietkau 2015-02-24 8:27 ` Brian Norris 2015-02-24 8:27 ` Brian Norris 2015-02-24 8:30 ` Felix Fietkau 2015-02-24 8:30 ` Felix Fietkau 2015-02-24 8:40 ` Brian Norris 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=20150224074541.GD24441@norris-Latitude-E6410 \ --to=computersforpeace@gmail.com \ --cc=dwmw2@infradead.org \ --cc=hkrzesin@redhat.com \ --cc=joern@logfs.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-mtd@lists.infradead.org \ --cc=nbd@openwrt.org \ --cc=rfreire@redhat.com \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.