2000-12-05 19:55:06

by Tigran Aivazian

[permalink] [raw]
Subject: check_lock() in d_move() and switch_names()?

Hi,

The check for BKL in d_move() and switch_names() seem to be unnecessary as
d_move() takes dcache_lock and switch_names() is only called by
d_move(). So, if the callers take BKL just for the sake of d_move() they
do not need to, but if, for other reasons, then that is fine. In any case,
the checks in both functions can be removed, imho. Opinions?

Regards.
Tigran


2000-12-05 20:11:32

by Alexander Viro

[permalink] [raw]
Subject: Re: check_lock() in d_move() and switch_names()?



On Tue, 5 Dec 2000, Tigran Aivazian wrote:

> Hi,
>
> The check for BKL in d_move() and switch_names() seem to be unnecessary as
> d_move() takes dcache_lock and switch_names() is only called by
> d_move(). So, if the callers take BKL just for the sake of d_move() they
> do not need to, but if, for other reasons, then that is fine. In any case,
> the checks in both functions can be removed, imho. Opinions?

Tigran, _please_ stop it. d_move() needs BKL. Test in question is a
sanity check _and_ reminder of that fact, so please leave it in place.
Microoptimizations are OK when they make the code cleaner, but here...

2000-12-05 20:17:12

by Tigran Aivazian

[permalink] [raw]
Subject: Re: check_lock() in d_move() and switch_names()?

On Tue, 5 Dec 2000, Alexander Viro wrote:
> > The check for BKL in d_move() and switch_names() seem to be unnecessary as
> > d_move() takes dcache_lock and switch_names() is only called by
> > d_move(). So, if the callers take BKL just for the sake of d_move() they
> > do not need to, but if, for other reasons, then that is fine. In any case,
> > the checks in both functions can be removed, imho. Opinions?
>
> Tigran, _please_ stop it. d_move() needs BKL. Test in question is a
> sanity check _and_ reminder of that fact, so please leave it in place.
> Microoptimizations are OK when they make the code cleaner, but here...

Alexander, in one point at least you are wrong. That one point is -- I did
_not_ suggest any optimizations (especially microoptimizations). I was
merely trying to see exactly _why_ d_move() needs a BKL since it takes
dcache_lock which already protects the lists which d_move manipulats.

You did, however provide useful information, namely the statement "d_move
needs BKL", albeit, without any proof to the truth thereof. So, I'll look
closer and try to find the proof myself.

Thank you,
Tigran

2000-12-05 20:32:34

by Alexander Viro

[permalink] [raw]
Subject: Re: check_lock() in d_move() and switch_names()?



On Tue, 5 Dec 2000, Tigran Aivazian wrote:

> Alexander, in one point at least you are wrong. That one point is -- I did
> _not_ suggest any optimizations (especially microoptimizations). I was
> merely trying to see exactly _why_ d_move() needs a BKL since it takes
> dcache_lock which already protects the lists which d_move manipulats.

->d_parent