Lines Matching refs:dir
334 struct f2fs_dir_entry *f2fs_find_in_inline_dir(struct inode *dir, in f2fs_find_in_inline_dir() argument
338 struct f2fs_sb_info *sbi = F2FS_SB(dir->i_sb); in f2fs_find_in_inline_dir()
344 ipage = f2fs_get_node_page(sbi, dir->i_ino); in f2fs_find_in_inline_dir()
350 inline_dentry = inline_data_addr(dir, ipage); in f2fs_find_in_inline_dir()
352 make_dentry_ptr_inline(dir, &d, inline_dentry); in f2fs_find_in_inline_dir()
390 static int f2fs_move_inline_dirents(struct inode *dir, struct page *ipage, in f2fs_move_inline_dirents() argument
399 page = f2fs_grab_cache_page(dir->i_mapping, 0, true); in f2fs_move_inline_dirents()
405 set_new_dnode(&dn, dir, ipage, NULL, 0); in f2fs_move_inline_dirents()
414 __func__, dir->i_ino, dn.data_blkaddr); in f2fs_move_inline_dirents()
430 make_dentry_ptr_inline(dir, &src, inline_dentry); in f2fs_move_inline_dirents()
431 make_dentry_ptr_block(dir, &dst, dentry_blk); in f2fs_move_inline_dirents()
443 f2fs_truncate_inline_inode(dir, ipage, 0); in f2fs_move_inline_dirents()
445 stat_dec_inline_dir(dir); in f2fs_move_inline_dirents()
446 clear_inode_flag(dir, FI_INLINE_DENTRY); in f2fs_move_inline_dirents()
452 if (!f2fs_sb_has_flexible_inline_xattr(F2FS_I_SB(dir)) && in f2fs_move_inline_dirents()
453 !f2fs_has_inline_xattr(dir)) in f2fs_move_inline_dirents()
454 F2FS_I(dir)->i_inline_xattr_size = 0; in f2fs_move_inline_dirents()
456 f2fs_i_depth_write(dir, 1); in f2fs_move_inline_dirents()
457 if (i_size_read(dir) < PAGE_SIZE) in f2fs_move_inline_dirents()
458 f2fs_i_size_write(dir, PAGE_SIZE); in f2fs_move_inline_dirents()
464 static int f2fs_add_inline_entries(struct inode *dir, void *inline_dentry) in f2fs_add_inline_entries() argument
470 make_dentry_ptr_inline(dir, &d, inline_dentry); in f2fs_add_inline_entries()
502 err = f2fs_add_regular_entry(dir, &fname, NULL, ino, fake_mode); in f2fs_add_inline_entries()
510 truncate_inode_pages(&dir->i_data, 0); in f2fs_add_inline_entries()
511 f2fs_truncate_blocks(dir, 0, false); in f2fs_add_inline_entries()
512 f2fs_remove_dirty_inode(dir); in f2fs_add_inline_entries()
516 static int f2fs_move_rehashed_dirents(struct inode *dir, struct page *ipage, in f2fs_move_rehashed_dirents() argument
522 backup_dentry = f2fs_kmalloc(F2FS_I_SB(dir), in f2fs_move_rehashed_dirents()
523 MAX_INLINE_DATA(dir), GFP_F2FS_ZERO); in f2fs_move_rehashed_dirents()
529 memcpy(backup_dentry, inline_dentry, MAX_INLINE_DATA(dir)); in f2fs_move_rehashed_dirents()
530 f2fs_truncate_inline_inode(dir, ipage, 0); in f2fs_move_rehashed_dirents()
534 err = f2fs_add_inline_entries(dir, backup_dentry); in f2fs_move_rehashed_dirents()
540 stat_dec_inline_dir(dir); in f2fs_move_rehashed_dirents()
541 clear_inode_flag(dir, FI_INLINE_DENTRY); in f2fs_move_rehashed_dirents()
547 if (!f2fs_sb_has_flexible_inline_xattr(F2FS_I_SB(dir)) && in f2fs_move_rehashed_dirents()
548 !f2fs_has_inline_xattr(dir)) in f2fs_move_rehashed_dirents()
549 F2FS_I(dir)->i_inline_xattr_size = 0; in f2fs_move_rehashed_dirents()
556 memcpy(inline_dentry, backup_dentry, MAX_INLINE_DATA(dir)); in f2fs_move_rehashed_dirents()
557 f2fs_i_depth_write(dir, 0); in f2fs_move_rehashed_dirents()
558 f2fs_i_size_write(dir, MAX_INLINE_DATA(dir)); in f2fs_move_rehashed_dirents()
566 static int do_convert_inline_dir(struct inode *dir, struct page *ipage, in do_convert_inline_dir() argument
569 if (!F2FS_I(dir)->i_dir_level) in do_convert_inline_dir()
570 return f2fs_move_inline_dirents(dir, ipage, inline_dentry); in do_convert_inline_dir()
572 return f2fs_move_rehashed_dirents(dir, ipage, inline_dentry); in do_convert_inline_dir()
575 int f2fs_try_convert_inline_dir(struct inode *dir, struct dentry *dentry) in f2fs_try_convert_inline_dir() argument
577 struct f2fs_sb_info *sbi = F2FS_I_SB(dir); in f2fs_try_convert_inline_dir()
583 if (!f2fs_has_inline_dentry(dir)) in f2fs_try_convert_inline_dir()
588 err = f2fs_setup_filename(dir, &dentry->d_name, 0, &fname); in f2fs_try_convert_inline_dir()
592 ipage = f2fs_get_node_page(sbi, dir->i_ino); in f2fs_try_convert_inline_dir()
598 if (f2fs_has_enough_room(dir, ipage, &fname)) { in f2fs_try_convert_inline_dir()
603 inline_dentry = inline_data_addr(dir, ipage); in f2fs_try_convert_inline_dir()
605 err = do_convert_inline_dir(dir, ipage, inline_dentry); in f2fs_try_convert_inline_dir()
615 int f2fs_add_inline_entry(struct inode *dir, const struct f2fs_filename *fname, in f2fs_add_inline_entry() argument
618 struct f2fs_sb_info *sbi = F2FS_I_SB(dir); in f2fs_add_inline_entry()
627 ipage = f2fs_get_node_page(sbi, dir->i_ino); in f2fs_add_inline_entry()
631 inline_dentry = inline_data_addr(dir, ipage); in f2fs_add_inline_entry()
632 make_dentry_ptr_inline(dir, &d, inline_dentry); in f2fs_add_inline_entry()
636 err = do_convert_inline_dir(dir, ipage, inline_dentry); in f2fs_add_inline_entry()
645 page = f2fs_init_inode_metadata(inode, dir, fname, ipage); in f2fs_add_inline_entry()
661 f2fs_i_pino_write(inode, dir->i_ino); in f2fs_add_inline_entry()
670 f2fs_update_parent_metadata(dir, inode, 0); in f2fs_add_inline_entry()
680 struct inode *dir, struct inode *inode) in f2fs_delete_inline_entry() argument
691 inline_dentry = inline_data_addr(dir, page); in f2fs_delete_inline_entry()
692 make_dentry_ptr_inline(dir, &d, inline_dentry); in f2fs_delete_inline_entry()
701 dir->i_ctime = dir->i_mtime = current_time(dir); in f2fs_delete_inline_entry()
702 f2fs_mark_inode_dirty_sync(dir, false); in f2fs_delete_inline_entry()
705 f2fs_drop_nlink(dir, inode); in f2fs_delete_inline_entry()
708 bool f2fs_empty_inline_dir(struct inode *dir) in f2fs_empty_inline_dir() argument
710 struct f2fs_sb_info *sbi = F2FS_I_SB(dir); in f2fs_empty_inline_dir()
716 ipage = f2fs_get_node_page(sbi, dir->i_ino); in f2fs_empty_inline_dir()
720 inline_dentry = inline_data_addr(dir, ipage); in f2fs_empty_inline_dir()
721 make_dentry_ptr_inline(dir, &d, inline_dentry); in f2fs_empty_inline_dir()