• majianpeng's avatar
    ceph: fix bugs about handling short-read for sync read mode. · 02ae66d8
    majianpeng authored
    cephfs . show_layout
    >layyout.data_pool:     0
    >layout.object_size:   4194304
    >layout.stripe_unit:   4194304
    >layout.stripe_count:  1
    
    TestA:
    >dd if=/dev/urandom of=test bs=1M count=2 oflag=direct
    >dd if=/dev/urandom of=test bs=1M count=2 seek=4  oflag=direct
    >dd if=test of=/dev/null bs=6M count=1 iflag=direct
    The messages from func striped_read are:
    ceph:           file.c:350  : striped_read 0~6291456 (read 0) got 2097152 HITSTRIPE SHORT
    ceph:           file.c:350  : striped_read 2097152~4194304 (read 2097152) got 0 HITSTRIPE SHORT
    ceph:           file.c:381  : zero tail 4194304
    ceph:           file.c:390  : striped_read returns 6291456
    The hole of file is from 2M--4M.But actualy it zero the last 4M include
    the last 2M area which isn't a hole.
    Using this patch, the messages are:
    ceph:           file.c:350  : striped_read 0~6291456 (read 0) got 2097152 HITSTRIPE SHORT
    ceph:           file.c:358  :  zero gap 2097152 to 4194304
    ceph:           file.c:350  : striped_read 4194304~2097152 (read 4194304) got 2097152
    ceph:           file.c:384  : striped_read returns 6291456
    
    TestB:
    >echo majianpeng > test
    >dd if=test of=/dev/null bs=2M count=1 iflag=direct
    The messages are:
    ceph:           file.c:350  : striped_read 0~6291456 (read 0) got 11 HITSTRIPE SHORT
    ceph:           file.c:350  : striped_read 11~6291445 (read 11) got 0 HITSTRIPE SHORT
    ceph:           file.c:390  : striped_read returns 11
    For this case,it did once more striped_read.It's no meaningless.
    Using this patch, the message are:
    ceph:           file.c:350  : striped_read 0~6291456 (read 0) got 11 HITSTRIPE SHORT
    ceph:           file.c:384  : striped_read returns 11
    
    Big thanks to Yan Zheng for the patch.
    Reviewed-by: default avatarYan, Zheng <zheng.z.yan@intel.com>
    Signed-off-by: default avatarJianpeng Ma <majianpeng@gmail.com>
    02ae66d8
Name
Last commit
Last update
..
Kconfig Loading commit data...
Makefile Loading commit data...
addr.c Loading commit data...
caps.c Loading commit data...
ceph_frag.c Loading commit data...
debugfs.c Loading commit data...
dir.c Loading commit data...
export.c Loading commit data...
file.c Loading commit data...
inode.c Loading commit data...
ioctl.c Loading commit data...
ioctl.h Loading commit data...
locks.c Loading commit data...
mds_client.c Loading commit data...
mds_client.h Loading commit data...
mdsmap.c Loading commit data...
snap.c Loading commit data...
strings.c Loading commit data...
super.c Loading commit data...
super.h Loading commit data...
xattr.c Loading commit data...