Skip to content

Commit 3457252

Browse files
aldotgeky
authored andcommitted
doc: Spelling fixes
1 parent 1fb6a19 commit 3457252

File tree

3 files changed

+28
-28
lines changed

3 files changed

+28
-28
lines changed

DESIGN.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ to three strong requirements:
7272

7373
## Existing designs?
7474

75-
There are of course, many different existing filesystem. Heres a very rough
75+
There are of course, many different existing filesystem. Here is a very rough
7676
summary of the general ideas behind some of them.
7777

7878
Most of the existing filesystems fall into the one big category of filesystem
@@ -91,7 +91,7 @@ the changes to the files are stored on disk. This has several neat advantages,
9191
such as the fact that the data is written in a cyclic log format naturally
9292
wear levels as a side effect. And, with a bit of error detection, the entire
9393
filesystem can easily be designed to be resilient to power loss. The
94-
journalling component of most modern day filesystems is actually a reduced
94+
journaling component of most modern day filesystems is actually a reduced
9595
form of a logging filesystem. However, logging filesystems have a difficulty
9696
scaling as the size of storage increases. And most filesystems compensate by
9797
caching large parts of the filesystem in RAM, a strategy that is unavailable
@@ -114,7 +114,7 @@ pairs, so that at any time there is always a backup containing the previous
114114
state of the metadata.
115115

