]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
udf: Remove checking of existence of filename in udf_add_entry()
authorJan Kara <jack@suse.cz>
Tue, 4 Mar 2008 12:10:29 +0000 (13:10 +0100)
committerJan Kara <jack@suse.cz>
Thu, 17 Apr 2008 12:23:03 +0000 (14:23 +0200)
We don't have to check whether a directory entry already exists in a directory
when creating a new one since we've already checked that earlier by lookup and
we are holding directory i_mutex all the time.

Signed-off-by: Jan Kara <jack@suse.cz>
fs/udf/namei.c

index ac7f72779e935fc8175c3b9793563093cd8838fe..e9f587201e1712ffe79159be0b5aef5de4c10e24 100644 (file)
@@ -303,11 +303,9 @@ static struct fileIdentDesc *udf_add_entry(struct inode *dir,
 {
        struct super_block *sb = dir->i_sb;
        struct fileIdentDesc *fi = NULL;
-       char name[UDF_NAME_LEN], fname[UDF_NAME_LEN];
+       char name[UDF_NAME_LEN];
        int namelen;
        loff_t f_pos;
-       int flen;
-       char *nameptr;
        loff_t size = udf_ext0_offset(dir) + dir->i_size;
        int nfidlen;
        uint8_t lfi;
@@ -385,26 +383,6 @@ static struct fileIdentDesc *udf_add_entry(struct inode *dir,
                liu = le16_to_cpu(cfi->lengthOfImpUse);
                lfi = cfi->lengthFileIdent;
 
-               if (fibh->sbh == fibh->ebh)
-                       nameptr = fi->fileIdent + liu;
-               else {
-                       int poffset;    /* Unpaded ending offset */
-
-                       poffset = fibh->soffset + sizeof(struct fileIdentDesc) +
-                                       liu + lfi;
-
-                       if (poffset >= lfi)
-                               nameptr = (char *)(fibh->ebh->b_data +
-                                                  poffset - lfi);
-                       else {
-                               nameptr = fname;
-                               memcpy(nameptr, fi->fileIdent + liu,
-                                       lfi - poffset);
-                               memcpy(nameptr + lfi - poffset,
-                                       fibh->ebh->b_data, poffset);
-                       }
-               }
-
                if ((cfi->fileCharacteristics & FID_FILE_CHAR_DELETED) != 0) {
                        if (((sizeof(struct fileIdentDesc) +
                                        liu + lfi + 3) & ~3) == nfidlen) {
@@ -423,20 +401,6 @@ static struct fileIdentDesc *udf_add_entry(struct inode *dir,
                                }
                        }
                }
-
-               if (!lfi || !dentry)
-                       continue;
-
-               flen = udf_get_filename(dir->i_sb, nameptr, fname, lfi);
-               if (flen && udf_match(flen, fname, dentry->d_name.len,
-                                     dentry->d_name.name)) {
-                       if (fibh->sbh != fibh->ebh)
-                               brelse(fibh->ebh);
-                       brelse(fibh->sbh);
-                       brelse(epos.bh);
-                       *err = -EEXIST;
-                       return NULL;
-               }
        }
 
 add: