• Home
  • Raw
  • Download

Lines Matching refs:inode

22 static int ext4_get_inline_size(struct inode *inode)  in ext4_get_inline_size()  argument
24 if (EXT4_I(inode)->i_inline_off) in ext4_get_inline_size()
25 return EXT4_I(inode)->i_inline_size; in ext4_get_inline_size()
30 static int get_max_inline_xattr_value_size(struct inode *inode, in get_max_inline_xattr_value_size() argument
39 if (!EXT4_INODE_HAS_XATTR_SPACE(inode)) in get_max_inline_xattr_value_size()
42 min_offs = EXT4_SB(inode->i_sb)->s_inode_size - in get_max_inline_xattr_value_size()
44 EXT4_I(inode)->i_extra_isize - in get_max_inline_xattr_value_size()
52 if (!ext4_test_inode_state(inode, EXT4_STATE_XATTR)) in get_max_inline_xattr_value_size()
58 header = IHDR(inode, raw_inode); in get_max_inline_xattr_value_size()
60 end = (void *)raw_inode + EXT4_SB(inode->i_sb)->s_inode_size; in get_max_inline_xattr_value_size()
67 EXT4_ERROR_INODE(inode, in get_max_inline_xattr_value_size()
81 if (EXT4_I(inode)->i_inline_off) { in get_max_inline_xattr_value_size()
83 ((void *)raw_inode + EXT4_I(inode)->i_inline_off); in get_max_inline_xattr_value_size()
105 int ext4_get_max_inline_size(struct inode *inode) in ext4_get_max_inline_size() argument
110 if (EXT4_I(inode)->i_extra_isize == 0) in ext4_get_max_inline_size()
113 error = ext4_get_inode_loc(inode, &iloc); in ext4_get_max_inline_size()
115 ext4_error_inode_err(inode, __func__, __LINE__, 0, -error, in ext4_get_max_inline_size()
117 inode->i_ino); in ext4_get_max_inline_size()
121 down_read(&EXT4_I(inode)->xattr_sem); in ext4_get_max_inline_size()
122 max_inline_size = get_max_inline_xattr_value_size(inode, &iloc); in ext4_get_max_inline_size()
123 up_read(&EXT4_I(inode)->xattr_sem); in ext4_get_max_inline_size()
138 int ext4_find_inline_data_nolock(struct inode *inode) in ext4_find_inline_data_nolock() argument
149 if (EXT4_I(inode)->i_extra_isize == 0) in ext4_find_inline_data_nolock()
152 error = ext4_get_inode_loc(inode, &is.iloc); in ext4_find_inline_data_nolock()
156 error = ext4_xattr_ibody_find(inode, &i, &is); in ext4_find_inline_data_nolock()
162 EXT4_ERROR_INODE(inode, "inline data xattr refers " in ext4_find_inline_data_nolock()
167 EXT4_I(inode)->i_inline_off = (u16)((void *)is.s.here - in ext4_find_inline_data_nolock()
169 EXT4_I(inode)->i_inline_size = EXT4_MIN_INLINE_DATA_SIZE + in ext4_find_inline_data_nolock()
177 static int ext4_read_inline_data(struct inode *inode, void *buffer, in ext4_read_inline_data() argument
189 BUG_ON(len > EXT4_I(inode)->i_inline_size); in ext4_read_inline_data()
203 header = IHDR(inode, raw_inode); in ext4_read_inline_data()
205 EXT4_I(inode)->i_inline_off); in ext4_read_inline_data()
223 static void ext4_write_inline_data(struct inode *inode, struct ext4_iloc *iloc, in ext4_write_inline_data() argument
231 if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb)))) in ext4_write_inline_data()
234 BUG_ON(!EXT4_I(inode)->i_inline_off); in ext4_write_inline_data()
235 BUG_ON(pos + len > EXT4_I(inode)->i_inline_size); in ext4_write_inline_data()
254 header = IHDR(inode, raw_inode); in ext4_write_inline_data()
256 EXT4_I(inode)->i_inline_off); in ext4_write_inline_data()
263 struct inode *inode, unsigned len) in ext4_create_inline_data() argument
275 error = ext4_get_inode_loc(inode, &is.iloc); in ext4_create_inline_data()
296 error = ext4_xattr_ibody_find(inode, &i, &is); in ext4_create_inline_data()
302 error = ext4_xattr_ibody_set(handle, inode, &i, &is); in ext4_create_inline_data()
305 ext4_clear_inode_state(inode, in ext4_create_inline_data()
313 EXT4_I(inode)->i_inline_off = (u16)((void *)is.s.here - in ext4_create_inline_data()
315 EXT4_I(inode)->i_inline_size = len + EXT4_MIN_INLINE_DATA_SIZE; in ext4_create_inline_data()
316 ext4_clear_inode_flag(inode, EXT4_INODE_EXTENTS); in ext4_create_inline_data()
317 ext4_set_inode_flag(inode, EXT4_INODE_INLINE_DATA); in ext4_create_inline_data()
319 error = ext4_mark_iloc_dirty(handle, inode, &is.iloc); in ext4_create_inline_data()
326 static int ext4_update_inline_data(handle_t *handle, struct inode *inode, in ext4_update_inline_data() argument
340 if (len <= EXT4_I(inode)->i_inline_size) in ext4_update_inline_data()
343 error = ext4_get_inode_loc(inode, &is.iloc); in ext4_update_inline_data()
347 error = ext4_xattr_ibody_find(inode, &i, &is); in ext4_update_inline_data()
360 error = ext4_xattr_ibody_get(inode, i.name_index, i.name, in ext4_update_inline_data()
374 error = ext4_xattr_ibody_set(handle, inode, &i, &is); in ext4_update_inline_data()
378 EXT4_I(inode)->i_inline_off = (u16)((void *)is.s.here - in ext4_update_inline_data()
380 EXT4_I(inode)->i_inline_size = EXT4_MIN_INLINE_DATA_SIZE + in ext4_update_inline_data()
382 ext4_set_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA); in ext4_update_inline_data()
384 error = ext4_mark_iloc_dirty(handle, inode, &is.iloc); in ext4_update_inline_data()
392 static int ext4_prepare_inline_data(handle_t *handle, struct inode *inode, in ext4_prepare_inline_data() argument
396 struct ext4_inode_info *ei = EXT4_I(inode); in ext4_prepare_inline_data()
398 if (!ext4_test_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA)) in ext4_prepare_inline_data()
401 size = ext4_get_max_inline_size(inode); in ext4_prepare_inline_data()
405 ext4_write_lock_xattr(inode, &no_expand); in ext4_prepare_inline_data()
408 ret = ext4_update_inline_data(handle, inode, len); in ext4_prepare_inline_data()
410 ret = ext4_create_inline_data(handle, inode, len); in ext4_prepare_inline_data()
412 ext4_write_unlock_xattr(inode, &no_expand); in ext4_prepare_inline_data()
417 struct inode *inode) in ext4_destroy_inline_data_nolock() argument
419 struct ext4_inode_info *ei = EXT4_I(inode); in ext4_destroy_inline_data_nolock()
434 error = ext4_get_inode_loc(inode, &is.iloc); in ext4_destroy_inline_data_nolock()
438 error = ext4_xattr_ibody_find(inode, &i, &is); in ext4_destroy_inline_data_nolock()
447 error = ext4_xattr_ibody_set(handle, inode, &i, &is); in ext4_destroy_inline_data_nolock()
455 if (ext4_has_feature_extents(inode->i_sb)) { in ext4_destroy_inline_data_nolock()
456 if (S_ISDIR(inode->i_mode) || in ext4_destroy_inline_data_nolock()
457 S_ISREG(inode->i_mode) || S_ISLNK(inode->i_mode)) { in ext4_destroy_inline_data_nolock()
458 ext4_set_inode_flag(inode, EXT4_INODE_EXTENTS); in ext4_destroy_inline_data_nolock()
459 ext4_ext_tree_init(handle, inode); in ext4_destroy_inline_data_nolock()
462 ext4_clear_inode_flag(inode, EXT4_INODE_INLINE_DATA); in ext4_destroy_inline_data_nolock()
465 error = ext4_mark_iloc_dirty(handle, inode, &is.iloc); in ext4_destroy_inline_data_nolock()
467 EXT4_I(inode)->i_inline_off = 0; in ext4_destroy_inline_data_nolock()
468 EXT4_I(inode)->i_inline_size = 0; in ext4_destroy_inline_data_nolock()
469 ext4_clear_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA); in ext4_destroy_inline_data_nolock()
477 static int ext4_read_inline_page(struct inode *inode, struct page *page) in ext4_read_inline_page() argument
485 BUG_ON(!ext4_has_inline_data(inode)); in ext4_read_inline_page()
488 if (!EXT4_I(inode)->i_inline_off) { in ext4_read_inline_page()
489 ext4_warning(inode->i_sb, "inode %lu doesn't have inline data.", in ext4_read_inline_page()
490 inode->i_ino); in ext4_read_inline_page()
494 ret = ext4_get_inode_loc(inode, &iloc); in ext4_read_inline_page()
498 len = min_t(size_t, ext4_get_inline_size(inode), i_size_read(inode)); in ext4_read_inline_page()
500 ret = ext4_read_inline_data(inode, kaddr, len, &iloc); in ext4_read_inline_page()
511 int ext4_readpage_inline(struct inode *inode, struct page *page) in ext4_readpage_inline() argument
515 down_read(&EXT4_I(inode)->xattr_sem); in ext4_readpage_inline()
516 if (!ext4_has_inline_data(inode)) { in ext4_readpage_inline()
517 up_read(&EXT4_I(inode)->xattr_sem); in ext4_readpage_inline()
526 inode); in ext4_readpage_inline()
527 trace_android_fs_dataread_start(inode, page_offset(page), in ext4_readpage_inline()
537 ret = ext4_read_inline_page(inode, page); in ext4_readpage_inline()
543 trace_android_fs_dataread_end(inode, page_offset(page), PAGE_SIZE); in ext4_readpage_inline()
545 up_read(&EXT4_I(inode)->xattr_sem); in ext4_readpage_inline()
552 struct inode *inode, in ext4_convert_inline_data_to_extent() argument
562 if (!ext4_has_inline_data(inode)) { in ext4_convert_inline_data_to_extent()
567 ext4_clear_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA); in ext4_convert_inline_data_to_extent()
571 needed_blocks = ext4_writepage_trans_blocks(inode); in ext4_convert_inline_data_to_extent()
573 ret = ext4_get_inode_loc(inode, &iloc); in ext4_convert_inline_data_to_extent()
578 handle = ext4_journal_start(inode, EXT4_HT_WRITE_PAGE, needed_blocks); in ext4_convert_inline_data_to_extent()
595 ext4_write_lock_xattr(inode, &no_expand); in ext4_convert_inline_data_to_extent()
598 if (!ext4_has_inline_data(inode)) { in ext4_convert_inline_data_to_extent()
604 to = ext4_get_inline_size(inode); in ext4_convert_inline_data_to_extent()
606 ret = ext4_read_inline_page(inode, page); in ext4_convert_inline_data_to_extent()
611 ret = ext4_destroy_inline_data_nolock(handle, inode); in ext4_convert_inline_data_to_extent()
615 if (ext4_should_dioread_nolock(inode)) { in ext4_convert_inline_data_to_extent()
621 if (!ret && ext4_should_journal_data(inode)) { in ext4_convert_inline_data_to_extent()
631 ext4_orphan_add(handle, inode); in ext4_convert_inline_data_to_extent()
632 ext4_write_unlock_xattr(inode, &no_expand); in ext4_convert_inline_data_to_extent()
636 ext4_truncate_failed_write(inode); in ext4_convert_inline_data_to_extent()
643 if (inode->i_nlink) in ext4_convert_inline_data_to_extent()
644 ext4_orphan_del(NULL, inode); in ext4_convert_inline_data_to_extent()
647 if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries)) in ext4_convert_inline_data_to_extent()
658 ext4_write_unlock_xattr(inode, &no_expand); in ext4_convert_inline_data_to_extent()
672 struct inode *inode, in ext4_try_to_write_inline_data() argument
682 if (pos + len > ext4_get_max_inline_size(inode)) in ext4_try_to_write_inline_data()
685 ret = ext4_get_inode_loc(inode, &iloc); in ext4_try_to_write_inline_data()
693 handle = ext4_journal_start(inode, EXT4_HT_INODE, 1); in ext4_try_to_write_inline_data()
700 ret = ext4_prepare_inline_data(handle, inode, pos + len); in ext4_try_to_write_inline_data()
724 down_read(&EXT4_I(inode)->xattr_sem); in ext4_try_to_write_inline_data()
725 if (!ext4_has_inline_data(inode)) { in ext4_try_to_write_inline_data()
733 ret = ext4_read_inline_page(inode, page); in ext4_try_to_write_inline_data()
744 up_read(&EXT4_I(inode)->xattr_sem); in ext4_try_to_write_inline_data()
752 inode, flags); in ext4_try_to_write_inline_data()
755 int ext4_write_inline_data_end(struct inode *inode, loff_t pos, unsigned len, in ext4_write_inline_data_end() argument
765 ret = ext4_get_inode_loc(inode, &iloc); in ext4_write_inline_data_end()
767 ext4_std_error(inode->i_sb, ret); in ext4_write_inline_data_end()
771 ext4_write_lock_xattr(inode, &no_expand); in ext4_write_inline_data_end()
772 BUG_ON(!ext4_has_inline_data(inode)); in ext4_write_inline_data_end()
778 (void) ext4_find_inline_data_nolock(inode); in ext4_write_inline_data_end()
781 ext4_write_inline_data(inode, &iloc, kaddr, pos, copied); in ext4_write_inline_data_end()
787 ext4_write_unlock_xattr(inode, &no_expand); in ext4_write_inline_data_end()
789 mark_inode_dirty(inode); in ext4_write_inline_data_end()
795 ext4_journalled_write_inline_data(struct inode *inode, in ext4_journalled_write_inline_data() argument
803 ret = ext4_get_inode_loc(inode, &iloc); in ext4_journalled_write_inline_data()
805 ext4_std_error(inode->i_sb, ret); in ext4_journalled_write_inline_data()
809 ext4_write_lock_xattr(inode, &no_expand); in ext4_journalled_write_inline_data()
811 ext4_write_inline_data(inode, &iloc, kaddr, 0, len); in ext4_journalled_write_inline_data()
813 ext4_write_unlock_xattr(inode, &no_expand); in ext4_journalled_write_inline_data()
828 struct inode *inode, in ext4_da_convert_inline_data_to_extent() argument
839 down_read(&EXT4_I(inode)->xattr_sem); in ext4_da_convert_inline_data_to_extent()
840 if (!ext4_has_inline_data(inode)) { in ext4_da_convert_inline_data_to_extent()
841 ext4_clear_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA); in ext4_da_convert_inline_data_to_extent()
845 inline_size = ext4_get_inline_size(inode); in ext4_da_convert_inline_data_to_extent()
848 ret = ext4_read_inline_page(inode, page); in ext4_da_convert_inline_data_to_extent()
856 up_read(&EXT4_I(inode)->xattr_sem); in ext4_da_convert_inline_data_to_extent()
859 ext4_truncate_failed_write(inode); in ext4_da_convert_inline_data_to_extent()
865 ext4_clear_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA); in ext4_da_convert_inline_data_to_extent()
869 up_read(&EXT4_I(inode)->xattr_sem); in ext4_da_convert_inline_data_to_extent()
886 struct inode *inode, in ext4_da_write_inline_data_begin() argument
898 ret = ext4_get_inode_loc(inode, &iloc); in ext4_da_write_inline_data_begin()
903 handle = ext4_journal_start(inode, EXT4_HT_INODE, 1); in ext4_da_write_inline_data_begin()
909 inline_size = ext4_get_max_inline_size(inode); in ext4_da_write_inline_data_begin()
913 ret = ext4_prepare_inline_data(handle, inode, pos + len); in ext4_da_write_inline_data_begin()
927 inode, in ext4_da_write_inline_data_begin()
931 ext4_should_retry_alloc(inode->i_sb, &retries)) in ext4_da_write_inline_data_begin()
942 down_read(&EXT4_I(inode)->xattr_sem); in ext4_da_write_inline_data_begin()
943 if (!ext4_has_inline_data(inode)) { in ext4_da_write_inline_data_begin()
949 ret = ext4_read_inline_page(inode, page); in ext4_da_write_inline_data_begin()
957 up_read(&EXT4_I(inode)->xattr_sem); in ext4_da_write_inline_data_begin()
962 up_read(&EXT4_I(inode)->xattr_sem); in ext4_da_write_inline_data_begin()
972 int ext4_da_write_inline_data_end(struct inode *inode, loff_t pos, in ext4_da_write_inline_data_end() argument
978 ret = ext4_write_inline_data_end(inode, pos, len, copied, page); in ext4_da_write_inline_data_end()
993 if (pos+copied > inode->i_size) in ext4_da_write_inline_data_end()
994 i_size_write(inode, pos+copied); in ext4_da_write_inline_data_end()
1004 mark_inode_dirty(inode); in ext4_da_write_inline_data_end()
1010 void ext4_show_inline_dir(struct inode *dir, struct buffer_head *bh, in ext4_show_inline_dir()
1024 de->name_len, le32_to_cpu(de->inode)); in ext4_show_inline_dir()
1044 struct inode *dir, in ext4_add_dirent_to_inline()
1045 struct inode *inode, in ext4_add_dirent_to_inline() argument
1052 err = ext4_find_dest_de(dir, inode, 0, iloc->bh, inline_start, in ext4_add_dirent_to_inline()
1061 ext4_insert_dentry(dir, inode, de, inline_size, fname); in ext4_add_dirent_to_inline()
1082 static void *ext4_get_inline_xattr_pos(struct inode *inode, in ext4_get_inline_xattr_pos() argument
1088 BUG_ON(!EXT4_I(inode)->i_inline_off); in ext4_get_inline_xattr_pos()
1090 header = IHDR(inode, ext4_raw_inode(iloc)); in ext4_get_inline_xattr_pos()
1092 EXT4_I(inode)->i_inline_off); in ext4_get_inline_xattr_pos()
1118 de->inode = 0; in ext4_update_final_de()
1123 static int ext4_update_inline_dir(handle_t *handle, struct inode *dir, in ext4_update_inline_dir()
1145 static void ext4_restore_inline_data(handle_t *handle, struct inode *inode, in ext4_restore_inline_data() argument
1151 ret = ext4_create_inline_data(handle, inode, inline_size); in ext4_restore_inline_data()
1153 ext4_msg(inode->i_sb, KERN_EMERG, in ext4_restore_inline_data()
1155 inode->i_ino, ret); in ext4_restore_inline_data()
1158 ext4_write_inline_data(inode, iloc, buf, 0, inline_size); in ext4_restore_inline_data()
1159 ext4_set_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA); in ext4_restore_inline_data()
1163 struct inode *inode, in ext4_finish_convert_inline_dir() argument
1177 de = ext4_init_dot_dotdot(inode, de, in ext4_finish_convert_inline_dir()
1178 inode->i_sb->s_blocksize, csum_size, in ext4_finish_convert_inline_dir()
1179 le32_to_cpu(((struct ext4_dir_entry_2 *)buf)->inode), 1); in ext4_finish_convert_inline_dir()
1185 if (ext4_has_metadata_csum(inode->i_sb)) in ext4_finish_convert_inline_dir()
1188 inode->i_size = inode->i_sb->s_blocksize; in ext4_finish_convert_inline_dir()
1189 i_size_write(inode, inode->i_sb->s_blocksize); in ext4_finish_convert_inline_dir()
1190 EXT4_I(inode)->i_disksize = inode->i_sb->s_blocksize; in ext4_finish_convert_inline_dir()
1193 inode->i_sb->s_blocksize - csum_size); in ext4_finish_convert_inline_dir()
1197 inode->i_sb->s_blocksize); in ext4_finish_convert_inline_dir()
1200 err = ext4_handle_dirty_dirblock(handle, inode, dir_block); in ext4_finish_convert_inline_dir()
1204 return ext4_mark_inode_dirty(handle, inode); in ext4_finish_convert_inline_dir()
1208 struct inode *inode, in ext4_convert_inline_data_nolock() argument
1217 inline_size = ext4_get_inline_size(inode); in ext4_convert_inline_data_nolock()
1224 error = ext4_read_inline_data(inode, buf, inline_size, iloc); in ext4_convert_inline_data_nolock()
1232 if (S_ISDIR(inode->i_mode)) { in ext4_convert_inline_data_nolock()
1233 error = ext4_check_all_de(inode, iloc->bh, in ext4_convert_inline_data_nolock()
1240 error = ext4_destroy_inline_data_nolock(handle, inode); in ext4_convert_inline_data_nolock()
1247 error = ext4_map_blocks(handle, inode, &map, EXT4_GET_BLOCKS_CREATE); in ext4_convert_inline_data_nolock()
1255 data_bh = sb_getblk(inode->i_sb, map.m_pblk); in ext4_convert_inline_data_nolock()
1268 memset(data_bh->b_data, 0, inode->i_sb->s_blocksize); in ext4_convert_inline_data_nolock()
1270 if (!S_ISDIR(inode->i_mode)) { in ext4_convert_inline_data_nolock()
1275 inode, data_bh); in ext4_convert_inline_data_nolock()
1277 error = ext4_finish_convert_inline_dir(handle, inode, data_bh, in ext4_convert_inline_data_nolock()
1283 ext4_restore_inline_data(handle, inode, iloc, buf, inline_size); in ext4_convert_inline_data_nolock()
1297 struct inode *dir, struct inode *inode) in ext4_try_add_inline_entry() argument
1315 ret = ext4_add_dirent_to_inline(handle, fname, dir, inode, &iloc, in ext4_try_add_inline_entry()
1337 inode, &iloc, inline_start, in ext4_try_add_inline_entry()
1366 struct inode *dir, ext4_lblk_t block, in ext4_inlinedir_to_tree()
1375 struct inode *inode = file_inode(dir_file); in ext4_inlinedir_to_tree() local
1382 ret = ext4_get_inode_loc(inode, &iloc); in ext4_inlinedir_to_tree()
1386 down_read(&EXT4_I(inode)->xattr_sem); in ext4_inlinedir_to_tree()
1387 if (!ext4_has_inline_data(inode)) { in ext4_inlinedir_to_tree()
1388 up_read(&EXT4_I(inode)->xattr_sem); in ext4_inlinedir_to_tree()
1393 inline_size = ext4_get_inline_size(inode); in ext4_inlinedir_to_tree()
1397 up_read(&EXT4_I(inode)->xattr_sem); in ext4_inlinedir_to_tree()
1401 ret = ext4_read_inline_data(inode, dir_buf, inline_size, &iloc); in ext4_inlinedir_to_tree()
1402 up_read(&EXT4_I(inode)->xattr_sem); in ext4_inlinedir_to_tree()
1407 parent_ino = le32_to_cpu(((struct ext4_dir_entry_2 *)dir_buf)->inode); in ext4_inlinedir_to_tree()
1415 fake.inode = cpu_to_le32(inode->i_ino); in ext4_inlinedir_to_tree()
1421 ext4_set_de_type(inode->i_sb, &fake, S_IFDIR); in ext4_inlinedir_to_tree()
1425 fake.inode = cpu_to_le32(parent_ino); in ext4_inlinedir_to_tree()
1431 ext4_set_de_type(inode->i_sb, &fake, S_IFDIR); in ext4_inlinedir_to_tree()
1437 if (ext4_check_dir_entry(inode, dir_file, de, in ext4_inlinedir_to_tree()
1455 if (de->inode == 0) in ext4_inlinedir_to_tree()
1490 struct inode *inode = file_inode(file); in ext4_read_inline_dir() local
1496 ret = ext4_get_inode_loc(inode, &iloc); in ext4_read_inline_dir()
1500 down_read(&EXT4_I(inode)->xattr_sem); in ext4_read_inline_dir()
1501 if (!ext4_has_inline_data(inode)) { in ext4_read_inline_dir()
1502 up_read(&EXT4_I(inode)->xattr_sem); in ext4_read_inline_dir()
1507 inline_size = ext4_get_inline_size(inode); in ext4_read_inline_dir()
1511 up_read(&EXT4_I(inode)->xattr_sem); in ext4_read_inline_dir()
1515 ret = ext4_read_inline_data(inode, dir_buf, inline_size, &iloc); in ext4_read_inline_dir()
1516 up_read(&EXT4_I(inode)->xattr_sem); in ext4_read_inline_dir()
1521 sb = inode->i_sb; in ext4_read_inline_dir()
1522 parent_ino = le32_to_cpu(((struct ext4_dir_entry_2 *)dir_buf)->inode); in ext4_read_inline_dir()
1543 if (!inode_eq_iversion(inode, file->f_version)) { in ext4_read_inline_dir()
1575 file->f_version = inode_query_iversion(inode); in ext4_read_inline_dir()
1580 if (!dir_emit(ctx, ".", 1, inode->i_ino, DT_DIR)) in ext4_read_inline_dir()
1595 if (ext4_check_dir_entry(inode, file, de, iloc.bh, dir_buf, in ext4_read_inline_dir()
1598 if (le32_to_cpu(de->inode)) { in ext4_read_inline_dir()
1600 le32_to_cpu(de->inode), in ext4_read_inline_dir()
1612 struct buffer_head *ext4_get_first_inline_block(struct inode *inode, in ext4_get_first_inline_block() argument
1618 *retval = ext4_get_inode_loc(inode, &iloc); in ext4_get_first_inline_block()
1632 int ext4_try_create_inline_dir(handle_t *handle, struct inode *parent, in ext4_try_create_inline_dir()
1633 struct inode *inode) in ext4_try_create_inline_dir() argument
1639 ret = ext4_get_inode_loc(inode, &iloc); in ext4_try_create_inline_dir()
1643 ret = ext4_prepare_inline_data(handle, inode, inline_size); in ext4_try_create_inline_dir()
1652 de->inode = cpu_to_le32(parent->i_ino); in ext4_try_create_inline_dir()
1654 de->inode = 0; in ext4_try_create_inline_dir()
1658 set_nlink(inode, 2); in ext4_try_create_inline_dir()
1659 inode->i_size = EXT4_I(inode)->i_disksize = inline_size; in ext4_try_create_inline_dir()
1665 struct buffer_head *ext4_find_inline_entry(struct inode *dir, in ext4_find_inline_entry()
1714 struct inode *dir, in ext4_delete_inline_entry()
1770 ext4_get_inline_entry(struct inode *inode, in ext4_get_inline_entry() argument
1778 BUG_ON(offset > ext4_get_inline_size(inode)); in ext4_get_inline_entry()
1784 inline_pos = ext4_get_inline_xattr_pos(inode, iloc); in ext4_get_inline_entry()
1786 *inline_size = ext4_get_inline_size(inode) - in ext4_get_inline_entry()
1795 bool empty_inline_dir(struct inode *dir, int *has_inline_data) in empty_inline_dir()
1821 if (!le32_to_cpu(de->inode)) { in empty_inline_dir()
1840 dir->i_ino, le32_to_cpu(de->inode), in empty_inline_dir()
1845 if (le32_to_cpu(de->inode)) { in empty_inline_dir()
1858 int ext4_destroy_inline_data(handle_t *handle, struct inode *inode) in ext4_destroy_inline_data() argument
1862 ext4_write_lock_xattr(inode, &no_expand); in ext4_destroy_inline_data()
1863 ret = ext4_destroy_inline_data_nolock(handle, inode); in ext4_destroy_inline_data()
1864 ext4_write_unlock_xattr(inode, &no_expand); in ext4_destroy_inline_data()
1869 int ext4_inline_data_iomap(struct inode *inode, struct iomap *iomap) in ext4_inline_data_iomap() argument
1875 down_read(&EXT4_I(inode)->xattr_sem); in ext4_inline_data_iomap()
1876 if (!ext4_has_inline_data(inode)) in ext4_inline_data_iomap()
1879 error = ext4_get_inode_loc(inode, &iloc); in ext4_inline_data_iomap()
1883 addr = (__u64)iloc.bh->b_blocknr << inode->i_sb->s_blocksize_bits; in ext4_inline_data_iomap()
1891 iomap->length = min_t(loff_t, ext4_get_inline_size(inode), in ext4_inline_data_iomap()
1892 i_size_read(inode)); in ext4_inline_data_iomap()
1897 up_read(&EXT4_I(inode)->xattr_sem); in ext4_inline_data_iomap()
1901 int ext4_inline_data_truncate(struct inode *inode, int *has_inline) in ext4_inline_data_truncate() argument
1916 needed_blocks = ext4_writepage_trans_blocks(inode); in ext4_inline_data_truncate()
1917 handle = ext4_journal_start(inode, EXT4_HT_INODE, needed_blocks); in ext4_inline_data_truncate()
1921 ext4_write_lock_xattr(inode, &no_expand); in ext4_inline_data_truncate()
1922 if (!ext4_has_inline_data(inode)) { in ext4_inline_data_truncate()
1923 ext4_write_unlock_xattr(inode, &no_expand); in ext4_inline_data_truncate()
1929 if ((err = ext4_orphan_add(handle, inode)) != 0) in ext4_inline_data_truncate()
1932 if ((err = ext4_get_inode_loc(inode, &is.iloc)) != 0) in ext4_inline_data_truncate()
1935 down_write(&EXT4_I(inode)->i_data_sem); in ext4_inline_data_truncate()
1936 i_size = inode->i_size; in ext4_inline_data_truncate()
1937 inline_size = ext4_get_inline_size(inode); in ext4_inline_data_truncate()
1938 EXT4_I(inode)->i_disksize = i_size; in ext4_inline_data_truncate()
1943 if ((err = ext4_xattr_ibody_find(inode, &i, &is)) != 0) in ext4_inline_data_truncate()
1955 err = ext4_xattr_ibody_get(inode, i.name_index, in ext4_inline_data_truncate()
1963 err = ext4_xattr_ibody_set(handle, inode, &i, &is); in ext4_inline_data_truncate()
1975 EXT4_I(inode)->i_inline_size = i_size < in ext4_inline_data_truncate()
1981 up_write(&EXT4_I(inode)->i_data_sem); in ext4_inline_data_truncate()
1984 ext4_write_unlock_xattr(inode, &no_expand); in ext4_inline_data_truncate()
1986 if (inode->i_nlink) in ext4_inline_data_truncate()
1987 ext4_orphan_del(handle, inode); in ext4_inline_data_truncate()
1990 inode->i_mtime = inode->i_ctime = current_time(inode); in ext4_inline_data_truncate()
1991 err = ext4_mark_inode_dirty(handle, inode); in ext4_inline_data_truncate()
1992 if (IS_SYNC(inode)) in ext4_inline_data_truncate()
1999 int ext4_convert_inline_data(struct inode *inode) in ext4_convert_inline_data() argument
2005 if (!ext4_has_inline_data(inode)) { in ext4_convert_inline_data()
2006 ext4_clear_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA); in ext4_convert_inline_data()
2008 } else if (!ext4_test_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA)) { in ext4_convert_inline_data()
2015 error = filemap_flush(inode->i_mapping); in ext4_convert_inline_data()
2018 if (!ext4_has_inline_data(inode)) in ext4_convert_inline_data()
2022 needed_blocks = ext4_writepage_trans_blocks(inode); in ext4_convert_inline_data()
2025 error = ext4_get_inode_loc(inode, &iloc); in ext4_convert_inline_data()
2029 handle = ext4_journal_start(inode, EXT4_HT_WRITE_PAGE, needed_blocks); in ext4_convert_inline_data()
2035 ext4_write_lock_xattr(inode, &no_expand); in ext4_convert_inline_data()
2036 if (ext4_has_inline_data(inode)) in ext4_convert_inline_data()
2037 error = ext4_convert_inline_data_nolock(handle, inode, &iloc); in ext4_convert_inline_data()
2038 ext4_write_unlock_xattr(inode, &no_expand); in ext4_convert_inline_data()