diff options
Diffstat (limited to 'fs/udf/inode.c')
| -rw-r--r-- | fs/udf/inode.c | 208 |
1 files changed, 60 insertions, 148 deletions
diff --git a/fs/udf/inode.c b/fs/udf/inode.c index 24cfa55d0fdc..6e74b117aaf0 100644 --- a/fs/udf/inode.c +++ b/fs/udf/inode.c | |||
| @@ -37,6 +37,7 @@ | |||
| 37 | #include <linux/buffer_head.h> | 37 | #include <linux/buffer_head.h> |
| 38 | #include <linux/writeback.h> | 38 | #include <linux/writeback.h> |
| 39 | #include <linux/slab.h> | 39 | #include <linux/slab.h> |
| 40 | #include <linux/crc-itu-t.h> | ||
| 40 | 41 | ||
| 41 | #include "udf_i.h" | 42 | #include "udf_i.h" |
| 42 | #include "udf_sb.h" | 43 | #include "udf_sb.h" |
| @@ -66,22 +67,7 @@ static void udf_update_extents(struct inode *, | |||
| 66 | struct extent_position *); | 67 | struct extent_position *); |
| 67 | static int udf_get_block(struct inode *, sector_t, struct buffer_head *, int); | 68 | static int udf_get_block(struct inode *, sector_t, struct buffer_head *, int); |
| 68 | 69 | ||
| 69 | /* | 70 | |
| 70 | * udf_delete_inode | ||
| 71 | * | ||
| 72 | * PURPOSE | ||
| 73 | * Clean-up before the specified inode is destroyed. | ||
| 74 | * | ||
| 75 | * DESCRIPTION | ||
| 76 | * This routine is called when the kernel destroys an inode structure | ||
| 77 | * ie. when iput() finds i_count == 0. | ||
| 78 | * | ||
| 79 | * HISTORY | ||
| 80 | * July 1, 1997 - Andrew E. Mileski | ||
| 81 | * Written, tested, and released. | ||
| 82 | * | ||
| 83 | * Called at the last iput() if i_nlink is zero. | ||
| 84 | */ | ||
| 85 | void udf_delete_inode(struct inode *inode) | 71 | void udf_delete_inode(struct inode *inode) |
| 86 | { | 72 | { |
| 87 | truncate_inode_pages(&inode->i_data, 0); | 73 | truncate_inode_pages(&inode->i_data, 0); |
| @@ -323,9 +309,6 @@ static int udf_get_block(struct inode *inode, sector_t block, | |||
| 323 | 309 | ||
| 324 | lock_kernel(); | 310 | lock_kernel(); |
| 325 | 311 | ||
| 326 | if (block < 0) | ||
| 327 | goto abort_negative; | ||
| 328 | |||
| 329 | iinfo = UDF_I(inode); | 312 | iinfo = UDF_I(inode); |
| 330 | if (block == iinfo->i_next_alloc_block + 1) { | 313 | if (block == iinfo->i_next_alloc_block + 1) { |
| 331 | iinfo->i_next_alloc_block++; | 314 | iinfo->i_next_alloc_block++; |
| @@ -347,10 +330,6 @@ static int udf_get_block(struct inode *inode, sector_t block, | |||
| 347 | abort: | 330 | abort: |
| 348 | unlock_kernel(); | 331 | unlock_kernel(); |
| 349 | return err; | 332 | return err; |
| 350 | |||
| 351 | abort_negative: | ||
| 352 | udf_warning(inode->i_sb, "udf_get_block", "block < 0"); | ||
| 353 | goto abort; | ||
| 354 | } | 333 | } |
| 355 | 334 | ||
| 356 | static struct buffer_head *udf_getblk(struct inode *inode, long block, | 335 | static struct buffer_head *udf_getblk(struct inode *inode, long block, |
| @@ -1116,42 +1095,36 @@ static void __udf_read_inode(struct inode *inode) | |||
| 1116 | fe = (struct fileEntry *)bh->b_data; | 1095 | fe = (struct fileEntry *)bh->b_data; |
| 1117 | 1096 | ||
| 1118 | if (fe->icbTag.strategyType == cpu_to_le16(4096)) { | 1097 | if (fe->icbTag.strategyType == cpu_to_le16(4096)) { |
| 1119 | struct buffer_head *ibh = NULL, *nbh = NULL; | 1098 | struct buffer_head *ibh; |
| 1120 | struct indirectEntry *ie; | ||
| 1121 | 1099 | ||
| 1122 | ibh = udf_read_ptagged(inode->i_sb, iinfo->i_location, 1, | 1100 | ibh = udf_read_ptagged(inode->i_sb, iinfo->i_location, 1, |
| 1123 | &ident); | 1101 | &ident); |
| 1124 | if (ident == TAG_IDENT_IE) { | 1102 | if (ident == TAG_IDENT_IE && ibh) { |
| 1125 | if (ibh) { | 1103 | struct buffer_head *nbh = NULL; |
| 1126 | kernel_lb_addr loc; | 1104 | kernel_lb_addr loc; |
| 1127 | ie = (struct indirectEntry *)ibh->b_data; | 1105 | struct indirectEntry *ie; |
| 1128 | 1106 | ||
| 1129 | loc = lelb_to_cpu(ie->indirectICB.extLocation); | 1107 | ie = (struct indirectEntry *)ibh->b_data; |
| 1130 | 1108 | loc = lelb_to_cpu(ie->indirectICB.extLocation); | |
| 1131 | if (ie->indirectICB.extLength && | 1109 | |
| 1132 | (nbh = udf_read_ptagged(inode->i_sb, loc, 0, | 1110 | if (ie->indirectICB.extLength && |
| 1133 | &ident))) { | 1111 | (nbh = udf_read_ptagged(inode->i_sb, loc, 0, |
| 1134 | if (ident == TAG_IDENT_FE || | 1112 | &ident))) { |
| 1135 | ident == TAG_IDENT_EFE) { | 1113 | if (ident == TAG_IDENT_FE || |
| 1136 | memcpy(&iinfo->i_location, | 1114 | ident == TAG_IDENT_EFE) { |
| 1137 | &loc, | 1115 | memcpy(&iinfo->i_location, |
| 1138 | sizeof(kernel_lb_addr)); | 1116 | &loc, |
| 1139 | brelse(bh); | 1117 | sizeof(kernel_lb_addr)); |
| 1140 | brelse(ibh); | 1118 | brelse(bh); |
| 1141 | brelse(nbh); | ||
| 1142 | __udf_read_inode(inode); | ||
| 1143 | return; | ||
| 1144 | } else { | ||
| 1145 | brelse(nbh); | ||
| 1146 | brelse(ibh); | ||
| 1147 | } | ||
| 1148 | } else { | ||
| 1149 | brelse(ibh); | 1119 | brelse(ibh); |
| 1120 | brelse(nbh); | ||
| 1121 | __udf_read_inode(inode); | ||
| 1122 | return; | ||
| 1150 | } | 1123 | } |
| 1124 | brelse(nbh); | ||
| 1151 | } | 1125 | } |
| 1152 | } else { | ||
| 1153 | brelse(ibh); | ||
| 1154 | } | 1126 | } |
| 1127 | brelse(ibh); | ||
| 1155 | } else if (fe->icbTag.strategyType != cpu_to_le16(4)) { | 1128 | } else if (fe->icbTag.strategyType != cpu_to_le16(4)) { |
| 1156 | printk(KERN_ERR "udf: unsupported strategy type: %d\n", | 1129 | printk(KERN_ERR "udf: unsupported strategy type: %d\n", |
| 1157 | le16_to_cpu(fe->icbTag.strategyType)); | 1130 | le16_to_cpu(fe->icbTag.strategyType)); |
| @@ -1168,8 +1141,6 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh) | |||
| 1168 | { | 1141 | { |
| 1169 | struct fileEntry *fe; | 1142 | struct fileEntry *fe; |
| 1170 | struct extendedFileEntry *efe; | 1143 | struct extendedFileEntry *efe; |
| 1171 | time_t convtime; | ||
| 1172 | long convtime_usec; | ||
| 1173 | int offset; | 1144 | int offset; |
| 1174 | struct udf_sb_info *sbi = UDF_SB(inode->i_sb); | 1145 | struct udf_sb_info *sbi = UDF_SB(inode->i_sb); |
| 1175 | struct udf_inode_info *iinfo = UDF_I(inode); | 1146 | struct udf_inode_info *iinfo = UDF_I(inode); |
| @@ -1257,29 +1228,15 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh) | |||
| 1257 | inode->i_blocks = le64_to_cpu(fe->logicalBlocksRecorded) << | 1228 | inode->i_blocks = le64_to_cpu(fe->logicalBlocksRecorded) << |
| 1258 | (inode->i_sb->s_blocksize_bits - 9); | 1229 | (inode->i_sb->s_blocksize_bits - 9); |
| 1259 | 1230 | ||
| 1260 | if (udf_stamp_to_time(&convtime, &convtime_usec, | 1231 | if (!udf_disk_stamp_to_time(&inode->i_atime, fe->accessTime)) |
| 1261 | lets_to_cpu(fe->accessTime))) { | ||
| 1262 | inode->i_atime.tv_sec = convtime; | ||
| 1263 | inode->i_atime.tv_nsec = convtime_usec * 1000; | ||
| 1264 | } else { | ||
| 1265 | inode->i_atime = sbi->s_record_time; | 1232 | inode->i_atime = sbi->s_record_time; |
| 1266 | } | ||
| 1267 | 1233 | ||
| 1268 | if (udf_stamp_to_time(&convtime, &convtime_usec, | 1234 | if (!udf_disk_stamp_to_time(&inode->i_mtime, |
| 1269 | lets_to_cpu(fe->modificationTime))) { | 1235 | fe->modificationTime)) |
| 1270 | inode->i_mtime.tv_sec = convtime; | ||
| 1271 | inode->i_mtime.tv_nsec = convtime_usec * 1000; | ||
| 1272 | } else { | ||
| 1273 | inode->i_mtime = sbi->s_record_time; | 1236 | inode->i_mtime = sbi->s_record_time; |
| 1274 | } | ||
| 1275 | 1237 | ||
| 1276 | if (udf_stamp_to_time(&convtime, &convtime_usec, | 1238 | if (!udf_disk_stamp_to_time(&inode->i_ctime, fe->attrTime)) |
| 1277 | lets_to_cpu(fe->attrTime))) { | ||
| 1278 | inode->i_ctime.tv_sec = convtime; | ||
| 1279 | inode->i_ctime.tv_nsec = convtime_usec * 1000; | ||
| 1280 | } else { | ||
| 1281 | inode->i_ctime = sbi->s_record_time; | 1239 | inode->i_ctime = sbi->s_record_time; |
| 1282 | } | ||
| 1283 | 1240 | ||
| 1284 | iinfo->i_unique = le64_to_cpu(fe->uniqueID); | 1241 | iinfo->i_unique = le64_to_cpu(fe->uniqueID); |
| 1285 | iinfo->i_lenEAttr = le32_to_cpu(fe->lengthExtendedAttr); | 1242 | iinfo->i_lenEAttr = le32_to_cpu(fe->lengthExtendedAttr); |
| @@ -1289,37 +1246,18 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh) | |||
| 1289 | inode->i_blocks = le64_to_cpu(efe->logicalBlocksRecorded) << | 1246 | inode->i_blocks = le64_to_cpu(efe->logicalBlocksRecorded) << |
| 1290 | (inode->i_sb->s_blocksize_bits - 9); | 1247 | (inode->i_sb->s_blocksize_bits - 9); |
| 1291 | 1248 | ||
| 1292 | if (udf_stamp_to_time(&convtime, &convtime_usec, | 1249 | if (!udf_disk_stamp_to_time(&inode->i_atime, efe->accessTime)) |
| 1293 | lets_to_cpu(efe->accessTime))) { | ||
| 1294 | inode->i_atime.tv_sec = convtime; | ||
| 1295 | inode->i_atime.tv_nsec = convtime_usec * 1000; | ||
| 1296 | } else { | ||
| 1297 | inode->i_atime = sbi->s_record_time; | 1250 | inode->i_atime = sbi->s_record_time; |
| 1298 | } | ||
| 1299 | 1251 | ||
| 1300 | if (udf_stamp_to_time(&convtime, &convtime_usec, | 1252 | if (!udf_disk_stamp_to_time(&inode->i_mtime, |
| 1301 | lets_to_cpu(efe->modificationTime))) { | 1253 | efe->modificationTime)) |
| 1302 | inode->i_mtime.tv_sec = convtime; | ||
| 1303 | inode->i_mtime.tv_nsec = convtime_usec * 1000; | ||
| 1304 | } else { | ||
| 1305 | inode->i_mtime = sbi->s_record_time; | 1254 | inode->i_mtime = sbi->s_record_time; |
| 1306 | } | ||
| 1307 | 1255 | ||
| 1308 | if (udf_stamp_to_time(&convtime, &convtime_usec, | 1256 | if (!udf_disk_stamp_to_time(&iinfo->i_crtime, efe->createTime)) |
| 1309 | lets_to_cpu(efe->createTime))) { | ||
| 1310 | iinfo->i_crtime.tv_sec = convtime; | ||
| 1311 | iinfo->i_crtime.tv_nsec = convtime_usec * 1000; | ||
| 1312 | } else { | ||
| 1313 | iinfo->i_crtime = sbi->s_record_time; | 1257 | iinfo->i_crtime = sbi->s_record_time; |
| 1314 | } | ||
| 1315 | 1258 | ||
| 1316 | if (udf_stamp_to_time(&convtime, &convtime_usec, | 1259 | if (!udf_disk_stamp_to_time(&inode->i_ctime, efe->attrTime)) |
| 1317 | lets_to_cpu(efe->attrTime))) { | ||
| 1318 | inode->i_ctime.tv_sec = convtime; | ||
| 1319 | inode->i_ctime.tv_nsec = convtime_usec * 1000; | ||
| 1320 | } else { | ||
| 1321 | inode->i_ctime = sbi->s_record_time; | 1260 | inode->i_ctime = sbi->s_record_time; |
| 1322 | } | ||
| 1323 | 1261 | ||
| 1324 | iinfo->i_unique = le64_to_cpu(efe->uniqueID); | 1262 | iinfo->i_unique = le64_to_cpu(efe->uniqueID); |
| 1325 | iinfo->i_lenEAttr = le32_to_cpu(efe->lengthExtendedAttr); | 1263 | iinfo->i_lenEAttr = le32_to_cpu(efe->lengthExtendedAttr); |
| @@ -1338,6 +1276,7 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh) | |||
| 1338 | case ICBTAG_FILE_TYPE_REALTIME: | 1276 | case ICBTAG_FILE_TYPE_REALTIME: |
| 1339 | case ICBTAG_FILE_TYPE_REGULAR: | 1277 | case ICBTAG_FILE_TYPE_REGULAR: |
| 1340 | case ICBTAG_FILE_TYPE_UNDEF: | 1278 | case ICBTAG_FILE_TYPE_UNDEF: |
| 1279 | case ICBTAG_FILE_TYPE_VAT20: | ||
| 1341 | if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) | 1280 | if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) |
| 1342 | inode->i_data.a_ops = &udf_adinicb_aops; | 1281 | inode->i_data.a_ops = &udf_adinicb_aops; |
| 1343 | else | 1282 | else |
| @@ -1363,6 +1302,15 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh) | |||
| 1363 | inode->i_op = &page_symlink_inode_operations; | 1302 | inode->i_op = &page_symlink_inode_operations; |
| 1364 | inode->i_mode = S_IFLNK | S_IRWXUGO; | 1303 | inode->i_mode = S_IFLNK | S_IRWXUGO; |
| 1365 | break; | 1304 | break; |
| 1305 | case ICBTAG_FILE_TYPE_MAIN: | ||
| 1306 | udf_debug("METADATA FILE-----\n"); | ||
| 1307 | break; | ||
| 1308 | case ICBTAG_FILE_TYPE_MIRROR: | ||
| 1309 | udf_debug("METADATA MIRROR FILE-----\n"); | ||
| 1310 | break; | ||
| 1311 | case ICBTAG_FILE_TYPE_BITMAP: | ||
| 1312 | udf_debug("METADATA BITMAP FILE-----\n"); | ||
| 1313 | break; | ||
| 1366 | default: | 1314 | default: |
| 1367 | printk(KERN_ERR "udf: udf_fill_inode(ino %ld) failed unknown " | 1315 | printk(KERN_ERR "udf: udf_fill_inode(ino %ld) failed unknown " |
| 1368 | "file type=%d\n", inode->i_ino, | 1316 | "file type=%d\n", inode->i_ino, |
| @@ -1416,21 +1364,6 @@ static mode_t udf_convert_permissions(struct fileEntry *fe) | |||
| 1416 | return mode; | 1364 | return mode; |
| 1417 | } | 1365 | } |
| 1418 | 1366 | ||
| 1419 | /* | ||
| 1420 | * udf_write_inode | ||
| 1421 | * | ||
| 1422 | * PURPOSE | ||
| 1423 | * Write out the specified inode. | ||
| 1424 | * | ||
| 1425 | * DESCRIPTION | ||
| 1426 | * This routine is called whenever an inode is synced. | ||
| 1427 | * Currently this routine is just a placeholder. | ||
| 1428 | * | ||
| 1429 | * HISTORY | ||
| 1430 | * July 1, 1997 - Andrew E. Mileski | ||
| 1431 | * Written, tested, and released. | ||
| 1432 | */ | ||
| 1433 | |||
| 1434 | int udf_write_inode(struct inode *inode, int sync) | 1367 | int udf_write_inode(struct inode *inode, int sync) |
| 1435 | { | 1368 | { |
| 1436 | int ret; | 1369 | int ret; |
| @@ -1455,7 +1388,6 @@ static int udf_update_inode(struct inode *inode, int do_sync) | |||
| 1455 | uint32_t udfperms; | 1388 | uint32_t udfperms; |
| 1456 | uint16_t icbflags; | 1389 | uint16_t icbflags; |
| 1457 | uint16_t crclen; | 1390 | uint16_t crclen; |
| 1458 | kernel_timestamp cpu_time; | ||
| 1459 | int err = 0; | 1391 | int err = 0; |
| 1460 | struct udf_sb_info *sbi = UDF_SB(inode->i_sb); | 1392 | struct udf_sb_info *sbi = UDF_SB(inode->i_sb); |
| 1461 | unsigned char blocksize_bits = inode->i_sb->s_blocksize_bits; | 1393 | unsigned char blocksize_bits = inode->i_sb->s_blocksize_bits; |
| @@ -1488,9 +1420,9 @@ static int udf_update_inode(struct inode *inode, int do_sync) | |||
| 1488 | iinfo->i_location. | 1420 | iinfo->i_location. |
| 1489 | logicalBlockNum); | 1421 | logicalBlockNum); |
| 1490 | use->descTag.descCRCLength = cpu_to_le16(crclen); | 1422 | use->descTag.descCRCLength = cpu_to_le16(crclen); |
| 1491 | use->descTag.descCRC = cpu_to_le16(udf_crc((char *)use + | 1423 | use->descTag.descCRC = cpu_to_le16(crc_itu_t(0, (char *)use + |
| 1492 | sizeof(tag), crclen, | 1424 | sizeof(tag), |
| 1493 | 0)); | 1425 | crclen)); |
| 1494 | use->descTag.tagChecksum = udf_tag_checksum(&use->descTag); | 1426 | use->descTag.tagChecksum = udf_tag_checksum(&use->descTag); |
| 1495 | 1427 | ||
| 1496 | mark_buffer_dirty(bh); | 1428 | mark_buffer_dirty(bh); |
| @@ -1558,12 +1490,9 @@ static int udf_update_inode(struct inode *inode, int do_sync) | |||
| 1558 | (inode->i_blocks + (1 << (blocksize_bits - 9)) - 1) >> | 1490 | (inode->i_blocks + (1 << (blocksize_bits - 9)) - 1) >> |
| 1559 | (blocksize_bits - 9)); | 1491 | (blocksize_bits - 9)); |
| 1560 | 1492 | ||
| 1561 | if (udf_time_to_stamp(&cpu_time, inode->i_atime)) | 1493 | udf_time_to_disk_stamp(&fe->accessTime, inode->i_atime); |
| 1562 | fe->accessTime = cpu_to_lets(cpu_time); | 1494 | udf_time_to_disk_stamp(&fe->modificationTime, inode->i_mtime); |
| 1563 | if (udf_time_to_stamp(&cpu_time, inode->i_mtime)) | 1495 | udf_time_to_disk_stamp(&fe->attrTime, inode->i_ctime); |
| 1564 | fe->modificationTime = cpu_to_lets(cpu_time); | ||
| 1565 | if (udf_time_to_stamp(&cpu_time, inode->i_ctime)) | ||
| 1566 | fe->attrTime = cpu_to_lets(cpu_time); | ||
| 1567 | memset(&(fe->impIdent), 0, sizeof(regid)); | 1496 | memset(&(fe->impIdent), 0, sizeof(regid)); |
| 1568 | strcpy(fe->impIdent.ident, UDF_ID_DEVELOPER); | 1497 | strcpy(fe->impIdent.ident, UDF_ID_DEVELOPER); |
| 1569 | fe->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX; | 1498 | fe->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX; |
| @@ -1598,14 +1527,10 @@ static int udf_update_inode(struct inode *inode, int do_sync) | |||
| 1598 | iinfo->i_crtime.tv_nsec > inode->i_ctime.tv_nsec)) | 1527 | iinfo->i_crtime.tv_nsec > inode->i_ctime.tv_nsec)) |
| 1599 | iinfo->i_crtime = inode->i_ctime; | 1528 | iinfo->i_crtime = inode->i_ctime; |
| 1600 | 1529 | ||
| 1601 | if (udf_time_to_stamp(&cpu_time, inode->i_atime)) | 1530 | udf_time_to_disk_stamp(&efe->accessTime, inode->i_atime); |
| 1602 | efe->accessTime = cpu_to_lets(cpu_time); | 1531 | udf_time_to_disk_stamp(&efe->modificationTime, inode->i_mtime); |
| 1603 | if (udf_time_to_stamp(&cpu_time, inode->i_mtime)) | 1532 | udf_time_to_disk_stamp(&efe->createTime, iinfo->i_crtime); |
| 1604 | efe->modificationTime = cpu_to_lets(cpu_time); | 1533 | udf_time_to_disk_stamp(&efe->attrTime, inode->i_ctime); |
| 1605 | if (udf_time_to_stamp(&cpu_time, iinfo->i_crtime)) | ||
| 1606 | efe->createTime = cpu_to_lets(cpu_time); | ||
| 1607 | if (udf_time_to_stamp(&cpu_time, inode->i_ctime)) | ||
| 1608 | efe->attrTime = cpu_to_lets(cpu_time); | ||
| 1609 | 1534 | ||
| 1610 | memset(&(efe->impIdent), 0, sizeof(regid)); | 1535 | memset(&(efe->impIdent), 0, sizeof(regid)); |
| 1611 | strcpy(efe->impIdent.ident, UDF_ID_DEVELOPER); | 1536 | strcpy(efe->impIdent.ident, UDF_ID_DEVELOPER); |
| @@ -1660,8 +1585,8 @@ static int udf_update_inode(struct inode *inode, int do_sync) | |||
| 1660 | crclen += iinfo->i_lenEAttr + iinfo->i_lenAlloc - | 1585 | crclen += iinfo->i_lenEAttr + iinfo->i_lenAlloc - |
| 1661 | sizeof(tag); | 1586 | sizeof(tag); |
| 1662 | fe->descTag.descCRCLength = cpu_to_le16(crclen); | 1587 | fe->descTag.descCRCLength = cpu_to_le16(crclen); |
| 1663 | fe->descTag.descCRC = cpu_to_le16(udf_crc((char *)fe + sizeof(tag), | 1588 | fe->descTag.descCRC = cpu_to_le16(crc_itu_t(0, (char *)fe + sizeof(tag), |
| 1664 | crclen, 0)); | 1589 | crclen)); |
| 1665 | fe->descTag.tagChecksum = udf_tag_checksum(&fe->descTag); | 1590 | fe->descTag.tagChecksum = udf_tag_checksum(&fe->descTag); |
| 1666 | 1591 | ||
| 1667 | /* write the data blocks */ | 1592 | /* write the data blocks */ |
| @@ -1778,9 +1703,7 @@ int8_t udf_add_aext(struct inode *inode, struct extent_position *epos, | |||
| 1778 | 1703 | ||
| 1779 | if (epos->bh) { | 1704 | if (epos->bh) { |
| 1780 | aed = (struct allocExtDesc *)epos->bh->b_data; | 1705 | aed = (struct allocExtDesc *)epos->bh->b_data; |
| 1781 | aed->lengthAllocDescs = | 1706 | le32_add_cpu(&aed->lengthAllocDescs, adsize); |
| 1782 | cpu_to_le32(le32_to_cpu( | ||
| 1783 | aed->lengthAllocDescs) + adsize); | ||
| 1784 | } else { | 1707 | } else { |
| 1785 | iinfo->i_lenAlloc += adsize; | 1708 | iinfo->i_lenAlloc += adsize; |
| 1786 | mark_inode_dirty(inode); | 1709 | mark_inode_dirty(inode); |
| @@ -1830,9 +1753,7 @@ int8_t udf_add_aext(struct inode *inode, struct extent_position *epos, | |||
| 1830 | mark_inode_dirty(inode); | 1753 | mark_inode_dirty(inode); |
| 1831 | } else { | 1754 | } else { |
| 1832 | aed = (struct allocExtDesc *)epos->bh->b_data; | 1755 | aed = (struct allocExtDesc *)epos->bh->b_data; |
| 1833 | aed->lengthAllocDescs = | 1756 | le32_add_cpu(&aed->lengthAllocDescs, adsize); |
| 1834 | cpu_to_le32(le32_to_cpu(aed->lengthAllocDescs) + | ||
| 1835 | adsize); | ||
| 1836 | if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT) || | 1757 | if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT) || |
| 1837 | UDF_SB(inode->i_sb)->s_udfrev >= 0x0201) | 1758 | UDF_SB(inode->i_sb)->s_udfrev >= 0x0201) |
| 1838 | udf_update_tag(epos->bh->b_data, | 1759 | udf_update_tag(epos->bh->b_data, |
| @@ -2046,9 +1967,7 @@ int8_t udf_delete_aext(struct inode *inode, struct extent_position epos, | |||
| 2046 | mark_inode_dirty(inode); | 1967 | mark_inode_dirty(inode); |
| 2047 | } else { | 1968 | } else { |
| 2048 | aed = (struct allocExtDesc *)oepos.bh->b_data; | 1969 | aed = (struct allocExtDesc *)oepos.bh->b_data; |
| 2049 | aed->lengthAllocDescs = | 1970 | le32_add_cpu(&aed->lengthAllocDescs, -(2 * adsize)); |
| 2050 | cpu_to_le32(le32_to_cpu(aed->lengthAllocDescs) - | ||
| 2051 | (2 * adsize)); | ||
| 2052 | if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT) || | 1971 | if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT) || |
| 2053 | UDF_SB(inode->i_sb)->s_udfrev >= 0x0201) | 1972 | UDF_SB(inode->i_sb)->s_udfrev >= 0x0201) |
| 2054 | udf_update_tag(oepos.bh->b_data, | 1973 | udf_update_tag(oepos.bh->b_data, |
| @@ -2065,9 +1984,7 @@ int8_t udf_delete_aext(struct inode *inode, struct extent_position epos, | |||
| 2065 | mark_inode_dirty(inode); | 1984 | mark_inode_dirty(inode); |
| 2066 | } else { | 1985 | } else { |
| 2067 | aed = (struct allocExtDesc *)oepos.bh->b_data; | 1986 | aed = (struct allocExtDesc *)oepos.bh->b_data; |
| 2068 | aed->lengthAllocDescs = | 1987 | le32_add_cpu(&aed->lengthAllocDescs, -adsize); |
| 2069 | cpu_to_le32(le32_to_cpu(aed->lengthAllocDescs) - | ||
| 2070 | adsize); | ||
| 2071 | if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT) || | 1988 | if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT) || |
| 2072 | UDF_SB(inode->i_sb)->s_udfrev >= 0x0201) | 1989 | UDF_SB(inode->i_sb)->s_udfrev >= 0x0201) |
| 2073 | udf_update_tag(oepos.bh->b_data, | 1990 | udf_update_tag(oepos.bh->b_data, |
| @@ -2095,11 +2012,6 @@ int8_t inode_bmap(struct inode *inode, sector_t block, | |||
| 2095 | int8_t etype; | 2012 | int8_t etype; |
| 2096 | struct udf_inode_info *iinfo; | 2013 | struct udf_inode_info *iinfo; |
| 2097 | 2014 | ||
| 2098 | if (block < 0) { | ||
| 2099 | printk(KERN_ERR "udf: inode_bmap: block < 0\n"); | ||
| 2100 | return -1; | ||
| 2101 | } | ||
| 2102 | |||
| 2103 | iinfo = UDF_I(inode); | 2015 | iinfo = UDF_I(inode); |
| 2104 | pos->offset = 0; | 2016 | pos->offset = 0; |
| 2105 | pos->block = iinfo->i_location; | 2017 | pos->block = iinfo->i_location; |
