[lkml]   [2007]   [May]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    Subject[PATCH 0/5][TAKE2] fallocate system call
    This is the new set of patches which take care of the review comments
    received from the community (mainly from Andrew).

    fallocate() is a new system call being proposed here which will allow
    applications to preallocate space to any file(s) in a file system.
    Each file system implementation that wants to use this feature will need
    to support an inode operation called fallocate.

    Applications can use this feature to avoid fragmentation to certain
    level and thus get faster access speed. With preallocation, applications
    also get a guarantee of space for particular file(s) - even if later the
    the system becomes full.

    Currently, glibc provides an interface called posix_fallocate() which
    can be used for similar cause. Though this has the advantage of working
    on all file systems, but it is quite slow (since it writes zeroes to
    each block that has to be preallocated). Without a doubt, file systems
    can do this more efficiently within the kernel, by implementing
    the proposed fallocate() system call. It is expected that
    posix_fallocate() will be modified to call this new system call first
    and incase the kernel/filesystem does not implement it, it should fall
    back to the current implementation of writing zeroes to the new blocks.

    The proposed system call's layout is:

    asmlinkage long sys_fallocate(int fd, int mode, loff_t offset, loff_t len)

    fd: The descriptor of the open file.

    mode*: This specifies the behavior of the system call. Currently the
    system call supports two modes - FA_ALLOCATE and FA_DEALLOCATE.
    FA_ALLOCATE: Applications can use this mode to preallocate blocks to
    a given file (specified by fd). This mode changes the file size if
    the preallocation is done beyond the EOF. It also updates the
    ctime/mtime in the inode of the corresponding file, marking a
    successfull allocation.
    FA_DEALLOCATE: This mode can be used by applications to deallocate the
    previously preallocated blocks. This also may change the file size
    and the ctime/mtime.
    * New modes might get added in future. One such new mode which is
    already under discussion is FA_PREALLOCATE, which when used will
    preallocate space but will not change the filesize and [cm]time.
    Since the semantics of this new mode is not clear and agreed upon yet,
    this patchset does not implement it currently.

    offset: This is the offset in bytes, from where the preallocation should

    len: This is the number of bytes requested for preallocation (from

    sys_fallocate() on s390:
    There is a problem with s390 ABI to implement sys_fallocate() with the
    proposed order of arguments. Martin Schwidefsky has suggested a patch to
    solve this problem which makes use of a wrapper in the kernel. This will
    require special handling of this system call on s390 in glibc as well.
    But, this seems to be the best solution so far.

    Known Problem:
    mmapped writes into uninitialized extents is a known problem with the
    current ext4 patches. Like XFS, ext4 may need to implement
    ->page_mkwrite() to solve this. See:

    Since there is a talk of ->fault() replacing ->page_mkwrite() and also
    with a generic block_page_mkwrite() implementation already posted, we
    can implement this later some time. See:

    1> Implementation on other architectures (other than i386, x86_64,
    ppc64 and s390(x)). David Chinner has already posted a patch for ia64.
    2> A generic file system operation to handle fallocate
    (generic_fallocate), for filesystems that do _not_ have the fallocate
    inode operation implemented.
    3> Changes to glibc,
    a) to support fallocate() system call
    b) to make posix_fallocate() and posix_fallocate64() call fallocate()

    Each post will have an individual changelog for the particular patch.
    Following posts with patches follow:

    Patch 1/5 : fallocate() implementation on i86, x86_64 and powerpc
    Patch 2/5 : fallocate() on s390
    Patch 3/5 : ext4: Extent overlap bugfix
    Patch 4/5 : ext4: fallocate support in ext4
    Patch 5/5 : ext4: write support for preallocated blocks

    Amit Arora
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2007-05-14 15:33    [W:0.025 / U:1.636 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site