|
Lines 408-422
static struct fileIdentDesc *udf_add_entry(struct inode *dir,
Link Here
|
| 408 |
} |
408 |
} |
| 409 |
|
409 |
|
| 410 |
add: |
410 |
add: |
| 411 |
/* Is there any extent whose size we need to round up? */ |
|
|
| 412 |
if (dinfo->i_alloc_type != ICBTAG_FLAG_AD_IN_ICB && elen) { |
| 413 |
elen = (elen + sb->s_blocksize - 1) & ~(sb->s_blocksize - 1); |
| 414 |
if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_SHORT) |
| 415 |
epos.offset -= sizeof(struct short_ad); |
| 416 |
else if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_LONG) |
| 417 |
epos.offset -= sizeof(struct long_ad); |
| 418 |
udf_write_aext(dir, &epos, &eloc, elen, 1); |
| 419 |
} |
| 420 |
f_pos += nfidlen; |
411 |
f_pos += nfidlen; |
| 421 |
|
412 |
|
| 422 |
if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB && |
413 |
if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB && |
|
Lines 439-444
add:
Link Here
|
| 439 |
udf_current_aext(dir, &epos, &eloc, &elen, 1); |
430 |
udf_current_aext(dir, &epos, &eloc, &elen, 1); |
| 440 |
} |
431 |
} |
| 441 |
|
432 |
|
|
|
433 |
/* Entry fits into current block? */ |
| 442 |
if (sb->s_blocksize - fibh->eoffset >= nfidlen) { |
434 |
if (sb->s_blocksize - fibh->eoffset >= nfidlen) { |
| 443 |
fibh->soffset = fibh->eoffset; |
435 |
fibh->soffset = fibh->eoffset; |
| 444 |
fibh->eoffset += nfidlen; |
436 |
fibh->eoffset += nfidlen; |
|
Lines 462-467
add:
Link Here
|
| 462 |
(fibh->sbh->b_data + fibh->soffset); |
454 |
(fibh->sbh->b_data + fibh->soffset); |
| 463 |
} |
455 |
} |
| 464 |
} else { |
456 |
} else { |
|
|
457 |
/* Round up last extent in the file */ |
| 458 |
elen = (elen + sb->s_blocksize - 1) & ~(sb->s_blocksize - 1); |
| 459 |
if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_SHORT) |
| 460 |
epos.offset -= sizeof(struct short_ad); |
| 461 |
else if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_LONG) |
| 462 |
epos.offset -= sizeof(struct long_ad); |
| 463 |
udf_write_aext(dir, &epos, &eloc, elen, 1); |
| 464 |
dinfo->i_lenExtents = (dinfo->i_lenExtents + sb->s_blocksize |
| 465 |
- 1) & ~(sb->s_blocksize - 1); |
| 466 |
|
| 465 |
fibh->soffset = fibh->eoffset - sb->s_blocksize; |
467 |
fibh->soffset = fibh->eoffset - sb->s_blocksize; |
| 466 |
fibh->eoffset += nfidlen - sb->s_blocksize; |
468 |
fibh->eoffset += nfidlen - sb->s_blocksize; |
| 467 |
if (fibh->sbh != fibh->ebh) { |
469 |
if (fibh->sbh != fibh->ebh) { |
|
Lines 508-513
add:
Link Here
|
| 508 |
dir->i_size += nfidlen; |
510 |
dir->i_size += nfidlen; |
| 509 |
if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) |
511 |
if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) |
| 510 |
dinfo->i_lenAlloc += nfidlen; |
512 |
dinfo->i_lenAlloc += nfidlen; |
|
|
513 |
else { |
| 514 |
/* Find the last extent and truncate it to proper size */ |
| 515 |
while (udf_next_aext(dir, &epos, &eloc, &elen, 1) == |
| 516 |
(EXT_RECORDED_ALLOCATED >> 30)); |
| 517 |
elen -= dinfo->i_lenExtents - dir->i_size; |
| 518 |
if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_SHORT) |
| 519 |
epos.offset -= sizeof(struct short_ad); |
| 520 |
else if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_LONG) |
| 521 |
epos.offset -= sizeof(struct long_ad); |
| 522 |
udf_write_aext(dir, &epos, &eloc, elen, 1); |
| 523 |
dinfo->i_lenExtents = dir->i_size; |
| 524 |
} |
| 525 |
|
| 511 |
mark_inode_dirty(dir); |
526 |
mark_inode_dirty(dir); |
| 512 |
goto out_ok; |
527 |
goto out_ok; |
| 513 |
} else { |
528 |
} else { |
|
Lines 922-928
static int udf_symlink(struct inode *dir, struct dentry *dentry,
Link Here
|
| 922 |
block = udf_get_pblock(inode->i_sb, block, |
937 |
block = udf_get_pblock(inode->i_sb, block, |
| 923 |
iinfo->i_location.partitionReferenceNum, |
938 |
iinfo->i_location.partitionReferenceNum, |
| 924 |
0); |
939 |
0); |
| 925 |
epos.bh = udf_tread(inode->i_sb, block); |
940 |
epos.bh = udf_tgetblk(inode->i_sb, block); |
| 926 |
lock_buffer(epos.bh); |
941 |
lock_buffer(epos.bh); |
| 927 |
memset(epos.bh->b_data, 0x00, inode->i_sb->s_blocksize); |
942 |
memset(epos.bh->b_data, 0x00, inode->i_sb->s_blocksize); |
| 928 |
set_buffer_uptodate(epos.bh); |
943 |
set_buffer_uptodate(epos.bh); |
|
Lines 999-1004
static int udf_symlink(struct inode *dir, struct dentry *dentry,
Link Here
|
| 999 |
inode->i_size = elen; |
1014 |
inode->i_size = elen; |
| 1000 |
if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) |
1015 |
if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) |
| 1001 |
iinfo->i_lenAlloc = inode->i_size; |
1016 |
iinfo->i_lenAlloc = inode->i_size; |
|
|
1017 |
else |
| 1018 |
udf_truncate_tail_extent(inode); |
| 1002 |
mark_inode_dirty(inode); |
1019 |
mark_inode_dirty(inode); |
| 1003 |
|
1020 |
|
| 1004 |
fi = udf_add_entry(dir, dentry, &fibh, &cfi, &err); |
1021 |
fi = udf_add_entry(dir, dentry, &fibh, &cfi, &err); |
| 1005 |
- |
|
|