Whamcloud - gitweb
LU-6030 ldiskfs: split pdirop patch
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / rhel7 / ext4-osd-iop-common.patch
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,
17                       char *search_buf,
18                       int buf_size,
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 *
24         return -ENOENT;
25  }
26  
27 -static int ext4_delete_entry(handle_t *handle,
28 +int ext4_delete_entry(handle_t *handle,
29                              struct inode *dir,
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);
34         return err;
35  }
36 -
37 +EXPORT_SYMBOL(ext4_delete_entry);
38  /*
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
42         return err;
43  }
44  
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)
48 +{
49 +       struct inode *inode;
50 +
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;
56 +#endif
57 +               } else {
58 +                       inode->i_op = &ext4_file_inode_operations;
59 +                       inode->i_fop = &ext4_file_operations;
60 +                       ext4_set_aops(inode);
61 +               }
62 +       }
63 +       return inode;
64 +}
65 +EXPORT_SYMBOL(ext4_create_inode);
66 +
67  /*
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:
71         return err;
72  }
73  
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)
78 +{
79 +       if (IS_ERR(handle))
80 +               return PTR_ERR(handle);
81 +
82 +       if (IS_DIRSYNC(dir))
83 +               ext4_handle_sync(handle);
84 +
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);
88 +}
89 +EXPORT_SYMBOL(ext4_add_dot_dotdot);
90 +
91  static int ext4_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
92  {
93         handle_t *handle;