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

osd: replace ceph:atomic_t with std::atomic in osd module. #9138

Merged
merged 1 commit into from Jul 11, 2016

Conversation

cxwshawn
Copy link

trying to use std more, and atomic_t easier to use and no need
t implement more interfaces, like operator++,++ etc.

Signed-off-by: Xiaowei Chen chen.xiaowei@h3c.com

@@ -1024,18 +1024,18 @@ class OSDService {
NOT_STOPPING,
PREPARING_TO_STOP,
STOPPING };
atomic_t state;
atomic_uint state;
Copy link
Contributor

Choose a reason for hiding this comment

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

atomic_int

@cxwshawn
Copy link
Author

@tchaikov please review again, thanks .

@gregsfortytwo
Copy link
Member

I think @adamemerson or somebody in his group was working on a more comprehensive set of changes to our atomics. Maybe he has thoughts about how incrementally we want to handle this transition.

@adamemerson
Copy link
Contributor

I didn't have a plan to do a big replacement all at once, though I can if people like. It would have a portability advantage since all we'd depend upon is C++ support, rather than pulling in libatomic_ops (or falling back on the spinlock.)

It would also open up the opportunity to use looser memory models where appropriate (though I would want to consult with the people more knowledgeable in any given subsystem before relaxing things.)

@cxwshawn
Copy link
Author

@adamemerson @gregsfortytwo so what's the meaning ? is this PR meaningful ? I am also trying to stdanlize ceph code.

@liewegas
Copy link
Member

@cxwshawn It means this is a step in the right direction, and nobody was working on it yet. :)

@liewegas
Copy link
Member

retest this please

@@ -1241,32 +1241,32 @@ class OSD : public Dispatcher,
}

private:
atomic_t state;
atomic_uint state;
Copy link
Contributor

@tchaikov tchaikov May 22, 2016

Choose a reason for hiding this comment

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

should use atomic_int, as the state here is int actually .

@cxwshawn
Copy link
Author

@tchaikov 👍 , thanks for the review, fixed

cxwshawn pushed a commit to cxwshawn/ceph that referenced this pull request May 23, 2016
same work as ceph#9138

Signed-off-by: Xiaowei Chen <chen.xiaowei@h3c.com>
cxwshawn pushed a commit to cxwshawn/ceph that referenced this pull request May 23, 2016
same work as ceph#9138

Signed-off-by: Xiaowei Chen <chen.xiaowei@h3c.com>
cxwshawn pushed a commit to cxwshawn/ceph that referenced this pull request May 23, 2016
…c_atomic_replacement.

same work as ceph#9138

Signed-off-by: Xiaowei Chen <chen.xiaowei@h3c.com>
@@ -796,7 +796,7 @@ class OSDService {

private:
/// throttle promotion attempts
atomic_t promote_probability_millis; ///< probability thousands. one word.
atomic_uint promote_probability_millis; ///< probability thousands. one word.
Copy link
Contributor

Choose a reason for hiding this comment

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

i'd prefer if we were explicit about the std:: part, especially in headers - we shouldn't assume that other headers are using namespace std;

Copy link
Member

Choose a reason for hiding this comment

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

cxwshawn pushed a commit to cxwshawn/ceph that referenced this pull request May 24, 2016
…c_atomic_replacement.

same work as ceph#9138

Signed-off-by: Xiaowei Chen <chen.xiaowei@h3c.com>
@cxwshawn
Copy link
Author

@cbodley thanks for your advice, @liewegas have fixed, please review.

@liewegas liewegas changed the title OSD: replace ceph:atomic_t with std::atomic in osd module. osd: replace ceph:atomic_t with std::atomic in osd module. May 26, 2016
@liewegas
Copy link
Member

lgtm

@@ -796,7 +796,7 @@ class OSDService {

private:
/// throttle promotion attempts
atomic_t promote_probability_millis; ///< probability thousands. one word.
std::atomic_uint promote_probability_millis; ///< probability thousands. one word.
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be initialized here.

@athanatos athanatos removed the needs-qa label Jun 8, 2016
@athanatos
Copy link
Contributor

You seem to have missed several more initializations. We'll re-add needs-qa once those are fixed.

@cxwshawn
Copy link
Author

@athanatos since the missed you said has been initialized by using constructor initialize list, so is there any need to reinitialize using xxx a{0} ?

@athanatos
Copy link
Contributor

You are claiming that they are already initialized in the constructor list? I'd actually prefer you moved the initialization to the declaration like you did with the other variables. Are those not also initialized in the constructor?

@cxwshawn
Copy link
Author

@athanatos yes, exactly, the former variables has been initialized in the constructor list, so I think there is no need to reinitialize, but since declaration initialization is preferred, I will change all the atomic variables to this form.

cxwshawn pushed a commit to cxwshawn/ceph that referenced this pull request Jun 17, 2016
…c_atomic_replacement.

same work as ceph#9138

Signed-off-by: Xiaowei Chen <chen.xiaowei@h3c.com>
@cxwshawn
Copy link
Author

@athanatos all modified atomic var has been initialized when declaration, please help merge, thanks!

cxwshawn pushed a commit to cxwshawn/ceph that referenced this pull request Jun 17, 2016
…c_atomic_replacement.

same work as ceph#9138

Signed-off-by: Xiaowei Chen <chen.xiaowei@h3c.com>
@athanatos
Copy link
Contributor

make check seems to be failing

@cxwshawn
Copy link
Author

@athanatos it's a little weired, does this failure relate with this change ?

@tchaikov
Copy link
Contributor

@cxwshawn you might want to rebase your changeset against master for a green build.

trying to clean up using std c++11 other than current project library.

Signed-off-by: Xiaowei Chen <chen.xiaowei@h3c.com>
@cxwshawn
Copy link
Author

@tchaikov @athanatos rebased, but still failed, is there any hint for this failure ? I cannot see any information related with this change.

@tchaikov
Copy link
Contributor

tested in http://pulpito.ceph.com/kchai-2016-07-10_07:48:29-rados-wip-kefu-testing---basic-mira/

the non-environmental failures are addressed by #10234 .

@tchaikov tchaikov merged commit b3bea59 into ceph:master Jul 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
8 participants