Skip to contentSkip to conversation

Query on shrink list

DISCUSSION Mukesh Ojha 2 participants 3 messages Aug 17, 2018 VFS

lore
Share & tools
lore
#0 lore raw

Hi Al Viro,

Is there is reason we have kept data->found++, if the dentry already there in shrink list ?

static enum d_walk_ret select_collect(
...
        if (dentry->d_flags & DCACHE_SHRINK_LIST) { data->found++;
        } else {
  ..

If the dentry is already there on shrink list, does it not mean that data->found is already non-zero ? Can't we just go out from here directly?

Regards,
Mukesh

maintainer
#1 lore raw
Quoted 12 lines · Mukesh Ojha

Hi Al Viro,

Is there is reason we have kept data->found++, if the dentry already there in shrink list ?

static enum d_walk_ret select_collect(
...
        if (dentry->d_flags & DCACHE_SHRINK_LIST) { data->found++;
        } else {
  ..

Quoted 2 lines

If the dentry is already there on shrink list, does it not mean that data->found is already non-zero ?

Nope. It can be on *another* shrink list - if two processes are doing that...

Quoted 1 line

Can't we just go out from here directly?

#2 lore raw
Quoted 13 lines · Al Viro
Quoted 12 lines · Mukesh Ojha

Hi Al Viro,

Is there is reason we have kept data->found++, if the dentry already there in shrink list ?

static enum d_walk_ret select_collect(
...
        if (dentry->d_flags & DCACHE_SHRINK_LIST) { data->found++;
        } else {
  ..

Quoted 4 lines
Quoted 2 lines

If the dentry is already there on shrink list, does it not mean that data->found is already non-zero ?

Nope. It can be on *another* shrink list - if two processes are doing that...

Ok, if we go out simply,  letting others to do the job will break shrink_dcache_parent() and if someone touched that dentry made the refcount > 0 while it is on shrink list then owner will keep on looping in shrink_dentry_list() until refcount becomes 0 .

Am i making sense here ?

Thanks.
Mukesh

Quoted 2 lines
Quoted 2 lines

Can't we just go out from here directly?