-
Notifications
You must be signed in to change notification settings - Fork 1.5k
drivers/mtd: Optimization of mtdconfig module #18024
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
@zhaoxingyu12 does NuttX have the possibility to distinguish between devices that require erase and devices that don't? Even for devices that do not require erase the benefits of zms over nvs (emulating a erase by writing 0xff) is very limited. I am unsure that the addition of zms (with associated maintenance) can be justified. |
@Laczen you can check whether mtd driver implement mtd_dev_s::erase. |
@xiaoxiang781216 this could be done, but this might break other drivers. E.g. the rwbuffer directly calls the underlying mtd_erase method. |
All places already add the check, I think. @zhaoxingyu12 please confirm this. |
improve the speed of finding the target ate Signed-off-by: guohao15 <guohao15@xiaomi.com>
change filename mtd/mtd_config_fs.c to mtd/mtd_config_nvs.c and optimize the configuration related to mtdconfig Signed-off-by: zhaoxingyu1 <zhaoxingyu1@xiaomi.com>
For nvs test in qemu Signed-off-by: guohao15 <guohao15@xiaomi.com>
The structure of mtd_config in Kconfig has changed. Signed-off-by: zhaoxingyu1 <zhaoxingyu1@xiaomi.com>
…y_path api mtd_config/mtd_config_nvs should all support mtdconfig_register_by_path/mtdconfig_unregister_by_path api Signed-off-by: zhaoxingyu1 <zhaoxingyu1@xiaomi.com>
For the MTD_CONFIG configuration item in drivers/mtd/Kconfig has changed. Signed-off-by: zhaoxingyu1 <zhaoxingyu1@xiaomi.com>
|
@zhaoxingyu12 please fix the following error: |
|
Shouldn't this be marked as breaking because of |
Does it mean to remove these two configs in boards/risc-v/esp32c3-legacy/esp32c3-legacy-devkit/configs/nvcfgdata/defconfig? i think #18024 and apache/nuttx-apps#3344 compiling together can fix it . but i dont know how to put the nuttx and nuttx-apps cict together |
@xiaoxiang781216 @Laczen It is currently only used in mtd_partition, and has (part->child.erase = mtd->erase ? part_erase : NULL; ) check in mtd_partition. |
|
@zhaoxingyu12 please fix: |
the tasking compiler reports the error: expression must be constant in line 510 Signed-off-by: zhaoxingyu1 <zhaoxingyu1@xiaomi.com>
Deleting a non-existent key-value pair is deemed a successful deletion. Signed-off-by: zhaoxingyu1 <zhaoxingyu1@xiaomi.com>
dbe464b
|
@zhaoxingyu12 fix the ci style error: |
Enhance the robustness of ATE traversal. Signed-off-by: zhaoxingyu1 <zhaoxingyu1@xiaomi.com>
The purpose is to reduce the conflict rate of ate CRC and verify the data Signed-off-by: zhaoxingyu1 <zhaoxingyu1@xiaomi.com>
use a fixed size buffer on stack instead of vla, When it needs to pass misra-c check Signed-off-by: zhaoxingyu1 <zhaoxingyu1@xiaomi.com>
when enable MTD_CONFIG_BUFFER_SIZE, 1669:10: error: unused variable 'ate_size' [-Werror=unused-variable] 1669 | size_t ate_size = nvs_ate_size(fs); 2160:10: error: unused variable 'ate_size' [-Werror=unused-variable] 2160 | size_t ate_size = nvs_ate_size(fs); Signed-off-by: zhaoxingyu1 <zhaoxingyu1@xiaomi.com>
Remove dirty data to ensure sufficient available storage space in the flash memory. Signed-off-by: zhaoxingyu1 <zhaoxingyu1@xiaomi.com>
When key string found corrupted during garbage collection, then remove key-value pair from the flash. Signed-off-by: zhaoxingyu1 <zhaoxingyu1@xiaomi.com>
Invalid data is cleared during garbage collection rather than deleted during initialization, thus accelerating the initialization speed. Signed-off-by: zhaoxingyu1 <zhaoxingyu1@xiaomi.com>
done |
Note: Please adhere to Contributing Guidelines.
Summary
Optimize mtdconfig related modules
Impact
KV read and write functions
Testing
testcases
`
int print_list(void)
{
int fd = open("/dev/nvs", O_RDONLY);
#ifdef CONFIG_MTD_CONFIG_NAMED
syslog(0, "######## key=%s, value=%s", data.name, data.configdata);
#else
syslog(0, "######## id=%d, instance=%d, value=%s", data.id, data.instance, data.configdata);
#endif
#ifdef CONFIG_MTD_CONFIG_NAMED
syslog(0, "######## key=%s, value=%s", data.name, data.configdata);
#else
syslog(0, "######## id=%d, instance=%d, value=%s", data.id, data.instance, data.configdata);
#endif
}
}
void test(void)
{
uint64_t filling_id = 0;
struct config_data_s data;
int ret;
#ifdef CONFIG_MTD_CONFIG_NAMED
char rd_buf[10] = {0};
#else
data.id = (uint16_t)filling_id;
data.instance = (int)filling_id + 1;
#endif
data.configdata = wr_buf;
data.len = sizeof(wr_buf);
ret = ioctl(fd, CFGDIOC_SETCONFIG, &data);
}
int main(int argc, FAR char *argv[])
{
test();
print_list();
return 0;
}
`
test result
[ 3.724800] [core0] ######## key=k28, value=v----------------------------28
[ 3.725400] [core0] ######## key=k27, value=v----------------------------27
[ 3.726000] [core0] ######## key=k26, value=v----------------------------26
[ 3.726600] [core0] ######## key=k25, value=v----------------------------25
[ 3.727100] [core0] ######## key=k24, value=v----------------------------24
[ 3.727700] [core0] ######## key=k23, value=v----------------------------23
[ 3.728300] [core0] ######## key=k22, value=v----------------------------22
[ 3.728800] [core0] ######## key=k21, value=v----------------------------21
[ 3.729400] [core0] ######## key=k20, value=v----------------------------20
[ 3.729900] [core0] ######## key=k1f, value=v----------------------------1f
[ 3.730500] [core0] ######## key=k1e, value=v----------------------------1e
[ 3.731200] [core0] ######## key=k1d, value=v----------------------------1d
[ 3.731800] [core0] ######## key=k1c, value=v----------------------------1c
[ 3.732500] [core0] ######## key=k1b, value=v----------------------------1b
[ 3.733100] [core0] ######## key=k1a, value=v----------------------------1a
[ 3.733700] [core0] ######## key=k19, value=v----------------------------19
[ 3.734300] [core0] ######## key=k18, value=v----------------------------18
[ 3.734800] [core0] ######## key=k17, value=v----------------------------17
[ 3.735400] [core0] ######## key=k16, value=v----------------------------16
[ 3.736100] [core0] ######## key=k15, value=v----------------------------15
[ 3.736700] [core0] ######## key=k14, value=v----------------------------14
[ 3.737300] [core0] ######## key=k13, value=v----------------------------13
[ 3.737700] [core0] ######## key=k12, value=v----------------------------12
[ 3.738200] [core0] ######## key=k11, value=v----------------------------11
[ 3.738700] [core0] ######## key=k10, value=v----------------------------10
[ 3.739100] [core0] ######## key=kf, value=v----------------------------f
[ 3.739600] [core0] ######## key=ke, value=v----------------------------e
[ 3.740100] [core0] ######## key=kd, value=v----------------------------d
[ 3.740600] [core0] ######## key=kc, value=v----------------------------c
[ 3.741100] [core0] ######## key=kb, value=v----------------------------b
[ 3.741700] [core0] ######## key=ka, value=v----------------------------a
[ 3.742100] [core0] ######## key=k9, value=v----------------------------9
[ 3.742600] [core0] ######## key=k8, value=v----------------------------8
[ 3.743100] [core0] ######## key=k7, value=v----------------------------7
[ 3.743500] [core0] ######## key=k6, value=v----------------------------6
[ 3.744000] [core0] ######## key=k5, value=v----------------------------5
[ 3.744500] [core0] ######## key=k4, value=v----------------------------4
[ 3.744900] [core0] ######## key=k3, value=v----------------------------3
[ 3.745400] [core0] ######## key=k2, value=v----------------------------2
[ 3.746000] [core0] ######## key=k1, value=v----------------------------1
[ 3.747300] [core0] ######## key=k0, value=v----------------------------0
[ 3.748300] [core0] ######## key=k29, value=v----------------------------29
[ 3.748700] [core0] ######## key=k2a, value=v----------------------------2a
[ 3.749300] [core0] ######## key=k2b, value=v----------------------------2b
[ 3.749800] [core0] ######## key=k2c, value=v----------------------------2c
[ 3.750300] [core0] ######## key=k2d, value=v----------------------------2d
[ 3.751000] [core0] ######## key=k2e, value=v----------------------------2e
[ 3.751600] [core0] ######## key=k2f, value=v----------------------------2f
[ 3.752200] [core0] ######## key=k30, value=v----------------------------30
[ 3.752700] [core0] ######## key=k31, value=v----------------------------31
[ 3.753300] [core0] ######## key=k32, value=v----------------------------32
[ 3.753800] [core0] ######## key=k33, value=v----------------------------33
[ 3.754300] [core0] ######## key=k34, value=v----------------------------34
[ 3.754900] [core0] ######## key=k35, value=v----------------------------35
[ 3.755400] [core0] ######## key=k36, value=v----------------------------36
[ 3.756100] [core0] ######## key=k37, value=v----------------------------37
[ 3.756600] [core0] ######## key=k38, value=v----------------------------38
[ 3.757200] [core0] ######## key=k39, value=v----------------------------39
[ 3.757700] [core0] ######## key=k3a, value=v----------------------------3a
[ 3.758200] [core0] ######## key=k3b, value=v----------------------------3b
[ 3.758800] [core0] ######## key=k3c, value=v----------------------------3c
[ 3.759300] [core0] ######## key=k3d, value=v----------------------------3d
[ 3.759800] [core0] ######## key=k3e, value=v----------------------------3e
[ 3.760300] [core0] ######## key=k3f, value=v----------------------------3f
[ 3.761100] [core0] ######## key=k40, value=v----------------------------40
[ 3.761700] [core0] ######## key=k41, value=v----------------------------41
[ 3.762200] [core0] ######## key=k42, value=v----------------------------42
[ 3.762700] [core0] ######## key=k43, value=v----------------------------43
[ 3.763200] [core0] ######## key=k44, value=v----------------------------44
[ 3.763800] [core0] ######## key=k45, value=v----------------------------45
[ 3.764300] [core0] ######## key=k46, value=v----------------------------46
[ 3.764800] [core0] ######## key=k47, value=v----------------------------47
[ 3.765400] [core0] ######## key=k48, value=v----------------------------48
[ 3.766000] [core0] ######## key=k49, value=v----------------------------49
[ 3.766600] [core0] ######## key=k4a, value=v----------------------------4a
[ 3.767100] [core0] ######## key=k4b, value=v----------------------------4b
[ 3.767600] [core0] ######## key=k4c, value=v----------------------------4c
[ 3.768200] [core0] ######## key=k4d, value=v----------------------------4d
[ 3.768800] [core0] ######## key=k4e, value=v----------------------------4e
[ 3.769300] [core0] ######## key=k4f, value=v----------------------------4f
[ 3.769900] [core0] ######## key=k50, value=v----------------------------50
[ 3.771100] [core0] ######## key=k51, value=v----------------------------51