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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2012-03-07, at 8:51 AM, Dave Chinner wrote:
> On Mon, Mar 05, 2012 at 08:50:29PM +0800, Zheng Liu wrote:
>> 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).

>> 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".

>> FADV_ALLOC_WRITE_ONCE
> 
> fallocate()
> 
>> 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





--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux