Whamcloud - gitweb
LU-17705 ptlrpc: replace synchronize_rcu() with rcu_barrier()
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / linux-5.8 / ext4-misc.patch
1 commit b175e2441b0cd9fae60341ba92b0f7f192e71446
2 Author: girish <girish>
3
4 b=16893
5 i=adilger
6 i=johann
7
8 ext4 ldiskfs patches for rhel5
9
10 ---
11  fs/ext4/ext4.h   |   23 ++++++++++++++++++++++-
12  fs/ext4/ext4_jbd2.c | 1 +
13  fs/ext4/ialloc.c |    3 ++-
14  fs/ext4/inode.c  |   15 +++++++++++++++
15  fs/ext4/namei.c  |    9 ++++++---
16  fs/ext4/super.c  |   10 ++--------
17  5 files changed, 48 insertions(+), 13 deletions(-)
18
19 diff -ur a/fs/ext4/ext4.h b/fs/ext4/ext4.h
20 --- a/fs/ext4/ext4.h    2021-06-28 08:45:39.093954644 -0600
21 +++ b/fs/ext4/ext4.h    2021-06-28 08:46:06.913523572 -0600
22 @@ -1995,7 +1997,21 @@
23  
24  EXTN_FEATURE_FUNCS(2)
25  EXTN_FEATURE_FUNCS(3)
26 -EXTN_FEATURE_FUNCS(4)
27 +static inline bool ext4_has_unknown_ext4_compat_features(struct super_block *sb)
28 +{
29 +       return ((EXT4_SB(sb)->s_es->s_feature_compat &
30 +               cpu_to_le32(~EXT4_FEATURE_COMPAT_SUPP)) != 0);
31 +}
32 +static inline bool ext4_has_unknown_ext4_ro_compat_features(struct super_block *sb)
33 +{
34 +       return ((EXT4_SB(sb)->s_es->s_feature_ro_compat &
35 +               cpu_to_le32(~EXT4_FEATURE_RO_COMPAT_SUPP)) != 0);
36 +}
37 +static inline bool ext4_has_unknown_ext4_incompat_features(struct super_block *sb)
38 +{
39 +       return ((EXT4_SB(sb)->s_es->s_feature_incompat &
40 +               cpu_to_le32(~EXT4_FEATURE_INCOMPAT_SUPP)) != 0);
41 +}
42  
43  static inline bool ext4_has_compat_features(struct super_block *sb)
44  {
45 @@ -3399,6 +3415,13 @@
46  #define EXT_MAX_BLOCKS 0xffffffff
47  
48  extern void ext4_ext_tree_init(handle_t *handle, struct inode *inode);
49 +extern struct buffer_head *ext4_read_inode_bitmap(struct super_block *sb,
50 +                                                 ext4_group_t block_group);
51 +extern void ext4_inc_count(handle_t *handle, struct inode *inode);
52 +extern void ext4_dec_count(handle_t *handle, struct inode *inode);
53 +extern struct buffer_head *ext4_append(handle_t *handle,
54 +                                      struct inode *inode,
55 +                                      ext4_lblk_t *block);
56  extern int ext4_ext_index_trans_blocks(struct inode *inode, int extents);
57  extern int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
58                                struct ext4_map_blocks *map, int flags);
59 diff -ur a/fs/ext4/ext4_jbd2.c b/fs/ext4/ext4_jbd2.c
60 --- a/fs/ext4/ext4_jbd2.c       2021-06-28 08:45:38.905957595 -0600
61 +++ b/fs/ext4/ext4_jbd2.c       2021-06-28 08:49:18.306817373 -0600
62 @@ -169,6 +169,7 @@
63         revoke_cred = max(0, revoke_cred - handle->h_revoke_credits);
64         return ext4_journal_extend(handle, extend_cred, revoke_cred);
65  }
66 +EXPORT_SYMBOL(__ext4_journal_ensure_credits);
67  
68  static void ext4_journal_abort_handle(const char *caller, unsigned int line,
69                                       const char *err_fn,
70 diff -ur a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
71 --- a/fs/ext4/ialloc.c  2021-06-28 08:45:38.993956213 -0600
72 +++ b/fs/ext4/ialloc.c  2021-06-28 08:46:06.917523511 -0600
73 @@ -115,7 +115,7 @@
74   *
75   * Return buffer_head of bitmap on success, or an ERR_PTR on error.
76   */
77 -static struct buffer_head *
78 +struct buffer_head *
79  ext4_read_inode_bitmap(struct super_block *sb, ext4_group_t block_group)
80  {
81         struct ext4_group_desc *desc;
82 @@ -214,6 +214,7 @@
83         put_bh(bh);
84         return ERR_PTR(err);
85  }
86 +EXPORT_SYMBOL(ext4_read_inode_bitmap);
87  
88  /*
89   * NOTE! When we get the inode, we're the only people
90 diff -ur a/fs/ext4/inode.c b/fs/ext4/inode.c
91 --- a/fs/ext4/inode.c   2021-06-28 08:45:39.069955021 -0600
92 +++ b/fs/ext4/inode.c   2021-06-28 08:46:06.921523449 -0600
93 @@ -6088,3 +6088,19 @@
94  
95         return ret;
96  }
97 +EXPORT_SYMBOL(ext4_map_blocks);
98 +EXPORT_SYMBOL(ext4_truncate);
99 +EXPORT_SYMBOL(ext4_iget);
100 +EXPORT_SYMBOL(ext4_bread);
101 +EXPORT_SYMBOL(ext4_itable_unused_count);
102 +EXPORT_SYMBOL(ext4_force_commit);
103 +EXPORT_SYMBOL(__ext4_mark_inode_dirty);
104 +EXPORT_SYMBOL(ext4_get_group_desc);
105 +EXPORT_SYMBOL(__ext4_journal_get_write_access);
106 +EXPORT_SYMBOL(__ext4_journal_start_sb);
107 +EXPORT_SYMBOL(__ext4_journal_stop);
108 +EXPORT_SYMBOL(__ext4_handle_dirty_metadata);
109 +EXPORT_SYMBOL(__ext4_std_error);
110 +EXPORT_SYMBOL(ext4fs_dirhash);
111 +EXPORT_SYMBOL(ext4_get_inode_loc);
112 +EXPORT_SYMBOL(ext4_chunk_trans_blocks);
113 diff -ur a/fs/ext4/namei.c b/fs/ext4/namei.c
114 --- a/fs/ext4/namei.c   2021-06-28 08:45:39.093954644 -0600
115 +++ b/fs/ext4/namei.c   2021-06-28 08:46:06.921523449 -0600
116 @@ -50,7 +50,7 @@
117  #define NAMEI_RA_BLOCKS  4
118  #define NAMEI_RA_SIZE       (NAMEI_RA_CHUNKS * NAMEI_RA_BLOCKS)
119  
120 -static struct buffer_head *ext4_append(handle_t *handle,
121 +struct buffer_head *ext4_append(handle_t *handle,
122                                         struct inode *inode,
123                                         ext4_lblk_t *block)
124  {
125 @@ -181,6 +181,7 @@
126         }
127         return bh;
128  }
129 +EXPORT_SYMBOL(ext4_append);
130  
131  #ifndef assert
132  #define assert(test) J_ASSERT(test)
133 @@ -2584,23 +2585,25 @@
134   * for checking S_ISDIR(inode) (since the INODE_INDEX feature will not be set
135   * on regular files) and to avoid creating huge/slow non-HTREE directories.
136   */
137 -static void ext4_inc_count(handle_t *handle, struct inode *inode)
138 +void ext4_inc_count(handle_t *handle, struct inode *inode)
139  {
140         inc_nlink(inode);
141         if (is_dx(inode) &&
142             (inode->i_nlink > EXT4_LINK_MAX || inode->i_nlink == 2))
143                 set_nlink(inode, 1);
144  }
145 +EXPORT_SYMBOL(ext4_inc_count);
146  
147  /*
148   * If a directory had nlink == 1, then we should let it be 1. This indicates
149   * directory has >EXT4_LINK_MAX subdirs.
150   */
151 -static void ext4_dec_count(handle_t *handle, struct inode *inode)
152 +void ext4_dec_count(handle_t *handle, struct inode *inode)
153  {
154         if (!S_ISDIR(inode->i_mode) || inode->i_nlink > 2)
155                 drop_nlink(inode);
156  }
157 +EXPORT_SYMBOL(ext4_dec_count);
158  
159  
160  /*
161 diff -ur a/fs/ext4/super.c b/fs/ext4/super.c
162 --- a/fs/ext4/super.c   2021-06-28 08:45:38.909957532 -0600
163 +++ b/fs/ext4/super.c   2021-06-28 08:46:06.921523449 -0600
164 @@ -348,7 +348,7 @@
165                 return;
166         es->s_state |= cpu_to_le16(EXT4_ERROR_FS);
167         ext4_update_tstamp(es, s_last_error_time);
168 -       strncpy(es->s_last_error_func, func, sizeof(es->s_last_error_func));
169 +       strlcpy(es->s_last_error_func, func, sizeof(es->s_last_error_func));
170         es->s_last_error_line = cpu_to_le32(line);
171         es->s_last_error_ino = cpu_to_le32(ino);
172         es->s_last_error_block = cpu_to_le64(block);
173 @@ -409,7 +409,7 @@
174         if (!es->s_first_error_time) {
175                 es->s_first_error_time = es->s_last_error_time;
176                 es->s_first_error_time_hi = es->s_last_error_time_hi;
177 -               strncpy(es->s_first_error_func, func,
178 +               strlcpy(es->s_first_error_func, func,
179                         sizeof(es->s_first_error_func));
180                 es->s_first_error_line = cpu_to_le32(line);
181                 es->s_first_error_ino = es->s_last_error_ino;
182 @@ -6382,16 +6382,12 @@
183         err = init_inodecache();
184         if (err)
185                 goto out1;
186 -       register_as_ext3();
187 -       register_as_ext2();
188         err = register_filesystem(&ext4_fs_type);
189         if (err)
190                 goto out;
191  
192         return 0;
193  out:
194 -       unregister_as_ext2();
195 -       unregister_as_ext3();
196         destroy_inodecache();
197  out1:
198         ext4_exit_mballoc();
199 @@ -6414,8 +6410,6 @@
200  static void __exit ext4_exit_fs(void)
201  {
202         ext4_destroy_lazyinit_thread();
203 -       unregister_as_ext2();
204 -       unregister_as_ext3();
205         unregister_filesystem(&ext4_fs_type);
206         destroy_inodecache();
207         ext4_exit_mballoc();