Whamcloud - gitweb
LU-17606 ldiskfs: remove old compatibility code
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / ubuntu20.04.3 / ext4-misc.patch
1 diff -ur a/fs/ext4/ext4.h b/fs/ext4/ext4.h
2 --- a/fs/ext4/ext4.h    2022-03-24 16:23:11.725060881 -0600
3 +++ b/fs/ext4/ext4.h    2022-03-24 16:24:35.400642866 -0600
4 @@ -2121,7 +2123,21 @@
5  
6  EXTN_FEATURE_FUNCS(2)
7  EXTN_FEATURE_FUNCS(3)
8 -EXTN_FEATURE_FUNCS(4)
9 +static inline bool ext4_has_unknown_ext4_compat_features(struct super_block *sb)
10 +{
11 +       return ((EXT4_SB(sb)->s_es->s_feature_compat &
12 +               cpu_to_le32(~EXT4_FEATURE_COMPAT_SUPP)) != 0);
13 +}
14 +static inline bool ext4_has_unknown_ext4_ro_compat_features(struct super_block *sb)
15 +{
16 +       return ((EXT4_SB(sb)->s_es->s_feature_ro_compat &
17 +               cpu_to_le32(~EXT4_FEATURE_RO_COMPAT_SUPP)) != 0);
18 +}
19 +static inline bool ext4_has_unknown_ext4_incompat_features(struct super_block *sb)
20 +{
21 +       return ((EXT4_SB(sb)->s_es->s_feature_incompat &
22 +               cpu_to_le32(~EXT4_FEATURE_INCOMPAT_SUPP)) != 0);
23 +}
24  
25  static inline bool ext4_has_compat_features(struct super_block *sb)
26  {
27 @@ -3594,6 +3610,13 @@
28  #define EXT_MAX_BLOCKS 0xffffffff
29  
30  extern void ext4_ext_tree_init(handle_t *handle, struct inode *inode);
31 +extern struct buffer_head *ext4_read_inode_bitmap(struct super_block *sb,
32 +                                                 ext4_group_t block_group);
33 +extern void ext4_inc_count(struct inode *inode);
34 +extern void ext4_dec_count(struct inode *inode);
35 +extern struct buffer_head *ext4_append(handle_t *handle,
36 +                                      struct inode *inode,
37 +                                      ext4_lblk_t *block);
38  extern int ext4_ext_index_trans_blocks(struct inode *inode, int extents);
39  extern int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
40                                struct ext4_map_blocks *map, int flags);
41 diff -ur a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
42 --- a/fs/ext4/ialloc.c  2022-03-24 16:23:11.713060939 -0600
43 +++ b/fs/ext4/ialloc.c  2022-03-24 16:24:35.404642846 -0600
44 @@ -120,7 +120,7 @@
45   *
46   * Return buffer_head of bitmap on success, or an ERR_PTR on error.
47   */
48 -static struct buffer_head *
49 +struct buffer_head *
50  ext4_read_inode_bitmap(struct super_block *sb, ext4_group_t block_group)
51  {
52         struct ext4_group_desc *desc;
53 @@ -215,6 +215,7 @@
54         put_bh(bh);
55         return ERR_PTR(err);
56  }
57 +EXPORT_SYMBOL(ext4_read_inode_bitmap);
58  
59  /*
60   * NOTE! When we get the inode, we're the only people
61 diff -ur a/fs/ext4/inode.c b/fs/ext4/inode.c
62 --- a/fs/ext4/inode.c   2022-03-24 16:23:11.721060900 -0600
63 +++ b/fs/ext4/inode.c   2022-03-24 16:24:35.412642805 -0600
64 @@ -6222,3 +6222,20 @@
65  
66         return ret;
67  }
68 +EXPORT_SYMBOL(ext4_map_blocks);
69 +EXPORT_SYMBOL(ext4_truncate);
70 +EXPORT_SYMBOL(ext4_iget);
71 +EXPORT_SYMBOL(ext4_bread);
72 +EXPORT_SYMBOL(ext4_itable_unused_count);
73 +EXPORT_SYMBOL(ext4_force_commit);
74 +EXPORT_SYMBOL(__ext4_mark_inode_dirty);
75 +EXPORT_SYMBOL(ext4_get_group_desc);
76 +EXPORT_SYMBOL(__ext4_journal_get_write_access);
77 +EXPORT_SYMBOL(__ext4_journal_start_sb);
78 +EXPORT_SYMBOL(__ext4_journal_stop);
79 +EXPORT_SYMBOL(__ext4_handle_dirty_metadata);
80 +EXPORT_SYMBOL(__ext4_std_error);
81 +EXPORT_SYMBOL(ext4fs_dirhash);
82 +EXPORT_SYMBOL(ext4_get_inode_loc);
83 +EXPORT_SYMBOL(__ext4_journal_ensure_credits);
84 +EXPORT_SYMBOL(ext4_chunk_trans_blocks);
85 diff -ur a/fs/ext4/namei.c b/fs/ext4/namei.c
86 --- a/fs/ext4/namei.c   2022-03-24 16:23:11.725060881 -0600
87 +++ b/fs/ext4/namei.c   2022-03-24 16:24:35.420642764 -0600
88 @@ -50,7 +50,7 @@
89  #define NAMEI_RA_BLOCKS  4
90  #define NAMEI_RA_SIZE       (NAMEI_RA_CHUNKS * NAMEI_RA_BLOCKS)
91  
92 -static struct buffer_head *ext4_append(handle_t *handle,
93 +struct buffer_head *ext4_append(handle_t *handle,
94                                         struct inode *inode,
95                                         ext4_lblk_t *block)
96  {
97 @@ -79,6 +79,8 @@
98         return bh;
99  }
100  
101 +#define assert(test) J_ASSERT(test)
102 +
103  static int ext4_dx_csum_verify(struct inode *inode,
104                                struct ext4_dir_entry *dirent);
105  
106 @@ -181,6 +183,7 @@
107         }
108         return bh;
109  }
110 +EXPORT_SYMBOL(ext4_append);
111  
112  #ifdef DX_DEBUG
113  #define dxtrace(command) command
114 @@ -2568,23 +2571,25 @@
115   * for checking S_ISDIR(inode) (since the INODE_INDEX feature will not be set
116   * on regular files) and to avoid creating huge/slow non-HTREE directories.
117   */
118 -static void ext4_inc_count(struct inode *inode)
119 +void ext4_inc_count(struct inode *inode)
120  {
121         inc_nlink(inode);
122         if (is_dx(inode) &&
123             (inode->i_nlink > EXT4_LINK_MAX || inode->i_nlink == 2))
124                 set_nlink(inode, 1);
125  }
126 +EXPORT_SYMBOL(ext4_inc_count);
127  
128  /*
129   * If a directory had nlink == 1, then we should let it be 1. This indicates
130   * directory has >EXT4_LINK_MAX subdirs.
131   */
132 -static void ext4_dec_count(struct inode *inode)
133 +void ext4_dec_count(struct inode *inode)
134  {
135         if (!S_ISDIR(inode->i_mode) || inode->i_nlink > 2)
136                 drop_nlink(inode);
137  }
138 +EXPORT_SYMBOL(ext4_dec_count);
139  
140  
141  /*
142 diff -ur a/fs/ext4/super.c b/fs/ext4/super.c
143 --- a/fs/ext4/super.c   2022-03-24 16:23:11.601061482 -0600
144 +++ b/fs/ext4/super.c   2022-03-24 16:24:35.424642743 -0600
145 @@ -5557,7 +5557,7 @@
146                         __ext4_update_tstamp(&es->s_first_error_time,
147                                              &es->s_first_error_time_hi,
148                                              sbi->s_first_error_time);
149 -                       strncpy(es->s_first_error_func, sbi->s_first_error_func,
150 +                       strlcpy(es->s_first_error_func, sbi->s_first_error_func,
151                                 sizeof(es->s_first_error_func));
152                         es->s_first_error_line =
153                                 cpu_to_le32(sbi->s_first_error_line);
154 @@ -5571,7 +5571,7 @@
155                 __ext4_update_tstamp(&es->s_last_error_time,
156                                      &es->s_last_error_time_hi,
157                                      sbi->s_last_error_time);
158 -               strncpy(es->s_last_error_func, sbi->s_last_error_func,
159 +               strlcpy(es->s_last_error_func, sbi->s_last_error_func,
160                         sizeof(es->s_last_error_func));
161                 es->s_last_error_line = cpu_to_le32(sbi->s_last_error_line);
162                 es->s_last_error_ino = cpu_to_le32(sbi->s_last_error_ino);
163 @@ -6760,16 +6760,12 @@
164         if (err)
165                 goto out05;
166  
167 -       register_as_ext3();
168 -       register_as_ext2();
169         err = register_filesystem(&ext4_fs_type);
170         if (err)
171                 goto out;
172  
173         return 0;
174  out:
175 -       unregister_as_ext2();
176 -       unregister_as_ext3();
177  out05:
178         destroy_inodecache();
179  out1:
180 @@ -6793,8 +6789,6 @@
181  static void __exit ext4_exit_fs(void)
182  {
183         ext4_destroy_lazyinit_thread();
184 -       unregister_as_ext2();
185 -       unregister_as_ext3();
186         unregister_filesystem(&ext4_fs_type);
187         destroy_inodecache();
188         ext4_exit_mballoc();