<s>
F2FS	B-Application
(	O
Flash-Friendly	B-Application
File	I-Application
System	I-Application
)	O
is	O
a	O
flash	B-Application
file	I-Application
system	I-Application
initially	O
developed	O
by	O
Samsung	O
Electronics	O
for	O
the	O
Linux	B-Operating_System
kernel	I-Operating_System
.	O
</s>
<s>
The	O
motive	O
for	O
F2FS	B-Application
was	O
to	O
build	O
a	O
file	B-Application
system	I-Application
that	O
,	O
from	O
the	O
start	O
,	O
takes	O
into	O
account	O
the	O
characteristics	O
of	O
NAND	O
flash	O
memory-based	O
storage	O
devices	O
(	O
such	O
as	O
solid-state	B-Device
disks	I-Device
,	O
eMMC	O
,	O
and	O
SD	B-Device
cards	I-Device
)	O
,	O
which	O
are	O
widely	O
used	O
in	O
computer	O
systems	O
ranging	O
from	O
mobile	O
devices	O
to	O
servers	O
.	O
</s>
<s>
F2FS	B-Application
was	O
designed	O
on	O
a	O
basis	O
of	O
a	O
log-structured	B-Application
file	I-Application
system	I-Application
approach	O
,	O
which	O
is	O
adapted	O
to	O
newer	O
forms	O
of	O
storage	O
.	O
</s>
<s>
Jaegeuk	O
Kim	O
,	O
the	O
principal	O
F2FS	B-Application
author	O
,	O
has	O
stated	O
that	O
it	O
remedies	O
some	O
known	O
issues	O
of	O
the	O
older	O
log-structured	B-Application
file	I-Application
systems	I-Application
,	O
such	O
as	O
the	O
snowball	O
effect	O
of	O
wandering	O
trees	O
and	O
high	O
cleaning	O
overhead	O
.	O
</s>
<s>
Note	O
,	O
that	O
by	O
default	O
F2FS	B-Application
uses	O
"	O
posix	O
"	O
fsync	O
scheme	O
,	O
which	O
carries	O
higher	O
risks	O
of	O
leaving	O
the	O
file	B-Application
system	I-Application
in	O
dirty	O
state	O
during	O
unclean	O
shutdown	O
(	O
as	O
it	O
does	O
not	O
guarantee	O
atomicity	B-General_Concept
of	O
write	O
operations	O
)	O
at	O
the	O
benefit	O
of	O
better	O
performance	O
.	O
</s>
<s>
F2FS	B-Application
divides	O
the	O
whole	O
volume	O
into	O
a	O
number	O
of	O
segments	O
,	O
each	O
of	O
which	O
is	O
fixed	O
at	O
2MB	O
.	O
</s>
<s>
F2FS	B-Application
splits	O
the	O
entire	O
volume	O
into	O
six	O
areas	O
,	O
and	O
all	O
except	O
the	O
superblock	O
area	O
consist	O
of	O
multiple	O
segments	O
as	O
described	O
below	O
.	O
</s>
<s>
There	O
are	O
two	O
copies	O
to	O
avoid	O
file-system	B-Application
corruption	O
.	O
</s>
<s>
It	O
contains	O
basic	O
partition	O
information	O
and	O
some	O
default	O
F2FS	B-Application
parameters	O
.	O
</s>
<s>
The	O
CP	O
contains	O
file	B-Application
system	I-Application
information	O
,	O
bitmaps	O
for	O
valid	O
NAT/SIT	O
sets	O
,	O
orphan	O
inode	B-Application
lists	O
,	O
and	O
summary	O
entries	O
of	O
current	O
active	O
segments	O
.	O
</s>
<s>
In	O
order	O
to	O
avoid	O
misalignment	O
between	O
file	B-Application
system	I-Application
and	O
flash	O
storage	O
,	O
F2FS	B-Application
aligns	O
the	O
start	O
block	O
address	O
of	O
the	O
CP	O
with	O
the	O
segment	O
size	O
.	O
</s>
<s>
F2FS	B-Application
uses	O
the	O
checkpoint	O
scheme	O
to	O
maintain	O
file	B-Application
system	I-Application
integrity	O
.	O
</s>
<s>
At	O
mount	O
time	O
,	O
F2FS	B-Application
first	O
tries	O
to	O
find	O
the	O
last	O
valid	O
checkpoint	O
data	O
by	O
scanning	O
the	O
CP	O
area	O
.	O
</s>
<s>
In	O
order	O
to	O
reduce	O
the	O
scanning	O
time	O
,	O
F2FS	B-Application
uses	O
only	O
two	O
copies	O
of	O
the	O
CP	O
.	O
</s>
<s>
For	O
file	B-Application
system	I-Application
consistency	O
,	O
each	O
CP	O
points	O
to	O
which	O
NAT	O
and	O
SIT	O
copies	O
are	O
valid	O
.	O
</s>
<s>
Similar	O
to	O
traditional	O
file	O
structures	O
,	O
F2FS	B-Application
has	O
three	O
types	O
of	O
nodes	O
:	O
inode	B-Application
,	O
direct	O
node	O
,	O
indirect	O
node	O
.	O
</s>
<s>
F2FS	B-Application
assigns	O
4KB	O
to	O
an	O
inode	B-Application
block	O
which	O
contains	O
923	O
data	O
block	O
indices	O
,	O
two	O
direct	O
node	O
pointers	O
,	O
two	O
indirect	O
node	O
pointers	O
,	O
and	O
one	O
double	O
indirect	O
node	O
pointer	O
as	O
described	O
below	O
.	O
</s>
<s>
Thus	O
,	O
one	O
inode	B-Application
block	O
(	O
i.e.	O
,	O
a	O
file	O
)	O
covers	O
:	O
</s>
<s>
To	O
mitigate	O
the	O
wandering	O
tree	O
problem	O
,	O
F2FS	B-Application
is	O
able	O
to	O
cut	O
off	O
the	O
propagation	O
of	O
node	O
updates	O
caused	O
by	O
leaf	O
data	O
writes	O
.	O
</s>
<s>
+	O
A	O
directory	O
entry	O
structure	O
hash	O
Hash	O
value	O
of	O
the	O
file	O
name	O
ino	O
Inode	B-Application
number	I-Application
len	O
The	O
length	O
of	O
file	O
name	O
type	O
File	O
type	O
such	O
as	O
directory	O
,	O
symlink	O
,	O
etc	O
.	O
</s>
<s>
F2FS	B-Application
implements	O
multi-level	O
hash	O
tables	O
for	O
the	O
directory	O
structure	O
.	O
</s>
<s>
When	O
F2FS	B-Application
finds	O
a	O
file	O
name	O
in	O
a	O
directory	O
,	O
first	O
a	O
hash	O
value	O
of	O
the	O
file	O
name	O
is	O
calculated	O
.	O
</s>
<s>
Then	O
,	O
F2FS	B-Application
scans	O
the	O
hash	O
table	O
in	O
level	O
#0	O
to	O
find	O
the	O
dentry	O
consisting	O
of	O
the	O
file	O
name	O
and	O
its	O
inode	B-Application
number	I-Application
.	O
</s>
<s>
If	O
not	O
found	O
,	O
F2FS	B-Application
scans	O
the	O
next	O
hash	O
table	O
in	O
level	O
#1	O
.	O
</s>
<s>
In	O
this	O
way	O
,	O
F2FS	B-Application
scans	O
hash	O
tables	O
in	O
each	O
level	O
incrementally	O
from	O
1	O
to	O
N	O
.	O
In	O
each	O
level	O
F2FS	B-Application
needs	O
to	O
scan	O
only	O
one	O
bucket	O
determined	O
by	O
the	O
following	O
equation	O
,	O
which	O
shows	O
O( log( #	O
of	O
files	O
)	O
)	O
complexity	O
.	O
</s>
<s>
In	O
the	O
case	O
of	O
file	O
creation	O
,	O
F2FS	B-Application
finds	O
empty	O
consecutive	O
slots	O
that	O
cover	O
the	O
file	O
name	O
.	O
</s>
<s>
F2FS	B-Application
searches	O
the	O
empty	O
slots	O
in	O
the	O
hash	O
tables	O
of	O
whole	O
levels	O
from	O
1	O
to	O
N	O
in	O
the	O
same	O
way	O
as	O
the	O
lookup	O
operation	O
.	O
</s>
<s>
At	O
runtime	O
,	O
F2FS	B-Application
manages	O
six	O
active	O
logs	O
inside	O
the	O
"	O
Main	O
Area	O
:	O
"	O
Hot/Warm/Cold	O
node	O
and	O
Hot/Warm/Cold	O
data	O
.	O
</s>
<s>
F2FS	B-Application
adopts	O
a	O
hybrid	O
scheme	O
where	O
the	O
copy-and-compaction	O
scheme	O
is	O
adopted	O
by	O
default	O
,	O
but	O
the	O
policy	O
is	O
dynamically	O
changed	O
to	O
the	O
threaded	O
log	O
scheme	O
according	O
to	O
the	O
file	B-Application
system	I-Application
status	O
.	O
</s>
<s>
In	O
order	O
to	O
align	O
F2FS	B-Application
with	O
underlying	O
flash-based	O
storage	O
,	O
F2FS	B-Application
allocates	O
a	O
segment	O
in	O
a	O
unit	O
of	O
a	O
section	O
.	O
</s>
<s>
F2FS	B-Application
expects	O
the	O
section	O
size	O
to	O
be	O
the	O
same	O
as	O
the	O
garbage	O
collection	O
unit	O
size	O
in	O
FTL	O
.	O
</s>
<s>
With	O
respect	O
to	O
the	O
mapping	O
granularity	O
in	O
FTL	O
,	O
F2FS	B-Application
allocates	O
each	O
section	O
of	O
the	O
active	O
logs	O
to	O
as	O
many	O
different	O
zones	O
as	O
possible	O
.	O
</s>
<s>
F2FS	B-Application
does	O
cleaning	O
both	O
on	O
demand	O
,	O
and	O
in	O
the	O
background	O
.	O
</s>
<s>
The	O
background	O
cleaner	O
is	O
executed	O
by	O
a	O
kernel	B-Operating_System
thread	O
,	O
and	O
triggers	O
the	O
cleaning	O
job	O
when	O
the	O
system	O
is	O
idle	O
.	O
</s>
<s>
F2FS	B-Application
supports	O
two	O
victim	O
selection	O
policies	O
:	O
greedy	O
,	O
and	O
cost-benefit	O
algorithms	O
.	O
</s>
<s>
In	O
the	O
greedy	O
algorithm	O
,	O
F2FS	B-Application
selects	O
a	O
victim	O
segment	O
having	O
the	O
smallest	O
number	O
of	O
valid	O
blocks	O
.	O
</s>
<s>
In	O
the	O
cost-benefit	O
algorithm	O
,	O
F2FS	B-Application
selects	O
a	O
victim	O
segment	O
according	O
to	O
the	O
segment	O
age	O
and	O
the	O
number	O
of	O
valid	O
blocks	O
in	O
order	O
to	O
address	O
the	O
log	O
block	O
thrashing	O
problem	O
present	O
in	O
the	O
greedy	O
algorithm	O
.	O
</s>
<s>
F2FS	B-Application
uses	O
the	O
greedy	O
algorithm	O
for	O
on-demand	O
cleaning	O
,	O
the	O
background	O
cleaner	O
uses	O
the	O
cost-benefit	O
algorithm	O
.	O
</s>
<s>
In	O
order	O
to	O
identify	O
whether	O
the	O
data	O
in	O
the	O
victim	O
segment	O
are	O
valid	O
or	O
not	O
,	O
F2FS	B-Application
manages	O
a	O
bitmap	O
.	O
</s>
<s>
Motorola	O
Mobility	O
has	O
used	O
F2FS	B-Application
in	O
their	O
Moto	O
G/E/X	O
and	O
Droid	O
phones	O
since	O
2012	O
.	O
</s>
<s>
Google	B-Application
first	O
used	O
F2FS	B-Application
in	O
their	O
Nexus	B-Device
9	I-Device
in	O
2014	O
.	O
</s>
<s>
However	O
Google	B-Application
's	I-Application
other	O
products	O
did	O
n't	O
adopt	O
F2FS	B-Application
until	O
the	O
Pixel	B-Device
3	I-Device
when	O
F2FS	B-Application
was	O
updated	O
with	O
inline	O
crypto	O
hardware	O
support	O
.	O
</s>
<s>
Huawei	O
has	O
used	O
F2FS	B-Application
since	O
the	O
Huawei	O
P9	O
in	O
2016	O
.	O
</s>
<s>
OnePlus	O
has	O
used	O
F2FS	B-Application
in	O
the	O
OnePlus	O
3T	O
.	O
</s>
<s>
ZTE	O
has	O
used	O
F2FS	B-Application
since	O
the	O
ZTE	O
Axon	O
10	O
Pro	O
in	O
2019	O
.	O
</s>
<s>
Arch	O
Linux	B-Operating_System
and	O
Gentoo	B-Application
Linux	I-Application
support	O
F2FS	B-Application
,	O
Debian	O
supports	O
it	O
from	O
version	O
10	O
upwards	O
as	O
well	O
.	O
</s>
