add patch handle-symlink-properly-with-inline_data
[ext4-patch-queue.git] / add-missing-BUFFER_TRACE-before-ext4_journal_get_write_access
blob4176301371905c98ace44fe4861f96b74f769f67
1 ext4: add missing BUFFER_TRACE before ext4_journal_get_write_access
3 From: liang xie <xieliang007@gmail.com>
5 Make them more consistently
7 Signed-off-by: xieliang <xieliang@xiaomi.com>
8 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
9 ---
10  fs/ext4/extents.c     |  1 +
11  fs/ext4/file.c        |  1 +
12  fs/ext4/inline.c      |  5 +++++
13  fs/ext4/inode.c       |  3 +++
14  fs/ext4/mballoc.c     |  2 ++
15  fs/ext4/move_extent.c |  1 +
16  fs/ext4/namei.c       |  2 ++
17  fs/ext4/resize.c      | 13 +++++++++++++
18  fs/ext4/super.c       |  1 +
19  fs/ext4/xattr.c       |  4 ++++
20  10 files changed, 33 insertions(+)
22 diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
23 index 662e94c..5bbe4256 100644
24 --- a/fs/ext4/extents.c
25 +++ b/fs/ext4/extents.c
26 @@ -143,6 +143,7 @@ static int ext4_ext_get_access(handle_t *handle, struct inode *inode,
27  {
28         if (path->p_bh) {
29                 /* path points to block */
30 +               BUFFER_TRACE(path->p_bh, "get_write_access");
31                 return ext4_journal_get_write_access(handle, path->p_bh);
32         }
33         /* path points to leaf/index in inode body */
34 diff --git a/fs/ext4/file.c b/fs/ext4/file.c
35 index 2389c4e..4e8bc284 100644
36 --- a/fs/ext4/file.c
37 +++ b/fs/ext4/file.c
38 @@ -244,6 +244,7 @@ static int ext4_file_open(struct inode * inode, struct file * filp)
39                         handle = ext4_journal_start_sb(sb, EXT4_HT_MISC, 1);
40                         if (IS_ERR(handle))
41                                 return PTR_ERR(handle);
42 +                       BUFFER_TRACE(sbi->s_sbh, "get_write_access");
43                         err = ext4_journal_get_write_access(handle, sbi->s_sbh);
44                         if (err) {
45                                 ext4_journal_stop(handle);
46 diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
47 index 33dd704..645205d 100644
48 --- a/fs/ext4/inline.c
49 +++ b/fs/ext4/inline.c
50 @@ -264,6 +264,7 @@ static int ext4_create_inline_data(handle_t *handle,
51         if (error)
52                 return error;
54 +       BUFFER_TRACE(is.iloc.bh, "get_write_access");
55         error = ext4_journal_get_write_access(handle, is.iloc.bh);
56         if (error)
57                 goto out;
58 @@ -347,6 +348,7 @@ static int ext4_update_inline_data(handle_t *handle, struct inode *inode,
59         if (error == -ENODATA)
60                 goto out;
62 +       BUFFER_TRACE(is.iloc.bh, "get_write_access");
63         error = ext4_journal_get_write_access(handle, is.iloc.bh);
64         if (error)
65                 goto out;
66 @@ -424,6 +426,7 @@ static int ext4_destroy_inline_data_nolock(handle_t *handle,
67         if (error)
68                 goto out;
70 +       BUFFER_TRACE(is.iloc.bh, "get_write_access");
71         error = ext4_journal_get_write_access(handle, is.iloc.bh);
72         if (error)
73                 goto out;
74 @@ -1007,6 +1010,7 @@ static int ext4_add_dirent_to_inline(handle_t *handle,
75         if (err)
76                 return err;
78 +       BUFFER_TRACE(iloc->bh, "get_write_access");
79         err = ext4_journal_get_write_access(handle, iloc->bh);
80         if (err)
81                 return err;
82 @@ -1669,6 +1673,7 @@ int ext4_delete_inline_entry(handle_t *handle,
83                                 EXT4_MIN_INLINE_DATA_SIZE;
84         }
86 +       BUFFER_TRACE(bh, "get_write_access");
87         err = ext4_journal_get_write_access(handle, bh);
88         if (err)
89                 goto out;
90 diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
91 index 2bdbfcb..645de3e 100644
92 --- a/fs/ext4/inode.c
93 +++ b/fs/ext4/inode.c
94 @@ -922,6 +922,7 @@ int do_journal_get_write_access(handle_t *handle,
95          */
96         if (dirty)
97                 clear_buffer_dirty(bh);
98 +       BUFFER_TRACE(bh, "get write access");
99         ret = ext4_journal_get_write_access(handle, bh);
100         if (!ret && dirty)
101                 ret = ext4_handle_dirty_metadata(handle, NULL, bh);
102 @@ -1769,6 +1770,7 @@ static int __ext4_journalled_writepage(struct page *page,
103         BUG_ON(!ext4_handle_valid(handle));
105         if (inline_data) {
106 +               BUFFER_TRACE(inode_bh, "get write access");
107                 ret = ext4_journal_get_write_access(handle, inode_bh);
109                 err = ext4_handle_dirty_metadata(handle, inode, inode_bh);
110 @@ -4412,6 +4414,7 @@ static int ext4_do_update_inode(handle_t *handle,
111                 err = rc;
112         ext4_clear_inode_state(inode, EXT4_STATE_NEW);
113         if (set_large_file) {
114 +               BUFFER_TRACE(EXT4_SB(sb)->s_sbh, "get write access");
115                 err = ext4_journal_get_write_access(handle, EXT4_SB(sb)->s_sbh);
116                 if (err)
117                         goto out_brelse;
118 diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
119 index 3235a2f..6ca41e7 100644
120 --- a/fs/ext4/mballoc.c
121 +++ b/fs/ext4/mballoc.c
122 @@ -2874,6 +2874,7 @@ ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac,
123         if (!bitmap_bh)
124                 goto out_err;
126 +       BUFFER_TRACE(bitmap_bh, "getting write access");
127         err = ext4_journal_get_write_access(handle, bitmap_bh);
128         if (err)
129                 goto out_err;
130 @@ -2886,6 +2887,7 @@ ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac,
131         ext4_debug("using block group %u(%d)\n", ac->ac_b_ex.fe_group,
132                         ext4_free_group_clusters(sb, gdp));
134 +       BUFFER_TRACE(gdp_bh, "get_write_access");
135         err = ext4_journal_get_write_access(handle, gdp_bh);
136         if (err)
137                 goto out_err;
138 diff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c
139 index 1b809fe..2484c7e 100644
140 --- a/fs/ext4/move_extent.c
141 +++ b/fs/ext4/move_extent.c
142 @@ -391,6 +391,7 @@ mext_insert_extents(handle_t *handle, struct inode *orig_inode,
144         if (depth) {
145                 /* Register to journal */
146 +               BUFFER_TRACE(orig_path->p_bh, "get_write_access");
147                 ret = ext4_journal_get_write_access(handle, orig_path->p_bh);
148                 if (ret)
149                         return ret;
150 diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
151 index a683f95..7ac6167 100644
152 --- a/fs/ext4/namei.c
153 +++ b/fs/ext4/namei.c
154 @@ -67,6 +67,7 @@ static struct buffer_head *ext4_append(handle_t *handle,
155                 return ERR_PTR(err);
156         inode->i_size += inode->i_sb->s_blocksize;
157         EXT4_I(inode)->i_disksize = inode->i_size;
158 +       BUFFER_TRACE(bh, "get_write_access");
159         err = ext4_journal_get_write_access(handle, bh);
160         if (err) {
161                 brelse(bh);
162 @@ -1778,6 +1779,7 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry,
164         blocksize =  dir->i_sb->s_blocksize;
165         dxtrace(printk(KERN_DEBUG "Creating index: inode %lu\n", dir->i_ino));
166 +       BUFFER_TRACE(bh, "get_write_access");
167         retval = ext4_journal_get_write_access(handle, bh);
168         if (retval) {
169                 ext4_std_error(dir->i_sb, retval);
170 diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
171 index f3b84cd..bb9adab 100644
172 --- a/fs/ext4/resize.c
173 +++ b/fs/ext4/resize.c
174 @@ -348,6 +348,7 @@ static struct buffer_head *bclean(handle_t *handle, struct super_block *sb,
175         bh = sb_getblk(sb, blk);
176         if (unlikely(!bh))
177                 return ERR_PTR(-ENOMEM);
178 +       BUFFER_TRACE(bh, "get_write_access");
179         if ((err = ext4_journal_get_write_access(handle, bh))) {
180                 brelse(bh);
181                 bh = ERR_PTR(err);
182 @@ -426,6 +427,7 @@ static int set_flexbg_block_bitmap(struct super_block *sb, handle_t *handle,
183                 if (unlikely(!bh))
184                         return -ENOMEM;
186 +               BUFFER_TRACE(bh, "get_write_access");
187                 err = ext4_journal_get_write_access(handle, bh);
188                 if (err)
189                         return err;
190 @@ -518,6 +520,7 @@ static int setup_new_flex_group_blocks(struct super_block *sb,
191                                 goto out;
192                         }
194 +                       BUFFER_TRACE(gdb, "get_write_access");
195                         err = ext4_journal_get_write_access(handle, gdb);
196                         if (err) {
197                                 brelse(gdb);
198 @@ -790,14 +793,17 @@ static int add_new_gdb(handle_t *handle, struct inode *inode,
199                 goto exit_dind;
200         }
202 +       BUFFER_TRACE(EXT4_SB(sb)->s_sbh, "get_write_access");
203         err = ext4_journal_get_write_access(handle, EXT4_SB(sb)->s_sbh);
204         if (unlikely(err))
205                 goto exit_dind;
207 +       BUFFER_TRACE(gdb_bh, "get_write_access");
208         err = ext4_journal_get_write_access(handle, gdb_bh);
209         if (unlikely(err))
210                 goto exit_dind;
212 +       BUFFER_TRACE(dind, "get_write_access");
213         err = ext4_journal_get_write_access(handle, dind);
214         if (unlikely(err))
215                 ext4_std_error(sb, err);
216 @@ -902,6 +908,7 @@ static int add_new_gdb_meta_bg(struct super_block *sb,
217         EXT4_SB(sb)->s_group_desc = n_group_desc;
218         EXT4_SB(sb)->s_gdb_count++;
219         ext4_kvfree(o_group_desc);
220 +       BUFFER_TRACE(gdb_bh, "get_write_access");
221         err = ext4_journal_get_write_access(handle, gdb_bh);
222         if (unlikely(err))
223                 brelse(gdb_bh);
224 @@ -977,6 +984,7 @@ static int reserve_backup_gdb(handle_t *handle, struct inode *inode,
225         }
227         for (i = 0; i < reserved_gdb; i++) {
228 +               BUFFER_TRACE(primary[i], "get_write_access");
229                 if ((err = ext4_journal_get_write_access(handle, primary[i])))
230                         goto exit_bh;
231         }
232 @@ -1084,6 +1092,7 @@ static void update_backups(struct super_block *sb, int blk_off, char *data,
233                 ext4_debug("update metadata backup %llu(+%llu)\n",
234                            backup_block, backup_block -
235                            ext4_group_first_block_no(sb, group));
236 +               BUFFER_TRACE(bh, "get_write_access");
237                 if ((err = ext4_journal_get_write_access(handle, bh)))
238                         break;
239                 lock_buffer(bh);
240 @@ -1163,6 +1172,7 @@ static int ext4_add_new_descs(handle_t *handle, struct super_block *sb,
241                  */
242                 if (gdb_off) {
243                         gdb_bh = sbi->s_group_desc[gdb_num];
244 +                       BUFFER_TRACE(gdb_bh, "get_write_access");
245                         err = ext4_journal_get_write_access(handle, gdb_bh);
247                         if (!err && reserved_gdb && ext4_bg_num_gdb(sb, group))
248 @@ -1433,6 +1443,7 @@ static int ext4_flex_group_add(struct super_block *sb,
249                 goto exit;
250         }
252 +       BUFFER_TRACE(sbi->s_sbh, "get_write_access");
253         err = ext4_journal_get_write_access(handle, sbi->s_sbh);
254         if (err)
255                 goto exit_journal;
256 @@ -1645,6 +1656,7 @@ static int ext4_group_extend_no_check(struct super_block *sb,
257                 return err;
258         }
260 +       BUFFER_TRACE(EXT4_SB(sb)->s_sbh, "get_write_access");
261         err = ext4_journal_get_write_access(handle, EXT4_SB(sb)->s_sbh);
262         if (err) {
263                 ext4_warning(sb, "error %d on journal write access", err);
264 @@ -1804,6 +1816,7 @@ static int ext4_convert_meta_bg(struct super_block *sb, struct inode *inode)
265         if (IS_ERR(handle))
266                 return PTR_ERR(handle);
268 +       BUFFER_TRACE(sbi->s_sbh, "get_write_access");
269         err = ext4_journal_get_write_access(handle, sbi->s_sbh);
270         if (err)
271                 goto errout;
272 diff --git a/fs/ext4/super.c b/fs/ext4/super.c
273 index 84e3303..b9b9aab 100644
274 --- a/fs/ext4/super.c
275 +++ b/fs/ext4/super.c
276 @@ -5381,6 +5381,7 @@ static ssize_t ext4_quota_write(struct super_block *sb, int type,
277         bh = ext4_bread(handle, inode, blk, 1, &err);
278         if (!bh)
279                 goto out;
280 +       BUFFER_TRACE(bh, "get write access");
281         err = ext4_journal_get_write_access(handle, bh);
282         if (err) {
283                 brelse(bh);
284 diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
285 index 3a5ac7c..e738733 100644
286 --- a/fs/ext4/xattr.c
287 +++ b/fs/ext4/xattr.c
288 @@ -516,6 +516,7 @@ static void ext4_xattr_update_super_block(handle_t *handle,
289         if (EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_EXT_ATTR))
290                 return;
292 +       BUFFER_TRACE(EXT4_SB(sb)->s_sbh, "get_write_access");
293         if (ext4_journal_get_write_access(handle, EXT4_SB(sb)->s_sbh) == 0) {
294                 EXT4_SET_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_EXT_ATTR);
295                 ext4_handle_dirty_super(handle, sb);
296 @@ -535,6 +536,7 @@ ext4_xattr_release_block(handle_t *handle, struct inode *inode,
297         struct mb_cache *ext4_mb_cache = EXT4_GET_MB_CACHE(inode);
299         ce = mb_cache_entry_get(ext4_mb_cache, bh->b_bdev, bh->b_blocknr);
300 +       BUFFER_TRACE(bh, "get_write_access");
301         error = ext4_journal_get_write_access(handle, bh);
302         if (error)
303                 goto out;
304 @@ -777,6 +779,7 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode,
305         if (s->base) {
306                 ce = mb_cache_entry_get(ext4_mb_cache, bs->bh->b_bdev,
307                                         bs->bh->b_blocknr);
308 +               BUFFER_TRACE(bs->bh, "get_write_access");
309                 error = ext4_journal_get_write_access(handle, bs->bh);
310                 if (error)
311                         goto cleanup;
312 @@ -862,6 +865,7 @@ inserted:
313                                                 EXT4_C2B(EXT4_SB(sb), 1));
314                                 if (error)
315                                         goto cleanup;
316 +                               BUFFER_TRACE(new_bh, "get_write_access");
317                                 error = ext4_journal_get_write_access(handle,
318                                                                       new_bh);
319                                 if (error)