diff options
Diffstat (limited to 'fs/udf')
-rw-r--r-- | fs/udf/balloc.c | 35 | ||||
-rw-r--r-- | fs/udf/dir.c | 8 | ||||
-rw-r--r-- | fs/udf/directory.c | 7 | ||||
-rw-r--r-- | fs/udf/file.c | 21 | ||||
-rw-r--r-- | fs/udf/ialloc.c | 49 | ||||
-rw-r--r-- | fs/udf/inode.c | 305 | ||||
-rw-r--r-- | fs/udf/misc.c | 40 | ||||
-rw-r--r-- | fs/udf/namei.c | 112 | ||||
-rw-r--r-- | fs/udf/partition.c | 8 | ||||
-rw-r--r-- | fs/udf/symlink.c | 6 | ||||
-rw-r--r-- | fs/udf/truncate.c | 37 |
11 files changed, 338 insertions, 290 deletions
diff --git a/fs/udf/balloc.c b/fs/udf/balloc.c index 7b95b3f46211..d721a1af1972 100644 --- a/fs/udf/balloc.c +++ b/fs/udf/balloc.c | |||
@@ -436,6 +436,7 @@ static void udf_table_free_blocks(struct super_block *sb, | |||
436 | struct extent_position oepos, epos; | 436 | struct extent_position oepos, epos; |
437 | int8_t etype; | 437 | int8_t etype; |
438 | int i; | 438 | int i; |
439 | struct udf_inode_info *iinfo; | ||
439 | 440 | ||
440 | mutex_lock(&sbi->s_alloc_mutex); | 441 | mutex_lock(&sbi->s_alloc_mutex); |
441 | if (bloc.logicalBlockNum < 0 || | 442 | if (bloc.logicalBlockNum < 0 || |
@@ -448,6 +449,7 @@ static void udf_table_free_blocks(struct super_block *sb, | |||
448 | goto error_return; | 449 | goto error_return; |
449 | } | 450 | } |
450 | 451 | ||
452 | iinfo = UDF_I(table); | ||
451 | /* We do this up front - There are some error conditions that | 453 | /* We do this up front - There are some error conditions that |
452 | could occure, but.. oh well */ | 454 | could occure, but.. oh well */ |
453 | if (inode) | 455 | if (inode) |
@@ -460,7 +462,7 @@ static void udf_table_free_blocks(struct super_block *sb, | |||
460 | 462 | ||
461 | epos.offset = oepos.offset = sizeof(struct unallocSpaceEntry); | 463 | epos.offset = oepos.offset = sizeof(struct unallocSpaceEntry); |
462 | elen = 0; | 464 | elen = 0; |
463 | epos.block = oepos.block = UDF_I(table)->i_location; | 465 | epos.block = oepos.block = iinfo->i_location; |
464 | epos.bh = oepos.bh = NULL; | 466 | epos.bh = oepos.bh = NULL; |
465 | 467 | ||
466 | while (count && | 468 | while (count && |
@@ -539,11 +541,11 @@ static void udf_table_free_blocks(struct super_block *sb, | |||
539 | elen = EXT_RECORDED_ALLOCATED | | 541 | elen = EXT_RECORDED_ALLOCATED | |
540 | (count << sb->s_blocksize_bits); | 542 | (count << sb->s_blocksize_bits); |
541 | 543 | ||
542 | if (UDF_I(table)->i_alloc_type == ICBTAG_FLAG_AD_SHORT) { | 544 | if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_SHORT) |
543 | adsize = sizeof(short_ad); | 545 | adsize = sizeof(short_ad); |
544 | } else if (UDF_I(table)->i_alloc_type == ICBTAG_FLAG_AD_LONG) { | 546 | else if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_LONG) |
545 | adsize = sizeof(long_ad); | 547 | adsize = sizeof(long_ad); |
546 | } else { | 548 | else { |
547 | brelse(oepos.bh); | 549 | brelse(oepos.bh); |
548 | brelse(epos.bh); | 550 | brelse(epos.bh); |
549 | goto error_return; | 551 | goto error_return; |
@@ -573,7 +575,7 @@ static void udf_table_free_blocks(struct super_block *sb, | |||
573 | if (epos.offset + adsize > sb->s_blocksize) { | 575 | if (epos.offset + adsize > sb->s_blocksize) { |
574 | loffset = epos.offset; | 576 | loffset = epos.offset; |
575 | aed->lengthAllocDescs = cpu_to_le32(adsize); | 577 | aed->lengthAllocDescs = cpu_to_le32(adsize); |
576 | sptr = UDF_I(table)->i_ext.i_data + epos.offset | 578 | sptr = iinfo->i_ext.i_data + epos.offset |
577 | - adsize; | 579 | - adsize; |
578 | dptr = epos.bh->b_data + | 580 | dptr = epos.bh->b_data + |
579 | sizeof(struct allocExtDesc); | 581 | sizeof(struct allocExtDesc); |
@@ -592,9 +594,9 @@ static void udf_table_free_blocks(struct super_block *sb, | |||
592 | aed->lengthAllocDescs) + | 594 | aed->lengthAllocDescs) + |
593 | adsize); | 595 | adsize); |
594 | } else { | 596 | } else { |
595 | sptr = UDF_I(table)->i_ext.i_data + | 597 | sptr = iinfo->i_ext.i_data + |
596 | epos.offset; | 598 | epos.offset; |
597 | UDF_I(table)->i_lenAlloc += adsize; | 599 | iinfo->i_lenAlloc += adsize; |
598 | mark_inode_dirty(table); | 600 | mark_inode_dirty(table); |
599 | } | 601 | } |
600 | epos.offset = sizeof(struct allocExtDesc); | 602 | epos.offset = sizeof(struct allocExtDesc); |
@@ -608,7 +610,7 @@ static void udf_table_free_blocks(struct super_block *sb, | |||
608 | 2, 1, epos.block.logicalBlockNum, | 610 | 2, 1, epos.block.logicalBlockNum, |
609 | sizeof(tag)); | 611 | sizeof(tag)); |
610 | 612 | ||
611 | switch (UDF_I(table)->i_alloc_type) { | 613 | switch (iinfo->i_alloc_type) { |
612 | case ICBTAG_FLAG_AD_SHORT: | 614 | case ICBTAG_FLAG_AD_SHORT: |
613 | sad = (short_ad *)sptr; | 615 | sad = (short_ad *)sptr; |
614 | sad->extLength = cpu_to_le32( | 616 | sad->extLength = cpu_to_le32( |
@@ -639,7 +641,7 @@ static void udf_table_free_blocks(struct super_block *sb, | |||
639 | udf_write_aext(table, &epos, eloc, elen, 1); | 641 | udf_write_aext(table, &epos, eloc, elen, 1); |
640 | 642 | ||
641 | if (!epos.bh) { | 643 | if (!epos.bh) { |
642 | UDF_I(table)->i_lenAlloc += adsize; | 644 | iinfo->i_lenAlloc += adsize; |
643 | mark_inode_dirty(table); | 645 | mark_inode_dirty(table); |
644 | } else { | 646 | } else { |
645 | aed = (struct allocExtDesc *)epos.bh->b_data; | 647 | aed = (struct allocExtDesc *)epos.bh->b_data; |
@@ -672,21 +674,23 @@ static int udf_table_prealloc_blocks(struct super_block *sb, | |||
672 | kernel_lb_addr eloc; | 674 | kernel_lb_addr eloc; |
673 | struct extent_position epos; | 675 | struct extent_position epos; |
674 | int8_t etype = -1; | 676 | int8_t etype = -1; |
677 | struct udf_inode_info *iinfo; | ||
675 | 678 | ||
676 | if (first_block < 0 || | 679 | if (first_block < 0 || |
677 | first_block >= sbi->s_partmaps[partition].s_partition_len) | 680 | first_block >= sbi->s_partmaps[partition].s_partition_len) |
678 | return 0; | 681 | return 0; |
679 | 682 | ||
680 | if (UDF_I(table)->i_alloc_type == ICBTAG_FLAG_AD_SHORT) | 683 | iinfo = UDF_I(table); |
684 | if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_SHORT) | ||
681 | adsize = sizeof(short_ad); | 685 | adsize = sizeof(short_ad); |
682 | else if (UDF_I(table)->i_alloc_type == ICBTAG_FLAG_AD_LONG) | 686 | else if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_LONG) |
683 | adsize = sizeof(long_ad); | 687 | adsize = sizeof(long_ad); |
684 | else | 688 | else |
685 | return 0; | 689 | return 0; |
686 | 690 | ||
687 | mutex_lock(&sbi->s_alloc_mutex); | 691 | mutex_lock(&sbi->s_alloc_mutex); |
688 | epos.offset = sizeof(struct unallocSpaceEntry); | 692 | epos.offset = sizeof(struct unallocSpaceEntry); |
689 | epos.block = UDF_I(table)->i_location; | 693 | epos.block = iinfo->i_location; |
690 | epos.bh = NULL; | 694 | epos.bh = NULL; |
691 | eloc.logicalBlockNum = 0xFFFFFFFF; | 695 | eloc.logicalBlockNum = 0xFFFFFFFF; |
692 | 696 | ||
@@ -739,12 +743,13 @@ static int udf_table_new_block(struct super_block *sb, | |||
739 | kernel_lb_addr eloc, uninitialized_var(goal_eloc); | 743 | kernel_lb_addr eloc, uninitialized_var(goal_eloc); |
740 | struct extent_position epos, goal_epos; | 744 | struct extent_position epos, goal_epos; |
741 | int8_t etype; | 745 | int8_t etype; |
746 | struct udf_inode_info *iinfo = UDF_I(table); | ||
742 | 747 | ||
743 | *err = -ENOSPC; | 748 | *err = -ENOSPC; |
744 | 749 | ||
745 | if (UDF_I(table)->i_alloc_type == ICBTAG_FLAG_AD_SHORT) | 750 | if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_SHORT) |
746 | adsize = sizeof(short_ad); | 751 | adsize = sizeof(short_ad); |
747 | else if (UDF_I(table)->i_alloc_type == ICBTAG_FLAG_AD_LONG) | 752 | else if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_LONG) |
748 | adsize = sizeof(long_ad); | 753 | adsize = sizeof(long_ad); |
749 | else | 754 | else |
750 | return newblock; | 755 | return newblock; |
@@ -759,7 +764,7 @@ static int udf_table_new_block(struct super_block *sb, | |||
759 | of the current closest match and use that when we are done. | 764 | of the current closest match and use that when we are done. |
760 | */ | 765 | */ |
761 | epos.offset = sizeof(struct unallocSpaceEntry); | 766 | epos.offset = sizeof(struct unallocSpaceEntry); |
762 | epos.block = UDF_I(table)->i_location; | 767 | epos.block = iinfo->i_location; |
763 | epos.bh = goal_epos.bh = NULL; | 768 | epos.bh = goal_epos.bh = NULL; |
764 | 769 | ||
765 | while (spread && | 770 | while (spread && |
diff --git a/fs/udf/dir.c b/fs/udf/dir.c index 6fd831413c9a..4d9b2153f686 100644 --- a/fs/udf/dir.c +++ b/fs/udf/dir.c | |||
@@ -117,6 +117,7 @@ do_udf_readdir(struct inode *dir, struct file *filp, filldir_t filldir, | |||
117 | int i, num; | 117 | int i, num; |
118 | unsigned int dt_type; | 118 | unsigned int dt_type; |
119 | struct extent_position epos = { NULL, 0, {0, 0} }; | 119 | struct extent_position epos = { NULL, 0, {0, 0} }; |
120 | struct udf_inode_info *iinfo; | ||
120 | 121 | ||
121 | if (nf_pos >= size) | 122 | if (nf_pos >= size) |
122 | return 0; | 123 | return 0; |
@@ -125,15 +126,16 @@ do_udf_readdir(struct inode *dir, struct file *filp, filldir_t filldir, | |||
125 | nf_pos = (udf_ext0_offset(dir) >> 2); | 126 | nf_pos = (udf_ext0_offset(dir) >> 2); |
126 | 127 | ||
127 | fibh.soffset = fibh.eoffset = (nf_pos & ((dir->i_sb->s_blocksize - 1) >> 2)) << 2; | 128 | fibh.soffset = fibh.eoffset = (nf_pos & ((dir->i_sb->s_blocksize - 1) >> 2)) << 2; |
128 | if (UDF_I(dir)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) { | 129 | iinfo = UDF_I(dir); |
130 | if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) { | ||
129 | fibh.sbh = fibh.ebh = NULL; | 131 | fibh.sbh = fibh.ebh = NULL; |
130 | } else if (inode_bmap(dir, nf_pos >> (dir->i_sb->s_blocksize_bits - 2), | 132 | } else if (inode_bmap(dir, nf_pos >> (dir->i_sb->s_blocksize_bits - 2), |
131 | &epos, &eloc, &elen, &offset) == (EXT_RECORDED_ALLOCATED >> 30)) { | 133 | &epos, &eloc, &elen, &offset) == (EXT_RECORDED_ALLOCATED >> 30)) { |
132 | block = udf_get_lb_pblock(dir->i_sb, eloc, offset); | 134 | block = udf_get_lb_pblock(dir->i_sb, eloc, offset); |
133 | if ((++offset << dir->i_sb->s_blocksize_bits) < elen) { | 135 | if ((++offset << dir->i_sb->s_blocksize_bits) < elen) { |
134 | if (UDF_I(dir)->i_alloc_type == ICBTAG_FLAG_AD_SHORT) | 136 | if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_SHORT) |
135 | epos.offset -= sizeof(short_ad); | 137 | epos.offset -= sizeof(short_ad); |
136 | else if (UDF_I(dir)->i_alloc_type == | 138 | else if (iinfo->i_alloc_type == |
137 | ICBTAG_FLAG_AD_LONG) | 139 | ICBTAG_FLAG_AD_LONG) |
138 | epos.offset -= sizeof(long_ad); | 140 | epos.offset -= sizeof(long_ad); |
139 | } else { | 141 | } else { |
diff --git a/fs/udf/directory.c b/fs/udf/directory.c index 949a5930f6d4..d8ceb44f4f22 100644 --- a/fs/udf/directory.c +++ b/fs/udf/directory.c | |||
@@ -81,12 +81,13 @@ struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t *nf_pos, | |||
81 | struct fileIdentDesc *fi; | 81 | struct fileIdentDesc *fi; |
82 | int i, num, block; | 82 | int i, num, block; |
83 | struct buffer_head *tmp, *bha[16]; | 83 | struct buffer_head *tmp, *bha[16]; |
84 | struct udf_inode_info *iinfo = UDF_I(dir); | ||
84 | 85 | ||
85 | fibh->soffset = fibh->eoffset; | 86 | fibh->soffset = fibh->eoffset; |
86 | 87 | ||
87 | if (UDF_I(dir)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) { | 88 | if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) { |
88 | fi = udf_get_fileident(UDF_I(dir)->i_ext.i_data - | 89 | fi = udf_get_fileident(iinfo->i_ext.i_data - |
89 | (UDF_I(dir)->i_efe ? | 90 | (iinfo->i_efe ? |
90 | sizeof(struct extendedFileEntry) : | 91 | sizeof(struct extendedFileEntry) : |
91 | sizeof(struct fileEntry)), | 92 | sizeof(struct fileEntry)), |
92 | dir->i_sb->s_blocksize, | 93 | dir->i_sb->s_blocksize, |
diff --git a/fs/udf/file.c b/fs/udf/file.c index a1e07a131623..97c71ae7c689 100644 --- a/fs/udf/file.c +++ b/fs/udf/file.c | |||
@@ -45,13 +45,13 @@ static int udf_adinicb_readpage(struct file *file, struct page *page) | |||
45 | { | 45 | { |
46 | struct inode *inode = page->mapping->host; | 46 | struct inode *inode = page->mapping->host; |
47 | char *kaddr; | 47 | char *kaddr; |
48 | struct udf_inode_info *iinfo = UDF_I(inode); | ||
48 | 49 | ||
49 | BUG_ON(!PageLocked(page)); | 50 | BUG_ON(!PageLocked(page)); |
50 | 51 | ||
51 | kaddr = kmap(page); | 52 | kaddr = kmap(page); |
52 | memset(kaddr, 0, PAGE_CACHE_SIZE); | 53 | memset(kaddr, 0, PAGE_CACHE_SIZE); |
53 | memcpy(kaddr, UDF_I(inode)->i_ext.i_data + UDF_I(inode)->i_lenEAttr, | 54 | memcpy(kaddr, iinfo->i_ext.i_data + iinfo->i_lenEAttr, inode->i_size); |
54 | inode->i_size); | ||
55 | flush_dcache_page(page); | 55 | flush_dcache_page(page); |
56 | SetPageUptodate(page); | 56 | SetPageUptodate(page); |
57 | kunmap(page); | 57 | kunmap(page); |
@@ -65,12 +65,12 @@ static int udf_adinicb_writepage(struct page *page, | |||
65 | { | 65 | { |
66 | struct inode *inode = page->mapping->host; | 66 | struct inode *inode = page->mapping->host; |
67 | char *kaddr; | 67 | char *kaddr; |
68 | struct udf_inode_info *iinfo = UDF_I(inode); | ||
68 | 69 | ||
69 | BUG_ON(!PageLocked(page)); | 70 | BUG_ON(!PageLocked(page)); |
70 | 71 | ||
71 | kaddr = kmap(page); | 72 | kaddr = kmap(page); |
72 | memcpy(UDF_I(inode)->i_ext.i_data + UDF_I(inode)->i_lenEAttr, kaddr, | 73 | memcpy(iinfo->i_ext.i_data + iinfo->i_lenEAttr, kaddr, inode->i_size); |
73 | inode->i_size); | ||
74 | mark_inode_dirty(inode); | 74 | mark_inode_dirty(inode); |
75 | SetPageUptodate(page); | 75 | SetPageUptodate(page); |
76 | kunmap(page); | 76 | kunmap(page); |
@@ -87,9 +87,10 @@ static int udf_adinicb_write_end(struct file *file, | |||
87 | struct inode *inode = mapping->host; | 87 | struct inode *inode = mapping->host; |
88 | unsigned offset = pos & (PAGE_CACHE_SIZE - 1); | 88 | unsigned offset = pos & (PAGE_CACHE_SIZE - 1); |
89 | char *kaddr; | 89 | char *kaddr; |
90 | struct udf_inode_info *iinfo = UDF_I(inode); | ||
90 | 91 | ||
91 | kaddr = kmap_atomic(page, KM_USER0); | 92 | kaddr = kmap_atomic(page, KM_USER0); |
92 | memcpy(UDF_I(inode)->i_ext.i_data + UDF_I(inode)->i_lenEAttr + offset, | 93 | memcpy(iinfo->i_ext.i_data + iinfo->i_lenEAttr + offset, |
93 | kaddr + offset, copied); | 94 | kaddr + offset, copied); |
94 | kunmap_atomic(kaddr, KM_USER0); | 95 | kunmap_atomic(kaddr, KM_USER0); |
95 | 96 | ||
@@ -112,8 +113,9 @@ static ssize_t udf_file_aio_write(struct kiocb *iocb, const struct iovec *iov, | |||
112 | struct inode *inode = file->f_path.dentry->d_inode; | 113 | struct inode *inode = file->f_path.dentry->d_inode; |
113 | int err, pos; | 114 | int err, pos; |
114 | size_t count = iocb->ki_left; | 115 | size_t count = iocb->ki_left; |
116 | struct udf_inode_info *iinfo = UDF_I(inode); | ||
115 | 117 | ||
116 | if (UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) { | 118 | if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) { |
117 | if (file->f_flags & O_APPEND) | 119 | if (file->f_flags & O_APPEND) |
118 | pos = inode->i_size; | 120 | pos = inode->i_size; |
119 | else | 121 | else |
@@ -123,16 +125,15 @@ static ssize_t udf_file_aio_write(struct kiocb *iocb, const struct iovec *iov, | |||
123 | (udf_file_entry_alloc_offset(inode) + | 125 | (udf_file_entry_alloc_offset(inode) + |
124 | pos + count)) { | 126 | pos + count)) { |
125 | udf_expand_file_adinicb(inode, pos + count, &err); | 127 | udf_expand_file_adinicb(inode, pos + count, &err); |
126 | if (UDF_I(inode)->i_alloc_type == | 128 | if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) { |
127 | ICBTAG_FLAG_AD_IN_ICB) { | ||
128 | udf_debug("udf_expand_adinicb: err=%d\n", err); | 129 | udf_debug("udf_expand_adinicb: err=%d\n", err); |
129 | return err; | 130 | return err; |
130 | } | 131 | } |
131 | } else { | 132 | } else { |
132 | if (pos + count > inode->i_size) | 133 | if (pos + count > inode->i_size) |
133 | UDF_I(inode)->i_lenAlloc = pos + count; | 134 | iinfo->i_lenAlloc = pos + count; |
134 | else | 135 | else |
135 | UDF_I(inode)->i_lenAlloc = inode->i_size; | 136 | iinfo->i_lenAlloc = inode->i_size; |
136 | } | 137 | } |
137 | } | 138 | } |
138 | 139 | ||
diff --git a/fs/udf/ialloc.c b/fs/udf/ialloc.c index 5ed8cda1c53e..84360315aca2 100644 --- a/fs/udf/ialloc.c +++ b/fs/udf/ialloc.c | |||
@@ -67,6 +67,8 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err) | |||
67 | struct inode *inode; | 67 | struct inode *inode; |
68 | int block; | 68 | int block; |
69 | uint32_t start = UDF_I(dir)->i_location.logicalBlockNum; | 69 | uint32_t start = UDF_I(dir)->i_location.logicalBlockNum; |
70 | struct udf_inode_info *iinfo; | ||
71 | struct udf_inode_info *dinfo = UDF_I(dir); | ||
70 | 72 | ||
71 | inode = new_inode(sb); | 73 | inode = new_inode(sb); |
72 | 74 | ||
@@ -76,14 +78,15 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err) | |||
76 | } | 78 | } |
77 | *err = -ENOSPC; | 79 | *err = -ENOSPC; |
78 | 80 | ||
79 | UDF_I(inode)->i_unique = 0; | 81 | iinfo = UDF_I(inode); |
80 | UDF_I(inode)->i_lenExtents = 0; | 82 | iinfo->i_unique = 0; |
81 | UDF_I(inode)->i_next_alloc_block = 0; | 83 | iinfo->i_lenExtents = 0; |
82 | UDF_I(inode)->i_next_alloc_goal = 0; | 84 | iinfo->i_next_alloc_block = 0; |
83 | UDF_I(inode)->i_strat4096 = 0; | 85 | iinfo->i_next_alloc_goal = 0; |
86 | iinfo->i_strat4096 = 0; | ||
84 | 87 | ||
85 | block = udf_new_block(dir->i_sb, NULL, | 88 | block = udf_new_block(dir->i_sb, NULL, |
86 | UDF_I(dir)->i_location.partitionReferenceNum, | 89 | dinfo->i_location.partitionReferenceNum, |
87 | start, err); | 90 | start, err); |
88 | if (*err) { | 91 | if (*err) { |
89 | iput(inode); | 92 | iput(inode); |
@@ -107,7 +110,7 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err) | |||
107 | else | 110 | else |
108 | lvidiu->numFiles = | 111 | lvidiu->numFiles = |
109 | cpu_to_le32(le32_to_cpu(lvidiu->numFiles) + 1); | 112 | cpu_to_le32(le32_to_cpu(lvidiu->numFiles) + 1); |
110 | UDF_I(inode)->i_unique = uniqueID = le64_to_cpu(lvhd->uniqueID); | 113 | iinfo->i_unique = uniqueID = le64_to_cpu(lvhd->uniqueID); |
111 | if (!(++uniqueID & 0x00000000FFFFFFFFUL)) | 114 | if (!(++uniqueID & 0x00000000FFFFFFFFUL)) |
112 | uniqueID += 16; | 115 | uniqueID += 16; |
113 | lvhd->uniqueID = cpu_to_le64(uniqueID); | 116 | lvhd->uniqueID = cpu_to_le64(uniqueID); |
@@ -123,41 +126,41 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err) | |||
123 | inode->i_gid = current->fsgid; | 126 | inode->i_gid = current->fsgid; |
124 | } | 127 | } |
125 | 128 | ||
126 | UDF_I(inode)->i_location.logicalBlockNum = block; | 129 | iinfo->i_location.logicalBlockNum = block; |
127 | UDF_I(inode)->i_location.partitionReferenceNum = | 130 | iinfo->i_location.partitionReferenceNum = |
128 | UDF_I(dir)->i_location.partitionReferenceNum; | 131 | dinfo->i_location.partitionReferenceNum; |
129 | inode->i_ino = udf_get_lb_pblock(sb, UDF_I(inode)->i_location, 0); | 132 | inode->i_ino = udf_get_lb_pblock(sb, iinfo->i_location, 0); |
130 | inode->i_blocks = 0; | 133 | inode->i_blocks = 0; |
131 | UDF_I(inode)->i_lenEAttr = 0; | 134 | iinfo->i_lenEAttr = 0; |
132 | UDF_I(inode)->i_lenAlloc = 0; | 135 | iinfo->i_lenAlloc = 0; |
133 | UDF_I(inode)->i_use = 0; | 136 | iinfo->i_use = 0; |
134 | if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_EXTENDED_FE)) { | 137 | if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_EXTENDED_FE)) { |
135 | UDF_I(inode)->i_efe = 1; | 138 | iinfo->i_efe = 1; |
136 | if (UDF_VERS_USE_EXTENDED_FE > sbi->s_udfrev) | 139 | if (UDF_VERS_USE_EXTENDED_FE > sbi->s_udfrev) |
137 | sbi->s_udfrev = UDF_VERS_USE_EXTENDED_FE; | 140 | sbi->s_udfrev = UDF_VERS_USE_EXTENDED_FE; |
138 | UDF_I(inode)->i_ext.i_data = kzalloc(inode->i_sb->s_blocksize - | 141 | iinfo->i_ext.i_data = kzalloc(inode->i_sb->s_blocksize - |
139 | sizeof(struct extendedFileEntry), | 142 | sizeof(struct extendedFileEntry), |
140 | GFP_KERNEL); | 143 | GFP_KERNEL); |
141 | } else { | 144 | } else { |
142 | UDF_I(inode)->i_efe = 0; | 145 | iinfo->i_efe = 0; |
143 | UDF_I(inode)->i_ext.i_data = kzalloc(inode->i_sb->s_blocksize - | 146 | iinfo->i_ext.i_data = kzalloc(inode->i_sb->s_blocksize - |
144 | sizeof(struct fileEntry), | 147 | sizeof(struct fileEntry), |
145 | GFP_KERNEL); | 148 | GFP_KERNEL); |
146 | } | 149 | } |
147 | if (!UDF_I(inode)->i_ext.i_data) { | 150 | if (!iinfo->i_ext.i_data) { |
148 | iput(inode); | 151 | iput(inode); |
149 | *err = -ENOMEM; | 152 | *err = -ENOMEM; |
150 | mutex_unlock(&sbi->s_alloc_mutex); | 153 | mutex_unlock(&sbi->s_alloc_mutex); |
151 | return NULL; | 154 | return NULL; |
152 | } | 155 | } |
153 | if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_AD_IN_ICB)) | 156 | if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_AD_IN_ICB)) |
154 | UDF_I(inode)->i_alloc_type = ICBTAG_FLAG_AD_IN_ICB; | 157 | iinfo->i_alloc_type = ICBTAG_FLAG_AD_IN_ICB; |
155 | else if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD)) | 158 | else if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD)) |
156 | UDF_I(inode)->i_alloc_type = ICBTAG_FLAG_AD_SHORT; | 159 | iinfo->i_alloc_type = ICBTAG_FLAG_AD_SHORT; |
157 | else | 160 | else |
158 | UDF_I(inode)->i_alloc_type = ICBTAG_FLAG_AD_LONG; | 161 | iinfo->i_alloc_type = ICBTAG_FLAG_AD_LONG; |
159 | inode->i_mtime = inode->i_atime = inode->i_ctime = | 162 | inode->i_mtime = inode->i_atime = inode->i_ctime = |
160 | UDF_I(inode)->i_crtime = current_fs_time(inode->i_sb); | 163 | iinfo->i_crtime = current_fs_time(inode->i_sb); |
161 | insert_inode_hash(inode); | 164 | insert_inode_hash(inode); |
162 | mark_inode_dirty(inode); | 165 | mark_inode_dirty(inode); |
163 | mutex_unlock(&sbi->s_alloc_mutex); | 166 | mutex_unlock(&sbi->s_alloc_mutex); |
diff --git a/fs/udf/inode.c b/fs/udf/inode.c index f746b9f1c03c..6b4409f50196 100644 --- a/fs/udf/inode.c +++ b/fs/udf/inode.c | |||
@@ -112,6 +112,7 @@ no_delete: | |||
112 | */ | 112 | */ |
113 | void udf_clear_inode(struct inode *inode) | 113 | void udf_clear_inode(struct inode *inode) |
114 | { | 114 | { |
115 | struct udf_inode_info *iinfo; | ||
115 | if (!(inode->i_sb->s_flags & MS_RDONLY)) { | 116 | if (!(inode->i_sb->s_flags & MS_RDONLY)) { |
116 | lock_kernel(); | 117 | lock_kernel(); |
117 | /* Discard preallocation for directories, symlinks, etc. */ | 118 | /* Discard preallocation for directories, symlinks, etc. */ |
@@ -120,8 +121,9 @@ void udf_clear_inode(struct inode *inode) | |||
120 | unlock_kernel(); | 121 | unlock_kernel(); |
121 | write_inode_now(inode, 1); | 122 | write_inode_now(inode, 1); |
122 | } | 123 | } |
123 | kfree(UDF_I(inode)->i_ext.i_data); | 124 | iinfo = UDF_I(inode); |
124 | UDF_I(inode)->i_ext.i_data = NULL; | 125 | kfree(iinfo->i_ext.i_data); |
126 | iinfo->i_ext.i_data = NULL; | ||
125 | } | 127 | } |
126 | 128 | ||
127 | static int udf_writepage(struct page *page, struct writeback_control *wbc) | 129 | static int udf_writepage(struct page *page, struct writeback_control *wbc) |
@@ -161,6 +163,7 @@ void udf_expand_file_adinicb(struct inode *inode, int newsize, int *err) | |||
161 | { | 163 | { |
162 | struct page *page; | 164 | struct page *page; |
163 | char *kaddr; | 165 | char *kaddr; |
166 | struct udf_inode_info *iinfo = UDF_I(inode); | ||
164 | struct writeback_control udf_wbc = { | 167 | struct writeback_control udf_wbc = { |
165 | .sync_mode = WB_SYNC_NONE, | 168 | .sync_mode = WB_SYNC_NONE, |
166 | .nr_to_write = 1, | 169 | .nr_to_write = 1, |
@@ -169,11 +172,11 @@ void udf_expand_file_adinicb(struct inode *inode, int newsize, int *err) | |||
169 | /* from now on we have normal address_space methods */ | 172 | /* from now on we have normal address_space methods */ |
170 | inode->i_data.a_ops = &udf_aops; | 173 | inode->i_data.a_ops = &udf_aops; |
171 | 174 | ||
172 | if (!UDF_I(inode)->i_lenAlloc) { | 175 | if (!iinfo->i_lenAlloc) { |
173 | if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD)) | 176 | if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD)) |
174 | UDF_I(inode)->i_alloc_type = ICBTAG_FLAG_AD_SHORT; | 177 | iinfo->i_alloc_type = ICBTAG_FLAG_AD_SHORT; |
175 | else | 178 | else |
176 | UDF_I(inode)->i_alloc_type = ICBTAG_FLAG_AD_LONG; | 179 | iinfo->i_alloc_type = ICBTAG_FLAG_AD_LONG; |
177 | mark_inode_dirty(inode); | 180 | mark_inode_dirty(inode); |
178 | return; | 181 | return; |
179 | } | 182 | } |
@@ -183,21 +186,21 @@ void udf_expand_file_adinicb(struct inode *inode, int newsize, int *err) | |||
183 | 186 | ||
184 | if (!PageUptodate(page)) { | 187 | if (!PageUptodate(page)) { |
185 | kaddr = kmap(page); | 188 | kaddr = kmap(page); |
186 | memset(kaddr + UDF_I(inode)->i_lenAlloc, 0x00, | 189 | memset(kaddr + iinfo->i_lenAlloc, 0x00, |
187 | PAGE_CACHE_SIZE - UDF_I(inode)->i_lenAlloc); | 190 | PAGE_CACHE_SIZE - iinfo->i_lenAlloc); |
188 | memcpy(kaddr, UDF_I(inode)->i_ext.i_data + | 191 | memcpy(kaddr, iinfo->i_ext.i_data + iinfo->i_lenEAttr, |
189 | UDF_I(inode)->i_lenEAttr, UDF_I(inode)->i_lenAlloc); | 192 | iinfo->i_lenAlloc); |
190 | flush_dcache_page(page); | 193 | flush_dcache_page(page); |
191 | SetPageUptodate(page); | 194 | SetPageUptodate(page); |
192 | kunmap(page); | 195 | kunmap(page); |
193 | } | 196 | } |
194 | memset(UDF_I(inode)->i_ext.i_data + UDF_I(inode)->i_lenEAttr, 0x00, | 197 | memset(iinfo->i_ext.i_data + iinfo->i_lenEAttr, 0x00, |
195 | UDF_I(inode)->i_lenAlloc); | 198 | iinfo->i_lenAlloc); |
196 | UDF_I(inode)->i_lenAlloc = 0; | 199 | iinfo->i_lenAlloc = 0; |
197 | if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD)) | 200 | if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD)) |
198 | UDF_I(inode)->i_alloc_type = ICBTAG_FLAG_AD_SHORT; | 201 | iinfo->i_alloc_type = ICBTAG_FLAG_AD_SHORT; |
199 | else | 202 | else |
200 | UDF_I(inode)->i_alloc_type = ICBTAG_FLAG_AD_LONG; | 203 | iinfo->i_alloc_type = ICBTAG_FLAG_AD_LONG; |
201 | 204 | ||
202 | inode->i_data.a_ops->writepage(page, &udf_wbc); | 205 | inode->i_data.a_ops->writepage(page, &udf_wbc); |
203 | page_cache_release(page); | 206 | page_cache_release(page); |
@@ -219,6 +222,7 @@ struct buffer_head *udf_expand_dir_adinicb(struct inode *inode, int *block, | |||
219 | loff_t f_pos = udf_ext0_offset(inode) >> 2; | 222 | loff_t f_pos = udf_ext0_offset(inode) >> 2; |
220 | int size = (udf_ext0_offset(inode) + inode->i_size) >> 2; | 223 | int size = (udf_ext0_offset(inode) + inode->i_size) >> 2; |
221 | struct fileIdentDesc cfi, *sfi, *dfi; | 224 | struct fileIdentDesc cfi, *sfi, *dfi; |
225 | struct udf_inode_info *iinfo = UDF_I(inode); | ||
222 | 226 | ||
223 | if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD)) | 227 | if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD)) |
224 | alloctype = ICBTAG_FLAG_AD_SHORT; | 228 | alloctype = ICBTAG_FLAG_AD_SHORT; |
@@ -226,19 +230,19 @@ struct buffer_head *udf_expand_dir_adinicb(struct inode *inode, int *block, | |||
226 | alloctype = ICBTAG_FLAG_AD_LONG; | 230 | alloctype = ICBTAG_FLAG_AD_LONG; |
227 | 231 | ||
228 | if (!inode->i_size) { | 232 | if (!inode->i_size) { |
229 | UDF_I(inode)->i_alloc_type = alloctype; | 233 | iinfo->i_alloc_type = alloctype; |
230 | mark_inode_dirty(inode); | 234 | mark_inode_dirty(inode); |
231 | return NULL; | 235 | return NULL; |
232 | } | 236 | } |
233 | 237 | ||
234 | /* alloc block, and copy data to it */ | 238 | /* alloc block, and copy data to it */ |
235 | *block = udf_new_block(inode->i_sb, inode, | 239 | *block = udf_new_block(inode->i_sb, inode, |
236 | UDF_I(inode)->i_location.partitionReferenceNum, | 240 | iinfo->i_location.partitionReferenceNum, |
237 | UDF_I(inode)->i_location.logicalBlockNum, err); | 241 | iinfo->i_location.logicalBlockNum, err); |
238 | if (!(*block)) | 242 | if (!(*block)) |
239 | return NULL; | 243 | return NULL; |
240 | newblock = udf_get_pblock(inode->i_sb, *block, | 244 | newblock = udf_get_pblock(inode->i_sb, *block, |
241 | UDF_I(inode)->i_location.partitionReferenceNum, | 245 | iinfo->i_location.partitionReferenceNum, |
242 | 0); | 246 | 0); |
243 | if (!newblock) | 247 | if (!newblock) |
244 | return NULL; | 248 | return NULL; |
@@ -257,14 +261,14 @@ struct buffer_head *udf_expand_dir_adinicb(struct inode *inode, int *block, | |||
257 | dfibh.soffset = dfibh.eoffset = 0; | 261 | dfibh.soffset = dfibh.eoffset = 0; |
258 | dfibh.sbh = dfibh.ebh = dbh; | 262 | dfibh.sbh = dfibh.ebh = dbh; |
259 | while ((f_pos < size)) { | 263 | while ((f_pos < size)) { |
260 | UDF_I(inode)->i_alloc_type = ICBTAG_FLAG_AD_IN_ICB; | 264 | iinfo->i_alloc_type = ICBTAG_FLAG_AD_IN_ICB; |
261 | sfi = udf_fileident_read(inode, &f_pos, &sfibh, &cfi, NULL, | 265 | sfi = udf_fileident_read(inode, &f_pos, &sfibh, &cfi, NULL, |
262 | NULL, NULL, NULL); | 266 | NULL, NULL, NULL); |
263 | if (!sfi) { | 267 | if (!sfi) { |
264 | brelse(dbh); | 268 | brelse(dbh); |
265 | return NULL; | 269 | return NULL; |
266 | } | 270 | } |
267 | UDF_I(inode)->i_alloc_type = alloctype; | 271 | iinfo->i_alloc_type = alloctype; |
268 | sfi->descTag.tagLocation = cpu_to_le32(*block); | 272 | sfi->descTag.tagLocation = cpu_to_le32(*block); |
269 | dfibh.soffset = dfibh.eoffset; | 273 | dfibh.soffset = dfibh.eoffset; |
270 | dfibh.eoffset += (sfibh.eoffset - sfibh.soffset); | 274 | dfibh.eoffset += (sfibh.eoffset - sfibh.soffset); |
@@ -272,23 +276,23 @@ struct buffer_head *udf_expand_dir_adinicb(struct inode *inode, int *block, | |||
272 | if (udf_write_fi(inode, sfi, dfi, &dfibh, sfi->impUse, | 276 | if (udf_write_fi(inode, sfi, dfi, &dfibh, sfi->impUse, |
273 | sfi->fileIdent + | 277 | sfi->fileIdent + |
274 | le16_to_cpu(sfi->lengthOfImpUse))) { | 278 | le16_to_cpu(sfi->lengthOfImpUse))) { |
275 | UDF_I(inode)->i_alloc_type = ICBTAG_FLAG_AD_IN_ICB; | 279 | iinfo->i_alloc_type = ICBTAG_FLAG_AD_IN_ICB; |
276 | brelse(dbh); | 280 | brelse(dbh); |
277 | return NULL; | 281 | return NULL; |
278 | } | 282 | } |
279 | } | 283 | } |
280 | mark_buffer_dirty_inode(dbh, inode); | 284 | mark_buffer_dirty_inode(dbh, inode); |
281 | 285 | ||
282 | memset(UDF_I(inode)->i_ext.i_data + UDF_I(inode)->i_lenEAttr, 0, | 286 | memset(iinfo->i_ext.i_data + iinfo->i_lenEAttr, 0, |
283 | UDF_I(inode)->i_lenAlloc); | 287 | iinfo->i_lenAlloc); |
284 | UDF_I(inode)->i_lenAlloc = 0; | 288 | iinfo->i_lenAlloc = 0; |
285 | eloc.logicalBlockNum = *block; | 289 | eloc.logicalBlockNum = *block; |
286 | eloc.partitionReferenceNum = | 290 | eloc.partitionReferenceNum = |
287 | UDF_I(inode)->i_location.partitionReferenceNum; | 291 | iinfo->i_location.partitionReferenceNum; |
288 | elen = inode->i_size; | 292 | elen = inode->i_size; |
289 | UDF_I(inode)->i_lenExtents = elen; | 293 | iinfo->i_lenExtents = elen; |
290 | epos.bh = NULL; | 294 | epos.bh = NULL; |
291 | epos.block = UDF_I(inode)->i_location; | 295 | epos.block = iinfo->i_location; |
292 | epos.offset = udf_file_entry_alloc_offset(inode); | 296 | epos.offset = udf_file_entry_alloc_offset(inode); |
293 | udf_add_aext(inode, &epos, eloc, elen, 0); | 297 | udf_add_aext(inode, &epos, eloc, elen, 0); |
294 | /* UniqueID stuff */ | 298 | /* UniqueID stuff */ |
@@ -304,6 +308,7 @@ static int udf_get_block(struct inode *inode, sector_t block, | |||
304 | int err, new; | 308 | int err, new; |
305 | struct buffer_head *bh; | 309 | struct buffer_head *bh; |
306 | unsigned long phys; | 310 | unsigned long phys; |
311 | struct udf_inode_info *iinfo; | ||
307 | 312 | ||
308 | if (!create) { | 313 | if (!create) { |
309 | phys = udf_block_map(inode, block); | 314 | phys = udf_block_map(inode, block); |
@@ -321,9 +326,10 @@ static int udf_get_block(struct inode *inode, sector_t block, | |||
321 | if (block < 0) | 326 | if (block < 0) |
322 | goto abort_negative; | 327 | goto abort_negative; |
323 | 328 | ||
324 | if (block == UDF_I(inode)->i_next_alloc_block + 1) { | 329 | iinfo = UDF_I(inode); |
325 | UDF_I(inode)->i_next_alloc_block++; | 330 | if (block == iinfo->i_next_alloc_block + 1) { |
326 | UDF_I(inode)->i_next_alloc_goal++; | 331 | iinfo->i_next_alloc_block++; |
332 | iinfo->i_next_alloc_goal++; | ||
327 | } | 333 | } |
328 | 334 | ||
329 | err = 0; | 335 | err = 0; |
@@ -380,20 +386,22 @@ int udf_extend_file(struct inode *inode, struct extent_position *last_pos, | |||
380 | struct super_block *sb = inode->i_sb; | 386 | struct super_block *sb = inode->i_sb; |
381 | kernel_lb_addr prealloc_loc = {}; | 387 | kernel_lb_addr prealloc_loc = {}; |
382 | int prealloc_len = 0; | 388 | int prealloc_len = 0; |
389 | struct udf_inode_info *iinfo; | ||
383 | 390 | ||
384 | /* The previous extent is fake and we should not extend by anything | 391 | /* The previous extent is fake and we should not extend by anything |
385 | * - there's nothing to do... */ | 392 | * - there's nothing to do... */ |
386 | if (!blocks && fake) | 393 | if (!blocks && fake) |
387 | return 0; | 394 | return 0; |
388 | 395 | ||
396 | iinfo = UDF_I(inode); | ||
389 | /* Round the last extent up to a multiple of block size */ | 397 | /* Round the last extent up to a multiple of block size */ |
390 | if (last_ext->extLength & (sb->s_blocksize - 1)) { | 398 | if (last_ext->extLength & (sb->s_blocksize - 1)) { |
391 | last_ext->extLength = | 399 | last_ext->extLength = |
392 | (last_ext->extLength & UDF_EXTENT_FLAG_MASK) | | 400 | (last_ext->extLength & UDF_EXTENT_FLAG_MASK) | |
393 | (((last_ext->extLength & UDF_EXTENT_LENGTH_MASK) + | 401 | (((last_ext->extLength & UDF_EXTENT_LENGTH_MASK) + |
394 | sb->s_blocksize - 1) & ~(sb->s_blocksize - 1)); | 402 | sb->s_blocksize - 1) & ~(sb->s_blocksize - 1)); |
395 | UDF_I(inode)->i_lenExtents = | 403 | iinfo->i_lenExtents = |
396 | (UDF_I(inode)->i_lenExtents + sb->s_blocksize - 1) & | 404 | (iinfo->i_lenExtents + sb->s_blocksize - 1) & |
397 | ~(sb->s_blocksize - 1); | 405 | ~(sb->s_blocksize - 1); |
398 | } | 406 | } |
399 | 407 | ||
@@ -470,9 +478,9 @@ out: | |||
470 | } | 478 | } |
471 | 479 | ||
472 | /* last_pos should point to the last written extent... */ | 480 | /* last_pos should point to the last written extent... */ |
473 | if (UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_SHORT) | 481 | if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_SHORT) |
474 | last_pos->offset -= sizeof(short_ad); | 482 | last_pos->offset -= sizeof(short_ad); |
475 | else if (UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_LONG) | 483 | else if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_LONG) |
476 | last_pos->offset -= sizeof(long_ad); | 484 | last_pos->offset -= sizeof(long_ad); |
477 | else | 485 | else |
478 | return -1; | 486 | return -1; |
@@ -495,11 +503,12 @@ static struct buffer_head *inode_getblk(struct inode *inode, sector_t block, | |||
495 | uint32_t newblocknum, newblock; | 503 | uint32_t newblocknum, newblock; |
496 | sector_t offset = 0; | 504 | sector_t offset = 0; |
497 | int8_t etype; | 505 | int8_t etype; |
498 | int goal = 0, pgoal = UDF_I(inode)->i_location.logicalBlockNum; | 506 | struct udf_inode_info *iinfo = UDF_I(inode); |
507 | int goal = 0, pgoal = iinfo->i_location.logicalBlockNum; | ||
499 | int lastblock = 0; | 508 | int lastblock = 0; |
500 | 509 | ||
501 | prev_epos.offset = udf_file_entry_alloc_offset(inode); | 510 | prev_epos.offset = udf_file_entry_alloc_offset(inode); |
502 | prev_epos.block = UDF_I(inode)->i_location; | 511 | prev_epos.block = iinfo->i_location; |
503 | prev_epos.bh = NULL; | 512 | prev_epos.bh = NULL; |
504 | cur_epos = next_epos = prev_epos; | 513 | cur_epos = next_epos = prev_epos; |
505 | b_off = (loff_t)block << inode->i_sb->s_blocksize_bits; | 514 | b_off = (loff_t)block << inode->i_sb->s_blocksize_bits; |
@@ -649,24 +658,23 @@ static struct buffer_head *inode_getblk(struct inode *inode, sector_t block, | |||
649 | if ((laarr[c].extLength >> 30) == (EXT_NOT_RECORDED_ALLOCATED >> 30)) | 658 | if ((laarr[c].extLength >> 30) == (EXT_NOT_RECORDED_ALLOCATED >> 30)) |
650 | newblocknum = laarr[c].extLocation.logicalBlockNum + offset; | 659 | newblocknum = laarr[c].extLocation.logicalBlockNum + offset; |
651 | else { /* otherwise, allocate a new block */ | 660 | else { /* otherwise, allocate a new block */ |
652 | if (UDF_I(inode)->i_next_alloc_block == block) | 661 | if (iinfo->i_next_alloc_block == block) |
653 | goal = UDF_I(inode)->i_next_alloc_goal; | 662 | goal = iinfo->i_next_alloc_goal; |
654 | 663 | ||
655 | if (!goal) { | 664 | if (!goal) { |
656 | if (!(goal = pgoal)) /* XXX: what was intended here? */ | 665 | if (!(goal = pgoal)) /* XXX: what was intended here? */ |
657 | goal = UDF_I(inode)-> | 666 | goal = iinfo->i_location.logicalBlockNum + 1; |
658 | i_location.logicalBlockNum + 1; | ||
659 | } | 667 | } |
660 | 668 | ||
661 | newblocknum = udf_new_block(inode->i_sb, inode, | 669 | newblocknum = udf_new_block(inode->i_sb, inode, |
662 | UDF_I(inode)->i_location.partitionReferenceNum, | 670 | iinfo->i_location.partitionReferenceNum, |
663 | goal, err); | 671 | goal, err); |
664 | if (!newblocknum) { | 672 | if (!newblocknum) { |
665 | brelse(prev_epos.bh); | 673 | brelse(prev_epos.bh); |
666 | *err = -ENOSPC; | 674 | *err = -ENOSPC; |
667 | return NULL; | 675 | return NULL; |
668 | } | 676 | } |
669 | UDF_I(inode)->i_lenExtents += inode->i_sb->s_blocksize; | 677 | iinfo->i_lenExtents += inode->i_sb->s_blocksize; |
670 | } | 678 | } |
671 | 679 | ||
672 | /* if the extent the requsted block is located in contains multiple | 680 | /* if the extent the requsted block is located in contains multiple |
@@ -691,14 +699,14 @@ static struct buffer_head *inode_getblk(struct inode *inode, sector_t block, | |||
691 | brelse(prev_epos.bh); | 699 | brelse(prev_epos.bh); |
692 | 700 | ||
693 | newblock = udf_get_pblock(inode->i_sb, newblocknum, | 701 | newblock = udf_get_pblock(inode->i_sb, newblocknum, |
694 | UDF_I(inode)->i_location.partitionReferenceNum, 0); | 702 | iinfo->i_location.partitionReferenceNum, 0); |
695 | if (!newblock) | 703 | if (!newblock) |
696 | return NULL; | 704 | return NULL; |
697 | *phys = newblock; | 705 | *phys = newblock; |
698 | *err = 0; | 706 | *err = 0; |
699 | *new = 1; | 707 | *new = 1; |
700 | UDF_I(inode)->i_next_alloc_block = block; | 708 | iinfo->i_next_alloc_block = block; |
701 | UDF_I(inode)->i_next_alloc_goal = newblocknum; | 709 | iinfo->i_next_alloc_goal = newblocknum; |
702 | inode->i_ctime = current_fs_time(inode->i_sb); | 710 | inode->i_ctime = current_fs_time(inode->i_sb); |
703 | 711 | ||
704 | if (IS_SYNC(inode)) | 712 | if (IS_SYNC(inode)) |
@@ -1027,6 +1035,7 @@ void udf_truncate(struct inode *inode) | |||
1027 | { | 1035 | { |
1028 | int offset; | 1036 | int offset; |
1029 | int err; | 1037 | int err; |
1038 | struct udf_inode_info *iinfo; | ||
1030 | 1039 | ||
1031 | if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) || | 1040 | if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) || |
1032 | S_ISLNK(inode->i_mode))) | 1041 | S_ISLNK(inode->i_mode))) |
@@ -1035,25 +1044,24 @@ void udf_truncate(struct inode *inode) | |||
1035 | return; | 1044 | return; |
1036 | 1045 | ||
1037 | lock_kernel(); | 1046 | lock_kernel(); |
1038 | if (UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) { | 1047 | iinfo = UDF_I(inode); |
1048 | if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) { | ||
1039 | if (inode->i_sb->s_blocksize < | 1049 | if (inode->i_sb->s_blocksize < |
1040 | (udf_file_entry_alloc_offset(inode) + | 1050 | (udf_file_entry_alloc_offset(inode) + |
1041 | inode->i_size)) { | 1051 | inode->i_size)) { |
1042 | udf_expand_file_adinicb(inode, inode->i_size, &err); | 1052 | udf_expand_file_adinicb(inode, inode->i_size, &err); |
1043 | if (UDF_I(inode)->i_alloc_type == | 1053 | if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) { |
1044 | ICBTAG_FLAG_AD_IN_ICB) { | 1054 | inode->i_size = iinfo->i_lenAlloc; |
1045 | inode->i_size = UDF_I(inode)->i_lenAlloc; | ||
1046 | unlock_kernel(); | 1055 | unlock_kernel(); |
1047 | return; | 1056 | return; |
1048 | } else | 1057 | } else |
1049 | udf_truncate_extents(inode); | 1058 | udf_truncate_extents(inode); |
1050 | } else { | 1059 | } else { |
1051 | offset = inode->i_size & (inode->i_sb->s_blocksize - 1); | 1060 | offset = inode->i_size & (inode->i_sb->s_blocksize - 1); |
1052 | memset(UDF_I(inode)->i_ext.i_data + | 1061 | memset(iinfo->i_ext.i_data + iinfo->i_lenEAttr + offset, |
1053 | UDF_I(inode)->i_lenEAttr + offset, | ||
1054 | 0x00, inode->i_sb->s_blocksize - | 1062 | 0x00, inode->i_sb->s_blocksize - |
1055 | offset - udf_file_entry_alloc_offset(inode)); | 1063 | offset - udf_file_entry_alloc_offset(inode)); |
1056 | UDF_I(inode)->i_lenAlloc = inode->i_size; | 1064 | iinfo->i_lenAlloc = inode->i_size; |
1057 | } | 1065 | } |
1058 | } else { | 1066 | } else { |
1059 | block_truncate_page(inode->i_mapping, inode->i_size, | 1067 | block_truncate_page(inode->i_mapping, inode->i_size, |
@@ -1074,6 +1082,7 @@ static void __udf_read_inode(struct inode *inode) | |||
1074 | struct buffer_head *bh = NULL; | 1082 | struct buffer_head *bh = NULL; |
1075 | struct fileEntry *fe; | 1083 | struct fileEntry *fe; |
1076 | uint16_t ident; | 1084 | uint16_t ident; |
1085 | struct udf_inode_info *iinfo = UDF_I(inode); | ||
1077 | 1086 | ||
1078 | /* | 1087 | /* |
1079 | * Set defaults, but the inode is still incomplete! | 1088 | * Set defaults, but the inode is still incomplete! |
@@ -1087,7 +1096,7 @@ static void __udf_read_inode(struct inode *inode) | |||
1087 | * i_nlink = 1 | 1096 | * i_nlink = 1 |
1088 | * i_op = NULL; | 1097 | * i_op = NULL; |
1089 | */ | 1098 | */ |
1090 | bh = udf_read_ptagged(inode->i_sb, UDF_I(inode)->i_location, 0, &ident); | 1099 | bh = udf_read_ptagged(inode->i_sb, iinfo->i_location, 0, &ident); |
1091 | if (!bh) { | 1100 | if (!bh) { |
1092 | printk(KERN_ERR "udf: udf_read_inode(ino %ld) failed !bh\n", | 1101 | printk(KERN_ERR "udf: udf_read_inode(ino %ld) failed !bh\n", |
1093 | inode->i_ino); | 1102 | inode->i_ino); |
@@ -1110,7 +1119,7 @@ static void __udf_read_inode(struct inode *inode) | |||
1110 | struct buffer_head *ibh = NULL, *nbh = NULL; | 1119 | struct buffer_head *ibh = NULL, *nbh = NULL; |
1111 | struct indirectEntry *ie; | 1120 | struct indirectEntry *ie; |
1112 | 1121 | ||
1113 | ibh = udf_read_ptagged(inode->i_sb, UDF_I(inode)->i_location, 1, | 1122 | ibh = udf_read_ptagged(inode->i_sb, iinfo->i_location, 1, |
1114 | &ident); | 1123 | &ident); |
1115 | if (ident == TAG_IDENT_IE) { | 1124 | if (ident == TAG_IDENT_IE) { |
1116 | if (ibh) { | 1125 | if (ibh) { |
@@ -1124,7 +1133,7 @@ static void __udf_read_inode(struct inode *inode) | |||
1124 | &ident))) { | 1133 | &ident))) { |
1125 | if (ident == TAG_IDENT_FE || | 1134 | if (ident == TAG_IDENT_FE || |
1126 | ident == TAG_IDENT_EFE) { | 1135 | ident == TAG_IDENT_EFE) { |
1127 | memcpy(&UDF_I(inode)->i_location, | 1136 | memcpy(&iinfo->i_location, |
1128 | &loc, | 1137 | &loc, |
1129 | sizeof(kernel_lb_addr)); | 1138 | sizeof(kernel_lb_addr)); |
1130 | brelse(bh); | 1139 | brelse(bh); |
@@ -1163,50 +1172,51 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh) | |||
1163 | long convtime_usec; | 1172 | long convtime_usec; |
1164 | int offset; | 1173 | int offset; |
1165 | struct udf_sb_info *sbi = UDF_SB(inode->i_sb); | 1174 | struct udf_sb_info *sbi = UDF_SB(inode->i_sb); |
1175 | struct udf_inode_info *iinfo = UDF_I(inode); | ||
1166 | 1176 | ||
1167 | fe = (struct fileEntry *)bh->b_data; | 1177 | fe = (struct fileEntry *)bh->b_data; |
1168 | efe = (struct extendedFileEntry *)bh->b_data; | 1178 | efe = (struct extendedFileEntry *)bh->b_data; |
1169 | 1179 | ||
1170 | if (fe->icbTag.strategyType == cpu_to_le16(4)) | 1180 | if (fe->icbTag.strategyType == cpu_to_le16(4)) |
1171 | UDF_I(inode)->i_strat4096 = 0; | 1181 | iinfo->i_strat4096 = 0; |
1172 | else /* if (fe->icbTag.strategyType == cpu_to_le16(4096)) */ | 1182 | else /* if (fe->icbTag.strategyType == cpu_to_le16(4096)) */ |
1173 | UDF_I(inode)->i_strat4096 = 1; | 1183 | iinfo->i_strat4096 = 1; |
1174 | 1184 | ||
1175 | UDF_I(inode)->i_alloc_type = le16_to_cpu(fe->icbTag.flags) & | 1185 | iinfo->i_alloc_type = le16_to_cpu(fe->icbTag.flags) & |
1176 | ICBTAG_FLAG_AD_MASK; | 1186 | ICBTAG_FLAG_AD_MASK; |
1177 | UDF_I(inode)->i_unique = 0; | 1187 | iinfo->i_unique = 0; |
1178 | UDF_I(inode)->i_lenEAttr = 0; | 1188 | iinfo->i_lenEAttr = 0; |
1179 | UDF_I(inode)->i_lenExtents = 0; | 1189 | iinfo->i_lenExtents = 0; |
1180 | UDF_I(inode)->i_lenAlloc = 0; | 1190 | iinfo->i_lenAlloc = 0; |
1181 | UDF_I(inode)->i_next_alloc_block = 0; | 1191 | iinfo->i_next_alloc_block = 0; |
1182 | UDF_I(inode)->i_next_alloc_goal = 0; | 1192 | iinfo->i_next_alloc_goal = 0; |
1183 | if (fe->descTag.tagIdent == cpu_to_le16(TAG_IDENT_EFE)) { | 1193 | if (fe->descTag.tagIdent == cpu_to_le16(TAG_IDENT_EFE)) { |
1184 | UDF_I(inode)->i_efe = 1; | 1194 | iinfo->i_efe = 1; |
1185 | UDF_I(inode)->i_use = 0; | 1195 | iinfo->i_use = 0; |
1186 | if (udf_alloc_i_data(inode, inode->i_sb->s_blocksize - | 1196 | if (udf_alloc_i_data(inode, inode->i_sb->s_blocksize - |
1187 | sizeof(struct extendedFileEntry))) { | 1197 | sizeof(struct extendedFileEntry))) { |
1188 | make_bad_inode(inode); | 1198 | make_bad_inode(inode); |
1189 | return; | 1199 | return; |
1190 | } | 1200 | } |
1191 | memcpy(UDF_I(inode)->i_ext.i_data, | 1201 | memcpy(iinfo->i_ext.i_data, |
1192 | bh->b_data + sizeof(struct extendedFileEntry), | 1202 | bh->b_data + sizeof(struct extendedFileEntry), |
1193 | inode->i_sb->s_blocksize - | 1203 | inode->i_sb->s_blocksize - |
1194 | sizeof(struct extendedFileEntry)); | 1204 | sizeof(struct extendedFileEntry)); |
1195 | } else if (fe->descTag.tagIdent == cpu_to_le16(TAG_IDENT_FE)) { | 1205 | } else if (fe->descTag.tagIdent == cpu_to_le16(TAG_IDENT_FE)) { |
1196 | UDF_I(inode)->i_efe = 0; | 1206 | iinfo->i_efe = 0; |
1197 | UDF_I(inode)->i_use = 0; | 1207 | iinfo->i_use = 0; |
1198 | if (udf_alloc_i_data(inode, inode->i_sb->s_blocksize - | 1208 | if (udf_alloc_i_data(inode, inode->i_sb->s_blocksize - |
1199 | sizeof(struct fileEntry))) { | 1209 | sizeof(struct fileEntry))) { |
1200 | make_bad_inode(inode); | 1210 | make_bad_inode(inode); |
1201 | return; | 1211 | return; |
1202 | } | 1212 | } |
1203 | memcpy(UDF_I(inode)->i_ext.i_data, | 1213 | memcpy(iinfo->i_ext.i_data, |
1204 | bh->b_data + sizeof(struct fileEntry), | 1214 | bh->b_data + sizeof(struct fileEntry), |
1205 | inode->i_sb->s_blocksize - sizeof(struct fileEntry)); | 1215 | inode->i_sb->s_blocksize - sizeof(struct fileEntry)); |
1206 | } else if (fe->descTag.tagIdent == cpu_to_le16(TAG_IDENT_USE)) { | 1216 | } else if (fe->descTag.tagIdent == cpu_to_le16(TAG_IDENT_USE)) { |
1207 | UDF_I(inode)->i_efe = 0; | 1217 | iinfo->i_efe = 0; |
1208 | UDF_I(inode)->i_use = 1; | 1218 | iinfo->i_use = 1; |
1209 | UDF_I(inode)->i_lenAlloc = le32_to_cpu( | 1219 | iinfo->i_lenAlloc = le32_to_cpu( |
1210 | ((struct unallocSpaceEntry *)bh->b_data)-> | 1220 | ((struct unallocSpaceEntry *)bh->b_data)-> |
1211 | lengthAllocDescs); | 1221 | lengthAllocDescs); |
1212 | if (udf_alloc_i_data(inode, inode->i_sb->s_blocksize - | 1222 | if (udf_alloc_i_data(inode, inode->i_sb->s_blocksize - |
@@ -1214,7 +1224,7 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh) | |||
1214 | make_bad_inode(inode); | 1224 | make_bad_inode(inode); |
1215 | return; | 1225 | return; |
1216 | } | 1226 | } |
1217 | memcpy(UDF_I(inode)->i_ext.i_data, | 1227 | memcpy(iinfo->i_ext.i_data, |
1218 | bh->b_data + sizeof(struct unallocSpaceEntry), | 1228 | bh->b_data + sizeof(struct unallocSpaceEntry), |
1219 | inode->i_sb->s_blocksize - | 1229 | inode->i_sb->s_blocksize - |
1220 | sizeof(struct unallocSpaceEntry)); | 1230 | sizeof(struct unallocSpaceEntry)); |
@@ -1238,12 +1248,12 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh) | |||
1238 | inode->i_nlink = 1; | 1248 | inode->i_nlink = 1; |
1239 | 1249 | ||
1240 | inode->i_size = le64_to_cpu(fe->informationLength); | 1250 | inode->i_size = le64_to_cpu(fe->informationLength); |
1241 | UDF_I(inode)->i_lenExtents = inode->i_size; | 1251 | iinfo->i_lenExtents = inode->i_size; |
1242 | 1252 | ||
1243 | inode->i_mode = udf_convert_permissions(fe); | 1253 | inode->i_mode = udf_convert_permissions(fe); |
1244 | inode->i_mode &= ~UDF_SB(inode->i_sb)->s_umask; | 1254 | inode->i_mode &= ~UDF_SB(inode->i_sb)->s_umask; |
1245 | 1255 | ||
1246 | if (UDF_I(inode)->i_efe == 0) { | 1256 | if (iinfo->i_efe == 0) { |
1247 | inode->i_blocks = le64_to_cpu(fe->logicalBlocksRecorded) << | 1257 | inode->i_blocks = le64_to_cpu(fe->logicalBlocksRecorded) << |
1248 | (inode->i_sb->s_blocksize_bits - 9); | 1258 | (inode->i_sb->s_blocksize_bits - 9); |
1249 | 1259 | ||
@@ -1271,10 +1281,10 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh) | |||
1271 | inode->i_ctime = sbi->s_record_time; | 1281 | inode->i_ctime = sbi->s_record_time; |
1272 | } | 1282 | } |
1273 | 1283 | ||
1274 | UDF_I(inode)->i_unique = le64_to_cpu(fe->uniqueID); | 1284 | iinfo->i_unique = le64_to_cpu(fe->uniqueID); |
1275 | UDF_I(inode)->i_lenEAttr = le32_to_cpu(fe->lengthExtendedAttr); | 1285 | iinfo->i_lenEAttr = le32_to_cpu(fe->lengthExtendedAttr); |
1276 | UDF_I(inode)->i_lenAlloc = le32_to_cpu(fe->lengthAllocDescs); | 1286 | iinfo->i_lenAlloc = le32_to_cpu(fe->lengthAllocDescs); |
1277 | offset = sizeof(struct fileEntry) + UDF_I(inode)->i_lenEAttr; | 1287 | offset = sizeof(struct fileEntry) + iinfo->i_lenEAttr; |
1278 | } else { | 1288 | } else { |
1279 | inode->i_blocks = le64_to_cpu(efe->logicalBlocksRecorded) << | 1289 | inode->i_blocks = le64_to_cpu(efe->logicalBlocksRecorded) << |
1280 | (inode->i_sb->s_blocksize_bits - 9); | 1290 | (inode->i_sb->s_blocksize_bits - 9); |
@@ -1297,10 +1307,10 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh) | |||
1297 | 1307 | ||
1298 | if (udf_stamp_to_time(&convtime, &convtime_usec, | 1308 | if (udf_stamp_to_time(&convtime, &convtime_usec, |
1299 | lets_to_cpu(efe->createTime))) { | 1309 | lets_to_cpu(efe->createTime))) { |
1300 | UDF_I(inode)->i_crtime.tv_sec = convtime; | 1310 | iinfo->i_crtime.tv_sec = convtime; |
1301 | UDF_I(inode)->i_crtime.tv_nsec = convtime_usec * 1000; | 1311 | iinfo->i_crtime.tv_nsec = convtime_usec * 1000; |
1302 | } else { | 1312 | } else { |
1303 | UDF_I(inode)->i_crtime = sbi->s_record_time; | 1313 | iinfo->i_crtime = sbi->s_record_time; |
1304 | } | 1314 | } |
1305 | 1315 | ||
1306 | if (udf_stamp_to_time(&convtime, &convtime_usec, | 1316 | if (udf_stamp_to_time(&convtime, &convtime_usec, |
@@ -1311,11 +1321,11 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh) | |||
1311 | inode->i_ctime = sbi->s_record_time; | 1321 | inode->i_ctime = sbi->s_record_time; |
1312 | } | 1322 | } |
1313 | 1323 | ||
1314 | UDF_I(inode)->i_unique = le64_to_cpu(efe->uniqueID); | 1324 | iinfo->i_unique = le64_to_cpu(efe->uniqueID); |
1315 | UDF_I(inode)->i_lenEAttr = le32_to_cpu(efe->lengthExtendedAttr); | 1325 | iinfo->i_lenEAttr = le32_to_cpu(efe->lengthExtendedAttr); |
1316 | UDF_I(inode)->i_lenAlloc = le32_to_cpu(efe->lengthAllocDescs); | 1326 | iinfo->i_lenAlloc = le32_to_cpu(efe->lengthAllocDescs); |
1317 | offset = sizeof(struct extendedFileEntry) + | 1327 | offset = sizeof(struct extendedFileEntry) + |
1318 | UDF_I(inode)->i_lenEAttr; | 1328 | iinfo->i_lenEAttr; |
1319 | } | 1329 | } |
1320 | 1330 | ||
1321 | switch (fe->icbTag.fileType) { | 1331 | switch (fe->icbTag.fileType) { |
@@ -1328,7 +1338,7 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh) | |||
1328 | case ICBTAG_FILE_TYPE_REALTIME: | 1338 | case ICBTAG_FILE_TYPE_REALTIME: |
1329 | case ICBTAG_FILE_TYPE_REGULAR: | 1339 | case ICBTAG_FILE_TYPE_REGULAR: |
1330 | case ICBTAG_FILE_TYPE_UNDEF: | 1340 | case ICBTAG_FILE_TYPE_UNDEF: |
1331 | if (UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) | 1341 | if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) |
1332 | inode->i_data.a_ops = &udf_adinicb_aops; | 1342 | inode->i_data.a_ops = &udf_adinicb_aops; |
1333 | else | 1343 | else |
1334 | inode->i_data.a_ops = &udf_aops; | 1344 | inode->i_data.a_ops = &udf_aops; |
@@ -1375,9 +1385,10 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh) | |||
1375 | 1385 | ||
1376 | static int udf_alloc_i_data(struct inode *inode, size_t size) | 1386 | static int udf_alloc_i_data(struct inode *inode, size_t size) |
1377 | { | 1387 | { |
1378 | UDF_I(inode)->i_ext.i_data = kmalloc(size, GFP_KERNEL); | 1388 | struct udf_inode_info *iinfo = UDF_I(inode); |
1389 | iinfo->i_ext.i_data = kmalloc(size, GFP_KERNEL); | ||
1379 | 1390 | ||
1380 | if (!UDF_I(inode)->i_ext.i_data) { | 1391 | if (!iinfo->i_ext.i_data) { |
1381 | printk(KERN_ERR "udf:udf_alloc_i_data (ino %ld) " | 1392 | printk(KERN_ERR "udf:udf_alloc_i_data (ino %ld) " |
1382 | "no free memory\n", inode->i_ino); | 1393 | "no free memory\n", inode->i_ino); |
1383 | return -ENOMEM; | 1394 | return -ENOMEM; |
@@ -1448,10 +1459,11 @@ static int udf_update_inode(struct inode *inode, int do_sync) | |||
1448 | int err = 0; | 1459 | int err = 0; |
1449 | struct udf_sb_info *sbi = UDF_SB(inode->i_sb); | 1460 | struct udf_sb_info *sbi = UDF_SB(inode->i_sb); |
1450 | unsigned char blocksize_bits = inode->i_sb->s_blocksize_bits; | 1461 | unsigned char blocksize_bits = inode->i_sb->s_blocksize_bits; |
1462 | struct udf_inode_info *iinfo = UDF_I(inode); | ||
1451 | 1463 | ||
1452 | bh = udf_tread(inode->i_sb, | 1464 | bh = udf_tread(inode->i_sb, |
1453 | udf_get_lb_pblock(inode->i_sb, | 1465 | udf_get_lb_pblock(inode->i_sb, |
1454 | UDF_I(inode)->i_location, 0)); | 1466 | iinfo->i_location, 0)); |
1455 | if (!bh) { | 1467 | if (!bh) { |
1456 | udf_debug("bread failure\n"); | 1468 | udf_debug("bread failure\n"); |
1457 | return -EIO; | 1469 | return -EIO; |
@@ -1466,14 +1478,14 @@ static int udf_update_inode(struct inode *inode, int do_sync) | |||
1466 | struct unallocSpaceEntry *use = | 1478 | struct unallocSpaceEntry *use = |
1467 | (struct unallocSpaceEntry *)bh->b_data; | 1479 | (struct unallocSpaceEntry *)bh->b_data; |
1468 | 1480 | ||
1469 | use->lengthAllocDescs = cpu_to_le32(UDF_I(inode)->i_lenAlloc); | 1481 | use->lengthAllocDescs = cpu_to_le32(iinfo->i_lenAlloc); |
1470 | memcpy(bh->b_data + sizeof(struct unallocSpaceEntry), | 1482 | memcpy(bh->b_data + sizeof(struct unallocSpaceEntry), |
1471 | UDF_I(inode)->i_ext.i_data, inode->i_sb->s_blocksize - | 1483 | iinfo->i_ext.i_data, inode->i_sb->s_blocksize - |
1472 | sizeof(struct unallocSpaceEntry)); | 1484 | sizeof(struct unallocSpaceEntry)); |
1473 | crclen = sizeof(struct unallocSpaceEntry) + | 1485 | crclen = sizeof(struct unallocSpaceEntry) + |
1474 | UDF_I(inode)->i_lenAlloc - sizeof(tag); | 1486 | iinfo->i_lenAlloc - sizeof(tag); |
1475 | use->descTag.tagLocation = cpu_to_le32( | 1487 | use->descTag.tagLocation = cpu_to_le32( |
1476 | UDF_I(inode)->i_location. | 1488 | iinfo->i_location. |
1477 | logicalBlockNum); | 1489 | logicalBlockNum); |
1478 | use->descTag.descCRCLength = cpu_to_le16(crclen); | 1490 | use->descTag.descCRCLength = cpu_to_le16(crclen); |
1479 | use->descTag.descCRC = cpu_to_le16(udf_crc((char *)use + | 1491 | use->descTag.descCRC = cpu_to_le16(udf_crc((char *)use + |
@@ -1538,9 +1550,9 @@ static int udf_update_inode(struct inode *inode, int do_sync) | |||
1538 | dsea->minorDeviceIdent = cpu_to_le32(iminor(inode)); | 1550 | dsea->minorDeviceIdent = cpu_to_le32(iminor(inode)); |
1539 | } | 1551 | } |
1540 | 1552 | ||
1541 | if (UDF_I(inode)->i_efe == 0) { | 1553 | if (iinfo->i_efe == 0) { |
1542 | memcpy(bh->b_data + sizeof(struct fileEntry), | 1554 | memcpy(bh->b_data + sizeof(struct fileEntry), |
1543 | UDF_I(inode)->i_ext.i_data, | 1555 | iinfo->i_ext.i_data, |
1544 | inode->i_sb->s_blocksize - sizeof(struct fileEntry)); | 1556 | inode->i_sb->s_blocksize - sizeof(struct fileEntry)); |
1545 | fe->logicalBlocksRecorded = cpu_to_le64( | 1557 | fe->logicalBlocksRecorded = cpu_to_le64( |
1546 | (inode->i_blocks + (1 << (blocksize_bits - 9)) - 1) >> | 1558 | (inode->i_blocks + (1 << (blocksize_bits - 9)) - 1) >> |
@@ -1556,14 +1568,14 @@ static int udf_update_inode(struct inode *inode, int do_sync) | |||
1556 | strcpy(fe->impIdent.ident, UDF_ID_DEVELOPER); | 1568 | strcpy(fe->impIdent.ident, UDF_ID_DEVELOPER); |
1557 | fe->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX; | 1569 | fe->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX; |
1558 | fe->impIdent.identSuffix[1] = UDF_OS_ID_LINUX; | 1570 | fe->impIdent.identSuffix[1] = UDF_OS_ID_LINUX; |
1559 | fe->uniqueID = cpu_to_le64(UDF_I(inode)->i_unique); | 1571 | fe->uniqueID = cpu_to_le64(iinfo->i_unique); |
1560 | fe->lengthExtendedAttr = cpu_to_le32(UDF_I(inode)->i_lenEAttr); | 1572 | fe->lengthExtendedAttr = cpu_to_le32(iinfo->i_lenEAttr); |
1561 | fe->lengthAllocDescs = cpu_to_le32(UDF_I(inode)->i_lenAlloc); | 1573 | fe->lengthAllocDescs = cpu_to_le32(iinfo->i_lenAlloc); |
1562 | fe->descTag.tagIdent = cpu_to_le16(TAG_IDENT_FE); | 1574 | fe->descTag.tagIdent = cpu_to_le16(TAG_IDENT_FE); |
1563 | crclen = sizeof(struct fileEntry); | 1575 | crclen = sizeof(struct fileEntry); |
1564 | } else { | 1576 | } else { |
1565 | memcpy(bh->b_data + sizeof(struct extendedFileEntry), | 1577 | memcpy(bh->b_data + sizeof(struct extendedFileEntry), |
1566 | UDF_I(inode)->i_ext.i_data, | 1578 | iinfo->i_ext.i_data, |
1567 | inode->i_sb->s_blocksize - | 1579 | inode->i_sb->s_blocksize - |
1568 | sizeof(struct extendedFileEntry)); | 1580 | sizeof(struct extendedFileEntry)); |
1569 | efe->objectSize = cpu_to_le64(inode->i_size); | 1581 | efe->objectSize = cpu_to_le64(inode->i_size); |
@@ -1571,26 +1583,26 @@ static int udf_update_inode(struct inode *inode, int do_sync) | |||
1571 | (inode->i_blocks + (1 << (blocksize_bits - 9)) - 1) >> | 1583 | (inode->i_blocks + (1 << (blocksize_bits - 9)) - 1) >> |
1572 | (blocksize_bits - 9)); | 1584 | (blocksize_bits - 9)); |
1573 | 1585 | ||
1574 | if (UDF_I(inode)->i_crtime.tv_sec > inode->i_atime.tv_sec || | 1586 | if (iinfo->i_crtime.tv_sec > inode->i_atime.tv_sec || |
1575 | (UDF_I(inode)->i_crtime.tv_sec == inode->i_atime.tv_sec && | 1587 | (iinfo->i_crtime.tv_sec == inode->i_atime.tv_sec && |
1576 | UDF_I(inode)->i_crtime.tv_nsec > inode->i_atime.tv_nsec)) | 1588 | iinfo->i_crtime.tv_nsec > inode->i_atime.tv_nsec)) |
1577 | UDF_I(inode)->i_crtime = inode->i_atime; | 1589 | iinfo->i_crtime = inode->i_atime; |
1578 | 1590 | ||
1579 | if (UDF_I(inode)->i_crtime.tv_sec > inode->i_mtime.tv_sec || | 1591 | if (iinfo->i_crtime.tv_sec > inode->i_mtime.tv_sec || |
1580 | (UDF_I(inode)->i_crtime.tv_sec == inode->i_mtime.tv_sec && | 1592 | (iinfo->i_crtime.tv_sec == inode->i_mtime.tv_sec && |
1581 | UDF_I(inode)->i_crtime.tv_nsec > inode->i_mtime.tv_nsec)) | 1593 | iinfo->i_crtime.tv_nsec > inode->i_mtime.tv_nsec)) |
1582 | UDF_I(inode)->i_crtime = inode->i_mtime; | 1594 | iinfo->i_crtime = inode->i_mtime; |
1583 | 1595 | ||
1584 | if (UDF_I(inode)->i_crtime.tv_sec > inode->i_ctime.tv_sec || | 1596 | if (iinfo->i_crtime.tv_sec > inode->i_ctime.tv_sec || |
1585 | (UDF_I(inode)->i_crtime.tv_sec == inode->i_ctime.tv_sec && | 1597 | (iinfo->i_crtime.tv_sec == inode->i_ctime.tv_sec && |
1586 | UDF_I(inode)->i_crtime.tv_nsec > inode->i_ctime.tv_nsec)) | 1598 | iinfo->i_crtime.tv_nsec > inode->i_ctime.tv_nsec)) |
1587 | UDF_I(inode)->i_crtime = inode->i_ctime; | 1599 | iinfo->i_crtime = inode->i_ctime; |
1588 | 1600 | ||
1589 | if (udf_time_to_stamp(&cpu_time, inode->i_atime)) | 1601 | if (udf_time_to_stamp(&cpu_time, inode->i_atime)) |
1590 | efe->accessTime = cpu_to_lets(cpu_time); | 1602 | efe->accessTime = cpu_to_lets(cpu_time); |
1591 | if (udf_time_to_stamp(&cpu_time, inode->i_mtime)) | 1603 | if (udf_time_to_stamp(&cpu_time, inode->i_mtime)) |
1592 | efe->modificationTime = cpu_to_lets(cpu_time); | 1604 | efe->modificationTime = cpu_to_lets(cpu_time); |
1593 | if (udf_time_to_stamp(&cpu_time, UDF_I(inode)->i_crtime)) | 1605 | if (udf_time_to_stamp(&cpu_time, iinfo->i_crtime)) |
1594 | efe->createTime = cpu_to_lets(cpu_time); | 1606 | efe->createTime = cpu_to_lets(cpu_time); |
1595 | if (udf_time_to_stamp(&cpu_time, inode->i_ctime)) | 1607 | if (udf_time_to_stamp(&cpu_time, inode->i_ctime)) |
1596 | efe->attrTime = cpu_to_lets(cpu_time); | 1608 | efe->attrTime = cpu_to_lets(cpu_time); |
@@ -1599,13 +1611,13 @@ static int udf_update_inode(struct inode *inode, int do_sync) | |||
1599 | strcpy(efe->impIdent.ident, UDF_ID_DEVELOPER); | 1611 | strcpy(efe->impIdent.ident, UDF_ID_DEVELOPER); |
1600 | efe->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX; | 1612 | efe->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX; |
1601 | efe->impIdent.identSuffix[1] = UDF_OS_ID_LINUX; | 1613 | efe->impIdent.identSuffix[1] = UDF_OS_ID_LINUX; |
1602 | efe->uniqueID = cpu_to_le64(UDF_I(inode)->i_unique); | 1614 | efe->uniqueID = cpu_to_le64(iinfo->i_unique); |
1603 | efe->lengthExtendedAttr = cpu_to_le32(UDF_I(inode)->i_lenEAttr); | 1615 | efe->lengthExtendedAttr = cpu_to_le32(iinfo->i_lenEAttr); |
1604 | efe->lengthAllocDescs = cpu_to_le32(UDF_I(inode)->i_lenAlloc); | 1616 | efe->lengthAllocDescs = cpu_to_le32(iinfo->i_lenAlloc); |
1605 | efe->descTag.tagIdent = cpu_to_le16(TAG_IDENT_EFE); | 1617 | efe->descTag.tagIdent = cpu_to_le16(TAG_IDENT_EFE); |
1606 | crclen = sizeof(struct extendedFileEntry); | 1618 | crclen = sizeof(struct extendedFileEntry); |
1607 | } | 1619 | } |
1608 | if (UDF_I(inode)->i_strat4096) { | 1620 | if (iinfo->i_strat4096) { |
1609 | fe->icbTag.strategyType = cpu_to_le16(4096); | 1621 | fe->icbTag.strategyType = cpu_to_le16(4096); |
1610 | fe->icbTag.strategyParameter = cpu_to_le16(1); | 1622 | fe->icbTag.strategyParameter = cpu_to_le16(1); |
1611 | fe->icbTag.numEntries = cpu_to_le16(2); | 1623 | fe->icbTag.numEntries = cpu_to_le16(2); |
@@ -1629,7 +1641,7 @@ static int udf_update_inode(struct inode *inode, int do_sync) | |||
1629 | else if (S_ISSOCK(inode->i_mode)) | 1641 | else if (S_ISSOCK(inode->i_mode)) |
1630 | fe->icbTag.fileType = ICBTAG_FILE_TYPE_SOCKET; | 1642 | fe->icbTag.fileType = ICBTAG_FILE_TYPE_SOCKET; |
1631 | 1643 | ||
1632 | icbflags = UDF_I(inode)->i_alloc_type | | 1644 | icbflags = iinfo->i_alloc_type | |
1633 | ((inode->i_mode & S_ISUID) ? ICBTAG_FLAG_SETUID : 0) | | 1645 | ((inode->i_mode & S_ISUID) ? ICBTAG_FLAG_SETUID : 0) | |
1634 | ((inode->i_mode & S_ISGID) ? ICBTAG_FLAG_SETGID : 0) | | 1646 | ((inode->i_mode & S_ISGID) ? ICBTAG_FLAG_SETGID : 0) | |
1635 | ((inode->i_mode & S_ISVTX) ? ICBTAG_FLAG_STICKY : 0) | | 1647 | ((inode->i_mode & S_ISVTX) ? ICBTAG_FLAG_STICKY : 0) | |
@@ -1644,8 +1656,8 @@ static int udf_update_inode(struct inode *inode, int do_sync) | |||
1644 | fe->descTag.descVersion = cpu_to_le16(2); | 1656 | fe->descTag.descVersion = cpu_to_le16(2); |
1645 | fe->descTag.tagSerialNum = cpu_to_le16(sbi->s_serial_number); | 1657 | fe->descTag.tagSerialNum = cpu_to_le16(sbi->s_serial_number); |
1646 | fe->descTag.tagLocation = cpu_to_le32( | 1658 | fe->descTag.tagLocation = cpu_to_le32( |
1647 | UDF_I(inode)->i_location.logicalBlockNum); | 1659 | iinfo->i_location.logicalBlockNum); |
1648 | crclen += UDF_I(inode)->i_lenEAttr + UDF_I(inode)->i_lenAlloc - | 1660 | crclen += iinfo->i_lenEAttr + iinfo->i_lenAlloc - |
1649 | sizeof(tag); | 1661 | sizeof(tag); |
1650 | fe->descTag.descCRCLength = cpu_to_le16(crclen); | 1662 | fe->descTag.descCRCLength = cpu_to_le16(crclen); |
1651 | fe->descTag.descCRC = cpu_to_le16(udf_crc((char *)fe + sizeof(tag), | 1663 | fe->descTag.descCRC = cpu_to_le16(udf_crc((char *)fe + sizeof(tag), |
@@ -1709,17 +1721,18 @@ int8_t udf_add_aext(struct inode *inode, struct extent_position *epos, | |||
1709 | struct allocExtDesc *aed; | 1721 | struct allocExtDesc *aed; |
1710 | int8_t etype; | 1722 | int8_t etype; |
1711 | uint8_t *ptr; | 1723 | uint8_t *ptr; |
1724 | struct udf_inode_info *iinfo = UDF_I(inode); | ||
1712 | 1725 | ||
1713 | if (!epos->bh) | 1726 | if (!epos->bh) |
1714 | ptr = UDF_I(inode)->i_ext.i_data + epos->offset - | 1727 | ptr = iinfo->i_ext.i_data + epos->offset - |
1715 | udf_file_entry_alloc_offset(inode) + | 1728 | udf_file_entry_alloc_offset(inode) + |
1716 | UDF_I(inode)->i_lenEAttr; | 1729 | iinfo->i_lenEAttr; |
1717 | else | 1730 | else |
1718 | ptr = epos->bh->b_data + epos->offset; | 1731 | ptr = epos->bh->b_data + epos->offset; |
1719 | 1732 | ||
1720 | if (UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_SHORT) | 1733 | if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_SHORT) |
1721 | adsize = sizeof(short_ad); | 1734 | adsize = sizeof(short_ad); |
1722 | else if (UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_LONG) | 1735 | else if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_LONG) |
1723 | adsize = sizeof(long_ad); | 1736 | adsize = sizeof(long_ad); |
1724 | else | 1737 | else |
1725 | return -1; | 1738 | return -1; |
@@ -1769,7 +1782,7 @@ int8_t udf_add_aext(struct inode *inode, struct extent_position *epos, | |||
1769 | cpu_to_le32(le32_to_cpu( | 1782 | cpu_to_le32(le32_to_cpu( |
1770 | aed->lengthAllocDescs) + adsize); | 1783 | aed->lengthAllocDescs) + adsize); |
1771 | } else { | 1784 | } else { |
1772 | UDF_I(inode)->i_lenAlloc += adsize; | 1785 | iinfo->i_lenAlloc += adsize; |
1773 | mark_inode_dirty(inode); | 1786 | mark_inode_dirty(inode); |
1774 | } | 1787 | } |
1775 | } | 1788 | } |
@@ -1779,7 +1792,7 @@ int8_t udf_add_aext(struct inode *inode, struct extent_position *epos, | |||
1779 | else | 1792 | else |
1780 | udf_new_tag(nbh->b_data, TAG_IDENT_AED, 2, 1, | 1793 | udf_new_tag(nbh->b_data, TAG_IDENT_AED, 2, 1, |
1781 | epos->block.logicalBlockNum, sizeof(tag)); | 1794 | epos->block.logicalBlockNum, sizeof(tag)); |
1782 | switch (UDF_I(inode)->i_alloc_type) { | 1795 | switch (iinfo->i_alloc_type) { |
1783 | case ICBTAG_FLAG_AD_SHORT: | 1796 | case ICBTAG_FLAG_AD_SHORT: |
1784 | sad = (short_ad *)sptr; | 1797 | sad = (short_ad *)sptr; |
1785 | sad->extLength = cpu_to_le32(EXT_NEXT_EXTENT_ALLOCDECS | | 1798 | sad->extLength = cpu_to_le32(EXT_NEXT_EXTENT_ALLOCDECS | |
@@ -1813,7 +1826,7 @@ int8_t udf_add_aext(struct inode *inode, struct extent_position *epos, | |||
1813 | etype = udf_write_aext(inode, epos, eloc, elen, inc); | 1826 | etype = udf_write_aext(inode, epos, eloc, elen, inc); |
1814 | 1827 | ||
1815 | if (!epos->bh) { | 1828 | if (!epos->bh) { |
1816 | UDF_I(inode)->i_lenAlloc += adsize; | 1829 | iinfo->i_lenAlloc += adsize; |
1817 | mark_inode_dirty(inode); | 1830 | mark_inode_dirty(inode); |
1818 | } else { | 1831 | } else { |
1819 | aed = (struct allocExtDesc *)epos->bh->b_data; | 1832 | aed = (struct allocExtDesc *)epos->bh->b_data; |
@@ -1840,15 +1853,16 @@ int8_t udf_write_aext(struct inode *inode, struct extent_position *epos, | |||
1840 | uint8_t *ptr; | 1853 | uint8_t *ptr; |
1841 | short_ad *sad; | 1854 | short_ad *sad; |
1842 | long_ad *lad; | 1855 | long_ad *lad; |
1856 | struct udf_inode_info *iinfo = UDF_I(inode); | ||
1843 | 1857 | ||
1844 | if (!epos->bh) | 1858 | if (!epos->bh) |
1845 | ptr = UDF_I(inode)->i_ext.i_data + epos->offset - | 1859 | ptr = iinfo->i_ext.i_data + epos->offset - |
1846 | udf_file_entry_alloc_offset(inode) + | 1860 | udf_file_entry_alloc_offset(inode) + |
1847 | UDF_I(inode)->i_lenEAttr; | 1861 | iinfo->i_lenEAttr; |
1848 | else | 1862 | else |
1849 | ptr = epos->bh->b_data + epos->offset; | 1863 | ptr = epos->bh->b_data + epos->offset; |
1850 | 1864 | ||
1851 | switch (UDF_I(inode)->i_alloc_type) { | 1865 | switch (iinfo->i_alloc_type) { |
1852 | case ICBTAG_FLAG_AD_SHORT: | 1866 | case ICBTAG_FLAG_AD_SHORT: |
1853 | sad = (short_ad *)ptr; | 1867 | sad = (short_ad *)ptr; |
1854 | sad->extLength = cpu_to_le32(elen); | 1868 | sad->extLength = cpu_to_le32(elen); |
@@ -1916,15 +1930,16 @@ int8_t udf_current_aext(struct inode *inode, struct extent_position *epos, | |||
1916 | uint8_t *ptr; | 1930 | uint8_t *ptr; |
1917 | short_ad *sad; | 1931 | short_ad *sad; |
1918 | long_ad *lad; | 1932 | long_ad *lad; |
1933 | struct udf_inode_info *iinfo = UDF_I(inode); | ||
1919 | 1934 | ||
1920 | if (!epos->bh) { | 1935 | if (!epos->bh) { |
1921 | if (!epos->offset) | 1936 | if (!epos->offset) |
1922 | epos->offset = udf_file_entry_alloc_offset(inode); | 1937 | epos->offset = udf_file_entry_alloc_offset(inode); |
1923 | ptr = UDF_I(inode)->i_ext.i_data + epos->offset - | 1938 | ptr = iinfo->i_ext.i_data + epos->offset - |
1924 | udf_file_entry_alloc_offset(inode) + | 1939 | udf_file_entry_alloc_offset(inode) + |
1925 | UDF_I(inode)->i_lenEAttr; | 1940 | iinfo->i_lenEAttr; |
1926 | alen = udf_file_entry_alloc_offset(inode) + | 1941 | alen = udf_file_entry_alloc_offset(inode) + |
1927 | UDF_I(inode)->i_lenAlloc; | 1942 | iinfo->i_lenAlloc; |
1928 | } else { | 1943 | } else { |
1929 | if (!epos->offset) | 1944 | if (!epos->offset) |
1930 | epos->offset = sizeof(struct allocExtDesc); | 1945 | epos->offset = sizeof(struct allocExtDesc); |
@@ -1934,7 +1949,7 @@ int8_t udf_current_aext(struct inode *inode, struct extent_position *epos, | |||
1934 | lengthAllocDescs); | 1949 | lengthAllocDescs); |
1935 | } | 1950 | } |
1936 | 1951 | ||
1937 | switch (UDF_I(inode)->i_alloc_type) { | 1952 | switch (iinfo->i_alloc_type) { |
1938 | case ICBTAG_FLAG_AD_SHORT: | 1953 | case ICBTAG_FLAG_AD_SHORT: |
1939 | sad = udf_get_fileshortad(ptr, alen, &epos->offset, inc); | 1954 | sad = udf_get_fileshortad(ptr, alen, &epos->offset, inc); |
1940 | if (!sad) | 1955 | if (!sad) |
@@ -1942,7 +1957,7 @@ int8_t udf_current_aext(struct inode *inode, struct extent_position *epos, | |||
1942 | etype = le32_to_cpu(sad->extLength) >> 30; | 1957 | etype = le32_to_cpu(sad->extLength) >> 30; |
1943 | eloc->logicalBlockNum = le32_to_cpu(sad->extPosition); | 1958 | eloc->logicalBlockNum = le32_to_cpu(sad->extPosition); |
1944 | eloc->partitionReferenceNum = | 1959 | eloc->partitionReferenceNum = |
1945 | UDF_I(inode)->i_location.partitionReferenceNum; | 1960 | iinfo->i_location.partitionReferenceNum; |
1946 | *elen = le32_to_cpu(sad->extLength) & UDF_EXTENT_LENGTH_MASK; | 1961 | *elen = le32_to_cpu(sad->extLength) & UDF_EXTENT_LENGTH_MASK; |
1947 | break; | 1962 | break; |
1948 | case ICBTAG_FLAG_AD_LONG: | 1963 | case ICBTAG_FLAG_AD_LONG: |
@@ -1955,7 +1970,7 @@ int8_t udf_current_aext(struct inode *inode, struct extent_position *epos, | |||
1955 | break; | 1970 | break; |
1956 | default: | 1971 | default: |
1957 | udf_debug("alloc_type = %d unsupported\n", | 1972 | udf_debug("alloc_type = %d unsupported\n", |
1958 | UDF_I(inode)->i_alloc_type); | 1973 | iinfo->i_alloc_type); |
1959 | return -1; | 1974 | return -1; |
1960 | } | 1975 | } |
1961 | 1976 | ||
@@ -1990,15 +2005,17 @@ int8_t udf_delete_aext(struct inode *inode, struct extent_position epos, | |||
1990 | int adsize; | 2005 | int adsize; |
1991 | int8_t etype; | 2006 | int8_t etype; |
1992 | struct allocExtDesc *aed; | 2007 | struct allocExtDesc *aed; |
2008 | struct udf_inode_info *iinfo; | ||
1993 | 2009 | ||
1994 | if (epos.bh) { | 2010 | if (epos.bh) { |
1995 | get_bh(epos.bh); | 2011 | get_bh(epos.bh); |
1996 | get_bh(epos.bh); | 2012 | get_bh(epos.bh); |
1997 | } | 2013 | } |
1998 | 2014 | ||
1999 | if (UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_SHORT) | 2015 | iinfo = UDF_I(inode); |
2016 | if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_SHORT) | ||
2000 | adsize = sizeof(short_ad); | 2017 | adsize = sizeof(short_ad); |
2001 | else if (UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_LONG) | 2018 | else if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_LONG) |
2002 | adsize = sizeof(long_ad); | 2019 | adsize = sizeof(long_ad); |
2003 | else | 2020 | else |
2004 | adsize = 0; | 2021 | adsize = 0; |
@@ -2025,7 +2042,7 @@ int8_t udf_delete_aext(struct inode *inode, struct extent_position epos, | |||
2025 | udf_write_aext(inode, &oepos, eloc, elen, 1); | 2042 | udf_write_aext(inode, &oepos, eloc, elen, 1); |
2026 | udf_write_aext(inode, &oepos, eloc, elen, 1); | 2043 | udf_write_aext(inode, &oepos, eloc, elen, 1); |
2027 | if (!oepos.bh) { | 2044 | if (!oepos.bh) { |
2028 | UDF_I(inode)->i_lenAlloc -= (adsize * 2); | 2045 | iinfo->i_lenAlloc -= (adsize * 2); |
2029 | mark_inode_dirty(inode); | 2046 | mark_inode_dirty(inode); |
2030 | } else { | 2047 | } else { |
2031 | aed = (struct allocExtDesc *)oepos.bh->b_data; | 2048 | aed = (struct allocExtDesc *)oepos.bh->b_data; |
@@ -2044,7 +2061,7 @@ int8_t udf_delete_aext(struct inode *inode, struct extent_position epos, | |||
2044 | } else { | 2061 | } else { |
2045 | udf_write_aext(inode, &oepos, eloc, elen, 1); | 2062 | udf_write_aext(inode, &oepos, eloc, elen, 1); |
2046 | if (!oepos.bh) { | 2063 | if (!oepos.bh) { |
2047 | UDF_I(inode)->i_lenAlloc -= adsize; | 2064 | iinfo->i_lenAlloc -= adsize; |
2048 | mark_inode_dirty(inode); | 2065 | mark_inode_dirty(inode); |
2049 | } else { | 2066 | } else { |
2050 | aed = (struct allocExtDesc *)oepos.bh->b_data; | 2067 | aed = (struct allocExtDesc *)oepos.bh->b_data; |
@@ -2076,14 +2093,16 @@ int8_t inode_bmap(struct inode *inode, sector_t block, | |||
2076 | loff_t lbcount = 0, bcount = | 2093 | loff_t lbcount = 0, bcount = |
2077 | (loff_t) block << blocksize_bits; | 2094 | (loff_t) block << blocksize_bits; |
2078 | int8_t etype; | 2095 | int8_t etype; |
2096 | struct udf_inode_info *iinfo; | ||
2079 | 2097 | ||
2080 | if (block < 0) { | 2098 | if (block < 0) { |
2081 | printk(KERN_ERR "udf: inode_bmap: block < 0\n"); | 2099 | printk(KERN_ERR "udf: inode_bmap: block < 0\n"); |
2082 | return -1; | 2100 | return -1; |
2083 | } | 2101 | } |
2084 | 2102 | ||
2103 | iinfo = UDF_I(inode); | ||
2085 | pos->offset = 0; | 2104 | pos->offset = 0; |
2086 | pos->block = UDF_I(inode)->i_location; | 2105 | pos->block = iinfo->i_location; |
2087 | pos->bh = NULL; | 2106 | pos->bh = NULL; |
2088 | *elen = 0; | 2107 | *elen = 0; |
2089 | 2108 | ||
@@ -2091,7 +2110,7 @@ int8_t inode_bmap(struct inode *inode, sector_t block, | |||
2091 | etype = udf_next_aext(inode, pos, eloc, elen, 1); | 2110 | etype = udf_next_aext(inode, pos, eloc, elen, 1); |
2092 | if (etype == -1) { | 2111 | if (etype == -1) { |
2093 | *offset = (bcount - lbcount) >> blocksize_bits; | 2112 | *offset = (bcount - lbcount) >> blocksize_bits; |
2094 | UDF_I(inode)->i_lenExtents = lbcount; | 2113 | iinfo->i_lenExtents = lbcount; |
2095 | return -1; | 2114 | return -1; |
2096 | } | 2115 | } |
2097 | lbcount += *elen; | 2116 | lbcount += *elen; |
diff --git a/fs/udf/misc.c b/fs/udf/misc.c index 2af44702633b..a1d6da0caf71 100644 --- a/fs/udf/misc.c +++ b/fs/udf/misc.c | |||
@@ -51,17 +51,18 @@ struct genericFormat *udf_add_extendedattr(struct inode *inode, uint32_t size, | |||
51 | uint8_t *ea = NULL, *ad = NULL; | 51 | uint8_t *ea = NULL, *ad = NULL; |
52 | int offset; | 52 | int offset; |
53 | uint16_t crclen; | 53 | uint16_t crclen; |
54 | struct udf_inode_info *iinfo = UDF_I(inode); | ||
54 | 55 | ||
55 | ea = UDF_I(inode)->i_ext.i_data; | 56 | ea = iinfo->i_ext.i_data; |
56 | if (UDF_I(inode)->i_lenEAttr) { | 57 | if (iinfo->i_lenEAttr) { |
57 | ad = UDF_I(inode)->i_ext.i_data + UDF_I(inode)->i_lenEAttr; | 58 | ad = iinfo->i_ext.i_data + iinfo->i_lenEAttr; |
58 | } else { | 59 | } else { |
59 | ad = ea; | 60 | ad = ea; |
60 | size += sizeof(struct extendedAttrHeaderDesc); | 61 | size += sizeof(struct extendedAttrHeaderDesc); |
61 | } | 62 | } |
62 | 63 | ||
63 | offset = inode->i_sb->s_blocksize - udf_file_entry_alloc_offset(inode) - | 64 | offset = inode->i_sb->s_blocksize - udf_file_entry_alloc_offset(inode) - |
64 | UDF_I(inode)->i_lenAlloc; | 65 | iinfo->i_lenAlloc; |
65 | 66 | ||
66 | /* TODO - Check for FreeEASpace */ | 67 | /* TODO - Check for FreeEASpace */ |
67 | 68 | ||
@@ -69,21 +70,21 @@ struct genericFormat *udf_add_extendedattr(struct inode *inode, uint32_t size, | |||
69 | struct extendedAttrHeaderDesc *eahd; | 70 | struct extendedAttrHeaderDesc *eahd; |
70 | eahd = (struct extendedAttrHeaderDesc *)ea; | 71 | eahd = (struct extendedAttrHeaderDesc *)ea; |
71 | 72 | ||
72 | if (UDF_I(inode)->i_lenAlloc) | 73 | if (iinfo->i_lenAlloc) |
73 | memmove(&ad[size], ad, UDF_I(inode)->i_lenAlloc); | 74 | memmove(&ad[size], ad, iinfo->i_lenAlloc); |
74 | 75 | ||
75 | if (UDF_I(inode)->i_lenEAttr) { | 76 | if (iinfo->i_lenEAttr) { |
76 | /* check checksum/crc */ | 77 | /* check checksum/crc */ |
77 | if (eahd->descTag.tagIdent != | 78 | if (eahd->descTag.tagIdent != |
78 | cpu_to_le16(TAG_IDENT_EAHD) || | 79 | cpu_to_le16(TAG_IDENT_EAHD) || |
79 | le32_to_cpu(eahd->descTag.tagLocation) != | 80 | le32_to_cpu(eahd->descTag.tagLocation) != |
80 | UDF_I(inode)->i_location.logicalBlockNum) | 81 | iinfo->i_location.logicalBlockNum) |
81 | return NULL; | 82 | return NULL; |
82 | } else { | 83 | } else { |
83 | struct udf_sb_info *sbi = UDF_SB(inode->i_sb); | 84 | struct udf_sb_info *sbi = UDF_SB(inode->i_sb); |
84 | 85 | ||
85 | size -= sizeof(struct extendedAttrHeaderDesc); | 86 | size -= sizeof(struct extendedAttrHeaderDesc); |
86 | UDF_I(inode)->i_lenEAttr += | 87 | iinfo->i_lenEAttr += |
87 | sizeof(struct extendedAttrHeaderDesc); | 88 | sizeof(struct extendedAttrHeaderDesc); |
88 | eahd->descTag.tagIdent = cpu_to_le16(TAG_IDENT_EAHD); | 89 | eahd->descTag.tagIdent = cpu_to_le16(TAG_IDENT_EAHD); |
89 | if (sbi->s_udfrev >= 0x0200) | 90 | if (sbi->s_udfrev >= 0x0200) |
@@ -93,15 +94,15 @@ struct genericFormat *udf_add_extendedattr(struct inode *inode, uint32_t size, | |||
93 | eahd->descTag.tagSerialNum = | 94 | eahd->descTag.tagSerialNum = |
94 | cpu_to_le16(sbi->s_serial_number); | 95 | cpu_to_le16(sbi->s_serial_number); |
95 | eahd->descTag.tagLocation = cpu_to_le32( | 96 | eahd->descTag.tagLocation = cpu_to_le32( |
96 | UDF_I(inode)->i_location.logicalBlockNum); | 97 | iinfo->i_location.logicalBlockNum); |
97 | eahd->impAttrLocation = cpu_to_le32(0xFFFFFFFF); | 98 | eahd->impAttrLocation = cpu_to_le32(0xFFFFFFFF); |
98 | eahd->appAttrLocation = cpu_to_le32(0xFFFFFFFF); | 99 | eahd->appAttrLocation = cpu_to_le32(0xFFFFFFFF); |
99 | } | 100 | } |
100 | 101 | ||
101 | offset = UDF_I(inode)->i_lenEAttr; | 102 | offset = iinfo->i_lenEAttr; |
102 | if (type < 2048) { | 103 | if (type < 2048) { |
103 | if (le32_to_cpu(eahd->appAttrLocation) < | 104 | if (le32_to_cpu(eahd->appAttrLocation) < |
104 | UDF_I(inode)->i_lenEAttr) { | 105 | iinfo->i_lenEAttr) { |
105 | uint32_t aal = | 106 | uint32_t aal = |
106 | le32_to_cpu(eahd->appAttrLocation); | 107 | le32_to_cpu(eahd->appAttrLocation); |
107 | memmove(&ea[offset - aal + size], | 108 | memmove(&ea[offset - aal + size], |
@@ -111,7 +112,7 @@ struct genericFormat *udf_add_extendedattr(struct inode *inode, uint32_t size, | |||
111 | cpu_to_le32(aal + size); | 112 | cpu_to_le32(aal + size); |
112 | } | 113 | } |
113 | if (le32_to_cpu(eahd->impAttrLocation) < | 114 | if (le32_to_cpu(eahd->impAttrLocation) < |
114 | UDF_I(inode)->i_lenEAttr) { | 115 | iinfo->i_lenEAttr) { |
115 | uint32_t ial = | 116 | uint32_t ial = |
116 | le32_to_cpu(eahd->impAttrLocation); | 117 | le32_to_cpu(eahd->impAttrLocation); |
117 | memmove(&ea[offset - ial + size], | 118 | memmove(&ea[offset - ial + size], |
@@ -122,7 +123,7 @@ struct genericFormat *udf_add_extendedattr(struct inode *inode, uint32_t size, | |||
122 | } | 123 | } |
123 | } else if (type < 65536) { | 124 | } else if (type < 65536) { |
124 | if (le32_to_cpu(eahd->appAttrLocation) < | 125 | if (le32_to_cpu(eahd->appAttrLocation) < |
125 | UDF_I(inode)->i_lenEAttr) { | 126 | iinfo->i_lenEAttr) { |
126 | uint32_t aal = | 127 | uint32_t aal = |
127 | le32_to_cpu(eahd->appAttrLocation); | 128 | le32_to_cpu(eahd->appAttrLocation); |
128 | memmove(&ea[offset - aal + size], | 129 | memmove(&ea[offset - aal + size], |
@@ -138,7 +139,7 @@ struct genericFormat *udf_add_extendedattr(struct inode *inode, uint32_t size, | |||
138 | eahd->descTag.descCRC = cpu_to_le16(udf_crc((char *)eahd + | 139 | eahd->descTag.descCRC = cpu_to_le16(udf_crc((char *)eahd + |
139 | sizeof(tag), crclen, 0)); | 140 | sizeof(tag), crclen, 0)); |
140 | eahd->descTag.tagChecksum = udf_tag_checksum(&eahd->descTag); | 141 | eahd->descTag.tagChecksum = udf_tag_checksum(&eahd->descTag); |
141 | UDF_I(inode)->i_lenEAttr += size; | 142 | iinfo->i_lenEAttr += size; |
142 | return (struct genericFormat *)&ea[offset]; | 143 | return (struct genericFormat *)&ea[offset]; |
143 | } | 144 | } |
144 | if (loc & 0x02) | 145 | if (loc & 0x02) |
@@ -153,10 +154,11 @@ struct genericFormat *udf_get_extendedattr(struct inode *inode, uint32_t type, | |||
153 | struct genericFormat *gaf; | 154 | struct genericFormat *gaf; |
154 | uint8_t *ea = NULL; | 155 | uint8_t *ea = NULL; |
155 | uint32_t offset; | 156 | uint32_t offset; |
157 | struct udf_inode_info *iinfo = UDF_I(inode); | ||
156 | 158 | ||
157 | ea = UDF_I(inode)->i_ext.i_data; | 159 | ea = iinfo->i_ext.i_data; |
158 | 160 | ||
159 | if (UDF_I(inode)->i_lenEAttr) { | 161 | if (iinfo->i_lenEAttr) { |
160 | struct extendedAttrHeaderDesc *eahd; | 162 | struct extendedAttrHeaderDesc *eahd; |
161 | eahd = (struct extendedAttrHeaderDesc *)ea; | 163 | eahd = (struct extendedAttrHeaderDesc *)ea; |
162 | 164 | ||
@@ -164,7 +166,7 @@ struct genericFormat *udf_get_extendedattr(struct inode *inode, uint32_t type, | |||
164 | if (eahd->descTag.tagIdent != | 166 | if (eahd->descTag.tagIdent != |
165 | cpu_to_le16(TAG_IDENT_EAHD) || | 167 | cpu_to_le16(TAG_IDENT_EAHD) || |
166 | le32_to_cpu(eahd->descTag.tagLocation) != | 168 | le32_to_cpu(eahd->descTag.tagLocation) != |
167 | UDF_I(inode)->i_location.logicalBlockNum) | 169 | iinfo->i_location.logicalBlockNum) |
168 | return NULL; | 170 | return NULL; |
169 | 171 | ||
170 | if (type < 2048) | 172 | if (type < 2048) |
@@ -174,7 +176,7 @@ struct genericFormat *udf_get_extendedattr(struct inode *inode, uint32_t type, | |||
174 | else | 176 | else |
175 | offset = le32_to_cpu(eahd->appAttrLocation); | 177 | offset = le32_to_cpu(eahd->appAttrLocation); |
176 | 178 | ||
177 | while (offset < UDF_I(inode)->i_lenEAttr) { | 179 | while (offset < iinfo->i_lenEAttr) { |
178 | gaf = (struct genericFormat *)&ea[offset]; | 180 | gaf = (struct genericFormat *)&ea[offset]; |
179 | if (le32_to_cpu(gaf->attrType) == type && | 181 | if (le32_to_cpu(gaf->attrType) == type && |
180 | gaf->attrSubtype == subtype) | 182 | gaf->attrSubtype == subtype) |
diff --git a/fs/udf/namei.c b/fs/udf/namei.c index 23e530659fa5..35e5bebe4fab 100644 --- a/fs/udf/namei.c +++ b/fs/udf/namei.c | |||
@@ -158,23 +158,23 @@ static struct fileIdentDesc *udf_find_entry(struct inode *dir, | |||
158 | uint32_t elen; | 158 | uint32_t elen; |
159 | sector_t offset; | 159 | sector_t offset; |
160 | struct extent_position epos = {}; | 160 | struct extent_position epos = {}; |
161 | struct udf_inode_info *dinfo = UDF_I(dir); | ||
161 | 162 | ||
162 | size = (udf_ext0_offset(dir) + dir->i_size) >> 2; | 163 | size = (udf_ext0_offset(dir) + dir->i_size) >> 2; |
163 | f_pos = (udf_ext0_offset(dir) >> 2); | 164 | f_pos = (udf_ext0_offset(dir) >> 2); |
164 | 165 | ||
165 | fibh->soffset = fibh->eoffset = | 166 | fibh->soffset = fibh->eoffset = |
166 | (f_pos & ((dir->i_sb->s_blocksize - 1) >> 2)) << 2; | 167 | (f_pos & ((dir->i_sb->s_blocksize - 1) >> 2)) << 2; |
167 | if (UDF_I(dir)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) | 168 | if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) |
168 | fibh->sbh = fibh->ebh = NULL; | 169 | fibh->sbh = fibh->ebh = NULL; |
169 | else if (inode_bmap(dir, f_pos >> (dir->i_sb->s_blocksize_bits - 2), | 170 | else if (inode_bmap(dir, f_pos >> (dir->i_sb->s_blocksize_bits - 2), |
170 | &epos, &eloc, &elen, &offset) == | 171 | &epos, &eloc, &elen, &offset) == |
171 | (EXT_RECORDED_ALLOCATED >> 30)) { | 172 | (EXT_RECORDED_ALLOCATED >> 30)) { |
172 | block = udf_get_lb_pblock(dir->i_sb, eloc, offset); | 173 | block = udf_get_lb_pblock(dir->i_sb, eloc, offset); |
173 | if ((++offset << dir->i_sb->s_blocksize_bits) < elen) { | 174 | if ((++offset << dir->i_sb->s_blocksize_bits) < elen) { |
174 | if (UDF_I(dir)->i_alloc_type == ICBTAG_FLAG_AD_SHORT) | 175 | if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_SHORT) |
175 | epos.offset -= sizeof(short_ad); | 176 | epos.offset -= sizeof(short_ad); |
176 | else if (UDF_I(dir)->i_alloc_type == | 177 | else if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_LONG) |
177 | ICBTAG_FLAG_AD_LONG) | ||
178 | epos.offset -= sizeof(long_ad); | 178 | epos.offset -= sizeof(long_ad); |
179 | } else | 179 | } else |
180 | offset = 0; | 180 | offset = 0; |
@@ -351,6 +351,7 @@ static struct fileIdentDesc *udf_add_entry(struct inode *dir, | |||
351 | uint32_t elen; | 351 | uint32_t elen; |
352 | sector_t offset; | 352 | sector_t offset; |
353 | struct extent_position epos = {}; | 353 | struct extent_position epos = {}; |
354 | struct udf_inode_info *dinfo; | ||
354 | 355 | ||
355 | if (dentry) { | 356 | if (dentry) { |
356 | if (!dentry->d_name.len) { | 357 | if (!dentry->d_name.len) { |
@@ -373,17 +374,17 @@ static struct fileIdentDesc *udf_add_entry(struct inode *dir, | |||
373 | 374 | ||
374 | fibh->soffset = fibh->eoffset = | 375 | fibh->soffset = fibh->eoffset = |
375 | (f_pos & ((dir->i_sb->s_blocksize - 1) >> 2)) << 2; | 376 | (f_pos & ((dir->i_sb->s_blocksize - 1) >> 2)) << 2; |
376 | if (UDF_I(dir)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) | 377 | dinfo = UDF_I(dir); |
378 | if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) | ||
377 | fibh->sbh = fibh->ebh = NULL; | 379 | fibh->sbh = fibh->ebh = NULL; |
378 | else if (inode_bmap(dir, f_pos >> (dir->i_sb->s_blocksize_bits - 2), | 380 | else if (inode_bmap(dir, f_pos >> (dir->i_sb->s_blocksize_bits - 2), |
379 | &epos, &eloc, &elen, &offset) == | 381 | &epos, &eloc, &elen, &offset) == |
380 | (EXT_RECORDED_ALLOCATED >> 30)) { | 382 | (EXT_RECORDED_ALLOCATED >> 30)) { |
381 | block = udf_get_lb_pblock(dir->i_sb, eloc, offset); | 383 | block = udf_get_lb_pblock(dir->i_sb, eloc, offset); |
382 | if ((++offset << dir->i_sb->s_blocksize_bits) < elen) { | 384 | if ((++offset << dir->i_sb->s_blocksize_bits) < elen) { |
383 | if (UDF_I(dir)->i_alloc_type == ICBTAG_FLAG_AD_SHORT) | 385 | if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_SHORT) |
384 | epos.offset -= sizeof(short_ad); | 386 | epos.offset -= sizeof(short_ad); |
385 | else if (UDF_I(dir)->i_alloc_type == | 387 | else if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_LONG) |
386 | ICBTAG_FLAG_AD_LONG) | ||
387 | epos.offset -= sizeof(long_ad); | 388 | epos.offset -= sizeof(long_ad); |
388 | } else | 389 | } else |
389 | offset = 0; | 390 | offset = 0; |
@@ -395,10 +396,10 @@ static struct fileIdentDesc *udf_add_entry(struct inode *dir, | |||
395 | return NULL; | 396 | return NULL; |
396 | } | 397 | } |
397 | 398 | ||
398 | block = UDF_I(dir)->i_location.logicalBlockNum; | 399 | block = dinfo->i_location.logicalBlockNum; |
399 | 400 | ||
400 | } else { | 401 | } else { |
401 | block = udf_get_lb_pblock(dir->i_sb, UDF_I(dir)->i_location, 0); | 402 | block = udf_get_lb_pblock(dir->i_sb, dinfo->i_location, 0); |
402 | fibh->sbh = fibh->ebh = NULL; | 403 | fibh->sbh = fibh->ebh = NULL; |
403 | fibh->soffset = fibh->eoffset = sb->s_blocksize; | 404 | fibh->soffset = fibh->eoffset = sb->s_blocksize; |
404 | goto add; | 405 | goto add; |
@@ -477,7 +478,7 @@ static struct fileIdentDesc *udf_add_entry(struct inode *dir, | |||
477 | add: | 478 | add: |
478 | f_pos += nfidlen; | 479 | f_pos += nfidlen; |
479 | 480 | ||
480 | if (UDF_I(dir)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB && | 481 | if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB && |
481 | sb->s_blocksize - fibh->eoffset < nfidlen) { | 482 | sb->s_blocksize - fibh->eoffset < nfidlen) { |
482 | brelse(epos.bh); | 483 | brelse(epos.bh); |
483 | epos.bh = NULL; | 484 | epos.bh = NULL; |
@@ -491,15 +492,15 @@ add: | |||
491 | udf_expand_dir_adinicb(dir, &block, err); | 492 | udf_expand_dir_adinicb(dir, &block, err); |
492 | if (!fibh->sbh) | 493 | if (!fibh->sbh) |
493 | return NULL; | 494 | return NULL; |
494 | epos.block = UDF_I(dir)->i_location; | 495 | epos.block = dinfo->i_location; |
495 | eloc.logicalBlockNum = block; | 496 | eloc.logicalBlockNum = block; |
496 | eloc.partitionReferenceNum = | 497 | eloc.partitionReferenceNum = |
497 | UDF_I(dir)->i_location.partitionReferenceNum; | 498 | dinfo->i_location.partitionReferenceNum; |
498 | elen = dir->i_sb->s_blocksize; | 499 | elen = dir->i_sb->s_blocksize; |
499 | epos.offset = udf_file_entry_alloc_offset(dir); | 500 | epos.offset = udf_file_entry_alloc_offset(dir); |
500 | if (UDF_I(dir)->i_alloc_type == ICBTAG_FLAG_AD_SHORT) | 501 | if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_SHORT) |
501 | epos.offset += sizeof(short_ad); | 502 | epos.offset += sizeof(short_ad); |
502 | else if (UDF_I(dir)->i_alloc_type == ICBTAG_FLAG_AD_LONG) | 503 | else if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_LONG) |
503 | epos.offset += sizeof(long_ad); | 504 | epos.offset += sizeof(long_ad); |
504 | } | 505 | } |
505 | 506 | ||
@@ -511,13 +512,13 @@ add: | |||
511 | fibh->sbh = fibh->ebh; | 512 | fibh->sbh = fibh->ebh; |
512 | } | 513 | } |
513 | 514 | ||
514 | if (UDF_I(dir)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) { | 515 | if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) { |
515 | block = UDF_I(dir)->i_location.logicalBlockNum; | 516 | block = dinfo->i_location.logicalBlockNum; |
516 | fi = (struct fileIdentDesc *) | 517 | fi = (struct fileIdentDesc *) |
517 | (UDF_I(dir)->i_ext.i_data + | 518 | (dinfo->i_ext.i_data + |
518 | fibh->soffset - | 519 | fibh->soffset - |
519 | udf_ext0_offset(dir) + | 520 | udf_ext0_offset(dir) + |
520 | UDF_I(dir)->i_lenEAttr); | 521 | dinfo->i_lenEAttr); |
521 | } else { | 522 | } else { |
522 | block = eloc.logicalBlockNum + | 523 | block = eloc.logicalBlockNum + |
523 | ((elen - 1) >> | 524 | ((elen - 1) >> |
@@ -575,8 +576,8 @@ add: | |||
575 | if (!udf_write_fi(dir, cfi, fi, fibh, NULL, name)) { | 576 | if (!udf_write_fi(dir, cfi, fi, fibh, NULL, name)) { |
576 | brelse(epos.bh); | 577 | brelse(epos.bh); |
577 | dir->i_size += nfidlen; | 578 | dir->i_size += nfidlen; |
578 | if (UDF_I(dir)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) | 579 | if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) |
579 | UDF_I(dir)->i_lenAlloc += nfidlen; | 580 | dinfo->i_lenAlloc += nfidlen; |
580 | mark_inode_dirty(dir); | 581 | mark_inode_dirty(dir); |
581 | return fi; | 582 | return fi; |
582 | } else { | 583 | } else { |
@@ -608,6 +609,7 @@ static int udf_create(struct inode *dir, struct dentry *dentry, int mode, | |||
608 | struct inode *inode; | 609 | struct inode *inode; |
609 | struct fileIdentDesc cfi, *fi; | 610 | struct fileIdentDesc cfi, *fi; |
610 | int err; | 611 | int err; |
612 | struct udf_inode_info *iinfo; | ||
611 | 613 | ||
612 | lock_kernel(); | 614 | lock_kernel(); |
613 | inode = udf_new_inode(dir, mode, &err); | 615 | inode = udf_new_inode(dir, mode, &err); |
@@ -616,7 +618,8 @@ static int udf_create(struct inode *dir, struct dentry *dentry, int mode, | |||
616 | return err; | 618 | return err; |
617 | } | 619 | } |
618 | 620 | ||
619 | if (UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) | 621 | iinfo = UDF_I(inode); |
622 | if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) | ||
620 | inode->i_data.a_ops = &udf_adinicb_aops; | 623 | inode->i_data.a_ops = &udf_adinicb_aops; |
621 | else | 624 | else |
622 | inode->i_data.a_ops = &udf_aops; | 625 | inode->i_data.a_ops = &udf_aops; |
@@ -634,9 +637,9 @@ static int udf_create(struct inode *dir, struct dentry *dentry, int mode, | |||
634 | return err; | 637 | return err; |
635 | } | 638 | } |
636 | cfi.icb.extLength = cpu_to_le32(inode->i_sb->s_blocksize); | 639 | cfi.icb.extLength = cpu_to_le32(inode->i_sb->s_blocksize); |
637 | cfi.icb.extLocation = cpu_to_lelb(UDF_I(inode)->i_location); | 640 | cfi.icb.extLocation = cpu_to_lelb(iinfo->i_location); |
638 | *(__le32 *)((struct allocDescImpUse *)cfi.icb.impUse)->impUse = | 641 | *(__le32 *)((struct allocDescImpUse *)cfi.icb.impUse)->impUse = |
639 | cpu_to_le32(UDF_I(inode)->i_unique & 0x00000000FFFFFFFFUL); | 642 | cpu_to_le32(iinfo->i_unique & 0x00000000FFFFFFFFUL); |
640 | udf_write_fi(dir, &cfi, fi, &fibh, NULL, NULL); | 643 | udf_write_fi(dir, &cfi, fi, &fibh, NULL, NULL); |
641 | if (UDF_I(dir)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) | 644 | if (UDF_I(dir)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) |
642 | mark_inode_dirty(dir); | 645 | mark_inode_dirty(dir); |
@@ -656,6 +659,7 @@ static int udf_mknod(struct inode *dir, struct dentry *dentry, int mode, | |||
656 | struct udf_fileident_bh fibh; | 659 | struct udf_fileident_bh fibh; |
657 | struct fileIdentDesc cfi, *fi; | 660 | struct fileIdentDesc cfi, *fi; |
658 | int err; | 661 | int err; |
662 | struct udf_inode_info *iinfo; | ||
659 | 663 | ||
660 | if (!old_valid_dev(rdev)) | 664 | if (!old_valid_dev(rdev)) |
661 | return -EINVAL; | 665 | return -EINVAL; |
@@ -666,6 +670,7 @@ static int udf_mknod(struct inode *dir, struct dentry *dentry, int mode, | |||
666 | if (!inode) | 670 | if (!inode) |
667 | goto out; | 671 | goto out; |
668 | 672 | ||
673 | iinfo = UDF_I(inode); | ||
669 | inode->i_uid = current->fsuid; | 674 | inode->i_uid = current->fsuid; |
670 | init_special_inode(inode, mode, rdev); | 675 | init_special_inode(inode, mode, rdev); |
671 | fi = udf_add_entry(dir, dentry, &fibh, &cfi, &err); | 676 | fi = udf_add_entry(dir, dentry, &fibh, &cfi, &err); |
@@ -677,9 +682,9 @@ static int udf_mknod(struct inode *dir, struct dentry *dentry, int mode, | |||
677 | return err; | 682 | return err; |
678 | } | 683 | } |
679 | cfi.icb.extLength = cpu_to_le32(inode->i_sb->s_blocksize); | 684 | cfi.icb.extLength = cpu_to_le32(inode->i_sb->s_blocksize); |
680 | cfi.icb.extLocation = cpu_to_lelb(UDF_I(inode)->i_location); | 685 | cfi.icb.extLocation = cpu_to_lelb(iinfo->i_location); |
681 | *(__le32 *)((struct allocDescImpUse *)cfi.icb.impUse)->impUse = | 686 | *(__le32 *)((struct allocDescImpUse *)cfi.icb.impUse)->impUse = |
682 | cpu_to_le32(UDF_I(inode)->i_unique & 0x00000000FFFFFFFFUL); | 687 | cpu_to_le32(iinfo->i_unique & 0x00000000FFFFFFFFUL); |
683 | udf_write_fi(dir, &cfi, fi, &fibh, NULL, NULL); | 688 | udf_write_fi(dir, &cfi, fi, &fibh, NULL, NULL); |
684 | if (UDF_I(dir)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) | 689 | if (UDF_I(dir)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) |
685 | mark_inode_dirty(dir); | 690 | mark_inode_dirty(dir); |
@@ -702,6 +707,8 @@ static int udf_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
702 | struct udf_fileident_bh fibh; | 707 | struct udf_fileident_bh fibh; |
703 | struct fileIdentDesc cfi, *fi; | 708 | struct fileIdentDesc cfi, *fi; |
704 | int err; | 709 | int err; |
710 | struct udf_inode_info *dinfo = UDF_I(dir); | ||
711 | struct udf_inode_info *iinfo; | ||
705 | 712 | ||
706 | lock_kernel(); | 713 | lock_kernel(); |
707 | err = -EMLINK; | 714 | err = -EMLINK; |
@@ -713,6 +720,7 @@ static int udf_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
713 | if (!inode) | 720 | if (!inode) |
714 | goto out; | 721 | goto out; |
715 | 722 | ||
723 | iinfo = UDF_I(inode); | ||
716 | inode->i_op = &udf_dir_inode_operations; | 724 | inode->i_op = &udf_dir_inode_operations; |
717 | inode->i_fop = &udf_dir_operations; | 725 | inode->i_fop = &udf_dir_operations; |
718 | fi = udf_add_entry(inode, NULL, &fibh, &cfi, &err); | 726 | fi = udf_add_entry(inode, NULL, &fibh, &cfi, &err); |
@@ -724,9 +732,9 @@ static int udf_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
724 | } | 732 | } |
725 | inode->i_nlink = 2; | 733 | inode->i_nlink = 2; |
726 | cfi.icb.extLength = cpu_to_le32(inode->i_sb->s_blocksize); | 734 | cfi.icb.extLength = cpu_to_le32(inode->i_sb->s_blocksize); |
727 | cfi.icb.extLocation = cpu_to_lelb(UDF_I(dir)->i_location); | 735 | cfi.icb.extLocation = cpu_to_lelb(dinfo->i_location); |
728 | *(__le32 *)((struct allocDescImpUse *)cfi.icb.impUse)->impUse = | 736 | *(__le32 *)((struct allocDescImpUse *)cfi.icb.impUse)->impUse = |
729 | cpu_to_le32(UDF_I(dir)->i_unique & 0x00000000FFFFFFFFUL); | 737 | cpu_to_le32(dinfo->i_unique & 0x00000000FFFFFFFFUL); |
730 | cfi.fileCharacteristics = | 738 | cfi.fileCharacteristics = |
731 | FID_FILE_CHAR_DIRECTORY | FID_FILE_CHAR_PARENT; | 739 | FID_FILE_CHAR_DIRECTORY | FID_FILE_CHAR_PARENT; |
732 | udf_write_fi(inode, &cfi, fi, &fibh, NULL, NULL); | 740 | udf_write_fi(inode, &cfi, fi, &fibh, NULL, NULL); |
@@ -744,9 +752,9 @@ static int udf_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
744 | goto out; | 752 | goto out; |
745 | } | 753 | } |
746 | cfi.icb.extLength = cpu_to_le32(inode->i_sb->s_blocksize); | 754 | cfi.icb.extLength = cpu_to_le32(inode->i_sb->s_blocksize); |
747 | cfi.icb.extLocation = cpu_to_lelb(UDF_I(inode)->i_location); | 755 | cfi.icb.extLocation = cpu_to_lelb(iinfo->i_location); |
748 | *(__le32 *)((struct allocDescImpUse *)cfi.icb.impUse)->impUse = | 756 | *(__le32 *)((struct allocDescImpUse *)cfi.icb.impUse)->impUse = |
749 | cpu_to_le32(UDF_I(inode)->i_unique & 0x00000000FFFFFFFFUL); | 757 | cpu_to_le32(iinfo->i_unique & 0x00000000FFFFFFFFUL); |
750 | cfi.fileCharacteristics |= FID_FILE_CHAR_DIRECTORY; | 758 | cfi.fileCharacteristics |= FID_FILE_CHAR_DIRECTORY; |
751 | udf_write_fi(dir, &cfi, fi, &fibh, NULL, NULL); | 759 | udf_write_fi(dir, &cfi, fi, &fibh, NULL, NULL); |
752 | inc_nlink(dir); | 760 | inc_nlink(dir); |
@@ -773,23 +781,23 @@ static int empty_dir(struct inode *dir) | |||
773 | uint32_t elen; | 781 | uint32_t elen; |
774 | sector_t offset; | 782 | sector_t offset; |
775 | struct extent_position epos = {}; | 783 | struct extent_position epos = {}; |
784 | struct udf_inode_info *dinfo = UDF_I(dir); | ||
776 | 785 | ||
777 | f_pos = (udf_ext0_offset(dir) >> 2); | 786 | f_pos = (udf_ext0_offset(dir) >> 2); |
778 | 787 | ||
779 | fibh.soffset = fibh.eoffset = | 788 | fibh.soffset = fibh.eoffset = |
780 | (f_pos & ((dir->i_sb->s_blocksize - 1) >> 2)) << 2; | 789 | (f_pos & ((dir->i_sb->s_blocksize - 1) >> 2)) << 2; |
781 | 790 | ||
782 | if (UDF_I(dir)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) | 791 | if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) |
783 | fibh.sbh = fibh.ebh = NULL; | 792 | fibh.sbh = fibh.ebh = NULL; |
784 | else if (inode_bmap(dir, f_pos >> (dir->i_sb->s_blocksize_bits - 2), | 793 | else if (inode_bmap(dir, f_pos >> (dir->i_sb->s_blocksize_bits - 2), |
785 | &epos, &eloc, &elen, &offset) == | 794 | &epos, &eloc, &elen, &offset) == |
786 | (EXT_RECORDED_ALLOCATED >> 30)) { | 795 | (EXT_RECORDED_ALLOCATED >> 30)) { |
787 | block = udf_get_lb_pblock(dir->i_sb, eloc, offset); | 796 | block = udf_get_lb_pblock(dir->i_sb, eloc, offset); |
788 | if ((++offset << dir->i_sb->s_blocksize_bits) < elen) { | 797 | if ((++offset << dir->i_sb->s_blocksize_bits) < elen) { |
789 | if (UDF_I(dir)->i_alloc_type == ICBTAG_FLAG_AD_SHORT) | 798 | if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_SHORT) |
790 | epos.offset -= sizeof(short_ad); | 799 | epos.offset -= sizeof(short_ad); |
791 | else if (UDF_I(dir)->i_alloc_type == | 800 | else if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_LONG) |
792 | ICBTAG_FLAG_AD_LONG) | ||
793 | epos.offset -= sizeof(long_ad); | 801 | epos.offset -= sizeof(long_ad); |
794 | } else | 802 | } else |
795 | offset = 0; | 803 | offset = 0; |
@@ -939,38 +947,40 @@ static int udf_symlink(struct inode *dir, struct dentry *dentry, | |||
939 | char name[UDF_NAME_LEN]; | 947 | char name[UDF_NAME_LEN]; |
940 | int namelen; | 948 | int namelen; |
941 | struct buffer_head *bh; | 949 | struct buffer_head *bh; |
950 | struct udf_inode_info *iinfo; | ||
942 | 951 | ||
943 | lock_kernel(); | 952 | lock_kernel(); |
944 | inode = udf_new_inode(dir, S_IFLNK, &err); | 953 | inode = udf_new_inode(dir, S_IFLNK, &err); |
945 | if (!inode) | 954 | if (!inode) |
946 | goto out; | 955 | goto out; |
947 | 956 | ||
957 | iinfo = UDF_I(inode); | ||
948 | inode->i_mode = S_IFLNK | S_IRWXUGO; | 958 | inode->i_mode = S_IFLNK | S_IRWXUGO; |
949 | inode->i_data.a_ops = &udf_symlink_aops; | 959 | inode->i_data.a_ops = &udf_symlink_aops; |
950 | inode->i_op = &page_symlink_inode_operations; | 960 | inode->i_op = &page_symlink_inode_operations; |
951 | 961 | ||
952 | if (UDF_I(inode)->i_alloc_type != ICBTAG_FLAG_AD_IN_ICB) { | 962 | if (iinfo->i_alloc_type != ICBTAG_FLAG_AD_IN_ICB) { |
953 | kernel_lb_addr eloc; | 963 | kernel_lb_addr eloc; |
954 | uint32_t elen; | 964 | uint32_t elen; |
955 | 965 | ||
956 | block = udf_new_block(inode->i_sb, inode, | 966 | block = udf_new_block(inode->i_sb, inode, |
957 | UDF_I(inode)->i_location.partitionReferenceNum, | 967 | iinfo->i_location.partitionReferenceNum, |
958 | UDF_I(inode)->i_location.logicalBlockNum, &err); | 968 | iinfo->i_location.logicalBlockNum, &err); |
959 | if (!block) | 969 | if (!block) |
960 | goto out_no_entry; | 970 | goto out_no_entry; |
961 | epos.block = UDF_I(inode)->i_location; | 971 | epos.block = iinfo->i_location; |
962 | epos.offset = udf_file_entry_alloc_offset(inode); | 972 | epos.offset = udf_file_entry_alloc_offset(inode); |
963 | epos.bh = NULL; | 973 | epos.bh = NULL; |
964 | eloc.logicalBlockNum = block; | 974 | eloc.logicalBlockNum = block; |
965 | eloc.partitionReferenceNum = | 975 | eloc.partitionReferenceNum = |
966 | UDF_I(inode)->i_location.partitionReferenceNum; | 976 | iinfo->i_location.partitionReferenceNum; |
967 | elen = inode->i_sb->s_blocksize; | 977 | elen = inode->i_sb->s_blocksize; |
968 | UDF_I(inode)->i_lenExtents = elen; | 978 | iinfo->i_lenExtents = elen; |
969 | udf_add_aext(inode, &epos, eloc, elen, 0); | 979 | udf_add_aext(inode, &epos, eloc, elen, 0); |
970 | brelse(epos.bh); | 980 | brelse(epos.bh); |
971 | 981 | ||
972 | block = udf_get_pblock(inode->i_sb, block, | 982 | block = udf_get_pblock(inode->i_sb, block, |
973 | UDF_I(inode)->i_location.partitionReferenceNum, | 983 | iinfo->i_location.partitionReferenceNum, |
974 | 0); | 984 | 0); |
975 | epos.bh = udf_tread(inode->i_sb, block); | 985 | epos.bh = udf_tread(inode->i_sb, block); |
976 | lock_buffer(epos.bh); | 986 | lock_buffer(epos.bh); |
@@ -979,9 +989,8 @@ static int udf_symlink(struct inode *dir, struct dentry *dentry, | |||
979 | unlock_buffer(epos.bh); | 989 | unlock_buffer(epos.bh); |
980 | mark_buffer_dirty_inode(epos.bh, inode); | 990 | mark_buffer_dirty_inode(epos.bh, inode); |
981 | ea = epos.bh->b_data + udf_ext0_offset(inode); | 991 | ea = epos.bh->b_data + udf_ext0_offset(inode); |
982 | } else { | 992 | } else |
983 | ea = UDF_I(inode)->i_ext.i_data + UDF_I(inode)->i_lenEAttr; | 993 | ea = iinfo->i_ext.i_data + iinfo->i_lenEAttr; |
984 | } | ||
985 | 994 | ||
986 | eoffset = inode->i_sb->s_blocksize - udf_ext0_offset(inode); | 995 | eoffset = inode->i_sb->s_blocksize - udf_ext0_offset(inode); |
987 | pc = (struct pathComponent *)ea; | 996 | pc = (struct pathComponent *)ea; |
@@ -1049,15 +1058,15 @@ static int udf_symlink(struct inode *dir, struct dentry *dentry, | |||
1049 | 1058 | ||
1050 | brelse(epos.bh); | 1059 | brelse(epos.bh); |
1051 | inode->i_size = elen; | 1060 | inode->i_size = elen; |
1052 | if (UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) | 1061 | if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) |
1053 | UDF_I(inode)->i_lenAlloc = inode->i_size; | 1062 | iinfo->i_lenAlloc = inode->i_size; |
1054 | mark_inode_dirty(inode); | 1063 | mark_inode_dirty(inode); |
1055 | 1064 | ||
1056 | fi = udf_add_entry(dir, dentry, &fibh, &cfi, &err); | 1065 | fi = udf_add_entry(dir, dentry, &fibh, &cfi, &err); |
1057 | if (!fi) | 1066 | if (!fi) |
1058 | goto out_no_entry; | 1067 | goto out_no_entry; |
1059 | cfi.icb.extLength = cpu_to_le32(inode->i_sb->s_blocksize); | 1068 | cfi.icb.extLength = cpu_to_le32(inode->i_sb->s_blocksize); |
1060 | cfi.icb.extLocation = cpu_to_lelb(UDF_I(inode)->i_location); | 1069 | cfi.icb.extLocation = cpu_to_lelb(iinfo->i_location); |
1061 | bh = UDF_SB(inode->i_sb)->s_lvid_bh; | 1070 | bh = UDF_SB(inode->i_sb)->s_lvid_bh; |
1062 | if (bh) { | 1071 | if (bh) { |
1063 | struct logicalVolIntegrityDesc *lvid = | 1072 | struct logicalVolIntegrityDesc *lvid = |
@@ -1162,6 +1171,7 @@ static int udf_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
1162 | struct buffer_head *dir_bh = NULL; | 1171 | struct buffer_head *dir_bh = NULL; |
1163 | int retval = -ENOENT; | 1172 | int retval = -ENOENT; |
1164 | kernel_lb_addr tloc; | 1173 | kernel_lb_addr tloc; |
1174 | struct udf_inode_info *old_iinfo = UDF_I(old_inode); | ||
1165 | 1175 | ||
1166 | lock_kernel(); | 1176 | lock_kernel(); |
1167 | ofi = udf_find_entry(old_dir, old_dentry, &ofibh, &ocfi); | 1177 | ofi = udf_find_entry(old_dir, old_dentry, &ofibh, &ocfi); |
@@ -1193,10 +1203,10 @@ static int udf_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
1193 | goto end_rename; | 1203 | goto end_rename; |
1194 | } | 1204 | } |
1195 | retval = -EIO; | 1205 | retval = -EIO; |
1196 | if (UDF_I(old_inode)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) { | 1206 | if (old_iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) { |
1197 | dir_fi = udf_get_fileident( | 1207 | dir_fi = udf_get_fileident( |
1198 | UDF_I(old_inode)->i_ext.i_data - | 1208 | old_iinfo->i_ext.i_data - |
1199 | (UDF_I(old_inode)->i_efe ? | 1209 | (old_iinfo->i_efe ? |
1200 | sizeof(struct extendedFileEntry) : | 1210 | sizeof(struct extendedFileEntry) : |
1201 | sizeof(struct fileEntry)), | 1211 | sizeof(struct fileEntry)), |
1202 | old_inode->i_sb->s_blocksize, &offset); | 1212 | old_inode->i_sb->s_blocksize, &offset); |
@@ -1258,7 +1268,7 @@ static int udf_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
1258 | udf_update_tag((char *)dir_fi, | 1268 | udf_update_tag((char *)dir_fi, |
1259 | (sizeof(struct fileIdentDesc) + | 1269 | (sizeof(struct fileIdentDesc) + |
1260 | le16_to_cpu(dir_fi->lengthOfImpUse) + 3) & ~3); | 1270 | le16_to_cpu(dir_fi->lengthOfImpUse) + 3) & ~3); |
1261 | if (UDF_I(old_inode)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) | 1271 | if (old_iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) |
1262 | mark_inode_dirty(old_inode); | 1272 | mark_inode_dirty(old_inode); |
1263 | else | 1273 | else |
1264 | mark_buffer_dirty_inode(dir_bh, old_inode); | 1274 | mark_buffer_dirty_inode(dir_bh, old_inode); |
diff --git a/fs/udf/partition.c b/fs/udf/partition.c index cfe213fd3113..fc533345ab89 100644 --- a/fs/udf/partition.c +++ b/fs/udf/partition.c | |||
@@ -55,6 +55,7 @@ uint32_t udf_get_pblock_virt15(struct super_block *sb, uint32_t block, | |||
55 | struct udf_sb_info *sbi = UDF_SB(sb); | 55 | struct udf_sb_info *sbi = UDF_SB(sb); |
56 | struct udf_part_map *map; | 56 | struct udf_part_map *map; |
57 | struct udf_virtual_data *vdata; | 57 | struct udf_virtual_data *vdata; |
58 | struct udf_inode_info *iinfo; | ||
58 | 59 | ||
59 | map = &sbi->s_partmaps[partition]; | 60 | map = &sbi->s_partmaps[partition]; |
60 | vdata = &map->s_type_specific.s_virtual; | 61 | vdata = &map->s_type_specific.s_virtual; |
@@ -88,15 +89,14 @@ uint32_t udf_get_pblock_virt15(struct super_block *sb, uint32_t block, | |||
88 | 89 | ||
89 | brelse(bh); | 90 | brelse(bh); |
90 | 91 | ||
91 | if (UDF_I(sbi->s_vat_inode)->i_location.partitionReferenceNum == | 92 | iinfo = UDF_I(sbi->s_vat_inode); |
92 | partition) { | 93 | if (iinfo->i_location.partitionReferenceNum == partition) { |
93 | udf_debug("recursive call to udf_get_pblock!\n"); | 94 | udf_debug("recursive call to udf_get_pblock!\n"); |
94 | return 0xFFFFFFFF; | 95 | return 0xFFFFFFFF; |
95 | } | 96 | } |
96 | 97 | ||
97 | return udf_get_pblock(sb, loc, | 98 | return udf_get_pblock(sb, loc, |
98 | UDF_I(sbi->s_vat_inode)->i_location. | 99 | iinfo->i_location.partitionReferenceNum, |
99 | partitionReferenceNum, | ||
100 | offset); | 100 | offset); |
101 | } | 101 | } |
102 | 102 | ||
diff --git a/fs/udf/symlink.c b/fs/udf/symlink.c index d55989c871d4..6ec99221e50c 100644 --- a/fs/udf/symlink.c +++ b/fs/udf/symlink.c | |||
@@ -79,10 +79,12 @@ static int udf_symlink_filler(struct file *file, struct page *page) | |||
79 | char *symlink; | 79 | char *symlink; |
80 | int err = -EIO; | 80 | int err = -EIO; |
81 | char *p = kmap(page); | 81 | char *p = kmap(page); |
82 | struct udf_inode_info *iinfo; | ||
82 | 83 | ||
83 | lock_kernel(); | 84 | lock_kernel(); |
84 | if (UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) { | 85 | iinfo = UDF_I(inode); |
85 | symlink = UDF_I(inode)->i_ext.i_data + UDF_I(inode)->i_lenEAttr; | 86 | if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) { |
87 | symlink = iinfo->i_ext.i_data + iinfo->i_lenEAttr; | ||
86 | } else { | 88 | } else { |
87 | bh = sb_bread(inode->i_sb, udf_block_map(inode, 0)); | 89 | bh = sb_bread(inode->i_sb, udf_block_map(inode, 0)); |
88 | 90 | ||
diff --git a/fs/udf/truncate.c b/fs/udf/truncate.c index 8eb1d24ce5ce..fe61be17cdab 100644 --- a/fs/udf/truncate.c +++ b/fs/udf/truncate.c | |||
@@ -74,17 +74,18 @@ void udf_truncate_tail_extent(struct inode *inode) | |||
74 | uint64_t lbcount = 0; | 74 | uint64_t lbcount = 0; |
75 | int8_t etype = -1, netype; | 75 | int8_t etype = -1, netype; |
76 | int adsize; | 76 | int adsize; |
77 | struct udf_inode_info *iinfo = UDF_I(inode); | ||
77 | 78 | ||
78 | if (UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB || | 79 | if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB || |
79 | inode->i_size == UDF_I(inode)->i_lenExtents) | 80 | inode->i_size == iinfo->i_lenExtents) |
80 | return; | 81 | return; |
81 | /* Are we going to delete the file anyway? */ | 82 | /* Are we going to delete the file anyway? */ |
82 | if (inode->i_nlink == 0) | 83 | if (inode->i_nlink == 0) |
83 | return; | 84 | return; |
84 | 85 | ||
85 | if (UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_SHORT) | 86 | if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_SHORT) |
86 | adsize = sizeof(short_ad); | 87 | adsize = sizeof(short_ad); |
87 | else if (UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_LONG) | 88 | else if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_LONG) |
88 | adsize = sizeof(long_ad); | 89 | adsize = sizeof(long_ad); |
89 | else | 90 | else |
90 | BUG(); | 91 | BUG(); |
@@ -117,7 +118,7 @@ void udf_truncate_tail_extent(struct inode *inode) | |||
117 | } | 118 | } |
118 | /* This inode entry is in-memory only and thus we don't have to mark | 119 | /* This inode entry is in-memory only and thus we don't have to mark |
119 | * the inode dirty */ | 120 | * the inode dirty */ |
120 | UDF_I(inode)->i_lenExtents = inode->i_size; | 121 | iinfo->i_lenExtents = inode->i_size; |
121 | brelse(epos.bh); | 122 | brelse(epos.bh); |
122 | } | 123 | } |
123 | 124 | ||
@@ -129,19 +130,20 @@ void udf_discard_prealloc(struct inode *inode) | |||
129 | uint64_t lbcount = 0; | 130 | uint64_t lbcount = 0; |
130 | int8_t etype = -1, netype; | 131 | int8_t etype = -1, netype; |
131 | int adsize; | 132 | int adsize; |
133 | struct udf_inode_info *iinfo = UDF_I(inode); | ||
132 | 134 | ||
133 | if (UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB || | 135 | if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB || |
134 | inode->i_size == UDF_I(inode)->i_lenExtents) | 136 | inode->i_size == iinfo->i_lenExtents) |
135 | return; | 137 | return; |
136 | 138 | ||
137 | if (UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_SHORT) | 139 | if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_SHORT) |
138 | adsize = sizeof(short_ad); | 140 | adsize = sizeof(short_ad); |
139 | else if (UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_LONG) | 141 | else if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_LONG) |
140 | adsize = sizeof(long_ad); | 142 | adsize = sizeof(long_ad); |
141 | else | 143 | else |
142 | adsize = 0; | 144 | adsize = 0; |
143 | 145 | ||
144 | epos.block = UDF_I(inode)->i_location; | 146 | epos.block = iinfo->i_location; |
145 | 147 | ||
146 | /* Find the last extent in the file */ | 148 | /* Find the last extent in the file */ |
147 | while ((netype = udf_next_aext(inode, &epos, &eloc, &elen, 1)) != -1) { | 149 | while ((netype = udf_next_aext(inode, &epos, &eloc, &elen, 1)) != -1) { |
@@ -153,7 +155,7 @@ void udf_discard_prealloc(struct inode *inode) | |||
153 | lbcount -= elen; | 155 | lbcount -= elen; |
154 | extent_trunc(inode, &epos, eloc, etype, elen, 0); | 156 | extent_trunc(inode, &epos, eloc, etype, elen, 0); |
155 | if (!epos.bh) { | 157 | if (!epos.bh) { |
156 | UDF_I(inode)->i_lenAlloc = | 158 | iinfo->i_lenAlloc = |
157 | epos.offset - | 159 | epos.offset - |
158 | udf_file_entry_alloc_offset(inode); | 160 | udf_file_entry_alloc_offset(inode); |
159 | mark_inode_dirty(inode); | 161 | mark_inode_dirty(inode); |
@@ -174,7 +176,7 @@ void udf_discard_prealloc(struct inode *inode) | |||
174 | } | 176 | } |
175 | /* This inode entry is in-memory only and thus we don't have to mark | 177 | /* This inode entry is in-memory only and thus we don't have to mark |
176 | * the inode dirty */ | 178 | * the inode dirty */ |
177 | UDF_I(inode)->i_lenExtents = lbcount; | 179 | iinfo->i_lenExtents = lbcount; |
178 | brelse(epos.bh); | 180 | brelse(epos.bh); |
179 | } | 181 | } |
180 | 182 | ||
@@ -189,10 +191,11 @@ void udf_truncate_extents(struct inode *inode) | |||
189 | sector_t first_block = inode->i_size >> sb->s_blocksize_bits, offset; | 191 | sector_t first_block = inode->i_size >> sb->s_blocksize_bits, offset; |
190 | loff_t byte_offset; | 192 | loff_t byte_offset; |
191 | int adsize; | 193 | int adsize; |
194 | struct udf_inode_info *iinfo = UDF_I(inode); | ||
192 | 195 | ||
193 | if (UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_SHORT) | 196 | if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_SHORT) |
194 | adsize = sizeof(short_ad); | 197 | adsize = sizeof(short_ad); |
195 | else if (UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_LONG) | 198 | else if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_LONG) |
196 | adsize = sizeof(long_ad); | 199 | adsize = sizeof(long_ad); |
197 | else | 200 | else |
198 | BUG(); | 201 | BUG(); |
@@ -227,7 +230,7 @@ void udf_truncate_extents(struct inode *inode) | |||
227 | 0, indirect_ext_len); | 230 | 0, indirect_ext_len); |
228 | } else { | 231 | } else { |
229 | if (!epos.bh) { | 232 | if (!epos.bh) { |
230 | UDF_I(inode)->i_lenAlloc = | 233 | iinfo->i_lenAlloc = |
231 | lenalloc; | 234 | lenalloc; |
232 | mark_inode_dirty(inode); | 235 | mark_inode_dirty(inode); |
233 | } else { | 236 | } else { |
@@ -275,7 +278,7 @@ void udf_truncate_extents(struct inode *inode) | |||
275 | indirect_ext_len); | 278 | indirect_ext_len); |
276 | } else { | 279 | } else { |
277 | if (!epos.bh) { | 280 | if (!epos.bh) { |
278 | UDF_I(inode)->i_lenAlloc = lenalloc; | 281 | iinfo->i_lenAlloc = lenalloc; |
279 | mark_inode_dirty(inode); | 282 | mark_inode_dirty(inode); |
280 | } else { | 283 | } else { |
281 | struct allocExtDesc *aed = | 284 | struct allocExtDesc *aed = |
@@ -325,7 +328,7 @@ void udf_truncate_extents(struct inode *inode) | |||
325 | (sb->s_blocksize - 1)) != 0)); | 328 | (sb->s_blocksize - 1)) != 0)); |
326 | } | 329 | } |
327 | } | 330 | } |
328 | UDF_I(inode)->i_lenExtents = inode->i_size; | 331 | iinfo->i_lenExtents = inode->i_size; |
329 | 332 | ||
330 | brelse(epos.bh); | 333 | brelse(epos.bh); |
331 | } | 334 | } |