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/bluestore/BitmapFreelistManager: readability improvements #12719
Conversation
To keep pace with other private methods. Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
825275c
to
b11b169
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rest looks good!
@@ -113,33 +113,32 @@ int BitmapFreelistManager::init() | |||
|
|||
// load meta | |||
while (it->valid()) { | |||
string k = it->key(); | |||
if (k == "bytes_per_block") { | |||
if (it->key() == "bytes_per_block") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
key() returns a string by value, not reference, so c_str() here is a use-after-free
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dropped this change
b11b169
to
d2d4ed9
Compare
retest this please |
if (p[byte] & mask) { | ||
int which_byte = start / 8; | ||
int which_bit = start % 8; | ||
if (p[which_byte] & byte_bit_mask[which_bit]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this really better than 1 << which_bit ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I doubt.
Repushed, can you check again?
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
28b0011
to
ea5d71c
Compare
Be slightly nice to who is looking at get_next_clear[set]_bit(). Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
@liewegas Any more comments? |
No description provided.