The way I understand this is in 2 parts and NOT scientific.
Part 1: Primary fermentation: There is no such thing as to much. There IS such thing as to little. Better have a blow off tube just to be sure! I do try to fill it with as much wort as possible within reason. I would REALLY suggest stopping a ways before the neck. I will also add that most of my beers have "sized" themselves.
Part 2: Secondary fermentation: You want as little as possible, up to or as close to the neck as possible.
The reasoning is that the fermentation causes Co2. The Co2 forms a "blanket" over the beer as it ferments, protecting it. This is ONE reason why the air lock bubbles, the co2 is escaping. There are some instances where there can be a "suck back" but these seem rare or related to picking up an Ale Pale or plastic bucket.
The "blanket" keeps O2 from oxidizing your beer. In secondary much of the fermentation is over and as such it will make a smaller "blanket" or a less dense one. O2 can get by it easier.
All that being said, most people will have a hard time oxidizing their beer if they are careful. Even fewer will even notice the off taste since it builds over time (aka new beers gets consumed pretty quickly most of the time.) This does not mean use the racking cane as a "pump" (I did this, as have others here...) or just pour it from the fermenter into the bottling bucket; but do it the way it is supposed to be done and you will be just fine!
Many people here do not even use a secondary so it becomes even more so of a moot point. I am sure there is a formula to determine this space but I do not know what it is.