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