Lines Matching refs:dir

79 int f2fs_init_casefolded_name(const struct inode *dir,  in f2fs_init_casefolded_name()  argument
83 struct super_block *sb = dir->i_sb; in f2fs_init_casefolded_name()
85 if (IS_CASEFOLDED(dir) && in f2fs_init_casefolded_name()
107 static int __f2fs_setup_filename(const struct inode *dir, in __f2fs_setup_filename() argument
124 err = f2fs_init_casefolded_name(dir, fname); in __f2fs_setup_filename()
129 f2fs_hash_filename(dir, fname); in __f2fs_setup_filename()
140 int f2fs_setup_filename(struct inode *dir, const struct qstr *iname, in f2fs_setup_filename() argument
146 err = fscrypt_setup_filename(dir, iname, lookup, &crypt_name); in f2fs_setup_filename()
150 return __f2fs_setup_filename(dir, &crypt_name, fname); in f2fs_setup_filename()
159 int f2fs_prepare_lookup(struct inode *dir, struct dentry *dentry, in f2fs_prepare_lookup() argument
165 err = fscrypt_prepare_lookup(dir, dentry, &crypt_name); in f2fs_prepare_lookup()
169 return __f2fs_setup_filename(dir, &crypt_name, fname); in f2fs_prepare_lookup()
198 static struct f2fs_dir_entry *find_in_block(struct inode *dir, in find_in_block() argument
208 make_dentry_ptr_block(dir, &d, dentry_blk); in find_in_block()
219 static int f2fs_match_ci_name(const struct inode *dir, const struct qstr *name, in f2fs_match_ci_name() argument
222 const struct super_block *sb = dir->i_sb; in f2fs_match_ci_name()
228 if (IS_ENCRYPTED(dir)) { in f2fs_match_ci_name()
232 if (WARN_ON_ONCE(!fscrypt_has_encryption_key(dir))) in f2fs_match_ci_name()
238 res = fscrypt_fname_disk_to_usr(dir, 0, 0, &encrypted_name, in f2fs_match_ci_name()
264 static inline int f2fs_match_name(const struct inode *dir, in f2fs_match_name() argument
274 return f2fs_match_ci_name(dir, &cf, de_name, de_name_len); in f2fs_match_name()
333 static struct f2fs_dir_entry *find_in_level(struct inode *dir, in find_in_level() argument
346 nbucket = dir_buckets(level, F2FS_I(dir)->i_dir_level); in find_in_level()
349 bidx = dir_block_index(level, F2FS_I(dir)->i_dir_level, in find_in_level()
355 dentry_page = f2fs_find_data_page(dir, bidx); in find_in_level()
366 de = find_in_block(dir, dentry_page, fname, &max_slots); in find_in_level()
381 if (!de && room && F2FS_I(dir)->chash != fname->hash) { in find_in_level()
382 F2FS_I(dir)->chash = fname->hash; in find_in_level()
383 F2FS_I(dir)->clevel = level; in find_in_level()
389 struct f2fs_dir_entry *__f2fs_find_entry(struct inode *dir, in __f2fs_find_entry() argument
393 unsigned long npages = dir_blocks(dir); in __f2fs_find_entry()
400 if (f2fs_has_inline_dentry(dir)) { in __f2fs_find_entry()
401 de = f2fs_find_in_inline_dir(dir, fname, res_page); in __f2fs_find_entry()
408 max_depth = F2FS_I(dir)->i_current_depth; in __f2fs_find_entry()
410 f2fs_warn(F2FS_I_SB(dir), "Corrupted max_depth of %lu: %u", in __f2fs_find_entry()
411 dir->i_ino, max_depth); in __f2fs_find_entry()
413 f2fs_i_depth_write(dir, max_depth); in __f2fs_find_entry()
417 de = find_in_level(dir, level, fname, res_page); in __f2fs_find_entry()
424 F2FS_I(dir)->task = current; in __f2fs_find_entry()
434 struct f2fs_dir_entry *f2fs_find_entry(struct inode *dir, in f2fs_find_entry() argument
441 err = f2fs_setup_filename(dir, child, 1, &fname); in f2fs_find_entry()
450 de = __f2fs_find_entry(dir, &fname, res_page); in f2fs_find_entry()
456 struct f2fs_dir_entry *f2fs_parent_dir(struct inode *dir, struct page **p) in f2fs_parent_dir() argument
458 return f2fs_find_entry(dir, &dotdot_name, p); in f2fs_parent_dir()
461 ino_t f2fs_inode_by_name(struct inode *dir, const struct qstr *qstr, in f2fs_inode_by_name() argument
467 de = f2fs_find_entry(dir, qstr, page); in f2fs_inode_by_name()
476 void f2fs_set_link(struct inode *dir, struct f2fs_dir_entry *de, in f2fs_set_link() argument
479 enum page_type type = f2fs_has_inline_dentry(dir) ? NODE : DATA; in f2fs_set_link()
487 dir->i_mtime = dir->i_ctime = current_time(dir); in f2fs_set_link()
488 f2fs_mark_inode_dirty_sync(dir, false); in f2fs_set_link()
492 static void init_dent_inode(struct inode *dir, struct inode *inode, in init_dent_inode() argument
507 if (IS_ENCRYPTED(dir)) { in init_dent_inode()
516 if (IS_CASEFOLDED(dir)) { in init_dent_inode()
565 struct page *f2fs_init_inode_metadata(struct inode *inode, struct inode *dir, in f2fs_init_inode_metadata() argument
579 err = make_empty_dir(inode, dir, page); in f2fs_init_inode_metadata()
587 err = f2fs_init_acl(inode, dir, page, dpage); in f2fs_init_inode_metadata()
591 err = f2fs_init_security(inode, dir, in f2fs_init_inode_metadata()
602 page = f2fs_get_node_page(F2FS_I_SB(dir), inode->i_ino); in f2fs_init_inode_metadata()
607 init_dent_inode(dir, inode, fname, page); in f2fs_init_inode_metadata()
621 f2fs_remove_orphan_inode(F2FS_I_SB(dir), inode->i_ino); in f2fs_init_inode_metadata()
633 void f2fs_update_parent_metadata(struct inode *dir, struct inode *inode, in f2fs_update_parent_metadata() argument
638 f2fs_i_links_write(dir, true); in f2fs_update_parent_metadata()
641 dir->i_mtime = dir->i_ctime = current_time(dir); in f2fs_update_parent_metadata()
642 f2fs_mark_inode_dirty_sync(dir, false); in f2fs_update_parent_metadata()
644 if (F2FS_I(dir)->i_current_depth != current_depth) in f2fs_update_parent_metadata()
645 f2fs_i_depth_write(dir, current_depth); in f2fs_update_parent_metadata()
671 bool f2fs_has_enough_room(struct inode *dir, struct page *ipage, in f2fs_has_enough_room() argument
678 make_dentry_ptr_inline(dir, &d, inline_data_addr(dir, ipage)); in f2fs_has_enough_room()
707 int f2fs_add_regular_entry(struct inode *dir, const struct f2fs_filename *fname, in f2fs_add_regular_entry() argument
724 current_depth = F2FS_I(dir)->i_current_depth; in f2fs_add_regular_entry()
725 if (F2FS_I(dir)->chash == fname->hash) { in f2fs_add_regular_entry()
726 level = F2FS_I(dir)->clevel; in f2fs_add_regular_entry()
727 F2FS_I(dir)->chash = 0; in f2fs_add_regular_entry()
731 if (time_to_inject(F2FS_I_SB(dir), FAULT_DIR_DEPTH)) { in f2fs_add_regular_entry()
732 f2fs_show_injection_info(F2FS_I_SB(dir), FAULT_DIR_DEPTH); in f2fs_add_regular_entry()
743 nbucket = dir_buckets(level, F2FS_I(dir)->i_dir_level); in f2fs_add_regular_entry()
746 bidx = dir_block_index(level, F2FS_I(dir)->i_dir_level, in f2fs_add_regular_entry()
750 dentry_page = f2fs_get_new_data_page(dir, NULL, block, true); in f2fs_add_regular_entry()
771 page = f2fs_init_inode_metadata(inode, dir, fname, NULL); in f2fs_add_regular_entry()
785 f2fs_i_pino_write(inode, dir->i_ino); in f2fs_add_regular_entry()
794 f2fs_update_parent_metadata(dir, inode, current_depth); in f2fs_add_regular_entry()
804 int f2fs_add_dentry(struct inode *dir, const struct f2fs_filename *fname, in f2fs_add_dentry() argument
809 if (f2fs_has_inline_dentry(dir)) in f2fs_add_dentry()
810 err = f2fs_add_inline_entry(dir, fname, inode, ino, mode); in f2fs_add_dentry()
812 err = f2fs_add_regular_entry(dir, fname, inode, ino, mode); in f2fs_add_dentry()
814 f2fs_update_time(F2FS_I_SB(dir), REQ_TIME); in f2fs_add_dentry()
822 int f2fs_do_add_link(struct inode *dir, const struct qstr *name, in f2fs_do_add_link() argument
830 err = f2fs_setup_filename(dir, name, 0, &fname); in f2fs_do_add_link()
841 if (current != F2FS_I(dir)->task) { in f2fs_do_add_link()
842 de = __f2fs_find_entry(dir, &fname, &page); in f2fs_do_add_link()
843 F2FS_I(dir)->task = NULL; in f2fs_do_add_link()
851 err = f2fs_add_dentry(dir, &fname, inode, ino, mode); in f2fs_do_add_link()
857 int f2fs_do_tmpfile(struct inode *inode, struct inode *dir) in f2fs_do_tmpfile() argument
863 page = f2fs_init_inode_metadata(inode, dir, NULL, NULL); in f2fs_do_tmpfile()
877 void f2fs_drop_nlink(struct inode *dir, struct inode *inode) in f2fs_drop_nlink() argument
879 struct f2fs_sb_info *sbi = F2FS_I_SB(dir); in f2fs_drop_nlink()
884 f2fs_i_links_write(dir, false); in f2fs_drop_nlink()
905 struct inode *dir, struct inode *inode) in f2fs_delete_entry() argument
912 f2fs_update_time(F2FS_I_SB(dir), REQ_TIME); in f2fs_delete_entry()
914 if (F2FS_OPTION(F2FS_I_SB(dir)).fsync_mode == FSYNC_MODE_STRICT) in f2fs_delete_entry()
915 f2fs_add_ino_entry(F2FS_I_SB(dir), dir->i_ino, TRANS_DIR_INO); in f2fs_delete_entry()
917 if (f2fs_has_inline_dentry(dir)) in f2fs_delete_entry()
918 return f2fs_delete_inline_entry(dentry, page, dir, inode); in f2fs_delete_entry()
935 !f2fs_truncate_hole(dir, page->index, page->index + 1)) { in f2fs_delete_entry()
942 inode_dec_dirty_pages(dir); in f2fs_delete_entry()
943 f2fs_remove_dirty_inode(dir); in f2fs_delete_entry()
950 dir->i_ctime = dir->i_mtime = current_time(dir); in f2fs_delete_entry()
951 f2fs_mark_inode_dirty_sync(dir, false); in f2fs_delete_entry()
954 f2fs_drop_nlink(dir, inode); in f2fs_delete_entry()
957 bool f2fs_empty_dir(struct inode *dir) in f2fs_empty_dir() argument
963 unsigned long nblock = dir_blocks(dir); in f2fs_empty_dir()
965 if (f2fs_has_inline_dentry(dir)) in f2fs_empty_dir()
966 return f2fs_empty_inline_dir(dir); in f2fs_empty_dir()
969 dentry_page = f2fs_get_lock_data_page(dir, bidx, false); in f2fs_empty_dir()