<s>
The	O
Log-Structured	B-Application
File	I-Application
System	I-Application
(	O
or	O
LFS	O
)	O
is	O
an	O
implementation	O
of	O
a	O
log-structured	B-Application
file	I-Application
system	I-Application
(	O
a	O
concept	O
originally	O
proposed	O
and	O
implemented	O
by	O
John	O
Ousterhout	O
)	O
,	O
originally	O
developed	O
for	O
BSD	B-Operating_System
.	O
</s>
<s>
It	O
was	O
removed	O
from	O
FreeBSD	B-Operating_System
and	O
OpenBSD	B-Operating_System
;	O
the	O
NetBSD	B-Device
implementation	O
was	O
nonfunctional	O
until	O
work	O
leading	O
up	O
to	O
the	O
4.0	O
release	O
made	O
it	O
viable	O
again	O
as	O
a	O
production	O
file	O
system	O
.	O
</s>
<s>
Most	O
of	O
the	O
on-disk	O
format	O
of	O
LFS	O
is	O
borrowed	O
from	O
UFS	B-Operating_System
.	O
</s>
<s>
The	O
indirect	O
block	O
,	O
inode	B-Application
and	O
directory	O
formats	O
are	O
almost	O
identical	O
.	O
</s>
<s>
This	O
allows	O
well-tested	O
UFS	B-Operating_System
file	O
system	O
code	O
to	O
be	O
re-used	O
;	O
current	O
implementations	O
of	O
LFS	O
share	O
the	O
higher-level	O
UFS	B-Operating_System
code	O
with	O
the	O
lower-level	O
code	O
for	O
FFS	O
,	O
since	O
both	O
of	O
these	O
file	O
systems	O
share	O
much	O
in	O
common	O
with	O
UFS	B-Operating_System
.	O
</s>
<s>
Inodes	B-Application
updated	O
to	O
point	O
to	O
(	O
2	O
)	O
.	O
</s>
<s>
Inode	B-Application
map	O
blocks	O
updated	O
to	O
point	O
at	O
(	O
3	O
)	O
.	O
</s>
<s>
Unlike	O
UFS	B-Operating_System
,	O
inodes	B-Application
in	O
LFS	O
do	O
not	O
have	O
fixed	O
locations	O
.	O
</s>
<s>
An	O
inode	B-Application
mapa	O
flat	O
list	O
of	O
inode	B-Application
block	O
locationsis	O
used	O
to	O
track	O
them	O
.	O
</s>
<s>
As	O
with	O
everything	O
else	O
,	O
inode	B-Application
map	O
blocks	O
are	O
also	O
written	O
to	O
the	O
log	O
when	O
they	O
are	O
changed	O
.	O
</s>
<s>
The	O
LFS	O
garbage	B-General_Concept
collector	I-General_Concept
turns	O
dirty	O
segments	O
into	O
clean	O
ones	O
by	O
copying	O
live	O
blocks	O
from	O
the	O
dirty	O
segment	O
into	O
the	O
current	O
segment	O
and	O
skipping	O
the	O
rest	O
.	O
</s>
<s>
Generally	O
,	O
garbage	B-General_Concept
collection	I-General_Concept
is	O
delayed	O
until	O
there	O
are	O
no	O
clean	O
segments	O
left	O
;	O
it	O
can	O
also	O
be	O
deferred	O
for	O
when	O
the	O
system	O
is	O
idle	O
.	O
</s>
<s>
At	O
a	O
checkpoint	O
(	O
usually	O
scheduled	O
about	O
once	O
every	O
30	O
seconds	O
)	O
,	O
LFS	O
writes	O
the	O
last	O
known	O
block	O
locations	O
of	O
the	O
inode	B-Application
map	O
and	O
the	O
number	O
of	O
the	O
current	O
segment	O
to	O
a	O
checkpoint	O
region	O
at	O
a	O
fixed	O
place	O
on	O
disk	O
.	O
</s>
<s>
Once	O
written	O
,	O
a	O
checkpoint	O
represents	O
the	O
last	O
consistent	O
snapshot	B-Application
of	O
the	O
file	O
system	O
.	O
</s>
<s>
Recovery	O
after	O
a	O
crash	O
and	O
normal	O
mounting	B-Application
work	O
the	O
same	O
waythe	O
file	O
system	O
simply	O
reconstructs	O
its	O
state	O
from	O
the	O
last	O
checkpoint	O
and	O
resumes	O
logging	O
from	O
there	O
.	O
</s>
<s>
There	O
can	O
be	O
severe	O
file	B-Application
system	I-Application
fragmentation	I-Application
in	O
LFS	O
,	O
especially	O
for	O
slowly	O
growing	O
files	O
or	O
multiple	O
simultaneous	O
large	O
writes	O
.	O
</s>
<s>
This	O
inflicts	O
a	O
severe	O
performance	O
penalty	O
,	O
even	O
though	O
the	O
design	O
rationale	O
for	O
log-structured	B-Application
file	I-Application
systems	I-Application
assumes	O
disk	O
reads	O
will	O
mostly	O
be	O
cached	O
away	O
.	O
</s>
<s>
LFS	O
becomes	O
progressively	O
less	O
efficient	O
as	O
it	O
nears	O
maximum	O
capacity	O
,	O
when	O
the	O
garbage	B-General_Concept
collector	I-General_Concept
has	O
to	O
run	O
almost	O
constantly	O
to	O
make	O
clean	O
segments	O
available	O
.	O
</s>
<s>
LFS	O
does	O
not	O
allow	O
snapshotting	B-Application
or	O
versioning	O
,	O
even	O
though	O
both	O
features	O
are	O
trivial	O
to	O
implement	O
in	O
general	O
on	O
log-structured	B-Application
file	I-Application
systems	I-Application
.	O
</s>
