Whamcloud - gitweb
367fe7518112c1914086dc3052c3854b67025ef1
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / rhel8.3 / 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 Index: linux-4.18.0-80.1.2.el8_0/fs/ext4/ext4.h
11 ===================================================================
12 --- linux-4.18.0-80.1.2.el8_0.orig/fs/ext4/ext4.h
13 +++ linux-4.18.0-80.1.2.el8_0/fs/ext4/ext4.h
14 @@ -1591,6 +1591,8 @@ static inline void ext4_clear_state_flag
15   */
16  #define NEXT_ORPHAN(inode) EXT4_I(inode)->i_dtime
17  
18 +#define JOURNAL_START_HAS_3ARGS        1
19 +
20  /*
21   * Codes for operating systems
22   */
23 @@ -1805,7 +1807,21 @@ static inline bool ext4_has_unknown_ext#
24  
25  EXTN_FEATURE_FUNCS(2)
26  EXTN_FEATURE_FUNCS(3)
27 -EXTN_FEATURE_FUNCS(4)
28 +static inline bool ext4_has_unknown_ext4_compat_features(struct super_block *sb)
29 +{
30 +       return ((EXT4_SB(sb)->s_es->s_feature_compat &
31 +               cpu_to_le32(~EXT4_FEATURE_COMPAT_SUPP)) != 0);
32 +}
33 +static inline bool ext4_has_unknown_ext4_ro_compat_features(struct super_block *sb)
34 +{
35 +       return ((EXT4_SB(sb)->s_es->s_feature_ro_compat &
36 +               cpu_to_le32(~EXT4_FEATURE_RO_COMPAT_SUPP)) != 0);
37 +}
38 +static inline bool ext4_has_unknown_ext4_incompat_features(struct super_block *sb)
39 +{
40 +       return ((EXT4_SB(sb)->s_es->s_feature_incompat &
41 +               cpu_to_le32(~EXT4_FEATURE_INCOMPAT_SUPP)) != 0);
42 +}
43  
44  static inline bool ext4_has_compat_features(struct super_block *sb)
45  {
46 @@ -3111,6 +3127,13 @@ struct ext4_extent;
47  
48  extern int ext4_ext_tree_init(handle_t *handle, struct inode *);
49  extern int ext4_ext_writepage_trans_blocks(struct inode *, int);
50 +extern struct buffer_head *ext4_read_inode_bitmap(struct super_block *sb,
51 +                                                 ext4_group_t block_group);
52 +extern void ext4_inc_count(handle_t *handle, struct inode *inode);
53 +extern void ext4_dec_count(handle_t *handle, struct inode *inode);
54 +extern struct buffer_head *ext4_append(handle_t *handle,
55 +                                      struct inode *inode,
56 +                                      ext4_lblk_t *block);
57  extern int ext4_ext_index_trans_blocks(struct inode *inode, int extents);
58  extern int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
59                                struct ext4_map_blocks *map, int flags);
60 Index: linux-4.18.0-80.1.2.el8_0/fs/ext4/ialloc.c
61 ===================================================================
62 --- linux-4.18.0-80.1.2.el8_0.orig/fs/ext4/ialloc.c
63 +++ linux-4.18.0-80.1.2.el8_0/fs/ext4/ialloc.c
64 @@ -114,7 +114,7 @@ verified:
65   *
66   * Return buffer_head of bitmap on success or NULL.
67   */
68 -static struct buffer_head *
69 +struct buffer_head *
70  ext4_read_inode_bitmap(struct super_block *sb, ext4_group_t block_group)
71  {
72         struct ext4_group_desc *desc;
73 @@ -211,6 +211,7 @@ out:
74         put_bh(bh);
75         return ERR_PTR(err);
76  }
77 +EXPORT_SYMBOL(ext4_read_inode_bitmap);
78  
79  /*
80   * NOTE! When we get the inode, we're the only people
81 Index: linux-4.18.0-240.1.1.el8/fs/ext4/inode.c
82 ===================================================================
83 --- linux-4.18.0-240.1.1.el8.orig/fs/ext4/inode.c
84 +++ linux-4.18.0-240.1.1.el8/fs/ext4/inode.c
85 @@ -6343,3 +6343,20 @@ vm_fault_t ext4_filemap_fault(struct vm_
86  
87         return ret;
88  }
89 +EXPORT_SYMBOL(ext4_map_blocks);
90 +EXPORT_SYMBOL(ext4_truncate);
91 +EXPORT_SYMBOL(__ext4_iget);
92 +EXPORT_SYMBOL(ext4_bread);
93 +EXPORT_SYMBOL(ext4_itable_unused_count);
94 +EXPORT_SYMBOL(ext4_force_commit);
95 +EXPORT_SYMBOL(ext4_mark_inode_dirty);
96 +EXPORT_SYMBOL(ext4_get_group_desc);
97 +EXPORT_SYMBOL(__ext4_journal_get_write_access);
98 +EXPORT_SYMBOL(__ext4_journal_start_sb);
99 +EXPORT_SYMBOL(__ext4_journal_stop);
100 +EXPORT_SYMBOL(__ext4_handle_dirty_metadata);
101 +EXPORT_SYMBOL(__ext4_std_error);
102 +EXPORT_SYMBOL(ext4fs_dirhash);
103 +EXPORT_SYMBOL(ext4_get_inode_loc);
104 +EXPORT_SYMBOL(__ext4_journal_ensure_credits);
105 +EXPORT_SYMBOL(ext4_chunk_trans_blocks);
106 Index: linux-stage/fs/ext4/namei.c
107 ===================================================================
108 --- linux-stage.orig/fs/ext4/namei.c
109 +++ linux-stage/fs/ext4/namei.c
110 @@ -49,7 +49,7 @@
111  #define NAMEI_RA_BLOCKS  4
112  #define NAMEI_RA_SIZE       (NAMEI_RA_CHUNKS * NAMEI_RA_BLOCKS)
113  
114 -static struct buffer_head *ext4_append(handle_t *handle,
115 +struct buffer_head *ext4_append(handle_t *handle,
116                                         struct inode *inode,
117                                         ext4_lblk_t *block)
118  {
119 @@ -160,6 +160,7 @@ static struct buffer_head *__ext4_read_d
120         }
121         return bh;
122  }
123 +EXPORT_SYMBOL(ext4_append);
124  
125  #ifndef assert
126  #define assert(test) J_ASSERT(test)
127 @@ -2415,23 +2416,25 @@ EXPORT_SYMBOL(ext4_delete_entry);
128   * for checking S_ISDIR(inode) (since the INODE_INDEX feature will not be set
129   * on regular files) and to avoid creating huge/slow non-HTREE directories.
130   */
131 -static void ext4_inc_count(handle_t *handle, struct inode *inode)
132 +void ext4_inc_count(handle_t *handle, struct inode *inode)
133  {
134         inc_nlink(inode);
135         if (is_dx(inode) &&
136             (inode->i_nlink > EXT4_LINK_MAX || inode->i_nlink == 2))
137                 set_nlink(inode, 1);
138  }
139 +EXPORT_SYMBOL(ext4_inc_count);
140  
141  /*
142   * If a directory had nlink == 1, then we should let it be 1. This indicates
143   * directory has >EXT4_LINK_MAX subdirs.
144   */
145 -static void ext4_dec_count(handle_t *handle, struct inode *inode)
146 +void ext4_dec_count(handle_t *handle, struct inode *inode)
147  {
148         if (!S_ISDIR(inode->i_mode) || inode->i_nlink > 2)
149                 drop_nlink(inode);
150  }
151 +EXPORT_SYMBOL(ext4_dec_count);
152  
153  
154  static int ext4_add_nondir(handle_t *handle,
155 Index: linux-4.18.0-240.1.1.el8/fs/ext4/super.c
156 ===================================================================
157 --- linux-4.18.0-240.1.1.el8.orig/fs/ext4/super.c
158 +++ linux-4.18.0-240.1.1.el8/fs/ext4/super.c
159 @@ -366,7 +366,7 @@ static void __save_error_info(struct sup
160                 return;
161         es->s_state |= cpu_to_le16(EXT4_ERROR_FS);
162         ext4_update_tstamp(es, s_last_error_time);
163 -       strncpy(es->s_last_error_func, func, sizeof(es->s_last_error_func));
164 +       strlcpy(es->s_last_error_func, func, sizeof(es->s_last_error_func));
165         es->s_last_error_line = cpu_to_le32(line);
166         es->s_last_error_ino = cpu_to_le32(ino);
167         es->s_last_error_block = cpu_to_le64(block);
168 @@ -427,7 +427,7 @@ static void __save_error_info(struct sup
169         if (!es->s_first_error_time) {
170                 es->s_first_error_time = es->s_last_error_time;
171                 es->s_first_error_time_hi = es->s_last_error_time_hi;
172 -               strncpy(es->s_first_error_func, func,
173 +               strlcpy(es->s_first_error_func, func,
174                         sizeof(es->s_first_error_func));
175                 es->s_first_error_line = cpu_to_le32(line);
176                 es->s_first_error_ino = es->s_last_error_ino;
177 @@ -6152,16 +6152,12 @@ static int __init ext4_init_fs(void)
178         err = init_inodecache();
179         if (err)
180                 goto out1;
181 -       register_as_ext3();
182 -       register_as_ext2();
183         err = register_filesystem(&ext4_fs_type);
184         if (err)
185                 goto out;
186  
187         return 0;
188  out:
189 -       unregister_as_ext2();
190 -       unregister_as_ext3();
191         destroy_inodecache();
192  out1:
193         ext4_exit_mballoc();
194 @@ -6182,8 +6178,6 @@ out6:
195  static void __exit ext4_exit_fs(void)
196  {
197         ext4_destroy_lazyinit_thread();
198 -       unregister_as_ext2();
199 -       unregister_as_ext3();
200         unregister_filesystem(&ext4_fs_type);
201         destroy_inodecache();
202         ext4_exit_mballoc();