Re: [PATCH V2 for-next 7/7] IB/core: Change completion channel to use the reworked objects schema

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 29, 2017 at 5:53 PM, Jason Gunthorpe
<jgunthorpe@xxxxxxxxxxxxxxxxxxxx> wrote:
> On Sun, Mar 19, 2017 at 05:59:05PM +0200, Matan Barak wrote:
>> +static struct ib_uverbs_completion_event_file *
>> +ib_uverbs_lookup_comp_file(int fd, struct ib_ucontext *context)
>> +{
>> +     struct ib_uobject *uobj = uobj_get_read(uobj_get_type(comp_channel),
>> +                                             fd, context);
>> +     struct ib_uobject_file *uobj_file;
>> +
>> +     if (IS_ERR(uobj))
>> +             return (void *)uobj;
>> +
>> +     uobj_file = container_of(uobj, struct ib_uobject_file, uobj);
>> +
>> +     uverbs_uobject_get(&uobj_file->uobj);
>> +     uobj_put_read(uobj);
>
> That looks odd, isn't uobj == uobj_file->uobj ?
>

Yeah, they're essentially the same. The uverbs_uobject_get is intended
to increase the reference count
on the returned object. The uobj_put_read is paired with uobj_get_read
(first line of this function).
We could change them both to uobj.

>> +     kref_init(&ev_file->ref);
>> +     filp = anon_inode_getfile("[infinibandevent]", &uverbs_async_event_fops,
>>                                 ev_file, O_RDONLY);
>
> It seems weird this name occures twice:
>

Unfortunately, we have to keep the current names. The old code created
the async fd
and the completion channel fd and both are called the same.

>> +const struct uverbs_obj_fd_type uverbs_type_attrs_comp_channel = {
>> +     .type = UVERBS_TYPE_ALLOC_FD(sizeof(struct ib_uverbs_completion_event_file), 0),
>> +     .context_closed = uverbs_hot_unplug_completion_event_file,
>> +     .fops = &uverbs_event_fops,
>> +     .name = "[infinibandevent]",
>> +     .flags = O_RDONLY,
>> +};
>
> Jason

Matan

> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux