[CRIU] [PATCH 8/9] tty: Use regular files engine to save paths to the peers, v4
Cyrill Gorcunov
gorcunov at gmail.com
Fri Oct 17 05:14:49 PDT 2014
On Fri, Oct 17, 2014 at 04:07:57PM +0400, Pavel Emelyanov wrote:
> > +
> > + if (add)
> > + file_desc_add(&r->d, tfe->id, NULL);
> > + else {
> > + r->d.id = tfe->id;
> > + INIT_LIST_HEAD(&r->d.fd_info_head);
> > + INIT_HLIST_NODE(&r->d.hash);
>
> This should be file_desc_init from patch #4, shouldn't it?
Seems so
> > +
> > + orig = container_of(info->reg_d, struct reg_file_info, d);
> > + new = container_of(fake_desc, struct reg_file_info, d);
>
> Some comment about what's going on below would be great.
OK
> > /*
> > + * The image might have no reg file record in old CRIU, so
> > + * lets don't fail for a while. After a couple of releases
> > + * simply require the record to present.
> > + */
> > + info->reg_d = find_file_desc_raw(FD_TYPES__REG, info->tfe->id);
> > + if (!info->reg_d) {
> > + info->reg_d = pty_alloc_reg(info, true);
> > + if (!info->reg_d) {
> > + pr_err("Can't generate new reg descriptor for id %#x\n",
> > + info->tfe->id);
> > + return -1;
> > + }
> > + } else {
> > + info->reg_d = collect_special_file(info->tfe->id);
>
> This results in double list lookup.
This gonna be pretty fast, it's hashed list. Look, the old interface should be deprecated
in a couple of releases I think and I will simply can use collect_special_file
withouth "try" (because now we can have images where no reg-entries are
present on disc and if I use collect_special_file now the user will
get an error message).
Cyrill
More information about the CRIU
mailing list