Whamcloud - gitweb
LU-5022 ldiskfs: enable support for RHEL7
[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,19 @@ 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_add_entry(handle_t *handle, struct dentry *dentry,
12 +                         struct inode *inode);
13 +extern int ext4_delete_entry(handle_t *handle, struct inode * dir,
14 +                            struct ext4_dir_entry_2 * de_del,
15 +                            struct buffer_head * bh);
16 +extern struct buffer_head * ext4_find_entry(struct inode *dir,
17 +                                           const struct qstr *d_name,
18 +                                           struct ext4_dir_entry_2 ** res_dir,
19 +                                           int *inlined);
20 +extern int ext4_add_dot_dotdot(handle_t *handle, struct inode *dir,
21 +                              struct inode *inode);
22  extern int search_dir(struct buffer_head *bh,
23                       char *search_buf,
24                       int buf_size,
25 Index: linux-3.10.0-123.13.2.el7.x86_64/fs/ext4/namei.c
26 ===================================================================
27 --- linux-3.10.0-123.13.2.el7.x86_64.orig/fs/ext4/namei.c
28 +++ linux-3.10.0-123.13.2.el7.x86_64/fs/ext4/namei.c
29 @@ -1211,7 +1211,7 @@ static int is_dx_internal_node(struct in
30   * The returned buffer_head has ->b_count elevated.  The caller is expected
31   * to brelse() it when appropriate.
32   */
33 -static struct buffer_head * ext4_find_entry (struct inode *dir,
34 +struct buffer_head * ext4_find_entry(struct inode *dir,
35                                         const struct qstr *d_name,
36                                         struct ext4_dir_entry_2 **res_dir,
37                                         int *inlined)
38 @@ -1355,6 +1355,7 @@ cleanup_and_exit:
39                 brelse(bh_use[ra_ptr]);
40         return ret;
41  }
42 +EXPORT_SYMBOL(ext4_find_entry);
43  
44  static struct buffer_head * ext4_dx_find_entry(struct inode *dir, const struct qstr *d_name,
45                        struct ext4_dir_entry_2 **res_dir, int *err)
46 @@ -1903,8 +1904,8 @@ static int make_indexed_dir(handle_t *ha
47   * may not sleep between calling this and putting something into
48   * the entry, as someone else might have used it while you slept.
49   */
50 -static int ext4_add_entry(handle_t *handle, struct dentry *dentry,
51 -                         struct inode *inode)
52 +int ext4_add_entry(handle_t *handle, struct dentry *dentry,
53 +                  struct inode *inode)
54  {
55         struct inode *dir = dentry->d_parent->d_inode;
56         struct buffer_head *bh;
57 @@ -1979,6 +1980,7 @@ static int ext4_add_entry(handle_t *hand
58                 ext4_set_inode_state(inode, EXT4_STATE_NEWENTRY);
59         return retval;
60  }
61 +EXPORT_SYMBOL(ext4_add_entry);
62  
63  /*
64   * Returns 0 for success, or a negative error value
65 @@ -2165,7 +2167,7 @@ int ext4_generic_delete_entry(handle_t *
66         return -ENOENT;
67  }
68  
69 -static int ext4_delete_entry(handle_t *handle,
70 +int ext4_delete_entry(handle_t *handle,
71                              struct inode *dir,
72                              struct ext4_dir_entry_2 *de_del,
73                              struct buffer_head *bh)
74 @@ -2206,7 +2208,7 @@ out:
75                 ext4_std_error(dir->i_sb, err);
76         return err;
77  }
78 -
79 +EXPORT_SYMBOL(ext4_delete_entry);
80  /*
81   * DIR_NLINK feature is set if 1) nlinks > EXT4_LINK_MAX or 2) nlinks == 2,
82   * since this indicates that nlinks count was previously 1.
83 @@ -2253,6 +2255,28 @@ static int ext4_add_nondir(handle_t *han
84         return err;
85  }
86  
87 + /* Return locked inode, then the caller can modify the inode's states/flags
88 +  * before others finding it. The caller should unlock the inode by itself. */
89 +struct inode * ext4_create_inode(handle_t *handle, struct inode * dir, int mode)
90 +{
91 +       struct inode *inode;
92 +
93 +       inode = ext4_new_inode(handle, dir, mode, NULL, 0, NULL);
94 +       if (!IS_ERR(inode)) {
95 +               if (S_ISCHR(mode) || S_ISBLK(mode) || S_ISFIFO(mode)) {
96 +#ifdef CONFIG_LDISKFS_FS_XATTR
97 +                       inode->i_op = &ext4_special_inode_operations;
98 +#endif
99 +               } else {
100 +                       inode->i_op = &ext4_file_inode_operations;
101 +                       inode->i_fop = &ext4_file_operations;
102 +                       ext4_set_aops(inode);
103 +               }
104 +       }
105 +       return inode;
106 +}
107 +EXPORT_SYMBOL(ext4_create_inode);
108 +
109  /*
110   * By the time this is called, we already have created
111   * the directory cache entry for the new file, but it
112 @@ -2402,6 +2426,23 @@ out:
113         return err;
114  }
115  
116 +/* Initialize @inode as a subdirectory of @dir, and add the
117 + * "." and ".." entries into the first directory block. */
118 +int ext4_add_dot_dotdot(handle_t *handle, struct inode * dir,
119 +                       struct inode *inode)
120 +{
121 +       if (IS_ERR(handle))
122 +               return PTR_ERR(handle);
123 +
124 +       if (IS_DIRSYNC(dir))
125 +               ext4_handle_sync(handle);
126 +
127 +       inode->i_op = &ext4_dir_inode_operations.ops;
128 +       inode->i_fop = &ext4_dir_operations;
129 +       return ext4_init_new_dir(handle, dir, inode);
130 +}
131 +EXPORT_SYMBOL(ext4_add_dot_dotdot);
132 +
133  static int ext4_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
134  {
135         handle_t *handle;