aboutsummaryrefslogtreecommitdiffstats
path: root/fs/udf/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/udf/inode.c')
-rw-r--r--fs/udf/inode.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index 6ff8151984c..2eb1220e423 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -1081,6 +1081,7 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh)
1081 time_t convtime; 1081 time_t convtime;
1082 long convtime_usec; 1082 long convtime_usec;
1083 int offset; 1083 int offset;
1084 struct udf_sb_info *sbi = UDF_SB(inode->i_sb);
1084 1085
1085 fe = (struct fileEntry *)bh->b_data; 1086 fe = (struct fileEntry *)bh->b_data;
1086 efe = (struct extendedFileEntry *)bh->b_data; 1087 efe = (struct extendedFileEntry *)bh->b_data;
@@ -1160,7 +1161,7 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh)
1160 inode->i_atime.tv_sec = convtime; 1161 inode->i_atime.tv_sec = convtime;
1161 inode->i_atime.tv_nsec = convtime_usec * 1000; 1162 inode->i_atime.tv_nsec = convtime_usec * 1000;
1162 } else { 1163 } else {
1163 inode->i_atime = UDF_SB_RECORDTIME(inode->i_sb); 1164 inode->i_atime = sbi->s_record_time;
1164 } 1165 }
1165 1166
1166 if (udf_stamp_to_time(&convtime, &convtime_usec, 1167 if (udf_stamp_to_time(&convtime, &convtime_usec,
@@ -1168,7 +1169,7 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh)
1168 inode->i_mtime.tv_sec = convtime; 1169 inode->i_mtime.tv_sec = convtime;
1169 inode->i_mtime.tv_nsec = convtime_usec * 1000; 1170 inode->i_mtime.tv_nsec = convtime_usec * 1000;
1170 } else { 1171 } else {
1171 inode->i_mtime = UDF_SB_RECORDTIME(inode->i_sb); 1172 inode->i_mtime = sbi->s_record_time;
1172 } 1173 }
1173 1174
1174 if (udf_stamp_to_time(&convtime, &convtime_usec, 1175 if (udf_stamp_to_time(&convtime, &convtime_usec,
@@ -1176,7 +1177,7 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh)
1176 inode->i_ctime.tv_sec = convtime; 1177 inode->i_ctime.tv_sec = convtime;
1177 inode->i_ctime.tv_nsec = convtime_usec * 1000; 1178 inode->i_ctime.tv_nsec = convtime_usec * 1000;
1178 } else { 1179 } else {
1179 inode->i_ctime = UDF_SB_RECORDTIME(inode->i_sb); 1180 inode->i_ctime = sbi->s_record_time;
1180 } 1181 }
1181 1182
1182 UDF_I_UNIQUE(inode) = le64_to_cpu(fe->uniqueID); 1183 UDF_I_UNIQUE(inode) = le64_to_cpu(fe->uniqueID);
@@ -1192,7 +1193,7 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh)
1192 inode->i_atime.tv_sec = convtime; 1193 inode->i_atime.tv_sec = convtime;
1193 inode->i_atime.tv_nsec = convtime_usec * 1000; 1194 inode->i_atime.tv_nsec = convtime_usec * 1000;
1194 } else { 1195 } else {
1195 inode->i_atime = UDF_SB_RECORDTIME(inode->i_sb); 1196 inode->i_atime = sbi->s_record_time;
1196 } 1197 }
1197 1198
1198 if (udf_stamp_to_time(&convtime, &convtime_usec, 1199 if (udf_stamp_to_time(&convtime, &convtime_usec,
@@ -1200,7 +1201,7 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh)
1200 inode->i_mtime.tv_sec = convtime; 1201 inode->i_mtime.tv_sec = convtime;
1201 inode->i_mtime.tv_nsec = convtime_usec * 1000; 1202 inode->i_mtime.tv_nsec = convtime_usec * 1000;
1202 } else { 1203 } else {
1203 inode->i_mtime = UDF_SB_RECORDTIME(inode->i_sb); 1204 inode->i_mtime = sbi->s_record_time;
1204 } 1205 }
1205 1206
1206 if (udf_stamp_to_time(&convtime, &convtime_usec, 1207 if (udf_stamp_to_time(&convtime, &convtime_usec,
@@ -1208,7 +1209,7 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh)
1208 UDF_I_CRTIME(inode).tv_sec = convtime; 1209 UDF_I_CRTIME(inode).tv_sec = convtime;
1209 UDF_I_CRTIME(inode).tv_nsec = convtime_usec * 1000; 1210 UDF_I_CRTIME(inode).tv_nsec = convtime_usec * 1000;
1210 } else { 1211 } else {
1211 UDF_I_CRTIME(inode) = UDF_SB_RECORDTIME(inode->i_sb); 1212 UDF_I_CRTIME(inode) = sbi->s_record_time;
1212 } 1213 }
1213 1214
1214 if (udf_stamp_to_time(&convtime, &convtime_usec, 1215 if (udf_stamp_to_time(&convtime, &convtime_usec,
@@ -1216,7 +1217,7 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh)
1216 inode->i_ctime.tv_sec = convtime; 1217 inode->i_ctime.tv_sec = convtime;
1217 inode->i_ctime.tv_nsec = convtime_usec * 1000; 1218 inode->i_ctime.tv_nsec = convtime_usec * 1000;
1218 } else { 1219 } else {
1219 inode->i_ctime = UDF_SB_RECORDTIME(inode->i_sb); 1220 inode->i_ctime = sbi->s_record_time;
1220 } 1221 }
1221 1222
1222 UDF_I_UNIQUE(inode) = le64_to_cpu(efe->uniqueID); 1223 UDF_I_UNIQUE(inode) = le64_to_cpu(efe->uniqueID);
@@ -1353,6 +1354,7 @@ static int udf_update_inode(struct inode *inode, int do_sync)
1353 int i; 1354 int i;
1354 kernel_timestamp cpu_time; 1355 kernel_timestamp cpu_time;
1355 int err = 0; 1356 int err = 0;
1357 struct udf_sb_info *sbi = UDF_SB(inode->i_sb);
1356 1358
1357 bh = udf_tread(inode->i_sb, udf_get_lb_pblock(inode->i_sb, UDF_I_LOCATION(inode), 0)); 1359 bh = udf_tread(inode->i_sb, udf_get_lb_pblock(inode->i_sb, UDF_I_LOCATION(inode), 0));
1358 if (!bh) { 1360 if (!bh) {
@@ -1537,11 +1539,11 @@ static int udf_update_inode(struct inode *inode, int do_sync)
1537 ICBTAG_FLAG_SETGID | ICBTAG_FLAG_STICKY)); 1539 ICBTAG_FLAG_SETGID | ICBTAG_FLAG_STICKY));
1538 1540
1539 fe->icbTag.flags = cpu_to_le16(icbflags); 1541 fe->icbTag.flags = cpu_to_le16(icbflags);
1540 if (UDF_SB_UDFREV(inode->i_sb) >= 0x0200) 1542 if (sbi->s_udfrev >= 0x0200)
1541 fe->descTag.descVersion = cpu_to_le16(3); 1543 fe->descTag.descVersion = cpu_to_le16(3);
1542 else 1544 else
1543 fe->descTag.descVersion = cpu_to_le16(2); 1545 fe->descTag.descVersion = cpu_to_le16(2);
1544 fe->descTag.tagSerialNum = cpu_to_le16(UDF_SB_SERIALNUM(inode->i_sb)); 1546 fe->descTag.tagSerialNum = cpu_to_le16(sbi->s_serial_number);
1545 fe->descTag.tagLocation = cpu_to_le32(UDF_I_LOCATION(inode).logicalBlockNum); 1547 fe->descTag.tagLocation = cpu_to_le32(UDF_I_LOCATION(inode).logicalBlockNum);
1546 crclen += UDF_I_LENEATTR(inode) + UDF_I_LENALLOC(inode) - sizeof(tag); 1548 crclen += UDF_I_LENEATTR(inode) + UDF_I_LENALLOC(inode) - sizeof(tag);
1547 fe->descTag.descCRCLength = cpu_to_le16(crclen); 1549 fe->descTag.descCRCLength = cpu_to_le16(crclen);
@@ -1585,7 +1587,7 @@ struct inode *udf_iget(struct super_block *sb, kernel_lb_addr ino)
1585 if (is_bad_inode(inode)) 1587 if (is_bad_inode(inode))
1586 goto out_iput; 1588 goto out_iput;
1587 1589
1588 if (ino.logicalBlockNum >= UDF_SB_PARTLEN(sb, ino.partitionReferenceNum)) { 1590 if (ino.logicalBlockNum >= UDF_SB(sb)->s_partmaps[ino.partitionReferenceNum].s_partition_len) {
1589 udf_debug("block=%d, partition=%d out of range\n", 1591 udf_debug("block=%d, partition=%d out of range\n",
1590 ino.logicalBlockNum, ino.partitionReferenceNum); 1592 ino.logicalBlockNum, ino.partitionReferenceNum);
1591 make_bad_inode(inode); 1593 make_bad_inode(inode);
@@ -1667,7 +1669,7 @@ int8_t udf_add_aext(struct inode * inode, struct extent_position * epos,
1667 mark_inode_dirty(inode); 1669 mark_inode_dirty(inode);
1668 } 1670 }
1669 } 1671 }
1670 if (UDF_SB_UDFREV(inode->i_sb) >= 0x0200) 1672 if (UDF_SB(inode->i_sb)->s_udfrev >= 0x0200)
1671 udf_new_tag(nbh->b_data, TAG_IDENT_AED, 3, 1, 1673 udf_new_tag(nbh->b_data, TAG_IDENT_AED, 3, 1,
1672 epos->block.logicalBlockNum, sizeof(tag)); 1674 epos->block.logicalBlockNum, sizeof(tag));
1673 else 1675 else
@@ -1690,7 +1692,7 @@ int8_t udf_add_aext(struct inode * inode, struct extent_position * epos,
1690 } 1692 }
1691 if (epos->bh) { 1693 if (epos->bh) {
1692 if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT) || 1694 if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT) ||
1693 UDF_SB_UDFREV(inode->i_sb) >= 0x0201) 1695 UDF_SB(inode->i_sb)->s_udfrev >= 0x0201)
1694 udf_update_tag(epos->bh->b_data, loffset); 1696 udf_update_tag(epos->bh->b_data, loffset);
1695 else 1697 else
1696 udf_update_tag(epos->bh->b_data, sizeof(struct allocExtDesc)); 1698 udf_update_tag(epos->bh->b_data, sizeof(struct allocExtDesc));
@@ -1711,7 +1713,7 @@ int8_t udf_add_aext(struct inode * inode, struct extent_position * epos,
1711 aed = (struct allocExtDesc *)epos->bh->b_data; 1713 aed = (struct allocExtDesc *)epos->bh->b_data;
1712 aed->lengthAllocDescs = 1714 aed->lengthAllocDescs =
1713 cpu_to_le32(le32_to_cpu(aed->lengthAllocDescs) + adsize); 1715 cpu_to_le32(le32_to_cpu(aed->lengthAllocDescs) + adsize);
1714 if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT) || UDF_SB_UDFREV(inode->i_sb) >= 0x0201) 1716 if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT) || UDF_SB(inode->i_sb)->s_udfrev >= 0x0201)
1715 udf_update_tag(epos->bh->b_data, epos->offset + (inc ? 0 : adsize)); 1717 udf_update_tag(epos->bh->b_data, epos->offset + (inc ? 0 : adsize));
1716 else 1718 else
1717 udf_update_tag(epos->bh->b_data, sizeof(struct allocExtDesc)); 1719 udf_update_tag(epos->bh->b_data, sizeof(struct allocExtDesc));
@@ -1754,7 +1756,7 @@ int8_t udf_write_aext(struct inode * inode, struct extent_position * epos,
1754 1756
1755 if (epos->bh) { 1757 if (epos->bh) {
1756 if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT) || 1758 if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT) ||
1757 UDF_SB_UDFREV(inode->i_sb) >= 0x0201) { 1759 UDF_SB(inode->i_sb)->s_udfrev >= 0x0201) {
1758 struct allocExtDesc *aed = (struct allocExtDesc *)epos->bh->b_data; 1760 struct allocExtDesc *aed = (struct allocExtDesc *)epos->bh->b_data;
1759 udf_update_tag(epos->bh->b_data, 1761 udf_update_tag(epos->bh->b_data,
1760 le32_to_cpu(aed->lengthAllocDescs) + sizeof(struct allocExtDesc)); 1762 le32_to_cpu(aed->lengthAllocDescs) + sizeof(struct allocExtDesc));
@@ -1907,7 +1909,7 @@ int8_t udf_delete_aext(struct inode * inode, struct extent_position epos,
1907 aed->lengthAllocDescs = 1909 aed->lengthAllocDescs =
1908 cpu_to_le32(le32_to_cpu(aed->lengthAllocDescs) - (2 * adsize)); 1910 cpu_to_le32(le32_to_cpu(aed->lengthAllocDescs) - (2 * adsize));
1909 if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT) || 1911 if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT) ||
1910 UDF_SB_UDFREV(inode->i_sb) >= 0x0201) 1912 UDF_SB(inode->i_sb)->s_udfrev >= 0x0201)
1911 udf_update_tag(oepos.bh->b_data, oepos.offset - (2 * adsize)); 1913 udf_update_tag(oepos.bh->b_data, oepos.offset - (2 * adsize));
1912 else 1914 else
1913 udf_update_tag(oepos.bh->b_data, sizeof(struct allocExtDesc)); 1915 udf_update_tag(oepos.bh->b_data, sizeof(struct allocExtDesc));
@@ -1923,7 +1925,7 @@ int8_t udf_delete_aext(struct inode * inode, struct extent_position epos,
1923 aed->lengthAllocDescs = 1925 aed->lengthAllocDescs =
1924 cpu_to_le32(le32_to_cpu(aed->lengthAllocDescs) - adsize); 1926 cpu_to_le32(le32_to_cpu(aed->lengthAllocDescs) - adsize);
1925 if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT) || 1927 if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT) ||
1926 UDF_SB_UDFREV(inode->i_sb) >= 0x0201) 1928 UDF_SB(inode->i_sb)->s_udfrev >= 0x0201)
1927 udf_update_tag(oepos.bh->b_data, epos.offset - adsize); 1929 udf_update_tag(oepos.bh->b_data, epos.offset - adsize);
1928 else 1930 else
1929 udf_update_tag(oepos.bh->b_data, sizeof(struct allocExtDesc)); 1931 udf_update_tag(oepos.bh->b_data, sizeof(struct allocExtDesc));