Skip to content

Commit c1e8d35

Browse files
committed
ocfs2: Remove EXIT from masklog.
mlog_exit is used to record the exit status of a function. But because it is added in so many functions, if we enable it, the system logs get filled up quickly and cause too much I/O. So actually no one can open it for a production system or even for a test. This patch just try to remove it or change it. So: 1. if all the error paths already use mlog_errno, it is just removed. Otherwise, it will be replaced by mlog_errno. 2. if it is used to print some return value, it is replaced with mlog(0,...). mlog_exit_ptr is changed to mlog(0. All those mlog(0,...) will be replaced with trace events later. Signed-off-by: Tao Ma <boyu.mt@taobao.com>
1 parent ef6b689 commit c1e8d35

27 files changed

Lines changed: 159 additions & 315 deletions

‎fs/ocfs2/alloc.c‎

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -985,7 +985,7 @@ int ocfs2_num_free_extents(struct ocfs2_super *osb,
985985
bail:
986986
brelse(eb_bh);
987987

988-
mlog_exit(retval);
988+
mlog(0, "retval = %d\n", retval);
989989
return retval;
990990
}
991991

@@ -1070,8 +1070,8 @@ static int ocfs2_create_new_meta_bhs(handle_t *handle,
10701070
brelse(bhs[i]);
10711071
bhs[i] = NULL;
10721072
}
1073+
mlog_errno(status);
10731074
}
1074-
mlog_exit(status);
10751075
return status;
10761076
}
10771077

@@ -1326,7 +1326,6 @@ static int ocfs2_add_branch(handle_t *handle,
13261326
kfree(new_eb_bhs);
13271327
}
13281328

1329-
mlog_exit(status);
13301329
return status;
13311330
}
13321331

@@ -1407,7 +1406,6 @@ static int ocfs2_shift_tree_depth(handle_t *handle,
14071406
bail:
14081407
brelse(new_eb_bh);
14091408

1410-
mlog_exit(status);
14111409
return status;
14121410
}
14131411

@@ -1493,7 +1491,6 @@ static int ocfs2_find_branch_target(struct ocfs2_extent_tree *et,
14931491
bail:
14941492
brelse(bh);
14951493

1496-
mlog_exit(status);
14971494
return status;
14981495
}
14991496

@@ -4552,7 +4549,7 @@ static int ocfs2_figure_insert_type(struct ocfs2_extent_tree *et,
45524549
ocfs2_et_get_last_eb_blk(et),
45534550
&bh);
45544551
if (ret) {
4555-
mlog_exit(ret);
4552+
mlog_errno(ret);
45564553
goto out;
45574554
}
45584555
eb = (struct ocfs2_extent_block *) bh->b_data;
@@ -4716,7 +4713,6 @@ int ocfs2_insert_extent(handle_t *handle,
47164713
bail:
47174714
brelse(last_eb_bh);
47184715

4719-
mlog_exit(status);
47204716
return status;
47214717
}
47224718

@@ -4818,7 +4814,6 @@ int ocfs2_add_clusters_in_btree(handle_t *handle,
48184814
}
48194815

48204816
leave:
4821-
mlog_exit(status);
48224817
if (reason_ret)
48234818
*reason_ret = reason;
48244819
return status;
@@ -5029,7 +5024,7 @@ int ocfs2_split_extent(handle_t *handle,
50295024
ocfs2_et_get_last_eb_blk(et),
50305025
&last_eb_bh);
50315026
if (ret) {
5032-
mlog_exit(ret);
5027+
mlog_errno(ret);
50335028
goto out;
50345029
}
50355030

@@ -5849,7 +5844,6 @@ int ocfs2_truncate_log_append(struct ocfs2_super *osb,
58495844

58505845
osb->truncated_clusters += num_clusters;
58515846
bail:
5852-
mlog_exit(status);
58535847
return status;
58545848
}
58555849

@@ -5920,7 +5914,6 @@ static int ocfs2_replay_truncate_records(struct ocfs2_super *osb,
59205914
osb->truncated_clusters = 0;
59215915

59225916
bail:
5923-
mlog_exit(status);
59245917
return status;
59255918
}
59265919

