| To: | Ying-Hung Chen <ying@xxxxxxxxxxxxxx> |
|---|---|
| Subject: | Re: howto preallocate to minimize fragmentation |
| From: | Eric Sandeen <sandeen@xxxxxxx> |
| Date: | Thu, 22 Sep 2005 10:45:02 -0500 |
| Cc: | Andrew Ho <andrewho@xxxxxxxxxxxxx>, linux-xfs@xxxxxxxxxxx |
| In-reply-to: | <4332CF04.2060604@xxxxxxxxxxxxxx> |
| References: | <43329839.2070005@xxxxxxxxxxxxxx> <4332A22B.6070708@xxxxxxx> <4332BFCC.8050803@xxxxxxxxxxxxxx> <4332C248.70503@xxxxxxx> <4332C636.9070509@xxxxxxxxxxxxxx> <4332CE65.2000500@xxxxxxxxxxxxx> <4332CF04.2060604@xxxxxxxxxxxxxx> |
| Sender: | linux-xfs-bounce@xxxxxxxxxxx |
| User-agent: | Mozilla Thunderbird 1.0 (X11/20041206) |
Ying-Hung Chen wrote: I guess while you played your video file, which was 2GB. Your video images were not smoothly shown on the player. It gave you an impression that there was a problem on the filesystem.actually, performance is the problem got my attention, and when i run xfs_db and check the fragmentation, its well over 95% on one 200GB partition...... run xfs_bmap on a few files, and see how bad it really is. That number can be misleading, sometimes.
but preallocation is an easy way to mitigate any fragmentation problems.
something like this:
int main(int argc, char **argv)
{
int fd, err;
xfs_flock64_t fl;
fl.l_whence = 0;
fl.l_start = 1;
fl.l_len = (off64_t)(20 * 1024 * 1024); /* 20M */
if(argc != 2)
return fprintf(stderr, "Filename expected.\n"), 1;
fd = open(argv[1], O_RDWR|O_CREAT, 0666);
if (fd < 0) {
perror("open: ");
printf("open of file %s failed\n", argv[1]);
exit(1);
}
err = xfsctl(argv[1], fd, XFS_IOC_RESVSP64, &fl);
if (err < 0) {
perror("allocsp: ");
printf("XFS_IOC_RESVSP64 failed\n");
close(fd);
exit(1);
}
close(fd);
return 0;
}
-Eric
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: howto preallocate to minimize fragmentation, Ying-Hung Chen |
|---|---|
| Next by Date: | xfs_repair: dinode.c:2436: process_dinode_int: Assertion `err == 0' failed., Jan Derfinak |
| Previous by Thread: | Re: howto preallocate to minimize fragmentation, Ying-Hung Chen |
| Next by Thread: | Re: howto preallocate to minimize fragmentation, Ying-Hung Chen |
| Indexes: | [Date] [Thread] [Top] [All Lists] |