public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* How to reserve disk space in XFS to make the blocks over many files continuous?
@ 2012-11-07  1:02 huubby zhou
  2012-11-07  3:19 ` Dave Chinner
  0 siblings, 1 reply; 7+ messages in thread
From: huubby zhou @ 2012-11-07  1:02 UTC (permalink / raw)
  To: xfs


[-- Attachment #1.1: Type: text/plain, Size: 1363 bytes --]

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()*<http://linux.die.net/man/3/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.

[-- Attachment #1.2: Type: text/html, Size: 4250 bytes --]

[-- Attachment #2: Type: text/plain, Size: 121 bytes --]

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-11-09 23:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-07  1:02 How to reserve disk space in XFS to make the blocks over many files continuous? huubby zhou
2012-11-07  3:19 ` Dave Chinner
2012-11-09  2:04   ` huubby zhou
2012-11-09  3:08     ` Dave Chinner
2012-11-09  6:50       ` huubby zhou
2012-11-09 15:03   ` Roger Willcocks
2012-11-09 23:15     ` Dave Chinner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox