ext4: let ext4_rename handle inline dir

In case we rename a directory, ext4_rename has to read the dir block
and change its dotdot's information.  The old ext4_rename encapsulated
the dir_block read into itself.  So this patch adds a new function
ext4_get_first_dir_block() which gets the dir buffer information so
the ext4_rename can handle it properly.  As it will also change the
parent inode number, we return the parent_de so that ext4_rename() can
handle it more easily.

ext4_find_entry is also changed so that the caller(rename) can tell
whether the found entry is an inlined one or not and journaling the
corresponding buffer head.

Signed-off-by: Tao Ma <boyu.mt@taobao.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
This commit is contained in:
Tao Ma
2012-12-10 14:06:01 -05:00
committed by Theodore Ts'o
parent 61f86638d8
commit 32f7f22c0b
3 changed files with 100 additions and 35 deletions

View File

@@ -181,6 +181,9 @@ extern int ext4_delete_inline_entry(handle_t *handle,
struct buffer_head *bh,
int *has_inline_data);
extern int empty_inline_dir(struct inode *dir, int *has_inline_data);
extern struct buffer_head *ext4_get_first_inline_block(struct inode *inode,
struct ext4_dir_entry_2 **parent_de,
int *retval);
# else /* CONFIG_EXT4_FS_XATTR */
static inline int
@@ -387,6 +390,14 @@ static inline int empty_inline_dir(struct inode *dir, int *has_inline_data)
{
return 0;
}
static inline struct buffer_head *
ext4_get_first_inline_block(struct inode *inode,
struct ext4_dir_entry_2 **parent_de,
int *retval)
{
return NULL;
}
# endif /* CONFIG_EXT4_FS_XATTR */
#ifdef CONFIG_EXT4_FS_SECURITY