<p>Is there a maximum number of inodes in a single directory? </p>

<p>I have a directory of over 2 million files and can't get the <code>ls</code> command to work against that directory. So now I'm wondering if I've exceeded a limit on inodes in Linux. Is there a limit before a 2^64 numerical limit?</p>

Can you get a real count of the number of files?  Does it fall very near a 2^n boundry?  Could you simply be running out of RAM to hold all the file names?
I know that in windows at least file system performance would drop dramatically as the number of files in the folder went up, but I thought that linux didn't suffer from this issue, at least if you were using a command prompt.  God help you if you try to get something like nautilus to open a folder with that many files.
I'm also wondering where these files come from.  Are you able to calculate file names programmatically?  If that's the case, you might be able to write a small program to sort them into a number of sub-folders.  Often listing the name of a specific file will grant you access where trying to look up the name will fail.  For example, I have a folder in windows with about 85,000 files where this works.
If this technique is successful, you might try finding a way to make this sort permanent, even if it's just running this small program as a cron job.  It'll work especially well if you can sort the files by date somewhere.