116116
Consider a small example where each metadata pair has a revision count,
117-
a number as data, and the xor of the block as a quick checksum. If
117+
a number as data, and the XOR of the block as a quick checksum. If
118118
we update the data to a value of 9, and then to a value of 5, here is
119119
what the pair of blocks may look like after each update:
120120
```
@@ -149,7 +149,7 @@ check our checksum we notice that block 1 was corrupted. So we fall back to
149149
block 2 and use the value 9.
150150

151151
Using this concept, the littlefs is able to update metadata blocks atomically.
152-
There are a few other tweaks, such as using a 32 bit crc and using sequence
152+
There are a few other tweaks, such as using a 32 bit CRC and using sequence
153153
arithmetic to handle revision count overflow, but the basic concept
154154
is the same. These metadata pairs define the backbone of the littlefs, and the
155155
rest of the filesystem is built on top of these atomic updates.
@@ -289,15 +289,15 @@ The path to data block 0 is even more quick, requiring only two jumps:
289289

290290
We can find the runtime complexity by looking at the path to any block from
291291
the block containing the most pointers. Every step along the path divides
292-
the search space for the block in half. This gives us a runtime of O(logn).
292+
the search space for the block in half. This gives us a runtime of O(log n).
293293
To get to the block with the most pointers, we can perform the same steps
294-
backwards, which puts the runtime at O(2logn) = O(logn). The interesting
294+
backwards, which puts the runtime at O(2 log n) = O(log n). The interesting
295295
part about this data structure is that this optimal path occurs naturally
296296
if we greedily choose the pointer that covers the most distance without passing
297297
our target block.
298298

299299
So now we have a representation of files that can be appended trivially with
300-
a runtime of O(1), and can be read with a worst case runtime of O(nlogn).
300+
a runtime of O(1), and can be read with a worst case runtime of O(n log n).
301301
Given that the the runtime is also divided by the amount of data we can store
302302
in a block, this is pretty reasonable.
303303

@@ -362,7 +362,7 @@ N = file size in bytes
362362

363363
And this works quite well, but is not trivial to calculate. This equation
364364
requires O(n) to compute, which brings the entire runtime of reading a file
365-
to O(n^2logn). Fortunately, the additional O(n) does not need to touch disk,
365+
to O(n^2 log n). Fortunately, the additional O(n) does not need to touch disk,
366366
so it is not completely unreasonable. But if we could solve this equation into
367367
a form that is easily computable, we can avoid a big slowdown.
368368

@@ -383,7 +383,7 @@ ctz(i) = the number of trailing bits that are 0 in i
383383
popcount(i) = the number of bits that are 1 in i
384384

385385
It's a bit bewildering that these two seemingly unrelated bitwise instructions
386-
are related by this property. But if we start to disect this equation we can
386+
are related by this property. But if we start to dissect this equation we can
387387
see that it does hold. As n approaches infinity, we do end up with an average
388388
overhead of 2 pointers as we find earlier. And popcount seems to handle the
389389
error from this average as it accumulates in the CTZ skip-list.
@@ -503,7 +503,7 @@ However, this approach had several issues:
503503
- There was a lot of nuanced logic for adding blocks to the free list without
504504
modifying the blocks, since the blocks remain active until the metadata is
505505
updated.
506-
- The free list had to support both additions and removals in fifo order while
506+
- The free list had to support both additions and removals in FIFO order while
507507
minimizing block erases.
508508
- The free list had to handle the case where the file system completely ran
509509
out of blocks and may no longer be able to add blocks to the free list.
@@ -622,7 +622,7 @@ So, as a solution, the littlefs adopted a sort of threaded tree. Each
622622
directory not only contains pointers to all of its children, but also a
623623
pointer to the next directory. These pointers create a linked-list that
624624
is threaded through all of the directories in the filesystem. Since we
625-
only use this linked list to check for existance, the order doesn't actually
625+
only use this linked list to check for existence, the order doesn't actually
626626
matter. As an added plus, we can repurpose the pointer for the individual
627627
directory linked-lists and avoid using any additional space.
628628

@@ -773,7 +773,7 @@ deorphan step that simply iterates through every directory in the linked-list
773773
and checks it against every directory entry in the filesystem to see if it
774774
has a parent. The deorphan step occurs on the first block allocation after
775775
boot, so orphans should never cause the littlefs to run out of storage
776-
prematurely. Note that the deorphan step never needs to run in a readonly
776+
prematurely. Note that the deorphan step never needs to run in a read-only
777777
filesystem.
778778

779779
## The move problem
@@ -883,7 +883,7 @@ a power loss will occur during filesystem activity. We still need to handle
883883
the condition, but runtime during a power loss takes a back seat to the runtime
884884
during normal operations.
885885

886-
So what littlefs does is unelegantly simple. When littlefs moves a file, it
886+
So what littlefs does is inelegantly simple. When littlefs moves a file, it
887887
marks the file as "moving". This is stored as a single bit in the directory
888888
entry and doesn't take up much space. Then littlefs moves the directory,
889889
finishing with the complete remove of the "moving" directory entry.
@@ -979,7 +979,7 @@ if it exists elsewhere in the filesystem.
979979
So now that we have all of the pieces of a filesystem, we can look at a more
980980
subtle attribute of embedded storage: The wear down of flash blocks.
981981

982-
The first concern for the littlefs, is that prefectly valid blocks can suddenly
982+
The first concern for the littlefs, is that perfectly valid blocks can suddenly
983983
become unusable. As a nice side-effect of using a COW data-structure for files,
984984
we can simply move on to a different block when a file write fails. All
985985
modifications to files are performed in copies, so we will only replace the
@@ -1210,7 +1210,7 @@ So, to summarize:
12101210
metadata block is active
12111211
4. Directory blocks contain either references to other directories or files
12121212
5. Files are represented by copy-on-write CTZ skip-lists which support O(1)
1213-
append and O(nlogn) reading
1213+
append and O(n log n) reading
12141214
6. Blocks are allocated by scanning the filesystem for used blocks in a
12151215
fixed-size lookahead region is that stored in a bit-vector
12161216
7. To facilitate scanning the filesystem, all directories are part of a

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ of memory. Recursion is avoided and dynamic memory is limited to configurable
1616
buffers that can be provided statically.
1717

1818
**Power-loss resilient** - The littlefs is designed for systems that may have
19-
random power failures. The littlefs has strong copy-on-write guaruntees and
19+
random power failures. The littlefs has strong copy-on-write guarantees and
2020
storage on disk is always kept in a valid state.
2121

2222
**Wear leveling** - Since the most common form of embedded storage is erodible
@@ -88,7 +88,7 @@ int main(void) {
8888
## Usage
8989
9090
Detailed documentation (or at least as much detail as is currently available)
91-
can be cound in the comments in [lfs.h](lfs.h).
91+
can be found in the comments in [lfs.h](lfs.h).
9292
9393
As you may have noticed, littlefs takes in a configuration structure that
9494
defines how the filesystem operates. The configuration struct provides the
@@ -101,12 +101,12 @@ to the user to allocate, allowing multiple filesystems to be in use
101101
simultaneously. With the `lfs_t` and configuration struct, a user can
102102
format a block device or mount the filesystem.
103103
104-
Once mounted, the littlefs provides a full set of posix-like file and
104+
Once mounted, the littlefs provides a full set of POSIX-like file and
105105
directory functions, with the deviation that the allocation of filesystem
106106
structures must be provided by the user.
107107
108-
All posix operations, such as remove and rename, are atomic, even in event
109-
of power-loss. Additionally, no file updates are actually commited to the
108+
All POSIX operations, such as remove and rename, are atomic, even in event
109+
of power-loss. Additionally, no file updates are actually committed to the
110110
filesystem until sync or close is called on the file.
111111
112112
## Other notes
@@ -131,9 +131,9 @@ with all the nitty-gritty details. Can be useful for developing tooling.
131131
132132
## Testing
133133
134-
The littlefs comes with a test suite designed to run on a pc using the
134+
The littlefs comes with a test suite designed to run on a PC using the
135135
[emulated block device](emubd/lfs_emubd.h) found in the emubd directory.
136-
The tests assume a linux environment and can be started with make:
136+
The tests assume a Linux environment and can be started with make:
137137
138138
``` bash
139139
make test

