[CRIU] [PATCH 08/16] files-ids: generate id-s accoding with mnt_id, st->st_dev and st->st_ino
Pavel Emelyanov
xemul at parallels.com
Wed Apr 9 22:44:31 PDT 2014
On 04/10/2014 09:12 AM, Andrew Vagin wrote:
> On Wed, Apr 09, 2014 at 07:00:32PM +0400, Pavel Emelyanov wrote:
>> On 04/09/2014 03:35 AM, Andrey Vagin wrote:
>>> One device can be mounted a few times, so files are identical only,
>>> if they have the same mnt_id.
>>
>> I see no changes in fdid generation, only it the caching.
>>
>
> ...
>
>>> -static struct fd_id *fd_id_cache_lookup(struct stat *st)
>>> +static struct fd_id *fd_id_cache_lookup(struct fd_parms *p)
>>> {
>>> + struct stat *st = &p->stat;
>>> struct fd_id *fi;
>>>
>>> for (fi = fd_id_cache[fdid_hashfn(st->st_dev, st->st_ino)];
>>> fi; fi = fi->n)
>>> - if (fi->dev == st->st_dev && fi->ino == st->st_ino)
>>> + if (fi->dev == st->st_dev &&
>>> + fi->ino == st->st_ino &&
>>> + fi->mnt_id == p->mnt_id)
>
>
> ^^^ check mnt_id
>>> return fi;
>>>
>>> return NULL;
>>> }
>>>
>>> -int fd_id_generate_special(struct stat *st, u32 *id)
>>> +int fd_id_generate_special(struct fd_parms *p, u32 *id)
>>> {
>>> - if (st) {
>>> + if (p) {
>>> struct fd_id *fi;
>>>
>>> - fi = fd_id_cache_lookup(st);
>>> + fi = fd_id_cache_lookup(p);
>
> If we don't have file with this mnt_id, we will generate a new id for
> the file.
Ah, I see. I was talking about KID generator, but this one doesn't
require that knowledge.
>>> if (fi) {
>>> *id = fi->id;
>>> return 0;
> .
>
More information about the CRIU
mailing list