IMX6: mkfs.ext4 on emmc is delayed

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

IMX6: mkfs.ext4 on emmc is delayed

5,452 Views
kiruthikavarada
Contributor III

Hi,

In IMX6 with 4GB flash when i perform

mkfs.ext4 on /dev/mmcblk0p2,  its consuming lot of time and seems like hardware hangs.

I tried with the option

mkfs.ext4 -E nodiscard /dev/mmcblk0p2  and it happens very quickly

4GB ,memory support "Discard" option..

root@imx6solosabreauto:/sys/block/mmcblk0/queue# cat discard_max_bytes

512

Any clues on why filesystem creation without -E nodiscard consumes more time.??

0 Kudos
Reply
7 Replies

3,294 Views
jaymind
Contributor IV

Hello

discard

                         Attempt  to  discard  blocks  at  mkfs time (discarding blocks initially is useful on solid state

                          devices and sparse / thin-provisioned storage). When the  device  advertises  that  discard  also

                          zeroes  data (any subsequent read after the discard and before write returns zero), then mark all

                          not-yet-zeroed inode tables as zeroed. This significantly speeds  up  filesystem  initialization.

                          This is set as default.

nodiscard

                          Do not attempt to discard blocks at mkfs time.

If you use kernel version 2.6.33 or later then discard capability is deactivated by default.

may below link useful for your understanding, (nice explanation):smileyinfo:Ext4 Filesystem - Thomas-Krenn-Wiki

So that's why it take very less time for -E nodiscard option because its not attempt any discard blocks (not yet zeroed)

suggestions are welcome.

Regards

Jaymin Dabhi

0 Kudos
Reply

3,294 Views
kiruthikavarada
Contributor III

Hi Jaymin,

I understand the meaning of nodiscard option.

Here

I have imx6 hardware connected to 8GB emmc Flash

I have another imx6 new hardware connected to 4GB emmc Flash

Note i am using the same driver for both devices.

I am trying to correlate why in new IMX6 hardware with 4GB emmc flash mkfs. is taking lot of time where as the same imx6 with 8GB emmc flash mkfs does not consume time ??

Will there be any change in the driver or patches available to reduce the mkfs time??

0 Kudos
Reply

3,294 Views
timjaacks
Contributor III

Hi kiruthika,

the discard command for eMMC has been introduced with eMMC spec v4.5. It is actually the intended behavior of mkfs.ext4 (since its version 1.41.10) to execute this by default (see manpage: mkfs.ext4(8): create ext2/ext3/ext4 filesystem - Linux man page).

Probably your 8GB implements an earlier version of the eMMC specification and does not support the discard command, while your 4GB eMMC does support it. Can you verify this?

Regards,

Tim

0 Kudos
Reply

3,294 Views
kiruthikavarada
Contributor III

Hi Tim,

  I went through the data sheet of 4gb emmc and it supports discard and sanitize feature and 4.51 spec compliant.

  8gb emmc does not have discard and sanitize feature and I think its 4.41 compliant.(will confirm)

Will there be any change or patches for the sdhci driver (3.10 kernel)provided by freescale for 4gb emmc if I do mkfs without nodiscard option.?

Will the performance of emmc get degraded if I execute mkfs every time with '-E nodiscard'?

Kindly clarify.

Thanks,

Kiruthika

0 Kudos
Reply

3,294 Views
timjaacks
Contributor III

Hi Kiruthika,

I don't think that Freescale will change anything here, because - as I said - it is the intended behavior. Whether to use discard or not is a decision based on your scenario. If you do not use discard at all, a deletion of data on the eMMC will result in simply marking the according blocks as free, without actually erasing them. NAND flash has to be erased before it can be reused, though. So if you do not use discard, the blocks will be erased in the moment new data is written to them, which will decrease write performance.

I posted a more detailed description of what is happening and what the different circumstances can be on a similar question: Re: i.MX6: eMMC hangs at mkfs "discard"

Hope this helps.

Best regards,

Tim

0 Kudos
Reply

3,294 Views
kiruthikavarada
Contributor III

Hi Tim,

Thank you for your suggestion.

I think my emmc frequently need read and write operations.So i have to have discard option.

I followed the patches provided by freescale for this issue. Its not included in mainline kernel yet.

Re: [PATCH 5/6] mmc: sdhci: calculate max_discard_to dynamically for SDHCI_QUIRK_DATA_TIMEOUT_USES_S...

With this patch i found that mkfs does not consume time at all but discard_max_bytes is too large. More value of max_discard_bytes is advisable??

Do you suggest anything to me regarding the emmc performance on this patch.

Thanks,

Kiruthika

0 Kudos
Reply

3,294 Views
kiruthikavarada
Contributor III

Hi Jaymin,

I understand the meaning of nodiscard option.

Here

I have imx6 hardware connected to 8GB emmc Flash

I have another imx6 new hardware connected to 4GB emmc Flash

Note i am using the same driver for both devices.

I am trying to correlate why in new IMX6 hardware with 4GB emmc flash mkfs. is taking lot of time where as the same imx6 with 8GB emmc nand mkfs does not consume time.

Do you mean to say that if emmc is virgin mkfs.ext4 with nodiscard option consume lot of time??

0 Kudos
Reply