[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <d5ca277e0907201841i18b83bb6uea757e83d177bc9b@mail.gmail.com>
Date: Mon, 20 Jul 2009 18:41:03 -0700
From: Xiang Wang <xiangw@...gle.com>
To: linux-ext4@...r.kernel.org
Subject: Using O_DIRECT in ext4
Hi,
Recently I've been experimenting with O_DIRECT in ext4 to get a
feeling of how much file fragmentation will be generated.
On a newly formatted ext4 partition(no-journal), I created a top-level
directory and under this top-level directory I ran a test program to
generate some files.
The test program does the following:
-- create multiple threads(in my test case: 16 threads)
-- each thread creates a file with the O_DIRECT flag and keeps
extending the file to 1MB
Since these threads run concurrently, they compete in block allocation.
After the program ran to a completion, I ran filefrag on each file and
measure how many extents there are in the file.
And here is a sample result:
file0: 6 extents found
file1: 20 extents found
file2: 7 extents found
file3: 6 extents found
file4: 6 extents found
file5: 5 extents found
file6: 6 extents found
file7: 20 extents found
file8: 20 extents found
file9: 20 extents found
file10: 20 extents found
file11: 20 extents found
file12: 20 extents found
file13: 19 extents found
file14: 19 extents found
file15: 19 extents found
Looks like these files are quite heavily fragmented.
For comparison, I did the same experiment on an ext2 partition,
resulting in each file having only 1 extent.
I also did the experiments of using buffered writes(by removing the
O_DIRECT flag) on ext2 and ext4, both resulting in each file having
only 1 extent.
I am wondering whether this kind of file fragmentation is already a
known issue in ext4 when O_DIRECT is used? Is it something by design?
Since it seems like ext2 does not have this issue under my test case,
is it necessary that we make the behavior of ext4 similar to ext2
under situations like this?
Thanks,
Xiang
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists