Thanks for the replies to my questions of some time ago, and now
some more questions.
I have become interested in the subject of preallocation, which
I suspect is particularly important for a filesystem with
extents and a buddy system free list.
Having thought about it, the use of a buddy system for file
space allocation seems a particularly good idea, because the one
or two big problem of the buddy system for memory allocation are
not relevant for files.
But it can be less optimal if files are written piecemeal.
What I want to know is how a common case like extracting a
number of files from a 'tar' archive works, in particular
in terms of preallocation and how many extents result.
So some questions about JFS as it is now:
* How to see how many extents of which size have been allocated
to an inode from the command line?
* How to list the free list from the command line?
* Suppose a filesystem is empty, and 'tar' extracts to it an
8MiB file, writing 32KiB blocks. How many extents will it
span? After it has been written, what will the free list
look like?
* How to preallocate space? As in, allocate to a file much more
space than its size. For example, when writing to a file it
may be known in advance that it will take 8MiB ('cp', 'tar',
'wget', ...), so create the file with a size of 0 but 8MiB
allocated.
* Would 'ftruncate'(2) (or the mythical 'posix_fallocate'(2))
with an argument greater than the size of the file do a
preallocation as per X/Open? It does not seem so now as in
'jfs_truncate_nolock()' the test looks like '(newsize >
length)'.
http://WWW.OpenGroup.org/onlinepubs/009695399/functions/ftruncate.html
http://WWW.OpenGroup.org/onlinepubs/009695399/functions/posix_fallocate.html
* How hard would it be to add global and/or per-filesystem
(permanent or at mount time) tunables to set:
- a minimum extent size? for example to ensure that no extent
smaller than 1MiB is allocated? The purpose is to ensure
that files tend to be contiguous.
- alternatively, a default minimum extent size? So that the
extents are initially allocated of that size, but can be
reduced by 'close'(2) or 'ftruncate'(2) to the actual size
of the file. For example so that when extracting from 'tar'
a minimum extent size of say 256KiB is used, but when the
file is closed or truncated the last extent can get chopped
to less than that.
- a maximum extent size? For example to ensure that no extent
larger than 256KiB is ever allocated? The purpose is to
minimize internal fragmentation by allocating only at the
lower levels of the buddy system.
I hope that the rationales are fairly clear; part of that is to
short circuit when possioble the somewhat hairy ''hint'' related
logic in 'jfs_dmap.c' and that in 'jfs_open()' for example.
While these are common strategies, I suspect that preallocation
of one form or another is better as he above may impair locality.
I have also noticed 'XAD_NOTRECORDED' that seems to indicate
that preallocation is indeed being done or at least anticipated.
-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
_______________________________________________
Jfs-discussion mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jfs-discussion