Skip to content

Commit

Permalink
udf: Remove checking of existence of filename in udf_add_entry()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jan Kara committed Apr 17, 2008
1 parent 200a359 commit 9bf2c6b
Showing 1 changed file with 1 addition and 37 deletions.
38 changes: 1 addition & 37 deletions fs/udf/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand All @@ -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:
Expand Down

0 comments on commit 9bf2c6b

Please sign in to comment.