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

Crush: when get immediate parent quickly reply. #7181

Merged
merged 1 commit into from Feb 8, 2016

Conversation

songbaisen
Copy link

Crush: when get immediate parent quickly reply.

Fixes: #14334
Signed-off-by: song baisen song.baisen@zte.com.cn

@@ -893,7 +893,8 @@ pair<string,string> CrushWrapper::get_immediate_parent(int id, int *_ret)
string parent_id = name_map[b->id];
string parent_bucket_type = type_map[b->type];
loc = make_pair(parent_bucket_type, parent_id);
ret = 0;
*_ret = 0;
Copy link
Member

Choose a reason for hiding this comment

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

Need to check _ret first, which might be null, see below.

@songbaisen songbaisen changed the title Crush when get immediate parent quickly reply. Crush: when get immediate parent quickly reply. Jan 13, 2016
@songbaisen
Copy link
Author

@smithfarm Thank you! I like your head portrait very much!

@smithfarm
Copy link
Contributor

@songbaisen Thanks for the kind compliment. You might like this one as well: http://happiehounds.com/wp-content/uploads/2012/04/rabbit3.jpg

@songbaisen
Copy link
Author

@smithfarm Yes it really look very interesting.Thanks for your sharing.

@xiexingguo
Copy link
Member

I think this change is good and makes sense. @liewegas What do you think?

ret = 0;
if (_ret)
*_ret = 0;
return loc;
Copy link
Member

Choose a reason for hiding this comment

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

if we do this, then we should get rid of int ret and loc at the top, move them into the inner scope, and make the end of the method unconditionally set *_ret = -ENOENT and return pair<string,string>().

@songbaisen
Copy link
Author

@liewegas Thank you for your good advice! @xiexingguo Please review it.Thank you!

ret = 0;
if (_ret)
*_ret = 0;
return make_pair(parent_bucket_type, parent_id);
Copy link
Member

Choose a reason for hiding this comment

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

There seems to be an extra whitespace, otherwise looks good to me.

@xiexingguo
Copy link
Member

Besides, your signed-off line is not right, should be:

Signed-off-by: song baisen <song.baisen@zte.com.cn>

instead of :

Signed-off-by: songbaisen song.baisen@zte.com.cn

@tchaikov
Copy link
Contributor

tchaikov commented Feb 3, 2016

imho, there is no need to file a tracker ticket for this change as this is just a cleanup try.

@xiexingguo
Copy link
Member

@tchaikov Indeed:-)

@songbaisen
Copy link
Author

@xiexingguo @tchaikov Thanks for two sir.

Fixes: ceph#14334
Signed-off-by: song baisen <song.baisen@zte.com.cn>
liewegas added a commit that referenced this pull request Feb 8, 2016
crush: reply quickly from get_immediate_parent

Reviewed-by: xie xingguo <xie.xingguo@zte.com.cn>
@liewegas liewegas merged commit a981c1e into ceph:master Feb 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants