Bug #12732
closedvery slow read when a file has holes.
0%
Description
When a file in cephfs has holes, reading this file is very slow.
This problem can be reproduced by the commands below
dd if=/dev/urandom of=/mnt/cephfs/holefie bs=4M count=20
dd if=/dev/urandom of=/mnt/cephfs/holefie bs=4M count=20 seek=1024
cp /mnt/cephfs/holefile some-user-dir
The cause may be as follows. File holes are not stored as objects in ceph;
they are simply nonexistent. When reading a hole of 4M size, the osd reply
returns an error -ENOENT. That is right. However, the function finish_read
in fs/ceph/addr.c doesn't fill the page with 0 when rc == -ENOENT. Instead,
finish_read just skip the pages when rc < 0. In this way, page readahead
doesn't work for nonexistent objects. The pages for nonexistent hole objects
would be read one by one, significantly reducing performance.
Can the condition statement in finish_read
if (rc < 0)
be changed as
if (rc < 0 && rc != -ENOENT)
?
Updated by Zheng Yan over 8 years ago
- Status changed from New to 12
'(rc < 0 && rc != -ENOENT)' should work. please send a patch to ceph-devel@vger.kernel.org
Updated by Zheng Yan over 8 years ago
- Status changed from 12 to Resolved