diff options
-rw-r--r-- | fs/udf/super.c | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/fs/udf/super.c b/fs/udf/super.c index 7712fa4b5a3d..3e9925acd235 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c | |||
@@ -1593,6 +1593,21 @@ static void udf_load_logicalvolint(struct super_block *sb, struct kernel_extent_ | |||
1593 | sbi->s_lvid_bh = NULL; | 1593 | sbi->s_lvid_bh = NULL; |
1594 | } | 1594 | } |
1595 | 1595 | ||
1596 | static struct udf_vds_record *get_volume_descriptor_record( | ||
1597 | struct udf_vds_record *vds, uint16_t ident) | ||
1598 | { | ||
1599 | switch (ident) { | ||
1600 | case TAG_IDENT_PVD: /* ISO 13346 3/10.1 */ | ||
1601 | return &vds[VDS_POS_PRIMARY_VOL_DESC]; | ||
1602 | case TAG_IDENT_IUVD: /* ISO 13346 3/10.4 */ | ||
1603 | return &vds[VDS_POS_IMP_USE_VOL_DESC]; | ||
1604 | case TAG_IDENT_LVD: /* ISO 13346 3/10.6 */ | ||
1605 | return &vds[VDS_POS_LOGICAL_VOL_DESC]; | ||
1606 | case TAG_IDENT_USD: /* ISO 13346 3/10.8 */ | ||
1607 | return &vds[VDS_POS_UNALLOC_SPACE_DESC]; | ||
1608 | } | ||
1609 | return NULL; | ||
1610 | } | ||
1596 | 1611 | ||
1597 | /* | 1612 | /* |
1598 | * Process a main/reserve volume descriptor sequence. | 1613 | * Process a main/reserve volume descriptor sequence. |
@@ -1635,13 +1650,6 @@ static noinline int udf_process_sequence( | |||
1635 | gd = (struct generic_desc *)bh->b_data; | 1650 | gd = (struct generic_desc *)bh->b_data; |
1636 | vdsn = le32_to_cpu(gd->volDescSeqNum); | 1651 | vdsn = le32_to_cpu(gd->volDescSeqNum); |
1637 | switch (ident) { | 1652 | switch (ident) { |
1638 | case TAG_IDENT_PVD: /* ISO 13346 3/10.1 */ | ||
1639 | curr = &vds[VDS_POS_PRIMARY_VOL_DESC]; | ||
1640 | if (vdsn >= curr->volDescSeqNum) { | ||
1641 | curr->volDescSeqNum = vdsn; | ||
1642 | curr->block = block; | ||
1643 | } | ||
1644 | break; | ||
1645 | case TAG_IDENT_VDP: /* ISO 13346 3/10.3 */ | 1653 | case TAG_IDENT_VDP: /* ISO 13346 3/10.3 */ |
1646 | if (++indirections > UDF_MAX_TD_NESTING) { | 1654 | if (++indirections > UDF_MAX_TD_NESTING) { |
1647 | udf_err(sb, "too many Volume Descriptor " | 1655 | udf_err(sb, "too many Volume Descriptor " |
@@ -1660,8 +1668,11 @@ static noinline int udf_process_sequence( | |||
1660 | /* For loop is going to increment 'block' again */ | 1668 | /* For loop is going to increment 'block' again */ |
1661 | block--; | 1669 | block--; |
1662 | break; | 1670 | break; |
1671 | case TAG_IDENT_PVD: /* ISO 13346 3/10.1 */ | ||
1663 | case TAG_IDENT_IUVD: /* ISO 13346 3/10.4 */ | 1672 | case TAG_IDENT_IUVD: /* ISO 13346 3/10.4 */ |
1664 | curr = &vds[VDS_POS_IMP_USE_VOL_DESC]; | 1673 | case TAG_IDENT_LVD: /* ISO 13346 3/10.6 */ |
1674 | case TAG_IDENT_USD: /* ISO 13346 3/10.8 */ | ||
1675 | curr = get_volume_descriptor_record(vds, ident); | ||
1665 | if (vdsn >= curr->volDescSeqNum) { | 1676 | if (vdsn >= curr->volDescSeqNum) { |
1666 | curr->volDescSeqNum = vdsn; | 1677 | curr->volDescSeqNum = vdsn; |
1667 | curr->block = block; | 1678 | curr->block = block; |
@@ -1672,20 +1683,6 @@ static noinline int udf_process_sequence( | |||
1672 | if (!curr->block) | 1683 | if (!curr->block) |
1673 | curr->block = block; | 1684 | curr->block = block; |
1674 | break; | 1685 | break; |
1675 | case TAG_IDENT_LVD: /* ISO 13346 3/10.6 */ | ||
1676 | curr = &vds[VDS_POS_LOGICAL_VOL_DESC]; | ||
1677 | if (vdsn >= curr->volDescSeqNum) { | ||
1678 | curr->volDescSeqNum = vdsn; | ||
1679 | curr->block = block; | ||
1680 | } | ||
1681 | break; | ||
1682 | case TAG_IDENT_USD: /* ISO 13346 3/10.8 */ | ||
1683 | curr = &vds[VDS_POS_UNALLOC_SPACE_DESC]; | ||
1684 | if (vdsn >= curr->volDescSeqNum) { | ||
1685 | curr->volDescSeqNum = vdsn; | ||
1686 | curr->block = block; | ||
1687 | } | ||
1688 | break; | ||
1689 | case TAG_IDENT_TD: /* ISO 13346 3/10.9 */ | 1686 | case TAG_IDENT_TD: /* ISO 13346 3/10.9 */ |
1690 | vds[VDS_POS_TERMINATING_DESC].block = block; | 1687 | vds[VDS_POS_TERMINATING_DESC].block = block; |
1691 | done = true; | 1688 | done = true; |