@@ -5995,7 +5988,6 @@ int __ocfs2_flush_truncate_log(struct ocfs2_super *osb)
59955988
iput(data_alloc_inode);
59965989

59975990
out:
5998-
mlog_exit(status);
59995991
return status;
60005992
}
60015993

@@ -6023,8 +6015,6 @@ static void ocfs2_truncate_log_worker(struct work_struct *work)
60236015
mlog_errno(status);
60246016
else
60256017
ocfs2_init_steal_slots(osb);
6026-
6027-
mlog_exit(status);
60286018
}
60296019

60306020
#define OCFS2_TRUNCATE_LOG_FLUSH_INTERVAL (2 * HZ)
@@ -6070,7 +6060,6 @@ static int ocfs2_get_truncate_log_info(struct ocfs2_super *osb,
60706060
*tl_inode = inode;
60716061
*tl_bh = bh;
60726062
bail:
6073-
mlog_exit(status);
60746063
return status;
60756064
}
60766065

@@ -6141,9 +6130,9 @@ int ocfs2_begin_truncate_log_recovery(struct ocfs2_super *osb,
61416130
if (status < 0 && (*tl_copy)) {
61426131
kfree(*tl_copy);
61436132
*tl_copy = NULL;
6133+
mlog_errno(status);
61446134
}
61456135

6146-
mlog_exit(status);
61476136
return status;
61486137
}
61496138

@@ -6201,7 +6190,6 @@ int ocfs2_complete_truncate_log_recovery(struct ocfs2_super *osb,
62016190
bail_up:
62026191
mutex_unlock(&tl_inode->i_mutex);
62036192

6204-
mlog_exit(status);
62056193
return status;
62066194
}
62076195

@@ -6221,8 +6209,6 @@ void ocfs2_truncate_log_shutdown(struct ocfs2_super *osb)
62216209
brelse(osb->osb_tl_bh);
62226210
iput(osb->osb_tl_inode);
62236211
}
6224-
6225-
mlog_exit_void();
62266212
}
62276213

62286214
int ocfs2_truncate_log_init(struct ocfs2_super *osb)
@@ -6246,7 +6232,6 @@ int ocfs2_truncate_log_init(struct ocfs2_super *osb)
62466232
osb->osb_tl_bh = tl_bh;
62476233
osb->osb_tl_inode = tl_inode;
62486234

6249-
mlog_exit(status);
62506235
return status;
62516236
}
62526237

@@ -7112,7 +7097,6 @@ int ocfs2_commit_truncate(struct ocfs2_super *osb,
71127097

71137098
ocfs2_free_path(path);
71147099

7115-
mlog_exit(status);
71167100
return status;
71177101
}
71187102

‎fs/ocfs2/aops.c‎

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ static int ocfs2_symlink_get_block(struct inode *inode, sector_t iblock,
123123
bail:
124124
brelse(bh);
125125

126-
mlog_exit(err);
127126
return err;
128127
}
129128

@@ -208,7 +207,6 @@ int ocfs2_get_block(struct inode *inode, sector_t iblock,
208207
if (err < 0)
209208
err = -EIO;
210209

211-
mlog_exit(err);
212210
return err;
213211
}
214212

@@ -323,7 +321,6 @@ static int ocfs2_readpage(struct file *file, struct page *page)
323321
out:
324322
if (unlock)
325323
unlock_page(page);
326-
mlog_exit(ret);
327324
return ret;
328325
}
329326

@@ -402,8 +399,6 @@ static int ocfs2_writepage(struct page *page, struct writeback_control *wbc)
402399

403400
ret = block_write_full_page(page, ocfs2_get_block, wbc);
404401

405-
mlog_exit(ret);
406-
407402
return ret;
408403
}
409404

@@ -484,8 +479,6 @@ static sector_t ocfs2_bmap(struct address_space *mapping, sector_t block)
484479
bail:
485480
status = err ? 0 : p_blkno;
486481

487-
mlog_exit((int)status);
488-
489482
return status;
490483
}
491484

