diff options
Diffstat (limited to 'fs/udf/super.c')
-rw-r--r-- | fs/udf/super.c | 75 |
1 files changed, 38 insertions, 37 deletions
diff --git a/fs/udf/super.c b/fs/udf/super.c index 023b304fdd99..9b8644a06e53 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c | |||
@@ -563,7 +563,7 @@ udf_vrs(struct super_block *sb, int silent) | |||
563 | 563 | ||
564 | if (vsd->stdIdent[0] == 0) | 564 | if (vsd->stdIdent[0] == 0) |
565 | { | 565 | { |
566 | udf_release_data(bh); | 566 | brelse(bh); |
567 | break; | 567 | break; |
568 | } | 568 | } |
569 | else if (!strncmp(vsd->stdIdent, VSD_STD_ID_CD001, VSD_STD_ID_LEN)) | 569 | else if (!strncmp(vsd->stdIdent, VSD_STD_ID_CD001, VSD_STD_ID_LEN)) |
@@ -596,7 +596,7 @@ udf_vrs(struct super_block *sb, int silent) | |||
596 | } | 596 | } |
597 | else if (!strncmp(vsd->stdIdent, VSD_STD_ID_TEA01, VSD_STD_ID_LEN)) | 597 | else if (!strncmp(vsd->stdIdent, VSD_STD_ID_TEA01, VSD_STD_ID_LEN)) |
598 | { | 598 | { |
599 | udf_release_data(bh); | 599 | brelse(bh); |
600 | break; | 600 | break; |
601 | } | 601 | } |
602 | else if (!strncmp(vsd->stdIdent, VSD_STD_ID_NSR02, VSD_STD_ID_LEN)) | 602 | else if (!strncmp(vsd->stdIdent, VSD_STD_ID_NSR02, VSD_STD_ID_LEN)) |
@@ -607,7 +607,7 @@ udf_vrs(struct super_block *sb, int silent) | |||
607 | { | 607 | { |
608 | nsr03 = sector; | 608 | nsr03 = sector; |
609 | } | 609 | } |
610 | udf_release_data(bh); | 610 | brelse(bh); |
611 | } | 611 | } |
612 | 612 | ||
613 | if (nsr03) | 613 | if (nsr03) |
@@ -673,7 +673,7 @@ udf_find_anchor(struct super_block *sb) | |||
673 | { | 673 | { |
674 | ident = le16_to_cpu(((tag *)bh->b_data)->tagIdent); | 674 | ident = le16_to_cpu(((tag *)bh->b_data)->tagIdent); |
675 | location = le32_to_cpu(((tag *)bh->b_data)->tagLocation); | 675 | location = le32_to_cpu(((tag *)bh->b_data)->tagLocation); |
676 | udf_release_data(bh); | 676 | brelse(bh); |
677 | } | 677 | } |
678 | 678 | ||
679 | if (ident == TAG_IDENT_AVDP) | 679 | if (ident == TAG_IDENT_AVDP) |
@@ -708,7 +708,7 @@ udf_find_anchor(struct super_block *sb) | |||
708 | { | 708 | { |
709 | ident = le16_to_cpu(((tag *)bh->b_data)->tagIdent); | 709 | ident = le16_to_cpu(((tag *)bh->b_data)->tagIdent); |
710 | location = le32_to_cpu(((tag *)bh->b_data)->tagLocation); | 710 | location = le32_to_cpu(((tag *)bh->b_data)->tagLocation); |
711 | udf_release_data(bh); | 711 | brelse(bh); |
712 | } | 712 | } |
713 | 713 | ||
714 | if (ident == TAG_IDENT_AVDP && | 714 | if (ident == TAG_IDENT_AVDP && |
@@ -727,7 +727,7 @@ udf_find_anchor(struct super_block *sb) | |||
727 | { | 727 | { |
728 | ident = le16_to_cpu(((tag *)bh->b_data)->tagIdent); | 728 | ident = le16_to_cpu(((tag *)bh->b_data)->tagIdent); |
729 | location = le32_to_cpu(((tag *)bh->b_data)->tagLocation); | 729 | location = le32_to_cpu(((tag *)bh->b_data)->tagLocation); |
730 | udf_release_data(bh); | 730 | brelse(bh); |
731 | } | 731 | } |
732 | 732 | ||
733 | if (ident == TAG_IDENT_AVDP && | 733 | if (ident == TAG_IDENT_AVDP && |
@@ -749,7 +749,7 @@ udf_find_anchor(struct super_block *sb) | |||
749 | { | 749 | { |
750 | ident = le16_to_cpu(((tag *)bh->b_data)->tagIdent); | 750 | ident = le16_to_cpu(((tag *)bh->b_data)->tagIdent); |
751 | location = le32_to_cpu(((tag *)bh->b_data)->tagLocation); | 751 | location = le32_to_cpu(((tag *)bh->b_data)->tagLocation); |
752 | udf_release_data(bh); | 752 | brelse(bh); |
753 | 753 | ||
754 | if (ident == TAG_IDENT_AVDP && location == 256) | 754 | if (ident == TAG_IDENT_AVDP && location == 256) |
755 | UDF_SET_FLAG(sb, UDF_FLAG_VARCONV); | 755 | UDF_SET_FLAG(sb, UDF_FLAG_VARCONV); |
@@ -766,7 +766,7 @@ udf_find_anchor(struct super_block *sb) | |||
766 | } | 766 | } |
767 | else | 767 | else |
768 | { | 768 | { |
769 | udf_release_data(bh); | 769 | brelse(bh); |
770 | if ((ident != TAG_IDENT_AVDP) && (i || | 770 | if ((ident != TAG_IDENT_AVDP) && (i || |
771 | (ident != TAG_IDENT_FE && ident != TAG_IDENT_EFE))) | 771 | (ident != TAG_IDENT_FE && ident != TAG_IDENT_EFE))) |
772 | { | 772 | { |
@@ -795,7 +795,7 @@ udf_find_fileset(struct super_block *sb, kernel_lb_addr *fileset, kernel_lb_addr | |||
795 | return 1; | 795 | return 1; |
796 | else if (ident != TAG_IDENT_FSD) | 796 | else if (ident != TAG_IDENT_FSD) |
797 | { | 797 | { |
798 | udf_release_data(bh); | 798 | brelse(bh); |
799 | return 1; | 799 | return 1; |
800 | } | 800 | } |
801 | 801 | ||
@@ -834,7 +834,7 @@ udf_find_fileset(struct super_block *sb, kernel_lb_addr *fileset, kernel_lb_addr | |||
834 | newfileset.logicalBlockNum += 1 + | 834 | newfileset.logicalBlockNum += 1 + |
835 | ((le32_to_cpu(sp->numOfBytes) + sizeof(struct spaceBitmapDesc) - 1) | 835 | ((le32_to_cpu(sp->numOfBytes) + sizeof(struct spaceBitmapDesc) - 1) |
836 | >> sb->s_blocksize_bits); | 836 | >> sb->s_blocksize_bits); |
837 | udf_release_data(bh); | 837 | brelse(bh); |
838 | break; | 838 | break; |
839 | } | 839 | } |
840 | case TAG_IDENT_FSD: | 840 | case TAG_IDENT_FSD: |
@@ -845,7 +845,7 @@ udf_find_fileset(struct super_block *sb, kernel_lb_addr *fileset, kernel_lb_addr | |||
845 | default: | 845 | default: |
846 | { | 846 | { |
847 | newfileset.logicalBlockNum ++; | 847 | newfileset.logicalBlockNum ++; |
848 | udf_release_data(bh); | 848 | brelse(bh); |
849 | bh = NULL; | 849 | bh = NULL; |
850 | break; | 850 | break; |
851 | } | 851 | } |
@@ -865,7 +865,7 @@ udf_find_fileset(struct super_block *sb, kernel_lb_addr *fileset, kernel_lb_addr | |||
865 | 865 | ||
866 | UDF_SB_PARTITION(sb) = fileset->partitionReferenceNum; | 866 | UDF_SB_PARTITION(sb) = fileset->partitionReferenceNum; |
867 | udf_load_fileset(sb, bh, root); | 867 | udf_load_fileset(sb, bh, root); |
868 | udf_release_data(bh); | 868 | brelse(bh); |
869 | return 0; | 869 | return 0; |
870 | } | 870 | } |
871 | return 1; | 871 | return 1; |
@@ -1083,7 +1083,7 @@ udf_load_logicalvol(struct super_block *sb, struct buffer_head * bh, kernel_lb_a | |||
1083 | if (ident != 0 || | 1083 | if (ident != 0 || |
1084 | strncmp(st->sparingIdent.ident, UDF_ID_SPARING, strlen(UDF_ID_SPARING))) | 1084 | strncmp(st->sparingIdent.ident, UDF_ID_SPARING, strlen(UDF_ID_SPARING))) |
1085 | { | 1085 | { |
1086 | udf_release_data(UDF_SB_TYPESPAR(sb,i).s_spar_map[j]); | 1086 | brelse(UDF_SB_TYPESPAR(sb,i).s_spar_map[j]); |
1087 | UDF_SB_TYPESPAR(sb,i).s_spar_map[j] = NULL; | 1087 | UDF_SB_TYPESPAR(sb,i).s_spar_map[j] = NULL; |
1088 | } | 1088 | } |
1089 | } | 1089 | } |
@@ -1137,12 +1137,12 @@ udf_load_logicalvolint(struct super_block *sb, kernel_extent_ad loc) | |||
1137 | udf_load_logicalvolint(sb, leea_to_cpu(UDF_SB_LVID(sb)->nextIntegrityExt)); | 1137 | udf_load_logicalvolint(sb, leea_to_cpu(UDF_SB_LVID(sb)->nextIntegrityExt)); |
1138 | 1138 | ||
1139 | if (UDF_SB_LVIDBH(sb) != bh) | 1139 | if (UDF_SB_LVIDBH(sb) != bh) |
1140 | udf_release_data(bh); | 1140 | brelse(bh); |
1141 | loc.extLength -= sb->s_blocksize; | 1141 | loc.extLength -= sb->s_blocksize; |
1142 | loc.extLocation ++; | 1142 | loc.extLocation ++; |
1143 | } | 1143 | } |
1144 | if (UDF_SB_LVIDBH(sb) != bh) | 1144 | if (UDF_SB_LVIDBH(sb) != bh) |
1145 | udf_release_data(bh); | 1145 | brelse(bh); |
1146 | } | 1146 | } |
1147 | 1147 | ||
1148 | /* | 1148 | /* |
@@ -1245,7 +1245,7 @@ udf_process_sequence(struct super_block *sb, long block, long lastblock, kernel_ | |||
1245 | done = 1; | 1245 | done = 1; |
1246 | break; | 1246 | break; |
1247 | } | 1247 | } |
1248 | udf_release_data(bh); | 1248 | brelse(bh); |
1249 | } | 1249 | } |
1250 | for (i=0; i<VDS_POS_LENGTH; i++) | 1250 | for (i=0; i<VDS_POS_LENGTH; i++) |
1251 | { | 1251 | { |
@@ -1267,10 +1267,10 @@ udf_process_sequence(struct super_block *sb, long block, long lastblock, kernel_ | |||
1267 | gd = (struct generic_desc *)bh2->b_data; | 1267 | gd = (struct generic_desc *)bh2->b_data; |
1268 | if (ident == TAG_IDENT_PD) | 1268 | if (ident == TAG_IDENT_PD) |
1269 | udf_load_partdesc(sb, bh2); | 1269 | udf_load_partdesc(sb, bh2); |
1270 | udf_release_data(bh2); | 1270 | brelse(bh2); |
1271 | } | 1271 | } |
1272 | } | 1272 | } |
1273 | udf_release_data(bh); | 1273 | brelse(bh); |
1274 | } | 1274 | } |
1275 | } | 1275 | } |
1276 | 1276 | ||
@@ -1333,7 +1333,7 @@ udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset) | |||
1333 | reserve_e = reserve_e >> sb->s_blocksize_bits; | 1333 | reserve_e = reserve_e >> sb->s_blocksize_bits; |
1334 | reserve_e += reserve_s; | 1334 | reserve_e += reserve_s; |
1335 | 1335 | ||
1336 | udf_release_data(bh); | 1336 | brelse(bh); |
1337 | 1337 | ||
1338 | /* Process the main & reserve sequences */ | 1338 | /* Process the main & reserve sequences */ |
1339 | /* responsible for finding the PartitionDesc(s) */ | 1339 | /* responsible for finding the PartitionDesc(s) */ |
@@ -1403,12 +1403,14 @@ udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset) | |||
1403 | 1403 | ||
1404 | pos = udf_block_map(UDF_SB_VAT(sb), 0); | 1404 | pos = udf_block_map(UDF_SB_VAT(sb), 0); |
1405 | bh = sb_bread(sb, pos); | 1405 | bh = sb_bread(sb, pos); |
1406 | if (!bh) | ||
1407 | return 1; | ||
1406 | UDF_SB_TYPEVIRT(sb,i).s_start_offset = | 1408 | UDF_SB_TYPEVIRT(sb,i).s_start_offset = |
1407 | le16_to_cpu(((struct virtualAllocationTable20 *)bh->b_data + udf_ext0_offset(UDF_SB_VAT(sb)))->lengthHeader) + | 1409 | le16_to_cpu(((struct virtualAllocationTable20 *)bh->b_data + udf_ext0_offset(UDF_SB_VAT(sb)))->lengthHeader) + |
1408 | udf_ext0_offset(UDF_SB_VAT(sb)); | 1410 | udf_ext0_offset(UDF_SB_VAT(sb)); |
1409 | UDF_SB_TYPEVIRT(sb,i).s_num_entries = (UDF_SB_VAT(sb)->i_size - | 1411 | UDF_SB_TYPEVIRT(sb,i).s_num_entries = (UDF_SB_VAT(sb)->i_size - |
1410 | UDF_SB_TYPEVIRT(sb,i).s_start_offset) >> 2; | 1412 | UDF_SB_TYPEVIRT(sb,i).s_start_offset) >> 2; |
1411 | udf_release_data(bh); | 1413 | brelse(bh); |
1412 | } | 1414 | } |
1413 | UDF_SB_PARTROOT(sb,i) = udf_get_pblock(sb, 0, i, 0); | 1415 | UDF_SB_PARTROOT(sb,i) = udf_get_pblock(sb, 0, i, 0); |
1414 | UDF_SB_PARTLEN(sb,i) = UDF_SB_PARTLEN(sb,ino.partitionReferenceNum); | 1416 | UDF_SB_PARTLEN(sb,i) = UDF_SB_PARTLEN(sb,ino.partitionReferenceNum); |
@@ -1661,7 +1663,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) | |||
1661 | iput(inode); | 1663 | iput(inode); |
1662 | goto error_out; | 1664 | goto error_out; |
1663 | } | 1665 | } |
1664 | sb->s_maxbytes = 1<<30; | 1666 | sb->s_maxbytes = MAX_LFS_FILESIZE; |
1665 | return 0; | 1667 | return 0; |
1666 | 1668 | ||
1667 | error_out: | 1669 | error_out: |
@@ -1680,7 +1682,7 @@ error_out: | |||
1680 | if (UDF_SB_PARTTYPE(sb, UDF_SB_PARTITION(sb)) == UDF_SPARABLE_MAP15) | 1682 | if (UDF_SB_PARTTYPE(sb, UDF_SB_PARTITION(sb)) == UDF_SPARABLE_MAP15) |
1681 | { | 1683 | { |
1682 | for (i=0; i<4; i++) | 1684 | for (i=0; i<4; i++) |
1683 | udf_release_data(UDF_SB_TYPESPAR(sb, UDF_SB_PARTITION(sb)).s_spar_map[i]); | 1685 | brelse(UDF_SB_TYPESPAR(sb, UDF_SB_PARTITION(sb)).s_spar_map[i]); |
1684 | } | 1686 | } |
1685 | } | 1687 | } |
1686 | #ifdef CONFIG_UDF_NLS | 1688 | #ifdef CONFIG_UDF_NLS |
@@ -1689,7 +1691,7 @@ error_out: | |||
1689 | #endif | 1691 | #endif |
1690 | if (!(sb->s_flags & MS_RDONLY)) | 1692 | if (!(sb->s_flags & MS_RDONLY)) |
1691 | udf_close_lvid(sb); | 1693 | udf_close_lvid(sb); |
1692 | udf_release_data(UDF_SB_LVIDBH(sb)); | 1694 | brelse(UDF_SB_LVIDBH(sb)); |
1693 | UDF_SB_FREE(sb); | 1695 | UDF_SB_FREE(sb); |
1694 | kfree(sbi); | 1696 | kfree(sbi); |
1695 | sb->s_fs_info = NULL; | 1697 | sb->s_fs_info = NULL; |
@@ -1758,7 +1760,7 @@ udf_put_super(struct super_block *sb) | |||
1758 | if (UDF_SB_PARTTYPE(sb, UDF_SB_PARTITION(sb)) == UDF_SPARABLE_MAP15) | 1760 | if (UDF_SB_PARTTYPE(sb, UDF_SB_PARTITION(sb)) == UDF_SPARABLE_MAP15) |
1759 | { | 1761 | { |
1760 | for (i=0; i<4; i++) | 1762 | for (i=0; i<4; i++) |
1761 | udf_release_data(UDF_SB_TYPESPAR(sb, UDF_SB_PARTITION(sb)).s_spar_map[i]); | 1763 | brelse(UDF_SB_TYPESPAR(sb, UDF_SB_PARTITION(sb)).s_spar_map[i]); |
1762 | } | 1764 | } |
1763 | } | 1765 | } |
1764 | #ifdef CONFIG_UDF_NLS | 1766 | #ifdef CONFIG_UDF_NLS |
@@ -1767,7 +1769,7 @@ udf_put_super(struct super_block *sb) | |||
1767 | #endif | 1769 | #endif |
1768 | if (!(sb->s_flags & MS_RDONLY)) | 1770 | if (!(sb->s_flags & MS_RDONLY)) |
1769 | udf_close_lvid(sb); | 1771 | udf_close_lvid(sb); |
1770 | udf_release_data(UDF_SB_LVIDBH(sb)); | 1772 | brelse(UDF_SB_LVIDBH(sb)); |
1771 | UDF_SB_FREE(sb); | 1773 | UDF_SB_FREE(sb); |
1772 | kfree(sb->s_fs_info); | 1774 | kfree(sb->s_fs_info); |
1773 | sb->s_fs_info = NULL; | 1775 | sb->s_fs_info = NULL; |
@@ -1837,7 +1839,7 @@ udf_count_free_bitmap(struct super_block *sb, struct udf_bitmap *bitmap) | |||
1837 | } | 1839 | } |
1838 | else if (ident != TAG_IDENT_SBD) | 1840 | else if (ident != TAG_IDENT_SBD) |
1839 | { | 1841 | { |
1840 | udf_release_data(bh); | 1842 | brelse(bh); |
1841 | printk(KERN_ERR "udf: udf_count_free failed\n"); | 1843 | printk(KERN_ERR "udf: udf_count_free failed\n"); |
1842 | goto out; | 1844 | goto out; |
1843 | } | 1845 | } |
@@ -1859,7 +1861,7 @@ udf_count_free_bitmap(struct super_block *sb, struct udf_bitmap *bitmap) | |||
1859 | } | 1861 | } |
1860 | if ( bytes ) | 1862 | if ( bytes ) |
1861 | { | 1863 | { |
1862 | udf_release_data(bh); | 1864 | brelse(bh); |
1863 | newblock = udf_get_lb_pblock(sb, loc, ++block); | 1865 | newblock = udf_get_lb_pblock(sb, loc, ++block); |
1864 | bh = udf_tread(sb, newblock); | 1866 | bh = udf_tread(sb, newblock); |
1865 | if (!bh) | 1867 | if (!bh) |
@@ -1871,7 +1873,7 @@ udf_count_free_bitmap(struct super_block *sb, struct udf_bitmap *bitmap) | |||
1871 | ptr = (uint8_t *)bh->b_data; | 1873 | ptr = (uint8_t *)bh->b_data; |
1872 | } | 1874 | } |
1873 | } | 1875 | } |
1874 | udf_release_data(bh); | 1876 | brelse(bh); |
1875 | 1877 | ||
1876 | out: | 1878 | out: |
1877 | unlock_kernel(); | 1879 | unlock_kernel(); |
@@ -1883,21 +1885,20 @@ static unsigned int | |||
1883 | udf_count_free_table(struct super_block *sb, struct inode * table) | 1885 | udf_count_free_table(struct super_block *sb, struct inode * table) |
1884 | { | 1886 | { |
1885 | unsigned int accum = 0; | 1887 | unsigned int accum = 0; |
1886 | uint32_t extoffset, elen; | 1888 | uint32_t elen; |
1887 | kernel_lb_addr bloc, eloc; | 1889 | kernel_lb_addr eloc; |
1888 | int8_t etype; | 1890 | int8_t etype; |
1889 | struct buffer_head *bh = NULL; | 1891 | struct extent_position epos; |
1890 | 1892 | ||
1891 | lock_kernel(); | 1893 | lock_kernel(); |
1892 | 1894 | ||
1893 | bloc = UDF_I_LOCATION(table); | 1895 | epos.block = UDF_I_LOCATION(table); |
1894 | extoffset = sizeof(struct unallocSpaceEntry); | 1896 | epos.offset = sizeof(struct unallocSpaceEntry); |
1897 | epos.bh = NULL; | ||
1895 | 1898 | ||
1896 | while ((etype = udf_next_aext(table, &bloc, &extoffset, &eloc, &elen, &bh, 1)) != -1) | 1899 | while ((etype = udf_next_aext(table, &epos, &eloc, &elen, 1)) != -1) |
1897 | { | ||
1898 | accum += (elen >> table->i_sb->s_blocksize_bits); | 1900 | accum += (elen >> table->i_sb->s_blocksize_bits); |
1899 | } | 1901 | brelse(epos.bh); |
1900 | udf_release_data(bh); | ||
1901 | 1902 | ||
1902 | unlock_kernel(); | 1903 | unlock_kernel(); |
1903 | 1904 | ||