Re: [PATCH] [2.6.24-rc3-mm1] loop cleanup in fs/namespace.c - repost

From: Al Viro
Date: Mon Nov 26 2007 - 05:30:46 EST


On Wed, Nov 21, 2007 at 03:24:33PM -0800, Andrew Morton wrote:
> -repeat:
> - if (atomic_dec_and_lock(&mnt->mnt_count, &vfsmount_lock)) {
> + while (atomic_dec_and_lock(&mnt->mnt_count, &vfsmount_lock)) {
> if (likely(!mnt->mnt_pinned)) {
> spin_unlock(&vfsmount_lock);
> __mntput(mnt);
> - return;
> + break;
> }
> atomic_add(mnt->mnt_pinned + 1, &mnt->mnt_count);
> mnt->mnt_pinned = 0;
> spin_unlock(&vfsmount_lock);
> acct_auto_close_mnt(mnt);
> security_sb_umount_close(mnt);
> - goto repeat;
> }
> }
>
> This patch has no changelog which I can use.

BTW, I have a problem with that one. The change is misleading; FWIW,
I'm very tempted to turn that into tail recursion, with

if (!atomic_dec_and_lock(&mnt->mnt_count, &vfsmount_lock))
return;

in the very beginning (i.e. invert the test and pull the body to top level).
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/