Re: [RFC 0/2] Case-insensitive filename lookup for XFS

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Anton Altaparmakov
Date: Tuesday, October 23, 2007 - 3:01 am

Hi,

On 23 Oct 2007, at 08:53, Barry Naujok wrote:

Both of the above can be fairly easily fixed if you want.  NTFS does  
it in the stock kernel.

You would need to change the XFS ->lookup inode operation so that when  
it reads the directory to check whether a name exists, if it is found  
but the case is not matched, you need to make a copy of the correctly  
cased name (if NTFS this is done in fs/ntfs/ 
dir.c::ntfs_lookup_inode_by_name() if you want to take a look, the  
name is stored in the "ntfs_name" structure that is allocated during  
the lookup if a case mismatched match is found and this is returned to  
the caller).

Then in ->lookup() if you got a correctly cased name structure (if the  
name was cased correctly the correctly cased named structure pointer  
would be NULL) then you need to replace the dentry passed into - 
 >lookup with a new one with the correct case.  This is a little  
complicated because such a dentry may already exist in which case you  
have to use the existing one (instantiating it if it was negative) and  
if it does not already exist you need to allocate a new one,  
instantiate it and then move it over the old one.  Again a little  
complicated because of disconnected dentries for NFS.  But it is not  
too bad and it works well in NTFS (see fs/ntfs/namei.c::ntfs_lookup()  
the code that does all of this starts at the "handle_name" goto label).

Doing things this way means that you never have wrong case dentries in  
dcache.  And this in turn means that things like handling ->unlink and  
->rename inode operations is much easier as the dentry you receive  
there is returned from a ->lookup() call thus you know it is correctly  
cased already so you can do a case-sensitive match when looking up the  
directory entry to remove/rename!  (I am afraid you cannot look at the  
NTFS code for that as that is not publicly available yet. )-:)

Best regards,

	Anton


-- 
Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @)
Unix Support, Computing Service, University of Cambridge, CB2 3QH, UK
Linux NTFS maintainer, http://www.linux-ntfs.org/

-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[RFC 0/2] Case-insensitive filename lookup for XFS, Barry Naujok, (Tue Oct 23, 12:53 am)
Re: [RFC 0/2] Case-insensitive filename lookup for XFS, Anton Altaparmakov, (Tue Oct 23, 3:01 am)
Re: [RFC 0/2] Case-insensitive filename lookup for XFS, Anton Altaparmakov, (Tue Oct 23, 3:07 am)
Re: [RFC 0/2] Case-insensitive filename lookup for XFS, Barry Naujok, (Wed Oct 24, 12:39 am)
Re: [RFC 0/2] Case-insensitive filename lookup for XFS, Anton Altaparmakov, (Wed Oct 24, 8:05 am)