The file system code (inside the kernel, for example, in linux-3.1.6/fs/ext4/
for ext4 file systems inside the linux-3.1.6 kernel source) controls the disk blocks used for this file. Thus, you cannot independently organize the disk blocks of some of your files. However, you can give some clues to the kernel using some weird system calls.
If you do not like this, you can avoid file system collaboration by writing directly to the unmounted partition, for example. making write (2) syscalls for the file descriptor obtained by open (2) - for example, /dev/sda2
; but if you really donβt know what you are doing (and the wording of your question makes me feel that you do not understand the exact role of file systems), I will not recommend it.
The kernel file system code is pretty good, and the kernel file system cache is very efficient.
If you want to speed up reading, consider using readahead (2) or fadvise (2) or madvise (2) system calls, perhaps.
You can also configure it for your specific purposes when creating your file system. For example, if you know that it will mainly contain large files, you can use the size of the standard block (for example, mke2fs -b 8192
), etc.
But do not think that software tricks will significantly speed up your application; if you do a lot of disk I / O, the real bottleneck is the hardware (so using SSDs instead of hard drives can be easier).
source share