Project

General

Profile

Actions

Bug #12732

closed

very slow read when a file has holes.

Added by caifeng zhu over 8 years ago. Updated over 8 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
% Done:

0%

Source:
other
Tags:
Backport:
Regression:
No
Severity:
2 - major
Reviewed:
Affected Versions:
ceph-qa-suite:
kcephfs
Component(FS):
Labels (FS):
Pull request ID:
Crash signature (v1):
Crash signature (v2):

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)
?

Actions #1

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

Actions

Also available in: Atom PDF