1 Index: linux-3.10.0-123.13.2.el7.x86_64/fs/ext4/ext4.h
2 ===================================================================
3 --- linux-3.10.0-123.13.2.el7.x86_64.orig/fs/ext4/ext4.h
4 +++ linux-3.10.0-123.13.2.el7.x86_64/fs/ext4/ext4.h
5 @@ -2145,6 +2145,13 @@ extern int ext4_orphan_add(handle_t *, s
6 extern int ext4_orphan_del(handle_t *, struct inode *);
7 extern int ext4_htree_fill_tree(struct file *dir_file, __u32 start_hash,
8 __u32 start_minor_hash, __u32 *next_hash);
9 +extern struct inode *ext4_create_inode(handle_t *handle,
10 + struct inode * dir, int mode);
11 +extern int ext4_delete_entry(handle_t *handle, struct inode * dir,
12 + struct ext4_dir_entry_2 * de_del,
13 + struct buffer_head * bh);
14 +extern int ext4_add_dot_dotdot(handle_t *handle, struct inode *dir,
15 + struct inode *inode);
16 extern int search_dir(struct buffer_head *bh,
19 Index: linux-3.10.0-123.13.2.el7.x86_64/fs/ext4/namei.c
20 ===================================================================
21 --- linux-3.10.0-123.13.2.el7.x86_64.orig/fs/ext4/namei.c
22 +++ linux-3.10.0-123.13.2.el7.x86_64/fs/ext4/namei.c
23 @@ -2165,7 +2167,7 @@ int ext4_generic_delete_entry(handle_t *
27 -static int ext4_delete_entry(handle_t *handle,
28 +int ext4_delete_entry(handle_t *handle,
30 struct ext4_dir_entry_2 *de_del,
31 struct buffer_head *bh)
32 @@ -2206,7 +2208,7 @@ out:
33 ext4_std_error(dir->i_sb, err);
37 +EXPORT_SYMBOL(ext4_delete_entry);
39 * DIR_NLINK feature is set if 1) nlinks > EXT4_LINK_MAX or 2) nlinks == 2,
40 * since this indicates that nlinks count was previously 1.
41 @@ -2253,6 +2255,28 @@ static int ext4_add_nondir(handle_t *han
45 + /* Return locked inode, then the caller can modify the inode's states/flags
46 + * before others finding it. The caller should unlock the inode by itself. */
47 +struct inode * ext4_create_inode(handle_t *handle, struct inode * dir, int mode)
49 + struct inode *inode;
51 + inode = ext4_new_inode(handle, dir, mode, NULL, 0, NULL);
52 + if (!IS_ERR(inode)) {
53 + if (S_ISCHR(mode) || S_ISBLK(mode) || S_ISFIFO(mode)) {
54 +#ifdef CONFIG_LDISKFS_FS_XATTR
55 + inode->i_op = &ext4_special_inode_operations;
58 + inode->i_op = &ext4_file_inode_operations;
59 + inode->i_fop = &ext4_file_operations;
60 + ext4_set_aops(inode);
65 +EXPORT_SYMBOL(ext4_create_inode);
68 * By the time this is called, we already have created
69 * the directory cache entry for the new file, but it
70 @@ -2402,6 +2426,23 @@ out:
74 +/* Initialize @inode as a subdirectory of @dir, and add the
75 + * "." and ".." entries into the first directory block. */
76 +int ext4_add_dot_dotdot(handle_t *handle, struct inode * dir,
77 + struct inode *inode)
80 + return PTR_ERR(handle);
82 + if (IS_DIRSYNC(dir))
83 + ext4_handle_sync(handle);
85 + inode->i_op = &ext4_dir_inode_operations.ops;
86 + inode->i_fop = &ext4_dir_operations;
87 + return ext4_init_new_dir(handle, dir, inode);
89 +EXPORT_SYMBOL(ext4_add_dot_dotdot);
91 static int ext4_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)