diff options
-rw-r--r-- | fs/udf/balloc.c | 13 | ||||
-rw-r--r-- | fs/udf/ialloc.c | 12 | ||||
-rw-r--r-- | fs/udf/inode.c | 16 |
3 files changed, 12 insertions, 29 deletions
diff --git a/fs/udf/balloc.c b/fs/udf/balloc.c index f855dcbbdfb..1b809bd494b 100644 --- a/fs/udf/balloc.c +++ b/fs/udf/balloc.c | |||
@@ -149,8 +149,7 @@ static bool udf_add_free_space(struct udf_sb_info *sbi, | |||
149 | return false; | 149 | return false; |
150 | 150 | ||
151 | lvid = (struct logicalVolIntegrityDesc *)sbi->s_lvid_bh->b_data; | 151 | lvid = (struct logicalVolIntegrityDesc *)sbi->s_lvid_bh->b_data; |
152 | lvid->freeSpaceTable[partition] = cpu_to_le32(le32_to_cpu( | 152 | le32_add_cpu(&lvid->freeSpaceTable[partition], cnt); |
153 | lvid->freeSpaceTable[partition]) + cnt); | ||
154 | return true; | 153 | return true; |
155 | } | 154 | } |
156 | 155 | ||
@@ -589,10 +588,8 @@ static void udf_table_free_blocks(struct super_block *sb, | |||
589 | sptr = oepos.bh->b_data + epos.offset; | 588 | sptr = oepos.bh->b_data + epos.offset; |
590 | aed = (struct allocExtDesc *) | 589 | aed = (struct allocExtDesc *) |
591 | oepos.bh->b_data; | 590 | oepos.bh->b_data; |
592 | aed->lengthAllocDescs = | 591 | le32_add_cpu(&aed->lengthAllocDescs, |
593 | cpu_to_le32(le32_to_cpu( | 592 | adsize); |
594 | aed->lengthAllocDescs) + | ||
595 | adsize); | ||
596 | } else { | 593 | } else { |
597 | sptr = iinfo->i_ext.i_data + | 594 | sptr = iinfo->i_ext.i_data + |
598 | epos.offset; | 595 | epos.offset; |
@@ -645,9 +642,7 @@ static void udf_table_free_blocks(struct super_block *sb, | |||
645 | mark_inode_dirty(table); | 642 | mark_inode_dirty(table); |
646 | } else { | 643 | } else { |
647 | aed = (struct allocExtDesc *)epos.bh->b_data; | 644 | aed = (struct allocExtDesc *)epos.bh->b_data; |
648 | aed->lengthAllocDescs = | 645 | le32_add_cpu(&aed->lengthAllocDescs, adsize); |
649 | cpu_to_le32(le32_to_cpu( | ||
650 | aed->lengthAllocDescs) + adsize); | ||
651 | udf_update_tag(epos.bh->b_data, epos.offset); | 646 | udf_update_tag(epos.bh->b_data, epos.offset); |
652 | mark_buffer_dirty(epos.bh); | 647 | mark_buffer_dirty(epos.bh); |
653 | } | 648 | } |
diff --git a/fs/udf/ialloc.c b/fs/udf/ialloc.c index c3fb28eee64..eb9cfa23dc3 100644 --- a/fs/udf/ialloc.c +++ b/fs/udf/ialloc.c | |||
@@ -46,11 +46,9 @@ void udf_free_inode(struct inode *inode) | |||
46 | struct logicalVolIntegrityDescImpUse *lvidiu = | 46 | struct logicalVolIntegrityDescImpUse *lvidiu = |
47 | udf_sb_lvidiu(sbi); | 47 | udf_sb_lvidiu(sbi); |
48 | if (S_ISDIR(inode->i_mode)) | 48 | if (S_ISDIR(inode->i_mode)) |
49 | lvidiu->numDirs = | 49 | le32_add_cpu(&lvidiu->numDirs, -1); |
50 | cpu_to_le32(le32_to_cpu(lvidiu->numDirs) - 1); | ||
51 | else | 50 | else |
52 | lvidiu->numFiles = | 51 | le32_add_cpu(&lvidiu->numFiles, -1); |
53 | cpu_to_le32(le32_to_cpu(lvidiu->numFiles) - 1); | ||
54 | 52 | ||
55 | mark_buffer_dirty(sbi->s_lvid_bh); | 53 | mark_buffer_dirty(sbi->s_lvid_bh); |
56 | } | 54 | } |
@@ -104,11 +102,9 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err) | |||
104 | lvhd = (struct logicalVolHeaderDesc *) | 102 | lvhd = (struct logicalVolHeaderDesc *) |
105 | (lvid->logicalVolContentsUse); | 103 | (lvid->logicalVolContentsUse); |
106 | if (S_ISDIR(mode)) | 104 | if (S_ISDIR(mode)) |
107 | lvidiu->numDirs = | 105 | le32_add_cpu(&lvidiu->numDirs, 1); |
108 | cpu_to_le32(le32_to_cpu(lvidiu->numDirs) + 1); | ||
109 | else | 106 | else |
110 | lvidiu->numFiles = | 107 | le32_add_cpu(&lvidiu->numFiles, 1); |
111 | cpu_to_le32(le32_to_cpu(lvidiu->numFiles) + 1); | ||
112 | iinfo->i_unique = uniqueID = le64_to_cpu(lvhd->uniqueID); | 108 | iinfo->i_unique = uniqueID = le64_to_cpu(lvhd->uniqueID); |
113 | if (!(++uniqueID & 0x00000000FFFFFFFFUL)) | 109 | if (!(++uniqueID & 0x00000000FFFFFFFFUL)) |
114 | uniqueID += 16; | 110 | uniqueID += 16; |
diff --git a/fs/udf/inode.c b/fs/udf/inode.c index dc2f946dfca..91d1f1d3d7a 100644 --- a/fs/udf/inode.c +++ b/fs/udf/inode.c | |||
@@ -1748,9 +1748,7 @@ int8_t udf_add_aext(struct inode *inode, struct extent_position *epos, | |||
1748 | 1748 | ||
1749 | if (epos->bh) { | 1749 | if (epos->bh) { |
1750 | aed = (struct allocExtDesc *)epos->bh->b_data; | 1750 | aed = (struct allocExtDesc *)epos->bh->b_data; |
1751 | aed->lengthAllocDescs = | 1751 | le32_add_cpu(&aed->lengthAllocDescs, adsize); |
1752 | cpu_to_le32(le32_to_cpu( | ||
1753 | aed->lengthAllocDescs) + adsize); | ||
1754 | } else { | 1752 | } else { |
1755 | iinfo->i_lenAlloc += adsize; | 1753 | iinfo->i_lenAlloc += adsize; |
1756 | mark_inode_dirty(inode); | 1754 | mark_inode_dirty(inode); |
@@ -1800,9 +1798,7 @@ int8_t udf_add_aext(struct inode *inode, struct extent_position *epos, | |||
1800 | mark_inode_dirty(inode); | 1798 | mark_inode_dirty(inode); |
1801 | } else { | 1799 | } else { |
1802 | aed = (struct allocExtDesc *)epos->bh->b_data; | 1800 | aed = (struct allocExtDesc *)epos->bh->b_data; |
1803 | aed->lengthAllocDescs = | 1801 | le32_add_cpu(&aed->lengthAllocDescs, adsize); |
1804 | cpu_to_le32(le32_to_cpu(aed->lengthAllocDescs) + | ||
1805 | adsize); | ||
1806 | if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT) || | 1802 | if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT) || |
1807 | UDF_SB(inode->i_sb)->s_udfrev >= 0x0201) | 1803 | UDF_SB(inode->i_sb)->s_udfrev >= 0x0201) |
1808 | udf_update_tag(epos->bh->b_data, | 1804 | udf_update_tag(epos->bh->b_data, |
@@ -2016,9 +2012,7 @@ int8_t udf_delete_aext(struct inode *inode, struct extent_position epos, | |||
2016 | mark_inode_dirty(inode); | 2012 | mark_inode_dirty(inode); |
2017 | } else { | 2013 | } else { |
2018 | aed = (struct allocExtDesc *)oepos.bh->b_data; | 2014 | aed = (struct allocExtDesc *)oepos.bh->b_data; |
2019 | aed->lengthAllocDescs = | 2015 | le32_add_cpu(&aed->lengthAllocDescs, -(2 * adsize)); |
2020 | cpu_to_le32(le32_to_cpu(aed->lengthAllocDescs) - | ||
2021 | (2 * adsize)); | ||
2022 | if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT) || | 2016 | if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT) || |
2023 | UDF_SB(inode->i_sb)->s_udfrev >= 0x0201) | 2017 | UDF_SB(inode->i_sb)->s_udfrev >= 0x0201) |
2024 | udf_update_tag(oepos.bh->b_data, | 2018 | udf_update_tag(oepos.bh->b_data, |
@@ -2035,9 +2029,7 @@ int8_t udf_delete_aext(struct inode *inode, struct extent_position epos, | |||
2035 | mark_inode_dirty(inode); | 2029 | mark_inode_dirty(inode); |
2036 | } else { | 2030 | } else { |
2037 | aed = (struct allocExtDesc *)oepos.bh->b_data; | 2031 | aed = (struct allocExtDesc *)oepos.bh->b_data; |
2038 | aed->lengthAllocDescs = | 2032 | le32_add_cpu(&aed->lengthAllocDescs, -adsize); |
2039 | cpu_to_le32(le32_to_cpu(aed->lengthAllocDescs) - | ||
2040 | adsize); | ||
2041 | if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT) || | 2033 | if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT) || |
2042 | UDF_SB(inode->i_sb)->s_udfrev >= 0x0201) | 2034 | UDF_SB(inode->i_sb)->s_udfrev >= 0x0201) |
2043 | udf_update_tag(oepos.bh->b_data, | 2035 | udf_update_tag(oepos.bh->b_data, |