Lines Matching refs:dir
74 int f2fs_init_casefolded_name(const struct inode *dir, in f2fs_init_casefolded_name() argument
78 struct super_block *sb = dir->i_sb; in f2fs_init_casefolded_name()
81 if (IS_CASEFOLDED(dir)) { in f2fs_init_casefolded_name()
102 static int __f2fs_setup_filename(const struct inode *dir, in __f2fs_setup_filename() argument
119 err = f2fs_init_casefolded_name(dir, fname); in __f2fs_setup_filename()
124 f2fs_hash_filename(dir, fname); in __f2fs_setup_filename()
135 int f2fs_setup_filename(struct inode *dir, const struct qstr *iname, in f2fs_setup_filename() argument
141 err = fscrypt_setup_filename(dir, iname, lookup, &crypt_name); in f2fs_setup_filename()
145 return __f2fs_setup_filename(dir, &crypt_name, fname); in f2fs_setup_filename()
154 int f2fs_prepare_lookup(struct inode *dir, struct dentry *dentry, in f2fs_prepare_lookup() argument
160 err = fscrypt_prepare_lookup(dir, dentry, &crypt_name); in f2fs_prepare_lookup()
164 return __f2fs_setup_filename(dir, &crypt_name, fname); in f2fs_prepare_lookup()
191 static struct f2fs_dir_entry *find_in_block(struct inode *dir, in find_in_block() argument
201 make_dentry_ptr_block(dir, &d, dentry_blk); in find_in_block()
210 static bool f2fs_match_ci_name(const struct inode *dir, const struct qstr *name, in f2fs_match_ci_name() argument
213 const struct super_block *sb = dir->i_sb; in f2fs_match_ci_name()
232 static inline bool f2fs_match_name(const struct inode *dir, in f2fs_match_name() argument
242 return f2fs_match_ci_name(dir, &cf, de_name, de_name_len); in f2fs_match_name()
295 static struct f2fs_dir_entry *find_in_level(struct inode *dir, in find_in_level() argument
308 nbucket = dir_buckets(level, F2FS_I(dir)->i_dir_level); in find_in_level()
311 bidx = dir_block_index(level, F2FS_I(dir)->i_dir_level, in find_in_level()
317 dentry_page = f2fs_find_data_page(dir, bidx); in find_in_level()
328 de = find_in_block(dir, dentry_page, fname, &max_slots); in find_in_level()
339 if (!de && room && F2FS_I(dir)->chash != fname->hash) { in find_in_level()
340 F2FS_I(dir)->chash = fname->hash; in find_in_level()
341 F2FS_I(dir)->clevel = level; in find_in_level()
347 struct f2fs_dir_entry *__f2fs_find_entry(struct inode *dir, in __f2fs_find_entry() argument
351 unsigned long npages = dir_blocks(dir); in __f2fs_find_entry()
358 if (f2fs_has_inline_dentry(dir)) { in __f2fs_find_entry()
359 de = f2fs_find_in_inline_dir(dir, fname, res_page); in __f2fs_find_entry()
366 max_depth = F2FS_I(dir)->i_current_depth; in __f2fs_find_entry()
368 f2fs_warn(F2FS_I_SB(dir), "Corrupted max_depth of %lu: %u", in __f2fs_find_entry()
369 dir->i_ino, max_depth); in __f2fs_find_entry()
371 f2fs_i_depth_write(dir, max_depth); in __f2fs_find_entry()
375 de = find_in_level(dir, level, fname, res_page); in __f2fs_find_entry()
382 F2FS_I(dir)->task = current; in __f2fs_find_entry()
392 struct f2fs_dir_entry *f2fs_find_entry(struct inode *dir, in f2fs_find_entry() argument
399 err = f2fs_setup_filename(dir, child, 1, &fname); in f2fs_find_entry()
408 de = __f2fs_find_entry(dir, &fname, res_page); in f2fs_find_entry()
414 struct f2fs_dir_entry *f2fs_parent_dir(struct inode *dir, struct page **p) in f2fs_parent_dir() argument
418 return f2fs_find_entry(dir, &dotdot, p); in f2fs_parent_dir()
421 ino_t f2fs_inode_by_name(struct inode *dir, const struct qstr *qstr, in f2fs_inode_by_name() argument
427 de = f2fs_find_entry(dir, qstr, page); in f2fs_inode_by_name()
436 void f2fs_set_link(struct inode *dir, struct f2fs_dir_entry *de, in f2fs_set_link() argument
439 enum page_type type = f2fs_has_inline_dentry(dir) ? NODE : DATA; in f2fs_set_link()
446 dir->i_mtime = dir->i_ctime = current_time(dir); in f2fs_set_link()
447 f2fs_mark_inode_dirty_sync(dir, false); in f2fs_set_link()
502 struct page *f2fs_init_inode_metadata(struct inode *inode, struct inode *dir, in f2fs_init_inode_metadata() argument
516 err = make_empty_dir(inode, dir, page); in f2fs_init_inode_metadata()
524 err = f2fs_init_acl(inode, dir, page, dpage); in f2fs_init_inode_metadata()
528 err = f2fs_init_security(inode, dir, in f2fs_init_inode_metadata()
539 page = f2fs_get_node_page(F2FS_I_SB(dir), inode->i_ino); in f2fs_init_inode_metadata()
546 if (IS_ENCRYPTED(dir)) in f2fs_init_inode_metadata()
562 f2fs_remove_orphan_inode(F2FS_I_SB(dir), inode->i_ino); in f2fs_init_inode_metadata()
574 void f2fs_update_parent_metadata(struct inode *dir, struct inode *inode, in f2fs_update_parent_metadata() argument
579 f2fs_i_links_write(dir, true); in f2fs_update_parent_metadata()
582 dir->i_mtime = dir->i_ctime = current_time(dir); in f2fs_update_parent_metadata()
583 f2fs_mark_inode_dirty_sync(dir, false); in f2fs_update_parent_metadata()
585 if (F2FS_I(dir)->i_current_depth != current_depth) in f2fs_update_parent_metadata()
586 f2fs_i_depth_write(dir, current_depth); in f2fs_update_parent_metadata()
612 bool f2fs_has_enough_room(struct inode *dir, struct page *ipage, in f2fs_has_enough_room() argument
619 make_dentry_ptr_inline(dir, &d, inline_data_addr(dir, ipage)); in f2fs_has_enough_room()
648 int f2fs_add_regular_entry(struct inode *dir, const struct f2fs_filename *fname, in f2fs_add_regular_entry() argument
665 current_depth = F2FS_I(dir)->i_current_depth; in f2fs_add_regular_entry()
666 if (F2FS_I(dir)->chash == fname->hash) { in f2fs_add_regular_entry()
667 level = F2FS_I(dir)->clevel; in f2fs_add_regular_entry()
668 F2FS_I(dir)->chash = 0; in f2fs_add_regular_entry()
672 if (time_to_inject(F2FS_I_SB(dir), FAULT_DIR_DEPTH)) { in f2fs_add_regular_entry()
673 f2fs_show_injection_info(F2FS_I_SB(dir), FAULT_DIR_DEPTH); in f2fs_add_regular_entry()
684 nbucket = dir_buckets(level, F2FS_I(dir)->i_dir_level); in f2fs_add_regular_entry()
687 bidx = dir_block_index(level, F2FS_I(dir)->i_dir_level, in f2fs_add_regular_entry()
691 dentry_page = f2fs_get_new_data_page(dir, NULL, block, true); in f2fs_add_regular_entry()
712 page = f2fs_init_inode_metadata(inode, dir, fname, NULL); in f2fs_add_regular_entry()
726 f2fs_i_pino_write(inode, dir->i_ino); in f2fs_add_regular_entry()
735 f2fs_update_parent_metadata(dir, inode, current_depth); in f2fs_add_regular_entry()
745 int f2fs_add_dentry(struct inode *dir, const struct f2fs_filename *fname, in f2fs_add_dentry() argument
750 if (f2fs_has_inline_dentry(dir)) in f2fs_add_dentry()
751 err = f2fs_add_inline_entry(dir, fname, inode, ino, mode); in f2fs_add_dentry()
753 err = f2fs_add_regular_entry(dir, fname, inode, ino, mode); in f2fs_add_dentry()
755 f2fs_update_time(F2FS_I_SB(dir), REQ_TIME); in f2fs_add_dentry()
763 int f2fs_do_add_link(struct inode *dir, const struct qstr *name, in f2fs_do_add_link() argument
771 err = f2fs_setup_filename(dir, name, 0, &fname); in f2fs_do_add_link()
782 if (current != F2FS_I(dir)->task) { in f2fs_do_add_link()
783 de = __f2fs_find_entry(dir, &fname, &page); in f2fs_do_add_link()
784 F2FS_I(dir)->task = NULL; in f2fs_do_add_link()
792 err = f2fs_add_dentry(dir, &fname, inode, ino, mode); in f2fs_do_add_link()
798 int f2fs_do_tmpfile(struct inode *inode, struct inode *dir) in f2fs_do_tmpfile() argument
804 page = f2fs_init_inode_metadata(inode, dir, NULL, NULL); in f2fs_do_tmpfile()
818 void f2fs_drop_nlink(struct inode *dir, struct inode *inode) in f2fs_drop_nlink() argument
820 struct f2fs_sb_info *sbi = F2FS_I_SB(dir); in f2fs_drop_nlink()
825 f2fs_i_links_write(dir, false); in f2fs_drop_nlink()
846 struct inode *dir, struct inode *inode) in f2fs_delete_entry() argument
853 f2fs_update_time(F2FS_I_SB(dir), REQ_TIME); in f2fs_delete_entry()
855 if (F2FS_OPTION(F2FS_I_SB(dir)).fsync_mode == FSYNC_MODE_STRICT) in f2fs_delete_entry()
856 f2fs_add_ino_entry(F2FS_I_SB(dir), dir->i_ino, TRANS_DIR_INO); in f2fs_delete_entry()
858 if (f2fs_has_inline_dentry(dir)) in f2fs_delete_entry()
859 return f2fs_delete_inline_entry(dentry, page, dir, inode); in f2fs_delete_entry()
876 !f2fs_truncate_hole(dir, page->index, page->index + 1)) { in f2fs_delete_entry()
882 inode_dec_dirty_pages(dir); in f2fs_delete_entry()
883 f2fs_remove_dirty_inode(dir); in f2fs_delete_entry()
887 dir->i_ctime = dir->i_mtime = current_time(dir); in f2fs_delete_entry()
888 f2fs_mark_inode_dirty_sync(dir, false); in f2fs_delete_entry()
891 f2fs_drop_nlink(dir, inode); in f2fs_delete_entry()
894 bool f2fs_empty_dir(struct inode *dir) in f2fs_empty_dir() argument
900 unsigned long nblock = dir_blocks(dir); in f2fs_empty_dir()
902 if (f2fs_has_inline_dentry(dir)) in f2fs_empty_dir()
903 return f2fs_empty_inline_dir(dir); in f2fs_empty_dir()
906 dentry_page = f2fs_get_lock_data_page(dir, bidx, false); in f2fs_empty_dir()