-
Notifications
You must be signed in to change notification settings - Fork 732
DNM: add zms_get_num_cycles() #2596
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: main
Are you sure you want to change the base?
Changes from 1 commit
03e2995
a08bb01
4d63c4e
ba83fb0
bc9a9ac
8a686a5
cb4ee54
4789325
ef6161b
db40586
314f3dd
f22df30
b323a20
a653cb7
87b366d
b83eabe
eb1ae9f
a195e73
895b509
04ece2c
581f3c1
c70e602
fb03222
80cc531
eee8e75
f2f1caa
1955241
ed93f6e
a68f065
ff0fbbb
9bc8f72
3c7c521
a2b3371
5d070d4
ce4b321
2b02e6d
4d1f543
4305296
9c4671f
5021b9f
a87e8a7
24d888d
0e6fbbd
ba8340a
e17bbfa
8d51afb
98c266e
c4508b6
1e073b5
c416d6f
2fc86c1
ba4d71a
c26cd49
416e8fc
f30c34f
805ede3
d2a2a87
e02acf3
6f78320
4ca71a2
f7e0944
bb4378e
a4c682d
b5268e1
cc05f9b
f8a9ebe
622e25f
1ab2cc6
c950013
5fc17c7
d191a5d
4d99685
e6cb111
f1cc6bc
c8d8d0f
ee1b5d6
02382d5
4e26578
06550b4
f600c99
c5d37e5
107f9f0
7d700de
098da0b
74e5da2
24fec0c
e538f0c
5f71dfc
50f0302
d1dd497
d28c320
230c063
8aa1511
c778e38
af1dea4
cf84a74
a3a1f4b
a77836f
01bec65
8479874
1e36a81
7525c0e
218b06f
6b8ec1e
fe73c8b
b85af47
6de6e75
0a614a3
32d63d8
8995779
7318bd1
87de55b
f28150c
34a8e0e
bae52a8
e252e62
cf5bed0
4a2ebc4
c368cd7
855ecdb
59ae559
02e2866
7e22b4a
686b58e
84483b8
8d6cd64
ba88cc2
47cad3b
6eb30df
f01cc4c
88ce8e0
ae94cdf
6b77915
dd2b35e
0d6e8cf
fd0f27a
67c011b
6f794f9
75ec3a1
3c9c7af
cd49156
3ed21ed
16dc0c6
b91aa4f
cd78af5
0aa2141
7bba252
a12ec54
938c437
43f054e
61c3d47
9f0c5c9
fdc20c9
8bd9e16
d1d8c78
00cfdc0
25cc8b5
d6072d4
73c8d65
5f86809
47a8e12
90c0360
a37c99e
ca2d61e
4cba24b
50128e3
a22f20f
5d28a5e
b2d2019
9a6076a
73d52ac
dc87df4
63aa79c
6b3d347
072a6f7
912cca9
c7ceba7
65d9b7d
0b58ccd
2bdfdda
dab6e40
7b4d2eb
1eff55d
e95813f
d445231
097b37e
a1cfd81
b36b947
a35da4f
4545832
1bf500b
7e1ff38
aaad8ca
a596b2d
6147494
769a573
71b0e2c
acc0066
9a75fac
c720f62
83d751b
afc1b46
b70deaa
3850f28
7fe2732
e72a650
f57f171
b3d63c6
93f72ad
10eb60b
6971f74
bda111b
1299951
a7dfb72
0cc20f2
9b95c91
d7581bf
a7e820a
b44731a
6dc8dcd
c3407f0
ee6cc76
96716d4
c63d142
7f22cd3
11ba5c5
e12cd33
a72ee93
4995572
e0803fe
353dcf9
7e6bdc5
c91988c
17e54e8
3411e13
236d29b
9476b04
163004a
4e35123
4791d73
d8923b1
5e97ba6
8a3ff36
fd89c32
17f3d59
59a3888
9ce771c
e6ecbaa
9fc0338
e835afc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -57,8 +57,12 @@ struct zms_ate { | |
| /** data field used to store small sized data */ | ||
| uint8_t data[8]; | ||
| struct { | ||
| /** data offset within sector */ | ||
| uint32_t offset; | ||
| union { | ||
| /** data offset within sector */ | ||
| uint32_t offset; | ||
| /** full cycle count (for empty ATE) */ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what does "full" indicate here? I think this is causing a bit of confusion for me.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. full as opposed to "modulo 256" that is normally stored in each ATE
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the cycle_cnt is truncated (only 8 bits) |
||
| uint32_t full_cycle_cnt; | ||
| }; | ||
| union { | ||
| /** | ||
| * crc for data: The data CRC is checked only when the whole data | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need to read all cycle_counts for all sectors ?
Reading the full_cycle_cnt of the current sector should be enough as it holds the maximum number of cycle_cnt.
I don't see scenarios where some closed sectors will have a full_cycle_cnt bigger than the current open sector.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it may happen if GC is interrupted and must be restarted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We increase the cycle only after erasing a sector which is the last operation after the GC has finished.
If the GC got interrupted, next time we won't find a GC_DONE ATE and we restart the GC, the cycle_cnt is increased only at the end.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But if you start copying entries from sector
N+1to sectorN, and GC is interrupted, then, after reboot, you must eraseNagain (even though this was erased before GC). This is what https://github.com/zephyrproject-rtos/zephyr/blob/main/subsys/fs/zms/zms.c#L1284 implements, no?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are right, we do this for the current sector and the next one, only in this case.
I will cherry-pick yours in my PR.
Please go ahead and push it upstream along with its documentation. It is a nice feature to have