@@ -616,7 +609,6 @@ static ssize_t ocfs2_direct_IO(int rw,
616609
{
617610
struct file *file = iocb->ki_filp;
618611
struct inode *inode = file->f_path.dentry->d_inode->i_mapping->host;
619-
int ret;
620612

621613
/*
622614
* Fallback to buffered I/O if we see an inode without
@@ -629,13 +621,10 @@ static ssize_t ocfs2_direct_IO(int rw,
629621
if (i_size_read(inode) <= offset)
630622
return 0;
631623

632-
ret = __blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev,
633-
iov, offset, nr_segs,
634-
ocfs2_direct_IO_get_blocks,
635-
ocfs2_dio_end_io, NULL, 0);
636-
637-
mlog_exit(ret);
638-
return ret;
624+
return __blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev,
625+
iov, offset, nr_segs,
626+
ocfs2_direct_IO_get_blocks,
627+
ocfs2_dio_end_io, NULL, 0);
639628
}
640629

641630
static void ocfs2_figure_cluster_boundaries(struct ocfs2_super *osb,

‎fs/ocfs2/buffer_head_io.c‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ int ocfs2_write_block(struct ocfs2_super *osb, struct buffer_head *bh,
6666
* can get modified during recovery even if read-only. */
6767
if (ocfs2_is_hard_readonly(osb)) {
6868
ret = -EROFS;
69+
mlog_errno(ret);
6970
goto out;
7071
}
7172

@@ -91,11 +92,11 @@ int ocfs2_write_block(struct ocfs2_super *osb, struct buffer_head *bh,
9192
* uptodate. */
9293
ret = -EIO;
9394
put_bh(bh);
95+
mlog_errno(ret);
9496
}
9597

9698
ocfs2_metadata_cache_io_unlock(ci);
9799
out:
98-
mlog_exit(ret);
99100
return ret;
100101
}
101102

@@ -374,7 +375,6 @@ int ocfs2_read_blocks(struct ocfs2_caching_info *ci, u64 block, int nr,
374375

375376
bail:
376377

377-
mlog_exit(status);
378378
return status;
379379
}
380380

@@ -413,6 +413,7 @@ int ocfs2_write_super_or_backup(struct ocfs2_super *osb,
413413

414414
if (ocfs2_is_hard_readonly(osb) || ocfs2_is_soft_readonly(osb)) {
415415
ret = -EROFS;
416+
mlog_errno(ret);
416417
goto out;
417418
}
418419

@@ -432,9 +433,9 @@ int ocfs2_write_super_or_backup(struct ocfs2_super *osb,
432433
if (!buffer_uptodate(bh)) {
433434
ret = -EIO;
434435
put_bh(bh);
436+
mlog_errno(ret);
435437
}
436438

437439
out:
438-
mlog_exit(ret);
439440
return ret;
440441
}

‎fs/ocfs2/cluster/heartbeat.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1679,7 +1679,6 @@ static int o2hb_populate_slot_data(struct o2hb_region *reg)
16791679
}
16801680

16811681
out:
1682-
mlog_exit(ret);
16831682
return ret;
16841683
}
16851684

‎fs/ocfs2/cluster/masklog.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
struct mlog_bits mlog_and_bits = MLOG_BITS_RHS(MLOG_INITIAL_AND_MASK);
3232
EXPORT_SYMBOL_GPL(mlog_and_bits);
33-
struct mlog_bits mlog_not_bits = MLOG_BITS_RHS(MLOG_INITIAL_NOT_MASK);
33+
struct mlog_bits mlog_not_bits = MLOG_BITS_RHS(0);
3434
EXPORT_SYMBOL_GPL(mlog_not_bits);
3535

3636
static ssize_t mlog_mask_show(u64 mask, char *buf)
@@ -80,7 +80,6 @@ struct mlog_attribute {
8080
}
8181

