On Sun, Jan 22, Andrew Morton wrote:
> > -void dput(struct dentry *dentry)
> > +static void dput_locked(struct dentry *dentry, struct list_head *list)
> > {
> > if (!dentry)
> > return;
> >
> > -repeat:
> > - if (atomic_read(&dentry->d_count) == 1)
> > - might_sleep();
> > - if (!atomic_dec_and_lock(&dentry->d_count, &dcache_lock))
> > + if (!atomic_dec_and_test(&dentry->d_count))
> > return;
> >
> > +
> >
> > ...
> >
> > +void dput(struct dentry *dentry)
> > +{
> > + LIST_HEAD(free_list);
> > +
> > + if (!dentry)
> > + return;
> > +
> > + if (atomic_add_unless(&dentry->d_count, -1, 1))
> > + return;
> > +
> > + spin_lock(&dcache_lock);
> > + dput_locked(dentry, &free_list);
> > + spin_unlock(&dcache_lock);
>
> This seems to be an open-coded copy of atomic_dec_and_lock()?
>
Yes, it is. Otherwise the reference counting would be like
if(!atomic_dec_and_lock())
return;
atomic_inc();
dput_locked();
or something similar stupid/racy.
Regards,
Jan
--
Jan Blunck [email protected]
SuSE LINUX AG - A Novell company
Maxfeldstr. 5 +49-911-74053-608
D-90409 Nürnberg http://www.suse.de
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]