aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2008-03-04 07:10:29 -0500
committerJan Kara <jack@suse.cz>2008-04-17 08:23:03 -0400
commit9bf2c6b834f4caad82b3e2d962c266153d39e411 (patch)
tree5386b3eb6dec103815b81e92d5977a59ef5c4ec9 /fs
parent200a3592cda7bfc010d30c0b1eb8eff3791e9ba9 (diff)
udf: Remove checking of existence of filename in udf_add_entry()
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>
Diffstat (limited to 'fs')
-rw-r--r--fs/udf/namei.c38
1 files changed, 1 insertions, 37 deletions
diff --git a/fs/udf/namei.c b/fs/udf/namei.c
index ac7f72779e93..e9f587201e17 100644
--- a/fs/udf/namei.c
+++ b/fs/udf/namei.c
@@ -303,11 +303,9 @@ static struct fileIdentDesc *udf_add_entry(struct inode *dir,
303{ 303{
304 struct super_block *sb = dir->i_sb; 304 struct super_block *sb = dir->i_sb;
305 struct fileIdentDesc *fi = NULL; 305 struct fileIdentDesc *fi = NULL;
306 char name[UDF_NAME_LEN], fname[UDF_NAME_LEN]; 306 char name[UDF_NAME_LEN];
307 int namelen; 307 int namelen;
308 loff_t f_pos; 308 loff_t f_pos;
309 int flen;
310 char *nameptr;
311 loff_t size = udf_ext0_offset(dir) + dir->i_size; 309 loff_t size = udf_ext0_offset(dir) + dir->i_size;
312 int nfidlen; 310 int nfidlen;
313 uint8_t lfi; 311 uint8_t lfi;
@@ -385,26 +383,6 @@ static struct fileIdentDesc *udf_add_entry(struct inode *dir,
385 liu = le16_to_cpu(cfi->lengthOfImpUse); 383 liu = le16_to_cpu(cfi->lengthOfImpUse);
386 lfi = cfi->lengthFileIdent; 384 lfi = cfi->lengthFileIdent;
387 385
388 if (fibh->sbh == fibh->ebh)
389 nameptr = fi->fileIdent + liu;
390 else {
391 int poffset; /* Unpaded ending offset */
392
393 poffset = fibh->soffset + sizeof(struct fileIdentDesc) +
394 liu + lfi;
395
396 if (poffset >= lfi)
397 nameptr = (char *)(fibh->ebh->b_data +
398 poffset - lfi);
399 else {
400 nameptr = fname;
401 memcpy(nameptr, fi->fileIdent + liu,
402 lfi - poffset);
403 memcpy(nameptr + lfi - poffset,
404 fibh->ebh->b_data, poffset);
405 }
406 }
407
408 if ((cfi->fileCharacteristics & FID_FILE_CHAR_DELETED) != 0) { 386 if ((cfi->fileCharacteristics & FID_FILE_CHAR_DELETED) != 0) {
409 if (((sizeof(struct fileIdentDesc) + 387 if (((sizeof(struct fileIdentDesc) +
410 liu + lfi + 3) & ~3) == nfidlen) { 388 liu + lfi + 3) & ~3) == nfidlen) {
@@ -423,20 +401,6 @@ static struct fileIdentDesc *udf_add_entry(struct inode *dir,
423 } 401 }
424 } 402 }
425 } 403 }
426
427 if (!lfi || !dentry)
428 continue;
429
430 flen = udf_get_filename(dir->i_sb, nameptr, fname, lfi);
431 if (flen && udf_match(flen, fname, dentry->d_name.len,
432 dentry->d_name.name)) {
433 if (fibh->sbh != fibh->ebh)
434 brelse(fibh->ebh);
435 brelse(fibh->sbh);
436 brelse(epos.bh);
437 *err = -EEXIST;
438 return NULL;
439 }
440 } 404 }
441 405
442add: 406add: