Re: [PATCH v2 08/20] ovl: lookup index entry for non-dir

Miklos Szeredi
2017-06-09T08:43:37Z

On Thu, Jun 8, 2017 at 6:09 PM, Amir Goldstein <amir73il@gmail.com> wrote:

> You mean iterate all existing the overlay inode dentry cache aliases?

Yes.

And locking is needed. The INUSE flag could provide that, but I'd
prefer something local to the overlay instance (i.e. in ovl_fs). The
reason is that lower layers could be shared and then separate
instances would be interfering with each other, which is not nice.
First version could just do a single mutex in ovl_fs. Could refine
that to an array of locks hashed by origin inode, or something.

>
>>>
>>>> This seems a big waste, since the index dentry will
>>>> be allocated for all lower files, yet never used unless copied up.
>>>>
>>>> Index is used:
>>>>
>>>> - at lookup need to find any copied up alias
>>>> - at copyup need to set up new index
>>>
>>> So it has several more subtle uses:
>>> - When whiteout a lower aliases, we need to count down nlink to
>>> know when we can unlink the an orphan index (TODO)
>>
>> If we do the link-up early (at lookup) then whiteout won't need
>> special casing. The link-up would be unnecessary in this case, but
>> delaying it will just cause headaches.
>>
>
> While on the subject, maybe you also have an idea about how to
> account for whiteouts *before* the first copy up:

Ah, another special case. We could un-special it by doing the copy-up
to index anyway before commencing with the delete (only for i_nlink >
1, obviously). Bit of a hack, but would make things simpler.

Thanks,
Miklos