• Home
  • Raw
  • Download

Lines Matching refs:inode

52 static int udf_update_inode(struct inode *, int);
53 static void udf_fill_inode(struct inode *, struct buffer_head *);
54 static int udf_alloc_i_data(struct inode *inode, size_t size);
55 static struct buffer_head *inode_getblk(struct inode *, sector_t, int *,
57 static int8_t udf_insert_aext(struct inode *, struct extent_position,
59 static void udf_split_extents(struct inode *, int *, int, int,
61 static void udf_prealloc_extents(struct inode *, int, int,
63 static void udf_merge_extents(struct inode *,
65 static void udf_update_extents(struct inode *,
68 static int udf_get_block(struct inode *, sector_t, struct buffer_head *, int);
71 void udf_delete_inode(struct inode *inode) in udf_delete_inode() argument
73 truncate_inode_pages(&inode->i_data, 0); in udf_delete_inode()
75 if (is_bad_inode(inode)) in udf_delete_inode()
78 inode->i_size = 0; in udf_delete_inode()
79 udf_truncate(inode); in udf_delete_inode()
82 udf_update_inode(inode, IS_SYNC(inode)); in udf_delete_inode()
83 udf_free_inode(inode); in udf_delete_inode()
89 clear_inode(inode); in udf_delete_inode()
99 void udf_clear_inode(struct inode *inode) in udf_clear_inode() argument
102 if (!(inode->i_sb->s_flags & MS_RDONLY)) { in udf_clear_inode()
105 udf_discard_prealloc(inode); in udf_clear_inode()
106 udf_truncate_tail_extent(inode); in udf_clear_inode()
108 write_inode_now(inode, 0); in udf_clear_inode()
109 invalidate_inode_buffers(inode); in udf_clear_inode()
111 iinfo = UDF_I(inode); in udf_clear_inode()
149 void udf_expand_file_adinicb(struct inode *inode, int newsize, int *err) in udf_expand_file_adinicb() argument
153 struct udf_inode_info *iinfo = UDF_I(inode); in udf_expand_file_adinicb()
160 inode->i_data.a_ops = &udf_aops; in udf_expand_file_adinicb()
163 if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD)) in udf_expand_file_adinicb()
167 mark_inode_dirty(inode); in udf_expand_file_adinicb()
171 page = grab_cache_page(inode->i_mapping, 0); in udf_expand_file_adinicb()
187 if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD)) in udf_expand_file_adinicb()
192 inode->i_data.a_ops->writepage(page, &udf_wbc); in udf_expand_file_adinicb()
195 mark_inode_dirty(inode); in udf_expand_file_adinicb()
198 struct buffer_head *udf_expand_dir_adinicb(struct inode *inode, int *block, in udf_expand_dir_adinicb() argument
209 loff_t f_pos = udf_ext0_offset(inode); in udf_expand_dir_adinicb()
210 int size = udf_ext0_offset(inode) + inode->i_size; in udf_expand_dir_adinicb()
212 struct udf_inode_info *iinfo = UDF_I(inode); in udf_expand_dir_adinicb()
214 if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD)) in udf_expand_dir_adinicb()
219 if (!inode->i_size) { in udf_expand_dir_adinicb()
221 mark_inode_dirty(inode); in udf_expand_dir_adinicb()
226 *block = udf_new_block(inode->i_sb, inode, in udf_expand_dir_adinicb()
231 newblock = udf_get_pblock(inode->i_sb, *block, in udf_expand_dir_adinicb()
236 dbh = udf_tgetblk(inode->i_sb, newblock); in udf_expand_dir_adinicb()
240 memset(dbh->b_data, 0x00, inode->i_sb->s_blocksize); in udf_expand_dir_adinicb()
243 mark_buffer_dirty_inode(dbh, inode); in udf_expand_dir_adinicb()
246 f_pos & (inode->i_sb->s_blocksize - 1); in udf_expand_dir_adinicb()
252 sfi = udf_fileident_read(inode, &f_pos, &sfibh, &cfi, NULL, in udf_expand_dir_adinicb()
263 if (udf_write_fi(inode, sfi, dfi, &dfibh, sfi->impUse, in udf_expand_dir_adinicb()
271 mark_buffer_dirty_inode(dbh, inode); in udf_expand_dir_adinicb()
279 elen = inode->i_sb->s_blocksize; in udf_expand_dir_adinicb()
283 epos.offset = udf_file_entry_alloc_offset(inode); in udf_expand_dir_adinicb()
284 udf_add_aext(inode, &epos, eloc, elen, 0); in udf_expand_dir_adinicb()
288 mark_inode_dirty(inode); in udf_expand_dir_adinicb()
292 static int udf_get_block(struct inode *inode, sector_t block, in udf_get_block() argument
301 phys = udf_block_map(inode, block); in udf_get_block()
303 map_bh(bh_result, inode->i_sb, phys); in udf_get_block()
313 iinfo = UDF_I(inode); in udf_get_block()
321 bh = inode_getblk(inode, block, &err, &phys, &new); in udf_get_block()
329 map_bh(bh_result, inode->i_sb, phys); in udf_get_block()
336 static struct buffer_head *udf_getblk(struct inode *inode, long block, in udf_getblk() argument
344 *err = udf_get_block(inode, block, &dummy, create); in udf_getblk()
346 bh = sb_getblk(inode->i_sb, dummy.b_blocknr); in udf_getblk()
349 memset(bh->b_data, 0x00, inode->i_sb->s_blocksize); in udf_getblk()
352 mark_buffer_dirty_inode(bh, inode); in udf_getblk()
361 int udf_extend_file(struct inode *inode, struct extent_position *last_pos, in udf_extend_file() argument
366 struct super_block *sb = inode->i_sb; in udf_extend_file()
376 iinfo = UDF_I(inode); in udf_extend_file()
414 udf_add_aext(inode, last_pos, last_ext->extLocation, in udf_extend_file()
418 udf_write_aext(inode, last_pos, last_ext->extLocation, in udf_extend_file()
435 if (udf_add_aext(inode, last_pos, last_ext->extLocation, in udf_extend_file()
443 if (udf_add_aext(inode, last_pos, last_ext->extLocation, in udf_extend_file()
452 if (udf_add_aext(inode, last_pos, prealloc_loc, in udf_extend_file()
471 static struct buffer_head *inode_getblk(struct inode *inode, sector_t block, in inode_getblk() argument
486 struct udf_inode_info *iinfo = UDF_I(inode); in inode_getblk()
490 prev_epos.offset = udf_file_entry_alloc_offset(inode); in inode_getblk()
494 b_off = (loff_t)block << inode->i_sb->s_blocksize_bits; in inode_getblk()
519 etype = udf_next_aext(inode, &next_epos, &eloc, &elen, 1); in inode_getblk()
530 ((elen + inode->i_sb->s_blocksize - 1) >> in inode_getblk()
531 inode->i_sb->s_blocksize_bits); in inode_getblk()
537 offset = b_off >> inode->i_sb->s_blocksize_bits; in inode_getblk()
542 udf_next_aext(inode, &prev_epos, &tmpeloc, &tmpelen, 0); in inode_getblk()
543 udf_next_aext(inode, &cur_epos, &tmpeloc, &tmpelen, 0); in inode_getblk()
549 if (elen & (inode->i_sb->s_blocksize - 1)) { in inode_getblk()
551 ((elen + inode->i_sb->s_blocksize - 1) & in inode_getblk()
552 ~(inode->i_sb->s_blocksize - 1)); in inode_getblk()
553 etype = udf_write_aext(inode, &cur_epos, eloc, elen, 1); in inode_getblk()
558 newblock = udf_get_lb_pblock(inode->i_sb, eloc, offset); in inode_getblk()
582 ret = udf_extend_file(inode, &prev_epos, laarr, offset); in inode_getblk()
603 inode->i_sb->s_blocksize; in inode_getblk()
625 etype = udf_next_aext(inode, &next_epos, &eloc, &elen, 0); in inode_getblk()
649 newblocknum = udf_new_block(inode->i_sb, inode, in inode_getblk()
657 iinfo->i_lenExtents += inode->i_sb->s_blocksize; in inode_getblk()
664 udf_split_extents(inode, &c, offset, newblocknum, laarr, &endnum); in inode_getblk()
668 udf_prealloc_extents(inode, c, lastblock, laarr, &endnum); in inode_getblk()
672 udf_merge_extents(inode, laarr, &endnum); in inode_getblk()
677 udf_update_extents(inode, laarr, startnum, endnum, &prev_epos); in inode_getblk()
681 newblock = udf_get_pblock(inode->i_sb, newblocknum, in inode_getblk()
690 inode->i_ctime = current_fs_time(inode->i_sb); in inode_getblk()
692 if (IS_SYNC(inode)) in inode_getblk()
693 udf_sync_inode(inode); in inode_getblk()
695 mark_inode_dirty(inode); in inode_getblk()
700 static void udf_split_extents(struct inode *inode, int *c, int offset, in udf_split_extents() argument
705 unsigned long blocksize = inode->i_sb->s_blocksize; in udf_split_extents()
706 unsigned char blocksize_bits = inode->i_sb->s_blocksize_bits; in udf_split_extents()
728 udf_free_blocks(inode->i_sb, inode, in udf_split_extents()
748 UDF_I(inode)->i_location.partitionReferenceNum; in udf_split_extents()
765 static void udf_prealloc_extents(struct inode *inode, int c, int lastblock, in udf_prealloc_extents() argument
783 inode->i_sb->s_blocksize - 1) >> in udf_prealloc_extents()
784 inode->i_sb->s_blocksize_bits); in udf_prealloc_extents()
797 inode->i_sb->s_blocksize - 1) >> in udf_prealloc_extents()
798 inode->i_sb->s_blocksize_bits); in udf_prealloc_extents()
806 inode->i_sb->s_blocksize - 1) >> in udf_prealloc_extents()
807 inode->i_sb->s_blocksize_bits); in udf_prealloc_extents()
808 int numalloc = udf_prealloc_blocks(inode->i_sb, inode, in udf_prealloc_extents()
817 inode->i_sb->s_blocksize_bits); in udf_prealloc_extents()
829 inode->i_sb->s_blocksize_bits); in udf_prealloc_extents()
836 inode->i_sb->s_blocksize - 1) >> in udf_prealloc_extents()
837 inode->i_sb->s_blocksize_bits; in udf_prealloc_extents()
842 inode->i_sb->s_blocksize_bits); in udf_prealloc_extents()
855 UDF_I(inode)->i_lenExtents += in udf_prealloc_extents()
856 numalloc << inode->i_sb->s_blocksize_bits; in udf_prealloc_extents()
861 static void udf_merge_extents(struct inode *inode, in udf_merge_extents() argument
866 unsigned long blocksize = inode->i_sb->s_blocksize; in udf_merge_extents()
867 unsigned char blocksize_bits = inode->i_sb->s_blocksize_bits; in udf_merge_extents()
914 udf_free_blocks(inode->i_sb, inode, li->extLocation, 0, in udf_merge_extents()
947 udf_free_blocks(inode->i_sb, inode, in udf_merge_extents()
961 static void udf_update_extents(struct inode *inode, in udf_update_extents() argument
972 udf_delete_aext(inode, *epos, laarr[i].extLocation, in udf_update_extents()
976 udf_insert_aext(inode, *epos, laarr[i].extLocation, in udf_update_extents()
978 udf_next_aext(inode, epos, &laarr[i].extLocation, in udf_update_extents()
985 udf_next_aext(inode, epos, &tmploc, &tmplen, 0); in udf_update_extents()
986 udf_write_aext(inode, epos, laarr[i].extLocation, in udf_update_extents()
991 struct buffer_head *udf_bread(struct inode *inode, int block, in udf_bread() argument
996 bh = udf_getblk(inode, block, create, err); in udf_bread()
1014 void udf_truncate(struct inode *inode) in udf_truncate() argument
1020 if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) || in udf_truncate()
1021 S_ISLNK(inode->i_mode))) in udf_truncate()
1023 if (IS_APPEND(inode) || IS_IMMUTABLE(inode)) in udf_truncate()
1027 iinfo = UDF_I(inode); in udf_truncate()
1029 if (inode->i_sb->s_blocksize < in udf_truncate()
1030 (udf_file_entry_alloc_offset(inode) + in udf_truncate()
1031 inode->i_size)) { in udf_truncate()
1032 udf_expand_file_adinicb(inode, inode->i_size, &err); in udf_truncate()
1034 inode->i_size = iinfo->i_lenAlloc; in udf_truncate()
1038 udf_truncate_extents(inode); in udf_truncate()
1040 offset = inode->i_size & (inode->i_sb->s_blocksize - 1); in udf_truncate()
1042 0x00, inode->i_sb->s_blocksize - in udf_truncate()
1043 offset - udf_file_entry_alloc_offset(inode)); in udf_truncate()
1044 iinfo->i_lenAlloc = inode->i_size; in udf_truncate()
1047 block_truncate_page(inode->i_mapping, inode->i_size, in udf_truncate()
1049 udf_truncate_extents(inode); in udf_truncate()
1052 inode->i_mtime = inode->i_ctime = current_fs_time(inode->i_sb); in udf_truncate()
1053 if (IS_SYNC(inode)) in udf_truncate()
1054 udf_sync_inode(inode); in udf_truncate()
1056 mark_inode_dirty(inode); in udf_truncate()
1060 static void __udf_read_inode(struct inode *inode) in __udf_read_inode() argument
1065 struct udf_inode_info *iinfo = UDF_I(inode); in __udf_read_inode()
1079 bh = udf_read_ptagged(inode->i_sb, iinfo->i_location, 0, &ident); in __udf_read_inode()
1082 inode->i_ino); in __udf_read_inode()
1083 make_bad_inode(inode); in __udf_read_inode()
1090 "failed ident=%d\n", inode->i_ino, ident); in __udf_read_inode()
1092 make_bad_inode(inode); in __udf_read_inode()
1101 ibh = udf_read_ptagged(inode->i_sb, iinfo->i_location, 1, in __udf_read_inode()
1112 (nbh = udf_read_ptagged(inode->i_sb, loc, 0, in __udf_read_inode()
1122 __udf_read_inode(inode); in __udf_read_inode()
1133 make_bad_inode(inode); in __udf_read_inode()
1136 udf_fill_inode(inode, bh); in __udf_read_inode()
1141 static void udf_fill_inode(struct inode *inode, struct buffer_head *bh) in udf_fill_inode() argument
1146 struct udf_sb_info *sbi = UDF_SB(inode->i_sb); in udf_fill_inode()
1147 struct udf_inode_info *iinfo = UDF_I(inode); in udf_fill_inode()
1168 if (udf_alloc_i_data(inode, inode->i_sb->s_blocksize - in udf_fill_inode()
1170 make_bad_inode(inode); in udf_fill_inode()
1175 inode->i_sb->s_blocksize - in udf_fill_inode()
1180 if (udf_alloc_i_data(inode, inode->i_sb->s_blocksize - in udf_fill_inode()
1182 make_bad_inode(inode); in udf_fill_inode()
1187 inode->i_sb->s_blocksize - sizeof(struct fileEntry)); in udf_fill_inode()
1194 if (udf_alloc_i_data(inode, inode->i_sb->s_blocksize - in udf_fill_inode()
1196 make_bad_inode(inode); in udf_fill_inode()
1201 inode->i_sb->s_blocksize - in udf_fill_inode()
1206 inode->i_uid = le32_to_cpu(fe->uid); in udf_fill_inode()
1207 if (inode->i_uid == -1 || in udf_fill_inode()
1208 UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_UID_IGNORE) || in udf_fill_inode()
1209 UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_UID_SET)) in udf_fill_inode()
1210 inode->i_uid = UDF_SB(inode->i_sb)->s_uid; in udf_fill_inode()
1212 inode->i_gid = le32_to_cpu(fe->gid); in udf_fill_inode()
1213 if (inode->i_gid == -1 || in udf_fill_inode()
1214 UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_GID_IGNORE) || in udf_fill_inode()
1215 UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_GID_SET)) in udf_fill_inode()
1216 inode->i_gid = UDF_SB(inode->i_sb)->s_gid; in udf_fill_inode()
1218 inode->i_nlink = le16_to_cpu(fe->fileLinkCount); in udf_fill_inode()
1219 if (!inode->i_nlink) in udf_fill_inode()
1220 inode->i_nlink = 1; in udf_fill_inode()
1222 inode->i_size = le64_to_cpu(fe->informationLength); in udf_fill_inode()
1223 iinfo->i_lenExtents = inode->i_size; in udf_fill_inode()
1225 inode->i_mode = udf_convert_permissions(fe); in udf_fill_inode()
1226 inode->i_mode &= ~UDF_SB(inode->i_sb)->s_umask; in udf_fill_inode()
1229 inode->i_blocks = le64_to_cpu(fe->logicalBlocksRecorded) << in udf_fill_inode()
1230 (inode->i_sb->s_blocksize_bits - 9); in udf_fill_inode()
1232 if (!udf_disk_stamp_to_time(&inode->i_atime, fe->accessTime)) in udf_fill_inode()
1233 inode->i_atime = sbi->s_record_time; in udf_fill_inode()
1235 if (!udf_disk_stamp_to_time(&inode->i_mtime, in udf_fill_inode()
1237 inode->i_mtime = sbi->s_record_time; in udf_fill_inode()
1239 if (!udf_disk_stamp_to_time(&inode->i_ctime, fe->attrTime)) in udf_fill_inode()
1240 inode->i_ctime = sbi->s_record_time; in udf_fill_inode()
1247 inode->i_blocks = le64_to_cpu(efe->logicalBlocksRecorded) << in udf_fill_inode()
1248 (inode->i_sb->s_blocksize_bits - 9); in udf_fill_inode()
1250 if (!udf_disk_stamp_to_time(&inode->i_atime, efe->accessTime)) in udf_fill_inode()
1251 inode->i_atime = sbi->s_record_time; in udf_fill_inode()
1253 if (!udf_disk_stamp_to_time(&inode->i_mtime, in udf_fill_inode()
1255 inode->i_mtime = sbi->s_record_time; in udf_fill_inode()
1260 if (!udf_disk_stamp_to_time(&inode->i_ctime, efe->attrTime)) in udf_fill_inode()
1261 inode->i_ctime = sbi->s_record_time; in udf_fill_inode()
1272 inode->i_op = &udf_dir_inode_operations; in udf_fill_inode()
1273 inode->i_fop = &udf_dir_operations; in udf_fill_inode()
1274 inode->i_mode |= S_IFDIR; in udf_fill_inode()
1275 inc_nlink(inode); in udf_fill_inode()
1282 inode->i_data.a_ops = &udf_adinicb_aops; in udf_fill_inode()
1284 inode->i_data.a_ops = &udf_aops; in udf_fill_inode()
1285 inode->i_op = &udf_file_inode_operations; in udf_fill_inode()
1286 inode->i_fop = &udf_file_operations; in udf_fill_inode()
1287 inode->i_mode |= S_IFREG; in udf_fill_inode()
1290 inode->i_mode |= S_IFBLK; in udf_fill_inode()
1293 inode->i_mode |= S_IFCHR; in udf_fill_inode()
1296 init_special_inode(inode, inode->i_mode | S_IFIFO, 0); in udf_fill_inode()
1299 init_special_inode(inode, inode->i_mode | S_IFSOCK, 0); in udf_fill_inode()
1302 inode->i_data.a_ops = &udf_symlink_aops; in udf_fill_inode()
1303 inode->i_op = &page_symlink_inode_operations; in udf_fill_inode()
1304 inode->i_mode = S_IFLNK | S_IRWXUGO; in udf_fill_inode()
1317 "file type=%d\n", inode->i_ino, in udf_fill_inode()
1319 make_bad_inode(inode); in udf_fill_inode()
1322 if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode)) { in udf_fill_inode()
1324 (struct deviceSpec *)udf_get_extendedattr(inode, 12, 1); in udf_fill_inode()
1326 init_special_inode(inode, inode->i_mode, in udf_fill_inode()
1331 make_bad_inode(inode); in udf_fill_inode()
1335 static int udf_alloc_i_data(struct inode *inode, size_t size) in udf_alloc_i_data() argument
1337 struct udf_inode_info *iinfo = UDF_I(inode); in udf_alloc_i_data()
1342 "no free memory\n", inode->i_ino); in udf_alloc_i_data()
1368 int udf_write_inode(struct inode *inode, int sync) in udf_write_inode() argument
1373 ret = udf_update_inode(inode, sync); in udf_write_inode()
1379 int udf_sync_inode(struct inode *inode) in udf_sync_inode() argument
1381 return udf_update_inode(inode, 1); in udf_sync_inode()
1384 static int udf_update_inode(struct inode *inode, int do_sync) in udf_update_inode() argument
1393 struct udf_sb_info *sbi = UDF_SB(inode->i_sb); in udf_update_inode()
1394 unsigned char blocksize_bits = inode->i_sb->s_blocksize_bits; in udf_update_inode()
1395 struct udf_inode_info *iinfo = UDF_I(inode); in udf_update_inode()
1397 bh = udf_tread(inode->i_sb, in udf_update_inode()
1398 udf_get_lb_pblock(inode->i_sb, in udf_update_inode()
1405 memset(bh->b_data, 0x00, inode->i_sb->s_blocksize); in udf_update_inode()
1416 iinfo->i_ext.i_data, inode->i_sb->s_blocksize - in udf_update_inode()
1434 if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_UID_FORGET)) in udf_update_inode()
1437 fe->uid = cpu_to_le32(inode->i_uid); in udf_update_inode()
1439 if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_GID_FORGET)) in udf_update_inode()
1442 fe->gid = cpu_to_le32(inode->i_gid); in udf_update_inode()
1444 udfperms = ((inode->i_mode & S_IRWXO)) | in udf_update_inode()
1445 ((inode->i_mode & S_IRWXG) << 2) | in udf_update_inode()
1446 ((inode->i_mode & S_IRWXU) << 4); in udf_update_inode()
1454 if (S_ISDIR(inode->i_mode)) in udf_update_inode()
1455 fe->fileLinkCount = cpu_to_le16(inode->i_nlink - 1); in udf_update_inode()
1457 fe->fileLinkCount = cpu_to_le16(inode->i_nlink); in udf_update_inode()
1459 fe->informationLength = cpu_to_le64(inode->i_size); in udf_update_inode()
1461 if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode)) { in udf_update_inode()
1464 (struct deviceSpec *)udf_get_extendedattr(inode, 12, 1); in udf_update_inode()
1467 udf_add_extendedattr(inode, in udf_update_inode()
1482 dsea->majorDeviceIdent = cpu_to_le32(imajor(inode)); in udf_update_inode()
1483 dsea->minorDeviceIdent = cpu_to_le32(iminor(inode)); in udf_update_inode()
1489 inode->i_sb->s_blocksize - sizeof(struct fileEntry)); in udf_update_inode()
1491 (inode->i_blocks + (1 << (blocksize_bits - 9)) - 1) >> in udf_update_inode()
1494 udf_time_to_disk_stamp(&fe->accessTime, inode->i_atime); in udf_update_inode()
1495 udf_time_to_disk_stamp(&fe->modificationTime, inode->i_mtime); in udf_update_inode()
1496 udf_time_to_disk_stamp(&fe->attrTime, inode->i_ctime); in udf_update_inode()
1509 inode->i_sb->s_blocksize - in udf_update_inode()
1511 efe->objectSize = cpu_to_le64(inode->i_size); in udf_update_inode()
1513 (inode->i_blocks + (1 << (blocksize_bits - 9)) - 1) >> in udf_update_inode()
1516 if (iinfo->i_crtime.tv_sec > inode->i_atime.tv_sec || in udf_update_inode()
1517 (iinfo->i_crtime.tv_sec == inode->i_atime.tv_sec && in udf_update_inode()
1518 iinfo->i_crtime.tv_nsec > inode->i_atime.tv_nsec)) in udf_update_inode()
1519 iinfo->i_crtime = inode->i_atime; in udf_update_inode()
1521 if (iinfo->i_crtime.tv_sec > inode->i_mtime.tv_sec || in udf_update_inode()
1522 (iinfo->i_crtime.tv_sec == inode->i_mtime.tv_sec && in udf_update_inode()
1523 iinfo->i_crtime.tv_nsec > inode->i_mtime.tv_nsec)) in udf_update_inode()
1524 iinfo->i_crtime = inode->i_mtime; in udf_update_inode()
1526 if (iinfo->i_crtime.tv_sec > inode->i_ctime.tv_sec || in udf_update_inode()
1527 (iinfo->i_crtime.tv_sec == inode->i_ctime.tv_sec && in udf_update_inode()
1528 iinfo->i_crtime.tv_nsec > inode->i_ctime.tv_nsec)) in udf_update_inode()
1529 iinfo->i_crtime = inode->i_ctime; in udf_update_inode()
1531 udf_time_to_disk_stamp(&efe->accessTime, inode->i_atime); in udf_update_inode()
1532 udf_time_to_disk_stamp(&efe->modificationTime, inode->i_mtime); in udf_update_inode()
1534 udf_time_to_disk_stamp(&efe->attrTime, inode->i_ctime); in udf_update_inode()
1555 if (S_ISDIR(inode->i_mode)) in udf_update_inode()
1557 else if (S_ISREG(inode->i_mode)) in udf_update_inode()
1559 else if (S_ISLNK(inode->i_mode)) in udf_update_inode()
1561 else if (S_ISBLK(inode->i_mode)) in udf_update_inode()
1563 else if (S_ISCHR(inode->i_mode)) in udf_update_inode()
1565 else if (S_ISFIFO(inode->i_mode)) in udf_update_inode()
1567 else if (S_ISSOCK(inode->i_mode)) in udf_update_inode()
1571 ((inode->i_mode & S_ISUID) ? ICBTAG_FLAG_SETUID : 0) | in udf_update_inode()
1572 ((inode->i_mode & S_ISGID) ? ICBTAG_FLAG_SETGID : 0) | in udf_update_inode()
1573 ((inode->i_mode & S_ISVTX) ? ICBTAG_FLAG_STICKY : 0) | in udf_update_inode()
1599 "[%s:%08lx]\n", inode->i_sb->s_id, in udf_update_inode()
1600 inode->i_ino); in udf_update_inode()
1609 struct inode *udf_iget(struct super_block *sb, kernel_lb_addr ino) in udf_iget()
1612 struct inode *inode = iget_locked(sb, block); in udf_iget() local
1614 if (!inode) in udf_iget()
1617 if (inode->i_state & I_NEW) { in udf_iget()
1618 memcpy(&UDF_I(inode)->i_location, &ino, sizeof(kernel_lb_addr)); in udf_iget()
1619 __udf_read_inode(inode); in udf_iget()
1620 unlock_new_inode(inode); in udf_iget()
1623 if (is_bad_inode(inode)) in udf_iget()
1630 make_bad_inode(inode); in udf_iget()
1634 return inode; in udf_iget()
1637 iput(inode); in udf_iget()
1641 int8_t udf_add_aext(struct inode *inode, struct extent_position *epos, in udf_add_aext() argument
1650 struct udf_inode_info *iinfo = UDF_I(inode); in udf_add_aext()
1654 udf_file_entry_alloc_offset(inode) + in udf_add_aext()
1666 if (epos->offset + (2 * adsize) > inode->i_sb->s_blocksize) { in udf_add_aext()
1672 epos->block.logicalBlockNum = udf_new_block(inode->i_sb, NULL, in udf_add_aext()
1677 nbh = udf_tgetblk(inode->i_sb, udf_get_lb_pblock(inode->i_sb, in udf_add_aext()
1683 memset(nbh->b_data, 0x00, inode->i_sb->s_blocksize); in udf_add_aext()
1686 mark_buffer_dirty_inode(nbh, inode); in udf_add_aext()
1689 if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT)) in udf_add_aext()
1692 if (epos->offset + adsize > inode->i_sb->s_blocksize) { in udf_add_aext()
1710 mark_inode_dirty(inode); in udf_add_aext()
1713 if (UDF_SB(inode->i_sb)->s_udfrev >= 0x0200) in udf_add_aext()
1723 inode->i_sb->s_blocksize); in udf_add_aext()
1730 inode->i_sb->s_blocksize); in udf_add_aext()
1736 if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT) || in udf_add_aext()
1737 UDF_SB(inode->i_sb)->s_udfrev >= 0x0201) in udf_add_aext()
1742 mark_buffer_dirty_inode(epos->bh, inode); in udf_add_aext()
1745 mark_inode_dirty(inode); in udf_add_aext()
1750 etype = udf_write_aext(inode, epos, eloc, elen, inc); in udf_add_aext()
1754 mark_inode_dirty(inode); in udf_add_aext()
1758 if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT) || in udf_add_aext()
1759 UDF_SB(inode->i_sb)->s_udfrev >= 0x0201) in udf_add_aext()
1765 mark_buffer_dirty_inode(epos->bh, inode); in udf_add_aext()
1771 int8_t udf_write_aext(struct inode *inode, struct extent_position *epos, in udf_write_aext() argument
1778 struct udf_inode_info *iinfo = UDF_I(inode); in udf_write_aext()
1782 udf_file_entry_alloc_offset(inode) + in udf_write_aext()
1806 if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT) || in udf_write_aext()
1807 UDF_SB(inode->i_sb)->s_udfrev >= 0x0201) { in udf_write_aext()
1814 mark_buffer_dirty_inode(epos->bh, inode); in udf_write_aext()
1816 mark_inode_dirty(inode); in udf_write_aext()
1825 int8_t udf_next_aext(struct inode *inode, struct extent_position *epos, in udf_next_aext() argument
1830 while ((etype = udf_current_aext(inode, epos, eloc, elen, inc)) == in udf_next_aext()
1836 block = udf_get_lb_pblock(inode->i_sb, epos->block, 0); in udf_next_aext()
1837 epos->bh = udf_tread(inode->i_sb, block); in udf_next_aext()
1847 int8_t udf_current_aext(struct inode *inode, struct extent_position *epos, in udf_current_aext() argument
1855 struct udf_inode_info *iinfo = UDF_I(inode); in udf_current_aext()
1859 epos->offset = udf_file_entry_alloc_offset(inode); in udf_current_aext()
1861 udf_file_entry_alloc_offset(inode) + in udf_current_aext()
1863 alen = udf_file_entry_alloc_offset(inode) + in udf_current_aext()
1902 static int8_t udf_insert_aext(struct inode *inode, struct extent_position epos, in udf_insert_aext() argument
1912 while ((etype = udf_next_aext(inode, &epos, &oeloc, &oelen, 0)) != -1) { in udf_insert_aext()
1913 udf_write_aext(inode, &epos, neloc, nelen, 1); in udf_insert_aext()
1917 udf_add_aext(inode, &epos, neloc, nelen, 1); in udf_insert_aext()
1923 int8_t udf_delete_aext(struct inode *inode, struct extent_position epos, in udf_delete_aext() argument
1937 iinfo = UDF_I(inode); in udf_delete_aext()
1946 if (udf_next_aext(inode, &epos, &eloc, &elen, 1) == -1) in udf_delete_aext()
1949 while ((etype = udf_next_aext(inode, &epos, &eloc, &elen, 1)) != -1) { in udf_delete_aext()
1950 udf_write_aext(inode, &oepos, eloc, (etype << 30) | elen, 1); in udf_delete_aext()
1963 udf_free_blocks(inode->i_sb, inode, epos.block, 0, 1); in udf_delete_aext()
1964 udf_write_aext(inode, &oepos, eloc, elen, 1); in udf_delete_aext()
1965 udf_write_aext(inode, &oepos, eloc, elen, 1); in udf_delete_aext()
1968 mark_inode_dirty(inode); in udf_delete_aext()
1972 if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT) || in udf_delete_aext()
1973 UDF_SB(inode->i_sb)->s_udfrev >= 0x0201) in udf_delete_aext()
1979 mark_buffer_dirty_inode(oepos.bh, inode); in udf_delete_aext()
1982 udf_write_aext(inode, &oepos, eloc, elen, 1); in udf_delete_aext()
1985 mark_inode_dirty(inode); in udf_delete_aext()
1989 if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT) || in udf_delete_aext()
1990 UDF_SB(inode->i_sb)->s_udfrev >= 0x0201) in udf_delete_aext()
1996 mark_buffer_dirty_inode(oepos.bh, inode); in udf_delete_aext()
2006 int8_t inode_bmap(struct inode *inode, sector_t block, in inode_bmap() argument
2010 unsigned char blocksize_bits = inode->i_sb->s_blocksize_bits; in inode_bmap()
2016 iinfo = UDF_I(inode); in inode_bmap()
2023 etype = udf_next_aext(inode, pos, eloc, elen, 1); in inode_bmap()
2037 long udf_block_map(struct inode *inode, sector_t block) in udf_block_map() argument
2047 if (inode_bmap(inode, block, &epos, &eloc, &elen, &offset) == in udf_block_map()
2049 ret = udf_get_lb_pblock(inode->i_sb, eloc, offset); in udf_block_map()
2056 if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_VARCONV)) in udf_block_map()