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