mkfs.ext3 --"Discarding device blocks: 4096/196608"

这篇博客讨论了一个内核BUG,当使用mkfs.ext3格式化eMMC设备时,程序会挂起。问题在于“Discarding device blocks”步骤,但通过添加"-E nodiscard"选项可以解决。博客中提到了该问题可能与mmcqd/1内核任务有关,并且提供了一些补丁和讨论,以解决mmc驱动程序中的超时和max_discard_to问题。
摘要由CSDN通过智能技术生成

DEBUG:这个问题是内核BUG, 新内核已经修正。


Discussion:
eMMC and “mkfs.ext3” hangs without “-E nodiscard”

Hi all,

on kernel 3.16.3 running on an i.MX6 with an eMMC card formatting a
partition won’t work, it hangs. With an added -v the last thing it
spit out is “Discarding device blocks: 4096/196608”.

When I run mkfs with “-E nodiscard”, formatting & booting works.

Noteworthy: when the eMMC device was still in virgin mode,
partitioning without “-E nodiscard” worked. But last week I used the
mmc tool to turn the user space into enhanced format. Basically, I
first run “mmc extcsd read /dev/mmcblk0” and used the number after
MAX_ENH_SIZE_MULT for an “mmc enh_area set -y 0 7651323 /dev/mmcblk0”.
Then, after a power-cycle, I also turned bkops on because kernel was
complaining that it wasn’t enabled. And since the default discard
option of mkfs.ext3 doesn’t seem to work anymore.

=======================================================
Are you sure that it’s not just taking very long?

Can you try erasing a smaller region of the device using the program
below? Normally BLKDISCARD is very fast for a device that has been
erased or that is new, but depending on the device it can take a
while to erase actual data.

Arnd

#define _GNU_SOURCE

#include <sys/stat.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
#include <linux/fs.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
int fd = open(argv[1], O_RDWR | O_DIRECT);
int ret;
unsigned long long range[2];

if (argc != 4) {
fprintf(stderr, "usage: %s <device> <start> <length>\n",
argv[0]);
}

if (fd < 0) {
perror("open");
return errno;
}

range[0] = atoll(argv[2]);
range[1] = atoll(argv[3]);

printf("erasing %lld to %lld on %s\n", range[0], range[0] + range[1], argv[1]);

ret = ioctl(fd, BLKDISCARD, range);
if (ret)
perror("ioctl");

return errno;
}

===================================================

Hi Arnd, Hmm, after one or two minutes I lost my patience.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值