How to reserve disk space in XFS to make the blocks over many files continuous?

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

 



Hi, folks,

I'm using CentOS5.8, with XFS filesystem extend storage disks. What I want to do is, pre-allocating many files, with continuous blocks in filesystem, both single file and crossing files. That is the start block ID of the next file is following the end block ID of current file.

I could do space pre-allocation by posix_allocate(), problem is the API zeros all disk space, I can't afford time consuming(I'm not sure if this API could make the blocks continuous). then I tried xfsctl(), with XFS_IOC_RESVSP flag, I can reserve space faster.

The problem with xfsctl() is, it could make the blocks continuous for individual file, but the blocks over files are not continuous. For example, 10 files, a/b/c/d/e/f... reserved. After I do the real writing to these files, it turns out the file 'b' isn't next to file 'a', and some file could be far from both previous one and next one, though other files may be neighboring with each other, rarely.

I use the following code to do the pre-allocation:


ftruncate(fd, FILE_SIZE);

xfs_flock_t flag = {0};
flag.l_whence = SEEK_SET;
flag.l_start  = 0;
flag.l_len    = 512*1024*1024;
xfsctl(fileName, fd, XFS_IOC_RESVSP64, &flag);

My question is, how can I guarantee the file system blocks over files continuous? Thanks for your time and appreciate your answer.

_______________________________________________
xfs mailing list
xfs@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs

[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux