All of lore.kernel.org
 help / color / mirror / Atom feed
* code question: PGQueueable VS OpRequestRef
@ 2017-01-27  7:41 Ming Lin
  2017-01-27 11:33 ` liuchang0812
  0 siblings, 1 reply; 3+ messages in thread
From: Ming Lin @ 2017-01-27  7:41 UTC (permalink / raw)
  To: Ceph Development

void PG::queue_op(OpRequestRef& op)
{
...
  osd->op_wq.queue(make_pair(PGRef(this), op));


class OSDService {
....
  ShardedThreadPool::ShardedWQ < pair <PGRef, PGQueueable> > &op_wq;

"op" is of type OpRequestRef, but op_wq second is of type PGQueueable

How does this work? Is "PGQueueable" same as "OpRequestRef"?

Thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: code question: PGQueueable VS OpRequestRef
  2017-01-27  7:41 code question: PGQueueable VS OpRequestRef Ming Lin
@ 2017-01-27 11:33 ` liuchang0812
  2017-01-27 18:26   ` Ming Lin
  0 siblings, 1 reply; 3+ messages in thread
From: liuchang0812 @ 2017-01-27 11:33 UTC (permalink / raw)
  To: Ming Lin; +Cc: Ceph Development

Hi, Ming.

PGQueueable class has a constructor as: `PGQueueable(OpRequestRef
op)`, which does not have `explicit`, so CPP compiler translates
OpRequestRef to PGQueueable in `
osd->op_wq.queue(make_pair(PGRef(this), op));`, as `
osd->op_wq.queue(make_pair(PGRef(this), PGQueueable(op)));`



2017-01-27 15:41 GMT+08:00 Ming Lin <minggr@gmail.com>:
> void PG::queue_op(OpRequestRef& op)
> {
> ...
>   osd->op_wq.queue(make_pair(PGRef(this), op));
>
>
> class OSDService {
> ....
>   ShardedThreadPool::ShardedWQ < pair <PGRef, PGQueueable> > &op_wq;
>
> "op" is of type OpRequestRef, but op_wq second is of type PGQueueable
>
> How does this work? Is "PGQueueable" same as "OpRequestRef"?
>
> Thanks.
> --
> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: code question: PGQueueable VS OpRequestRef
  2017-01-27 11:33 ` liuchang0812
@ 2017-01-27 18:26   ` Ming Lin
  0 siblings, 0 replies; 3+ messages in thread
From: Ming Lin @ 2017-01-27 18:26 UTC (permalink / raw)
  To: liuchang0812; +Cc: Ceph Development

On Fri, Jan 27, 2017 at 3:33 AM, liuchang0812 <liuchang0812@gmail.com> wrote:
> Hi, Ming.
>
> PGQueueable class has a constructor as: `PGQueueable(OpRequestRef
> op)`, which does not have `explicit`, so CPP compiler translates
> OpRequestRef to PGQueueable in `
> osd->op_wq.queue(make_pair(PGRef(this), op));`, as `
> osd->op_wq.queue(make_pair(PGRef(this), PGQueueable(op)));`

Hi Chang,

Thanks for the explanation. I just verify it with below test code.

class Foo {

};

class Bar {
public:
        Bar(Foo f)
        {
                cout << "Bar constructor called" << endl;
        }
};

void test(Bar t)
{
}

int main()
{
        Foo f;

        test(f);

        return 0;
}

>
>
>
> 2017-01-27 15:41 GMT+08:00 Ming Lin <minggr@gmail.com>:
>> void PG::queue_op(OpRequestRef& op)
>> {
>> ...
>>   osd->op_wq.queue(make_pair(PGRef(this), op));
>>
>>
>> class OSDService {
>> ....
>>   ShardedThreadPool::ShardedWQ < pair <PGRef, PGQueueable> > &op_wq;
>>
>> "op" is of type OpRequestRef, but op_wq second is of type PGQueueable
>>
>> How does this work? Is "PGQueueable" same as "OpRequestRef"?
>>
>> Thanks.
>> --
>> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-01-27 18:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-27  7:41 code question: PGQueueable VS OpRequestRef Ming Lin
2017-01-27 11:33 ` liuchang0812
2017-01-27 18:26   ` Ming Lin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.