struct f2fs_dir_entry *find_in_inline_dir(struct inode *dir, struct f2fs_filename *fname, struct page **res_page, unsigned int flags) { struct f2fs_sb_info *sbi = F2FS_SB(dir->i_sb); struct f2fs_inline_dentry *inline_dentry; struct qstr name = FSTR_TO_QSTR(&fname->disk_name); struct f2fs_dir_entry *de; struct f2fs_dentry_ptr d; struct page *ipage; f2fs_hash_t namehash; ipage = get_node_page(sbi, dir->i_ino); if (IS_ERR(ipage)) return NULL; namehash = f2fs_dentry_hash(&name); inline_dentry = inline_data_addr(ipage); make_dentry_ptr(NULL, &d, (void *)inline_dentry, 2); de = find_target_dentry(fname, namehash, NULL, &d, flags); unlock_page(ipage); if (de) *res_page = ipage; else f2fs_put_page(ipage, 0); /* * For the most part, it should be a bug when name_len is zero. * We stop here for figuring out where the bugs has occurred. */ f2fs_bug_on(sbi, d.max < 0); return de; }
static struct f2fs_dir_entry *find_in_block(struct page *dentry_page, struct qstr *name, int *max_slots, struct page **res_page, unsigned int flags) { struct f2fs_dentry_block *dentry_blk; struct f2fs_dir_entry *de; struct f2fs_dentry_ptr d; dentry_blk = (struct f2fs_dentry_block *)kmap(dentry_page); make_dentry_ptr(&d, (void *)dentry_blk, 1); de = find_target_dentry(name, max_slots, &d, flags); if (de) *res_page = dentry_page; else kunmap(dentry_page); /* * For the most part, it should be a bug when name_len is zero. * We stop here for figuring out where the bugs has occurred. */ f2fs_bug_on(F2FS_P_SB(dentry_page), d.max < 0); return de; }
struct f2fs_dir_entry *find_in_inline_dir(struct inode *dir, struct qstr *name, struct page **res_page) { struct f2fs_sb_info *sbi = F2FS_SB(dir->i_sb); struct f2fs_inline_dentry *inline_dentry; struct f2fs_dir_entry *de; struct f2fs_dentry_ptr d; struct page *ipage; ipage = get_node_page(sbi, dir->i_ino); if (IS_ERR(ipage)) return NULL; inline_dentry = inline_data_addr(ipage); make_dentry_ptr(&d, (void *)inline_dentry, 2); de = find_target_dentry(name, NULL, &d); unlock_page(ipage); if (de) *res_page = ipage; else f2fs_put_page(ipage, 0); /* * For the most part, it should be a bug when name_len is zero. * We stop here for figuring out where the bugs has occurred. */ f2fs_bug_on(sbi, d.max < 0); return de; }
struct f2fs_dir_entry *find_in_inline_dir(struct inode *dir, struct fscrypt_name *fname, struct page **res_page) { struct f2fs_sb_info *sbi = F2FS_SB(dir->i_sb); struct f2fs_inline_dentry *inline_dentry; struct qstr name = FSTR_TO_QSTR(&fname->disk_name); struct f2fs_dir_entry *de; struct f2fs_dentry_ptr d; struct page *ipage; f2fs_hash_t namehash; ipage = get_node_page(sbi, dir->i_ino); if (IS_ERR(ipage)) { *res_page = ipage; return NULL; } namehash = f2fs_dentry_hash(&name, fname); inline_dentry = inline_data_addr(ipage); make_dentry_ptr_inline(NULL, &d, inline_dentry); de = find_target_dentry(fname, namehash, NULL, &d); unlock_page(ipage); if (de) *res_page = ipage; else f2fs_put_page(ipage, 0); return de; }
static struct f2fs_dir_entry *find_in_block(void *block, const u8 *name, int len, f2fs_hash_t namehash, int *max_slots) { struct f2fs_dentry_ptr d; make_dentry_ptr(&d, NULL, block, 1); return find_target_dentry(name, len, namehash, max_slots, &d); }