SPEC.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Here's the layout of metadata blocks on disk:
4646
| 0x04 | 32 bits | dir size |
4747
| 0x08 | 64 bits | tail pointer |
4848
| 0x10 | size-16 bytes | dir entries |
49-
| 0x00+s | 32 bits | crc |
49+
| 0x00+s | 32 bits | CRC |
5050

5151
**Revision count** - Incremented every update, only the uncorrupted
5252
metadata-block with the most recent revision count contains the valid metadata.
@@ -75,7 +75,7 @@ Here's an example of a simple directory stored on disk:
7575
(32 bits) revision count = 10 (0x0000000a)
7676
(32 bits) dir size = 154 bytes, end of dir (0x0000009a)
7777
(64 bits) tail pointer = 37, 36 (0x00000025, 0x00000024)
78-
(32 bits) crc = 0xc86e3106
78+
(32 bits) CRC = 0xc86e3106
7979
8080
00000000: 0a 00 00 00 9a 00 00 00 25 00 00 00 24 00 00 00 ........%...$...
8181
00000010: 22 08 00 03 05 00 00 00 04 00 00 00 74 65 61 22 "...........tea"
@@ -138,12 +138,12 @@ not include the entry type size, attributes, or name. The full size in bytes
138138
of the entry is 4 + entry length + attribute length + name length.
139139

140140
**Attribute length** - Length of system-specific attributes in bytes. Since
141-
attributes are system specific, there is not much garuntee on the values in
141+
attributes are system specific, there is not much guarantee on the values in
142142
this section, and systems are expected to work even when it is empty. See the
143143
[attributes](#entry-attributes) section for more details.
144144

145-
**Name length** - Length of the entry name. Entry names are stored as utf8,
146-
although most systems will probably only support ascii. Entry names can not
145+
**Name length** - Length of the entry name. Entry names are stored as UTF8,
146+
although most systems will probably only support ASCII. Entry names can not
147147
contain '/' and can not be '.' or '..' as these are a part of the syntax of
148148
filesystem paths.
149149

@@ -222,7 +222,7 @@ Here's an example of a complete superblock:
222222
(32 bits) block count = 1024 blocks (0x00000400)
223223
(32 bits) version = 1.1 (0x00010001)
224224
(8 bytes) magic string = littlefs
225-
(32 bits) crc = 0xc50b74fa
225+
(32 bits) CRC = 0xc50b74fa
226226
227227
00000000: 03 00 00 00 34 00 00 00 03 00 00 00 02 00 00 00 ....4...........
228228
00000010: 2e 14 00 08 03 00 00 00 02 00 00 00 00 02 00 00 ................

0 commit comments

Comments
 (0)