f2fs: introduce f2fs_dentry_ptr structure for code clean-up
This patch introduces f2fs_dentry_ptr structure for the use of a function parameter in inline_dentry operations. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
@@ -265,8 +265,8 @@ struct f2fs_dir_entry *find_in_inline_dir(struct inode *dir,
|
||||
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;
|
||||
int max_slots = NR_INLINE_DENTRY;
|
||||
|
||||
ipage = get_node_page(sbi, dir->i_ino);
|
||||
if (IS_ERR(ipage))
|
||||
@@ -274,9 +274,9 @@ struct f2fs_dir_entry *find_in_inline_dir(struct inode *dir,
|
||||
|
||||
inline_dentry = inline_data_addr(ipage);
|
||||
|
||||
de = find_target_dentry(name, &max_slots, &inline_dentry->dentry_bitmap,
|
||||
inline_dentry->dentry,
|
||||
inline_dentry->filename);
|
||||
make_dentry_ptr(&d, (void *)inline_dentry, 2);
|
||||
de = find_target_dentry(name, NULL, &d);
|
||||
|
||||
unlock_page(ipage);
|
||||
if (de)
|
||||
*res_page = ipage;
|
||||
@@ -287,7 +287,7 @@ struct f2fs_dir_entry *find_in_inline_dir(struct inode *dir,
|
||||
* 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, max_slots < 0);
|
||||
f2fs_bug_on(sbi, d.max < 0);
|
||||
return de;
|
||||
}
|
||||
|
||||
@@ -519,6 +519,7 @@ int f2fs_read_inline_dir(struct file *file, struct dir_context *ctx)
|
||||
struct inode *inode = file_inode(file);
|
||||
struct f2fs_inline_dentry *inline_dentry = NULL;
|
||||
struct page *ipage = NULL;
|
||||
struct f2fs_dentry_ptr d;
|
||||
|
||||
if (ctx->pos == NR_INLINE_DENTRY)
|
||||
return 0;
|
||||
@@ -529,10 +530,9 @@ int f2fs_read_inline_dir(struct file *file, struct dir_context *ctx)
|
||||
|
||||
inline_dentry = inline_data_addr(ipage);
|
||||
|
||||
if (!f2fs_fill_dentries(ctx, &inline_dentry->dentry_bitmap,
|
||||
inline_dentry->dentry,
|
||||
inline_dentry->filename,
|
||||
NR_INLINE_DENTRY, 0))
|
||||
make_dentry_ptr(&d, (void *)inline_dentry, 2);
|
||||
|
||||
if (!f2fs_fill_dentries(ctx, &d, 0))
|
||||
ctx->pos = NR_INLINE_DENTRY;
|
||||
|
||||
f2fs_put_page(ipage, 1);
|
||||
|
Reference in New Issue
Block a user