Whamcloud - gitweb
LU-15801 ldiskfs: Server support for RHEL9
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / linux-5.16 / ext4-misc.patch
1 diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
2 index d7332df..d04d87c 100644
3 --- a/fs/ext4/ext4.h
4 +++ b/fs/ext4/ext4.h
5 @@ -1956,6 +1956,8 @@ static inline bool ext4_verity_in_progress(struct inode *inode)
6  
7  #define NEXT_ORPHAN(inode) EXT4_I(inode)->i_dtime
8  
9 +#define JOURNAL_START_HAS_3ARGS        1
10 +
11  /*
12   * Codes for operating systems
13   */
14 @@ -2202,7 +2204,21 @@ static inline bool ext4_has_unknown_ext##ver##_incompat_features(struct super_bl
15  
16  EXTN_FEATURE_FUNCS(2)
17  EXTN_FEATURE_FUNCS(3)
18 -EXTN_FEATURE_FUNCS(4)
19 +static inline bool ext4_has_unknown_ext4_compat_features(struct super_block *sb)
20 +{
21 +       return ((EXT4_SB(sb)->s_es->s_feature_compat &
22 +               cpu_to_le32(~EXT4_FEATURE_COMPAT_SUPP)) != 0);
23 +}
24 +static inline bool ext4_has_unknown_ext4_ro_compat_features(struct super_block *sb)
25 +{
26 +       return ((EXT4_SB(sb)->s_es->s_feature_ro_compat &
27 +               cpu_to_le32(~EXT4_FEATURE_RO_COMPAT_SUPP)) != 0);
28 +}
29 +static inline bool ext4_has_unknown_ext4_incompat_features(struct super_block *sb)
30 +{
31 +       return ((EXT4_SB(sb)->s_es->s_feature_incompat &
32 +               cpu_to_le32(~EXT4_FEATURE_INCOMPAT_SUPP)) != 0);
33 +}
34  
35  static inline bool ext4_has_compat_features(struct super_block *sb)
36  {
37 @@ -3724,6 +3740,13 @@ struct ext4_extent;
38  #define EXT_MAX_BLOCKS 0xffffffff
39  
40  extern void ext4_ext_tree_init(handle_t *handle, struct inode *inode);
41 +extern struct buffer_head *ext4_read_inode_bitmap(struct super_block *sb,
42 +                                                 ext4_group_t block_group);
43 +extern void ext4_inc_count(struct inode *inode);
44 +extern void ext4_dec_count(struct inode *inode);
45 +extern struct buffer_head *ext4_append(handle_t *handle,
46 +                                      struct inode *inode,
47 +                                      ext4_lblk_t *block);
48  extern int ext4_ext_index_trans_blocks(struct inode *inode, int extents);
49  extern int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
50                                struct ext4_map_blocks *map, int flags);
51 diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
52 index 5d0a11d..4840190 100644
53 --- a/fs/ext4/ialloc.c
54 +++ b/fs/ext4/ialloc.c
55 @@ -120,7 +120,7 @@ verified:
56   *
57   * Return buffer_head of bitmap on success, or an ERR_PTR on error.
58   */
59 -static struct buffer_head *
60 +struct buffer_head *
61  ext4_read_inode_bitmap(struct super_block *sb, ext4_group_t block_group)
62  {
63         struct ext4_group_desc *desc;
64 @@ -215,6 +215,7 @@ out:
65         put_bh(bh);
66         return ERR_PTR(err);
67  }
68 +EXPORT_SYMBOL(ext4_read_inode_bitmap);
69  
70  /*
71   * NOTE! When we get the inode, we're the only people
72 diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
73 index f0206e2..88e82d6 100644
74 --- a/fs/ext4/inode.c
75 +++ b/fs/ext4/inode.c
76 @@ -6145,3 +6145,19 @@ out_error:
77         ext4_journal_stop(handle);
78         goto out;
79  }
80 +EXPORT_SYMBOL(ext4_map_blocks);
81 +EXPORT_SYMBOL(ext4_truncate);
82 +EXPORT_SYMBOL(ext4_iget);
83 +EXPORT_SYMBOL(ext4_bread);
84 +EXPORT_SYMBOL(ext4_itable_unused_count);
85 +EXPORT_SYMBOL(ext4_force_commit);
86 +EXPORT_SYMBOL(__ext4_mark_inode_dirty);
87 +EXPORT_SYMBOL(ext4_get_group_desc);
88 +EXPORT_SYMBOL(__ext4_journal_get_write_access);
89 +EXPORT_SYMBOL(__ext4_journal_start_sb);
90 +EXPORT_SYMBOL(__ext4_journal_stop);
91 +EXPORT_SYMBOL(__ext4_handle_dirty_metadata);
92 +EXPORT_SYMBOL(__ext4_std_error);
93 +EXPORT_SYMBOL(ext4fs_dirhash);
94 +EXPORT_SYMBOL(ext4_get_inode_loc);
95 +EXPORT_SYMBOL(__ext4_journal_ensure_credits);
96 diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
97 index 249836e..627b9eb 100644
98 --- a/fs/ext4/namei.c
99 +++ b/fs/ext4/namei.c
100 @@ -50,7 +50,7 @@
101  #define NAMEI_RA_BLOCKS  4
102  #define NAMEI_RA_SIZE       (NAMEI_RA_CHUNKS * NAMEI_RA_BLOCKS)
103  
104 -static struct buffer_head *ext4_append(handle_t *handle,
105 +struct buffer_head *ext4_append(handle_t *handle,
106                                         struct inode *inode,
107                                         ext4_lblk_t *block)
108  {
109 @@ -182,6 +182,7 @@ static struct buffer_head *__ext4_read_dirblock(struct inode *inode,
110         }
111         return bh;
112  }
113 +EXPORT_SYMBOL(ext4_append);
114  
115  #ifdef DX_DEBUG
116  #define dxtrace(command) command
117 @@ -2703,23 +2704,25 @@ out:
118   * for checking S_ISDIR(inode) (since the INODE_INDEX feature will not be set
119   * on regular files) and to avoid creating huge/slow non-HTREE directories.
120   */
121 -static void ext4_inc_count(struct inode *inode)
122 +void ext4_inc_count(struct inode *inode)
123  {
124         inc_nlink(inode);
125         if (is_dx(inode) &&
126             (inode->i_nlink > EXT4_LINK_MAX || inode->i_nlink == 2))
127                 set_nlink(inode, 1);
128  }
129 +EXPORT_SYMBOL(ext4_inc_count);
130  
131  /*
132   * If a directory had nlink == 1, then we should let it be 1. This indicates
133   * directory has >EXT4_LINK_MAX subdirs.
134   */
135 -static void ext4_dec_count(struct inode *inode)
136 +void ext4_dec_count(struct inode *inode)
137  {
138         if (!S_ISDIR(inode->i_mode) || inode->i_nlink > 2)
139                 drop_nlink(inode);
140  }
141 +EXPORT_SYMBOL(ext4_dec_count);
142  
143  
144  /*
145 diff --git a/fs/ext4/super.c b/fs/ext4/super.c
146 index 24a7ad8..b8a9fce 100644
147 --- a/fs/ext4/super.c
148 +++ b/fs/ext4/super.c
149 @@ -5429,7 +5429,7 @@ static void ext4_update_super(struct super_block *sb)
150                         __ext4_update_tstamp(&es->s_first_error_time,
151                                              &es->s_first_error_time_hi,
152                                              sbi->s_first_error_time);
153 -                       strncpy(es->s_first_error_func, sbi->s_first_error_func,
154 +                       strlcpy(es->s_first_error_func, sbi->s_first_error_func,
155                                 sizeof(es->s_first_error_func));
156                         es->s_first_error_line =
157                                 cpu_to_le32(sbi->s_first_error_line);
158 @@ -5443,7 +5443,7 @@ static void ext4_update_super(struct super_block *sb)
159                 __ext4_update_tstamp(&es->s_last_error_time,
160                                      &es->s_last_error_time_hi,
161                                      sbi->s_last_error_time);
162 -               strncpy(es->s_last_error_func, sbi->s_last_error_func,
163 +               strlcpy(es->s_last_error_func, sbi->s_last_error_func,
164                         sizeof(es->s_last_error_func));
165                 es->s_last_error_line = cpu_to_le32(sbi->s_last_error_line);
166                 es->s_last_error_ino = cpu_to_le32(sbi->s_last_error_ino);
167 @@ -6652,16 +6652,12 @@ static int __init ext4_init_fs(void)
168         if (err)
169                 goto out05;
170  
171 -       register_as_ext3();
172 -       register_as_ext2();
173         err = register_filesystem(&ext4_fs_type);
174         if (err)
175                 goto out;
176  
177         return 0;
178  out:
179 -       unregister_as_ext2();
180 -       unregister_as_ext3();
181         ext4_fc_destroy_dentry_cache();
182  out05:
183         destroy_inodecache();
184 @@ -6686,8 +6682,6 @@ out7:
185  static void __exit ext4_exit_fs(void)
186  {
187         ext4_destroy_lazyinit_thread();
188 -       unregister_as_ext2();
189 -       unregister_as_ext3();
190         unregister_filesystem(&ext4_fs_type);
191         ext4_fc_destroy_dentry_cache();
192         destroy_inodecache();
193 diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
194 index 1e0fc1e..379c59c 100644
195 --- a/fs/ext4/xattr.c
196 +++ b/fs/ext4/xattr.c
197 @@ -656,6 +656,7 @@ ext4_xattr_get(struct inode *inode, int name_index, const char *name,
198         up_read(&EXT4_I(inode)->xattr_sem);
199         return error;
200  }
201 +EXPORT_SYMBOL(ext4_xattr_get);
202  
203  static int
204  ext4_xattr_list_entries(struct dentry *dentry, struct ext4_xattr_entry *entry,
205 @@ -2416,6 +2417,7 @@ cleanup:
206         ext4_write_unlock_xattr(inode, &no_expand);
207         return error;
208  }
209 +EXPORT_SYMBOL(ext4_xattr_set_handle);
210  
211  int ext4_xattr_set_credits(struct inode *inode, size_t value_len,
212                            bool is_create, int *credits)
213 -- 
214 2.27.0
215