Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

os/filestore: require offset == length == 0 for full object read; add test #7957

Merged
merged 2 commits into from Mar 17, 2016

Conversation

majianpeng
Copy link
Member

Like FileStore, length=0 mean length=object.size.

Signed-off-by: Jianpeng Ma jianpeng.ma@intel.com

@@ -2522,7 +2522,7 @@ int BlueStore::read(
goto out;
}

if (offset == length && offset == 0)
if (lenght == 0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/lenght/length/

@liewegas
Copy link
Member

liewegas commented Mar 9, 2016

I don't think this is right.. if I do offset 2000 and length 0 i do'nt want to read the object size from offset 2000. I think only offset == length == 0 makes sense.

BTW, is there store_test.cc test that covers this case?

@majianpeng
Copy link
Member Author

@liewegas .
In ReplicatedPG::do_osd_ops:

case CEPH_OSD_OP_READ:
if (op.extent.length == 0) //length is zero mean read the whole object
op.extent.length = size;

In FileStore::read

if (len == 0) {
struct stat st;
memset(&st, 0, sizeof(struct stat));
int r = ::fstat(**fd, &st);
assert(r == 0);
len = st.st_size;
}

I don't find test case in store_test.cc.
Long long ago, i wanted to remove code for FileStore::read. But you or sam point background need this. But i don't find those again!

@liewegas
Copy link
Member

liewegas commented Mar 10, 2016 via email

Signed-off-by: Jianpeng Ma <jianpeng.ma@intel.com>
Signed-off-by: Jianpeng Ma <jianpeng.ma@intel.com>
@ifed01
Copy link
Contributor

ifed01 commented Mar 17, 2016

Probably I missed something but I don't see any changes at bluestore.cc at the moment. Only Filestore.cc is updated. Is this correct?

@ifed01
Copy link
Contributor

ifed01 commented Mar 17, 2016

Answering myself - that's correct. Just PR name is confusing...

@liewegas liewegas changed the title os/bluestore/BlueStore: for read, length=0 mean lenght=object.size os/filestore: require offset == length == 0 for full object read; add test Mar 17, 2016
liewegas added a commit that referenced this pull request Mar 17, 2016
os/filestore: require offset == length == 0 for full object read; add test

Reviewed-by: Sage Weil <sage@redhat.com>
Reviewed-by: Igor Fedotov <ifedotov@mirantis.com>
@liewegas liewegas merged commit 6741606 into ceph:master Mar 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants