Re: 2.1.118 Tons of oopes

Richard Gooch (rgooch@atnf.csiro.au)
Mon, 31 Aug 1998 18:33:32 +1000


Jamie Lokier writes:
> Richard Gooch wrote:
> > Yes, I can see the benefit of avoiding the NULL check. It would be
> > nice to be able to do this. However, that would then require every
> > driver to be updated on every addition of a new VFS method.
>
> It's possible, in the NULL case, that the check is faster than the
> function call to the default function.

Yeah, but that doesn't really matter, since the normal case is that
the method is implemented. In that case, the test is usually wasted
time. The most commonly accessed methods for each driver are going to
be implemented, so the test is wasted time.

And, probably more important, the VFS code would be neater without all
those tests.

> > However, if there was some compiler trickery we could employ such that
> > a VFS change doesn't require source code to be touched, it would be a
> > good idea. Being able to strip those method existence tests would make
> > code a bit more readable and would also save a few cycles. But I don't
> > see how to do it without making drivers not distributed with the
> > kernel much harder to maintain.
>
> You're describing C++ virtual functions.

Yeah, but the kernel is in C. Secondly, Linus expressly wants to
prevent this "laziness" in drivers. In which case forcing all drivers
to implement all methods (by dropping the NULL-method tests) is fine.

Regards,

Richard....

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html