Thread (13 messages) 13 messages, 6 authors, 2012-03-07

Re: [RFC] fadvise: add more flags to provide a hint for block allocation

flat view

From: Andreas Dilger <hidden>
Date: 2012-03-07 04:14:43
Also in: linux-fsdevel

On 2012-03-07, at 8:51 AM, Dave Chinner wrote:
On Mon, Mar 05, 2012 at 08:50:29PM +0800, Zheng Liu wrote:
quoted
Block allocation is a key component of file system.  Every file systems try to
improve the performance with optimizing the block allocation of a file.  But no
matter what file system does, it just guesses what the user expects.  Thus, it
is not very accurate.  fadvise(2) provides a method to let the user to give a
hint to file system.  However, until now, only few flags are provided.  So we
can provide more flags to tell file system how to allocate the blocks for a
file.

For example:
we can add these flags into fadvise(2):
FADV_ALLOC_READ_SEQ
fallocate()
I think this is already the assumed default for any file IO, but is included for completeness (e.g. to be able to turn off READ_RANDOM).
quoted
FADV_ALLOC_READ_RANDOM
Allocation can't be optimised as the read pattern cannot be defined.
I think what this is intended for is to tell the filesystem "don't work very hard to find optimum allocation, it will have a random read pattern anyway".
quoted
FADV_ALLOC_WRITE_ONCE
fallocate()
quoted
FADV_ALLOC_WRITE_APPEND
chattr +a
and/or fallocate(KEEP_SIZE)

Having a consistent API definitely makes sense.

This proposal definitely needs to have some clear explanation of how the flags are intended to be used by applications, and why they will help filesystems to improve allocation.  I'm not for adding gratuitous APIs, but at the same time I think that filesystems are often working in the dark and could benefit from more information being passed from the application.

Cheers, Andreas




Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help