<s>
A	O
log-structured	B-Application
filesystem	I-Application
is	O
a	O
file	B-Application
system	I-Application
in	O
which	O
data	O
and	O
metadata	O
are	O
written	O
sequentially	O
to	O
a	O
circular	B-Data_Structure
buffer	I-Data_Structure
,	O
called	O
a	O
log	B-Application
.	O
</s>
<s>
The	O
design	O
was	O
first	O
proposed	O
in	O
1988	O
by	O
John	O
K	O
.	O
Ousterhout	O
and	O
Fred	O
Douglis	O
and	O
first	O
implemented	O
in	O
1992	O
by	O
Ousterhout	O
and	O
Mendel	O
Rosenblum	O
for	O
the	O
Unix-like	O
Sprite	B-Operating_System
distributed	O
operating	O
system	O
.	O
</s>
<s>
Conventional	O
file	B-Application
systems	I-Application
tend	O
to	O
lay	O
out	O
files	O
with	O
great	O
care	O
for	O
spatial	O
locality	O
and	O
make	O
in-place	O
changes	O
to	O
their	O
data	O
structures	O
in	O
order	O
to	O
perform	O
well	O
on	O
optical	O
and	O
magnetic	O
disks	O
,	O
which	O
tend	O
to	O
seek	O
relatively	O
slowly	O
.	O
</s>
<s>
The	O
design	O
of	O
log-structured	B-Application
file	I-Application
systems	I-Application
is	O
based	O
on	O
the	O
hypothesis	O
that	O
this	O
will	O
no	O
longer	O
be	O
effective	O
because	O
ever-increasing	O
memory	O
sizes	O
on	O
modern	O
computers	O
would	O
lead	O
to	O
I/O	O
becoming	O
write-heavy	O
because	O
reads	O
would	O
be	O
almost	O
always	O
satisfied	O
from	O
memory	O
cache	O
.	O
</s>
<s>
A	O
log-structured	B-Application
file	I-Application
system	I-Application
thus	O
treats	O
its	O
storage	O
as	O
a	O
circular	B-Data_Structure
log	I-Data_Structure
and	O
writes	O
sequentially	O
to	O
the	O
head	O
of	O
the	O
log	B-Application
.	O
</s>
<s>
Some	O
implementations	O
make	O
these	O
old	O
file	O
versions	O
nameable	O
and	O
accessible	O
,	O
a	O
feature	O
sometimes	O
called	O
time-travel	O
or	O
snapshotting	B-Application
.	O
</s>
<s>
This	O
is	O
very	O
similar	O
to	O
a	O
versioning	B-Application
file	I-Application
system	I-Application
.	O
</s>
<s>
Upon	O
its	O
next	O
mount	O
,	O
the	O
file	B-Application
system	I-Application
does	O
not	O
need	O
to	O
walk	O
all	O
its	O
data	O
structures	O
to	O
fix	O
any	O
inconsistencies	O
,	O
but	O
can	O
reconstruct	O
its	O
state	O
from	O
the	O
last	O
consistent	O
point	O
in	O
the	O
log	B-Application
.	O
</s>
<s>
Log-structured	B-Application
file	I-Application
systems	I-Application
,	O
however	O
,	O
must	O
reclaim	O
free	O
space	O
from	O
the	O
tail	O
of	O
the	O
log	B-Application
to	O
prevent	O
the	O
file	B-Application
system	I-Application
from	O
becoming	O
full	O
when	O
the	O
head	O
of	O
the	O
log	B-Application
wraps	O
around	O
to	O
meet	O
it	O
.	O
</s>
<s>
The	O
tail	O
can	O
release	O
space	O
and	O
move	O
forward	O
by	O
skipping	O
over	O
data	O
for	O
which	O
newer	O
versions	O
exist	O
farther	O
ahead	O
in	O
the	O
log	B-Application
.	O
</s>
<s>
To	O
reduce	O
the	O
overhead	O
incurred	O
by	O
this	O
garbage	B-General_Concept
collection	I-General_Concept
,	O
most	O
implementations	O
avoid	O
purely	O
circular	B-Data_Structure
logs	I-Data_Structure
and	O
divide	O
up	O
their	O
storage	O
into	O
segments	O
.	O
</s>
<s>
The	O
head	O
of	O
the	O
log	B-Application
simply	O
advances	O
into	O
non-adjacent	O
segments	O
which	O
are	O
already	O
free	O
.	O
</s>
<s>
This	O
decreases	O
the	O
I/O	O
load	O
(	O
and	O
decreases	O
the	O
write	B-Error_Name
amplification	I-Error_Name
)	O
of	O
the	O
garbage	B-General_Concept
collector	I-General_Concept
,	O
but	O
becomes	O
increasingly	O
ineffective	O
as	O
the	O
file	B-Application
system	I-Application
fills	O
up	O
and	O
nears	O
capacity	O
.	O
</s>
<s>
The	O
design	O
rationale	O
for	O
log-structured	B-Application
file	I-Application
systems	I-Application
assumes	O
that	O
most	O
reads	O
will	O
be	O
optimized	O
away	O
by	O
ever-enlarging	O
memory	O
caches	O
.	O
</s>
<s>
On	O
magnetic	O
media	O
—	O
where	O
seeks	O
are	O
relatively	O
expensive	O
—	O
the	O
log	B-Application
structure	O
may	O
actually	O
make	O
reads	O
much	O
slower	O
,	O
since	O
it	O
fragments	O
files	O
that	O
conventional	O
file	B-Application
systems	I-Application
normally	O
keep	O
contiguous	O
with	O
in-place	O
writes	O
.	O
</s>
<s>
On	O
flash	B-Device
memory	I-Device
—	O
where	O
seek	O
times	O
are	O
usually	O
negligible	O
—	O
the	O
log	B-Application
structure	O
may	O
not	O
confer	O
a	O
worthwhile	O
performance	O
gain	O
because	O
write	O
fragmentation	O
has	O
much	O
less	O
of	O
an	O
impact	O
on	O
write	O
throughput	O
.	O
</s>
<s>
Another	O
issue	O
is	O
stacking	O
one	O
log	B-Application
on	O
top	O
of	O
another	O
log	B-Application
,	O
which	O
is	O
n't	O
a	O
very	O
good	O
idea	O
as	O
it	O
forces	O
multiple	O
erases	O
with	O
unaligned	O
access	O
.	O
</s>
<s>
However	O
many	O
flash	O
based	O
devices	O
cannot	O
rewrite	O
part	O
of	O
a	O
block	O
,	O
and	O
they	O
must	O
first	O
perform	O
a	O
(	O
slow	O
)	O
erase	O
cycle	O
of	O
each	O
block	O
before	O
being	O
able	O
to	O
re-write	O
,	O
so	O
by	O
putting	O
all	O
the	O
writes	O
in	O
one	O
block	O
,	O
this	O
can	O
help	O
performance	O
as	O
opposed	O
to	O
writes	O
scattered	O
into	O
various	O
blocks	O
,	O
each	O
one	O
of	O
which	O
must	O
be	O
copied	O
into	O
a	O
buffer	O
,	O
erased	O
,	O
and	O
written	O
back	O
,	O
which	O
is	O
a	O
clear	O
advantage	O
for	O
so-called	O
"	O
raw	O
"	O
flash	B-Device
memory	I-Device
where	O
flash	O
translation	O
layer	O
is	O
bypassed	O
.	O
</s>
