@@ -1155,8 +1155,8 @@ static struct ceph_osd *create_osd(struct ceph_osd_client *osdc, int onum)
static struct ceph_osd *get_osd(struct ceph_osd *osd)
{
if (refcount_inc_not_zero(&osd->o_ref)) {
- dout("get_osd %p %d -> %d\n", osd, refcount_read(&osd->o_ref)-1,
- refcount_read(&osd->o_ref));
+ unsigned int refcnt = refcount_read(&osd->o_ref);
+ dout("get_osd %p %d -> %d\n", osd, refcnt - 1, refcnt);
return osd;
} else {
dout("get_osd %p FAIL\n", osd);
@@ -1166,8 +1166,8 @@ static struct ceph_osd *get_osd(struct ceph_osd *osd)
static void put_osd(struct ceph_osd *osd)
{
- dout("put_osd %p %d -> %d\n", osd, refcount_read(&osd->o_ref),
- refcount_read(&osd->o_ref) - 1);
+ unsigned int refcnt = refcount_read(&osd->o_ref);
+ dout("put_osd %p %d -> %d\n", osd, refcnt, refcnt - 1);
if (refcount_dec_and_test(&osd->o_ref)) {
osd_cleanup(osd);
kfree(osd);
Calling refcount_read() twice in a debug message may return different value each time, so introduce a variable to avoid it. Signed-off-by: Chengguang Xu <cgxu519@gmx.com> --- net/ceph/osd_client.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)