8282
static struct mlog_attribute mlog_attrs[MLOG_MAX_BITS] = {
83-
define_mask(EXIT),
8483
define_mask(TCP),
8584
define_mask(MSG),
8685
define_mask(SOCKET),

‎fs/ocfs2/cluster/masklog.h‎

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@
8282

8383
/* bits that are frequently given and infrequently matched in the low word */
8484
/* NOTE: If you add a flag, you need to also update masklog.c! */
85-
#define ML_EXIT 0x0000000000000002ULL /* func call exit */
8685
#define ML_TCP 0x0000000000000004ULL /* net cluster/tcp.c */
8786
#define ML_MSG 0x0000000000000008ULL /* net network messages */
8887
#define ML_SOCKET 0x0000000000000010ULL /* net socket lifetime */
@@ -123,7 +122,6 @@
123122
#define ML_KTHREAD 0x4000000000000000ULL /* kernel thread activity */
124123

125124
#define MLOG_INITIAL_AND_MASK (ML_ERROR|ML_NOTICE)
126-
#define MLOG_INITIAL_NOT_MASK (ML_EXIT)
127125
#ifndef MLOG_MASK_PREFIX
128126
#define MLOG_MASK_PREFIX 0
129127
#endif
@@ -221,48 +219,6 @@ extern struct mlog_bits mlog_and_bits, mlog_not_bits;
221219
mlog(ML_ERROR, "status = %lld\n", (long long)_st); \
222220
} while (0)
223221

224-
#if defined(CONFIG_OCFS2_DEBUG_MASKLOG)
225-
/*
226-
* We disable this for sparse.
227-
*/
228-
#if !defined(__CHECKER__)
229-
#define mlog_exit(st) do { \
230-
if (__builtin_types_compatible_p(typeof(st), unsigned long)) \
231-
mlog(ML_EXIT, "EXIT: %lu\n", (unsigned long) (st)); \
232-
else if (__builtin_types_compatible_p(typeof(st), signed long)) \
233-
mlog(ML_EXIT, "EXIT: %ld\n", (signed long) (st)); \
234-
else if (__builtin_types_compatible_p(typeof(st), unsigned int) \
235-
|| __builtin_types_compatible_p(typeof(st), unsigned short) \
236-
|| __builtin_types_compatible_p(typeof(st), unsigned char)) \
237-
mlog(ML_EXIT, "EXIT: %u\n", (unsigned int) (st)); \
238-
else if (__builtin_types_compatible_p(typeof(st), signed int) \
239-
|| __builtin_types_compatible_p(typeof(st), signed short) \
240-
|| __builtin_types_compatible_p(typeof(st), signed char)) \
241-
mlog(ML_EXIT, "EXIT: %d\n", (signed int) (st)); \
242-
else if (__builtin_types_compatible_p(typeof(st), long long)) \
243-
mlog(ML_EXIT, "EXIT: %lld\n", (long long) (st)); \
244-
else \
245-
mlog(ML_EXIT, "EXIT: %llu\n", (unsigned long long) (st)); \
246-
} while (0)
247-
#else
248-
#define mlog_exit(st) do { \
249-
mlog(ML_EXIT, "EXIT: %lld\n", (long long) (st)); \
250-
} while (0)
251-
#endif
252-
253-
#define mlog_exit_ptr(ptr) do { \
254-
mlog(ML_EXIT, "EXIT: %p\n", ptr); \
255-
} while (0)
256-
257-
#define mlog_exit_void() do { \
258-
mlog(ML_EXIT, "EXIT\n"); \
259-
} while (0)
260-
#else
261-
#define mlog_exit(...) do { } while (0)
262-
#define mlog_exit_ptr(...) do { } while (0)
263-
#define mlog_exit_void(...) do { } while (0)
264-
#endif /* defined(CONFIG_OCFS2_DEBUG_MASKLOG) */
265-
266222
#define mlog_bug_on_msg(cond, fmt, args...) do { \
267223
if (cond) { \
268224
mlog(ML_ERROR, "bug expression: " #cond "\n"); \

‎fs/ocfs2/dcache.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,7 @@ static int ocfs2_dentry_revalidate(struct dentry *dentry,
123123
ret = 1;
124124

125125
bail:
126-
mlog_exit(ret);
127-
126+
mlog(0, "ret = %d\n", ret);
128127
return ret;
129128
}
130129

0 commit comments

Comments
 (0)