]> CyberLeo.Net >> Repos - FreeBSD/stable/9.git/commit
MFC of 242520:
authormckusick <mckusick@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Mon, 22 Apr 2013 23:59:00 +0000 (23:59 +0000)
committermckusick <mckusick@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Mon, 22 Apr 2013 23:59:00 +0000 (23:59 +0000)
commit7f42bbfd1ed5d4f84dd3fd2cacdacb39168f2f27
tree146c040ae82939f684e52667de3910faf6f84c67
parent0ce48da0b9122cf269985fd89fe95735d87a2ad6
MFC of 242520:

When a file is first being written, the dynamic block reallocation
(implemented by ffs_reallocblks_ufs[12]) relocates the file's blocks
so as to cluster them together into a contiguous set of blocks on
the disk.

When the cluster crosses the boundary into the first indirect block,
the first indirect block is initially allocated in a position
immediately following the last direct block.  Block reallocation
would usually destroy locality by moving the indirect block out of
the way to keep the data blocks contiguous.  This change compensates
for this problem by noting that the first indirect block should be
left immediately following the last direct block.  It then tries
to start a new cluster of contiguous blocks (referenced by the
indirect block) immediately following the indirect block.

We should also do this for other indirect block boundaries, but it
is only important for the first one.

Suggested by: Bruce Evans

MFC of 248623:

The purpose of this change to the FFS layout policy is to reduce the
running time for a full fsck. It also reduces the random access time
for large files and speeds the traversal time for directory tree walks.

The key idea is to reserve a small area in each cylinder group
immediately following the inode blocks for the use of metadata,
specifically indirect blocks and directory contents. The new policy
is to preferentially place metadata in the metadata area and
everything else in the blocks that follow the metadata area.

The size of this area can be set when creating a filesystem using
newfs(8) or changed in an existing filesystem using tunefs(8).
Both utilities use the `-k held-for-metadata-blocks' option to
specify the amount of space to be held for metadata blocks in each
cylinder group. By default, newfs(8) sets this area to half of
minfree (typically 4% of the data area).

This work was inspired by a paper presented at Usenix's FAST '13:
www.usenix.org/conference/fast13/ffsck-fast-file-system-checker

Details of this implementation appears in the April 2013 of ;login:
www.usenix.org/publications/login/april-2013-volume-38-number-2.
A copy of the April 2013 ;login: paper can also be downloaded
from: www.mckusick.com/publications/faster_fsck.pdf.

Reviewed by: kib
Tested by:   Peter Holm

git-svn-id: svn://svn.freebsd.org/base/stable/9@249782 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
sys/ufs/ffs/ffs_alloc.c
sys/ufs/ffs/ffs_balloc.c
sys/ufs/ffs/fs.h