Lines Matching refs:dir
331 struct f2fs_dir_entry *f2fs_find_in_inline_dir(struct inode *dir, in f2fs_find_in_inline_dir() argument
335 struct f2fs_sb_info *sbi = F2FS_SB(dir->i_sb); in f2fs_find_in_inline_dir()
341 ipage = f2fs_get_node_page(sbi, dir->i_ino); in f2fs_find_in_inline_dir()
347 inline_dentry = inline_data_addr(dir, ipage); in f2fs_find_in_inline_dir()
349 make_dentry_ptr_inline(dir, &d, inline_dentry); in f2fs_find_in_inline_dir()
383 static int f2fs_move_inline_dirents(struct inode *dir, struct page *ipage, in f2fs_move_inline_dirents() argument
392 page = f2fs_grab_cache_page(dir->i_mapping, 0, true); in f2fs_move_inline_dirents()
398 set_new_dnode(&dn, dir, ipage, NULL, 0); in f2fs_move_inline_dirents()
407 __func__, dir->i_ino, dn.data_blkaddr); in f2fs_move_inline_dirents()
422 make_dentry_ptr_inline(dir, &src, inline_dentry); in f2fs_move_inline_dirents()
423 make_dentry_ptr_block(dir, &dst, dentry_blk); in f2fs_move_inline_dirents()
435 f2fs_truncate_inline_inode(dir, ipage, 0); in f2fs_move_inline_dirents()
437 stat_dec_inline_dir(dir); in f2fs_move_inline_dirents()
438 clear_inode_flag(dir, FI_INLINE_DENTRY); in f2fs_move_inline_dirents()
444 if (!f2fs_sb_has_flexible_inline_xattr(F2FS_I_SB(dir)) && in f2fs_move_inline_dirents()
445 !f2fs_has_inline_xattr(dir)) in f2fs_move_inline_dirents()
446 F2FS_I(dir)->i_inline_xattr_size = 0; in f2fs_move_inline_dirents()
448 f2fs_i_depth_write(dir, 1); in f2fs_move_inline_dirents()
449 if (i_size_read(dir) < PAGE_SIZE) in f2fs_move_inline_dirents()
450 f2fs_i_size_write(dir, PAGE_SIZE); in f2fs_move_inline_dirents()
456 static int f2fs_add_inline_entries(struct inode *dir, void *inline_dentry) in f2fs_add_inline_entries() argument
462 make_dentry_ptr_inline(dir, &d, inline_dentry); in f2fs_add_inline_entries()
494 err = f2fs_add_regular_entry(dir, &fname, NULL, ino, fake_mode); in f2fs_add_inline_entries()
502 truncate_inode_pages(&dir->i_data, 0); in f2fs_add_inline_entries()
503 f2fs_truncate_blocks(dir, 0, false); in f2fs_add_inline_entries()
504 f2fs_remove_dirty_inode(dir); in f2fs_add_inline_entries()
508 static int f2fs_move_rehashed_dirents(struct inode *dir, struct page *ipage, in f2fs_move_rehashed_dirents() argument
514 backup_dentry = f2fs_kmalloc(F2FS_I_SB(dir), in f2fs_move_rehashed_dirents()
515 MAX_INLINE_DATA(dir), GFP_F2FS_ZERO); in f2fs_move_rehashed_dirents()
521 memcpy(backup_dentry, inline_dentry, MAX_INLINE_DATA(dir)); in f2fs_move_rehashed_dirents()
522 f2fs_truncate_inline_inode(dir, ipage, 0); in f2fs_move_rehashed_dirents()
526 err = f2fs_add_inline_entries(dir, backup_dentry); in f2fs_move_rehashed_dirents()
532 stat_dec_inline_dir(dir); in f2fs_move_rehashed_dirents()
533 clear_inode_flag(dir, FI_INLINE_DENTRY); in f2fs_move_rehashed_dirents()
539 if (!f2fs_sb_has_flexible_inline_xattr(F2FS_I_SB(dir)) && in f2fs_move_rehashed_dirents()
540 !f2fs_has_inline_xattr(dir)) in f2fs_move_rehashed_dirents()
541 F2FS_I(dir)->i_inline_xattr_size = 0; in f2fs_move_rehashed_dirents()
548 memcpy(inline_dentry, backup_dentry, MAX_INLINE_DATA(dir)); in f2fs_move_rehashed_dirents()
549 f2fs_i_depth_write(dir, 0); in f2fs_move_rehashed_dirents()
550 f2fs_i_size_write(dir, MAX_INLINE_DATA(dir)); in f2fs_move_rehashed_dirents()
558 static int do_convert_inline_dir(struct inode *dir, struct page *ipage, in do_convert_inline_dir() argument
561 if (!F2FS_I(dir)->i_dir_level) in do_convert_inline_dir()
562 return f2fs_move_inline_dirents(dir, ipage, inline_dentry); in do_convert_inline_dir()
564 return f2fs_move_rehashed_dirents(dir, ipage, inline_dentry); in do_convert_inline_dir()
567 int f2fs_try_convert_inline_dir(struct inode *dir, struct dentry *dentry) in f2fs_try_convert_inline_dir() argument
569 struct f2fs_sb_info *sbi = F2FS_I_SB(dir); in f2fs_try_convert_inline_dir()
575 if (!f2fs_has_inline_dentry(dir)) in f2fs_try_convert_inline_dir()
580 err = f2fs_setup_filename(dir, &dentry->d_name, 0, &fname); in f2fs_try_convert_inline_dir()
584 ipage = f2fs_get_node_page(sbi, dir->i_ino); in f2fs_try_convert_inline_dir()
590 if (f2fs_has_enough_room(dir, ipage, &fname)) { in f2fs_try_convert_inline_dir()
595 inline_dentry = inline_data_addr(dir, ipage); in f2fs_try_convert_inline_dir()
597 err = do_convert_inline_dir(dir, ipage, inline_dentry); in f2fs_try_convert_inline_dir()
607 int f2fs_add_inline_entry(struct inode *dir, const struct f2fs_filename *fname, in f2fs_add_inline_entry() argument
610 struct f2fs_sb_info *sbi = F2FS_I_SB(dir); in f2fs_add_inline_entry()
619 ipage = f2fs_get_node_page(sbi, dir->i_ino); in f2fs_add_inline_entry()
623 inline_dentry = inline_data_addr(dir, ipage); in f2fs_add_inline_entry()
624 make_dentry_ptr_inline(dir, &d, inline_dentry); in f2fs_add_inline_entry()
628 err = do_convert_inline_dir(dir, ipage, inline_dentry); in f2fs_add_inline_entry()
637 page = f2fs_init_inode_metadata(inode, dir, fname, ipage); in f2fs_add_inline_entry()
653 f2fs_i_pino_write(inode, dir->i_ino); in f2fs_add_inline_entry()
662 f2fs_update_parent_metadata(dir, inode, 0); in f2fs_add_inline_entry()
672 struct inode *dir, struct inode *inode) in f2fs_delete_inline_entry() argument
683 inline_dentry = inline_data_addr(dir, page); in f2fs_delete_inline_entry()
684 make_dentry_ptr_inline(dir, &d, inline_dentry); in f2fs_delete_inline_entry()
693 dir->i_ctime = dir->i_mtime = current_time(dir); in f2fs_delete_inline_entry()
694 f2fs_mark_inode_dirty_sync(dir, false); in f2fs_delete_inline_entry()
697 f2fs_drop_nlink(dir, inode); in f2fs_delete_inline_entry()
700 bool f2fs_empty_inline_dir(struct inode *dir) in f2fs_empty_inline_dir() argument
702 struct f2fs_sb_info *sbi = F2FS_I_SB(dir); in f2fs_empty_inline_dir()
708 ipage = f2fs_get_node_page(sbi, dir->i_ino); in f2fs_empty_inline_dir()
712 inline_dentry = inline_data_addr(dir, ipage); in f2fs_empty_inline_dir()
713 make_dentry_ptr_inline(dir, &d, inline_dentry); in f2fs_empty_inline_dir()