Skip to content

Commit

Permalink
ocfs2: Remove EXIT from masklog.
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
taoma-tm committed Mar 7, 2011
1 parent ef6b689 commit c1e8d35
Show file tree
Hide file tree
Showing 27 changed files with 159 additions and 315 deletions.
26 changes: 5 additions & 21 deletions fs/ocfs2/alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -985,7 +985,7 @@ int ocfs2_num_free_extents(struct ocfs2_super *osb,
bail:
brelse(eb_bh);

mlog_exit(retval);
mlog(0, "retval = %d\n", retval);
return retval;
}

Expand Down Expand Up @@ -1070,8 +1070,8 @@ static int ocfs2_create_new_meta_bhs(handle_t *handle,
brelse(bhs[i]);
bhs[i] = NULL;
}
mlog_errno(status);
}
mlog_exit(status);
return status;
}

Expand Down Expand Up @@ -1326,7 +1326,6 @@ static int ocfs2_add_branch(handle_t *handle,
kfree(new_eb_bhs);
}

mlog_exit(status);
return status;
}

Expand Down Expand Up @@ -1407,7 +1406,6 @@ static int ocfs2_shift_tree_depth(handle_t *handle,
bail:
brelse(new_eb_bh);

mlog_exit(status);
return status;
}

Expand Down Expand Up @@ -1493,7 +1491,6 @@ static int ocfs2_find_branch_target(struct ocfs2_extent_tree *et,
bail:
brelse(bh);

mlog_exit(status);
return status;
}

Expand Down Expand Up @@ -4552,7 +4549,7 @@ static int ocfs2_figure_insert_type(struct ocfs2_extent_tree *et,
ocfs2_et_get_last_eb_blk(et),
&bh);
if (ret) {
mlog_exit(ret);
mlog_errno(ret);
goto out;
}
eb = (struct ocfs2_extent_block *) bh->b_data;
Expand Down Expand Up @@ -4716,7 +4713,6 @@ int ocfs2_insert_extent(handle_t *handle,
bail:
brelse(last_eb_bh);

mlog_exit(status);
return status;
}

Expand Down Expand Up @@ -4818,7 +4814,6 @@ int ocfs2_add_clusters_in_btree(handle_t *handle,
}

leave:
mlog_exit(status);
if (reason_ret)
*reason_ret = reason;
return status;
Expand Down Expand Up @@ -5029,7 +5024,7 @@ int ocfs2_split_extent(handle_t *handle,
ocfs2_et_get_last_eb_blk(et),
&last_eb_bh);
if (ret) {
mlog_exit(ret);
mlog_errno(ret);
goto out;
}

Expand Down Expand Up @@ -5849,7 +5844,6 @@ int ocfs2_truncate_log_append(struct ocfs2_super *osb,

osb->truncated_clusters += num_clusters;
bail:
mlog_exit(status);
return status;
}

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

bail:
mlog_exit(status);
return status;
}

Expand Down Expand Up @@ -5995,7 +5988,6 @@ int __ocfs2_flush_truncate_log(struct ocfs2_super *osb)
iput(data_alloc_inode);

out:
mlog_exit(status);
return status;
}

Expand Down Expand Up @@ -6023,8 +6015,6 @@ static void ocfs2_truncate_log_worker(struct work_struct *work)
mlog_errno(status);
else
ocfs2_init_steal_slots(osb);

mlog_exit(status);
}

#define OCFS2_TRUNCATE_LOG_FLUSH_INTERVAL (2 * HZ)
Expand Down Expand Up @@ -6070,7 +6060,6 @@ static int ocfs2_get_truncate_log_info(struct ocfs2_super *osb,
*tl_inode = inode;
*tl_bh = bh;
bail:
mlog_exit(status);
return status;
}

Expand Down Expand Up @@ -6141,9 +6130,9 @@ int ocfs2_begin_truncate_log_recovery(struct ocfs2_super *osb,
if (status < 0 && (*tl_copy)) {
kfree(*tl_copy);
*tl_copy = NULL;
mlog_errno(status);
}

mlog_exit(status);
return status;
}

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

mlog_exit(status);
return status;
}

Expand All @@ -6221,8 +6209,6 @@ void ocfs2_truncate_log_shutdown(struct ocfs2_super *osb)
brelse(osb->osb_tl_bh);
iput(osb->osb_tl_inode);
}

mlog_exit_void();
}

int ocfs2_truncate_log_init(struct ocfs2_super *osb)
Expand All @@ -6246,7 +6232,6 @@ int ocfs2_truncate_log_init(struct ocfs2_super *osb)
osb->osb_tl_bh = tl_bh;
osb->osb_tl_inode = tl_inode;

mlog_exit(status);
return status;
}

Expand Down Expand Up @@ -7112,7 +7097,6 @@ int ocfs2_commit_truncate(struct ocfs2_super *osb,

ocfs2_free_path(path);

mlog_exit(status);
return status;
}

Expand Down
19 changes: 4 additions & 15 deletions fs/ocfs2/aops.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ static int ocfs2_symlink_get_block(struct inode *inode, sector_t iblock,
bail:
brelse(bh);

mlog_exit(err);
return err;
}

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

mlog_exit(err);
return err;
}

Expand Down Expand Up @@ -323,7 +321,6 @@ static int ocfs2_readpage(struct file *file, struct page *page)
out:
if (unlock)
unlock_page(page);
mlog_exit(ret);
return ret;
}

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

ret = block_write_full_page(page, ocfs2_get_block, wbc);

mlog_exit(ret);

return ret;
}

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

mlog_exit((int)status);

return status;
}

Expand Down Expand Up @@ -616,7 +609,6 @@ static ssize_t ocfs2_direct_IO(int rw,
{
struct file *file = iocb->ki_filp;
struct inode *inode = file->f_path.dentry->d_inode->i_mapping->host;
int ret;

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

ret = __blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev,
iov, offset, nr_segs,
ocfs2_direct_IO_get_blocks,
ocfs2_dio_end_io, NULL, 0);

mlog_exit(ret);
return ret;
return __blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev,
iov, offset, nr_segs,
ocfs2_direct_IO_get_blocks,
ocfs2_dio_end_io, NULL, 0);
}

static void ocfs2_figure_cluster_boundaries(struct ocfs2_super *osb,
Expand Down
7 changes: 4 additions & 3 deletions fs/ocfs2/buffer_head_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ int ocfs2_write_block(struct ocfs2_super *osb, struct buffer_head *bh,
* can get modified during recovery even if read-only. */
if (ocfs2_is_hard_readonly(osb)) {
ret = -EROFS;
mlog_errno(ret);
goto out;
}

Expand All @@ -91,11 +92,11 @@ int ocfs2_write_block(struct ocfs2_super *osb, struct buffer_head *bh,
* uptodate. */
ret = -EIO;
put_bh(bh);
mlog_errno(ret);
}

ocfs2_metadata_cache_io_unlock(ci);
out:
mlog_exit(ret);
return ret;
}

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

bail:

mlog_exit(status);
return status;
}

Expand Down Expand Up @@ -413,6 +413,7 @@ int ocfs2_write_super_or_backup(struct ocfs2_super *osb,

if (ocfs2_is_hard_readonly(osb) || ocfs2_is_soft_readonly(osb)) {
ret = -EROFS;
mlog_errno(ret);
goto out;
}

Expand All @@ -432,9 +433,9 @@ int ocfs2_write_super_or_backup(struct ocfs2_super *osb,
if (!buffer_uptodate(bh)) {
ret = -EIO;
put_bh(bh);
mlog_errno(ret);
}

out:
mlog_exit(ret);
return ret;
}
1 change: 0 additions & 1 deletion fs/ocfs2/cluster/heartbeat.c
Original file line number Diff line number Diff line change
Expand Up @@ -1679,7 +1679,6 @@ static int o2hb_populate_slot_data(struct o2hb_region *reg)
}

out:
mlog_exit(ret);
return ret;
}

Expand Down
3 changes: 1 addition & 2 deletions fs/ocfs2/cluster/masklog.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

struct mlog_bits mlog_and_bits = MLOG_BITS_RHS(MLOG_INITIAL_AND_MASK);
EXPORT_SYMBOL_GPL(mlog_and_bits);
struct mlog_bits mlog_not_bits = MLOG_BITS_RHS(MLOG_INITIAL_NOT_MASK);
struct mlog_bits mlog_not_bits = MLOG_BITS_RHS(0);
EXPORT_SYMBOL_GPL(mlog_not_bits);

static ssize_t mlog_mask_show(u64 mask, char *buf)
Expand Down Expand Up @@ -80,7 +80,6 @@ struct mlog_attribute {
}

static struct mlog_attribute mlog_attrs[MLOG_MAX_BITS] = {
define_mask(EXIT),
define_mask(TCP),
define_mask(MSG),
define_mask(SOCKET),
Expand Down
44 changes: 0 additions & 44 deletions fs/ocfs2/cluster/masklog.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@

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

#define MLOG_INITIAL_AND_MASK (ML_ERROR|ML_NOTICE)
#define MLOG_INITIAL_NOT_MASK (ML_EXIT)
#ifndef MLOG_MASK_PREFIX
#define MLOG_MASK_PREFIX 0
#endif
Expand Down Expand Up @@ -221,48 +219,6 @@ extern struct mlog_bits mlog_and_bits, mlog_not_bits;
mlog(ML_ERROR, "status = %lld\n", (long long)_st); \
} while (0)

#if defined(CONFIG_OCFS2_DEBUG_MASKLOG)
/*
* We disable this for sparse.
*/
#if !defined(__CHECKER__)
#define mlog_exit(st) do { \
if (__builtin_types_compatible_p(typeof(st), unsigned long)) \
mlog(ML_EXIT, "EXIT: %lu\n", (unsigned long) (st)); \
else if (__builtin_types_compatible_p(typeof(st), signed long)) \
mlog(ML_EXIT, "EXIT: %ld\n", (signed long) (st)); \
else if (__builtin_types_compatible_p(typeof(st), unsigned int) \
|| __builtin_types_compatible_p(typeof(st), unsigned short) \
|| __builtin_types_compatible_p(typeof(st), unsigned char)) \
mlog(ML_EXIT, "EXIT: %u\n", (unsigned int) (st)); \
else if (__builtin_types_compatible_p(typeof(st), signed int) \
|| __builtin_types_compatible_p(typeof(st), signed short) \
|| __builtin_types_compatible_p(typeof(st), signed char)) \
mlog(ML_EXIT, "EXIT: %d\n", (signed int) (st)); \
else if (__builtin_types_compatible_p(typeof(st), long long)) \
mlog(ML_EXIT, "EXIT: %lld\n", (long long) (st)); \
else \
mlog(ML_EXIT, "EXIT: %llu\n", (unsigned long long) (st)); \
} while (0)
#else
#define mlog_exit(st) do { \
mlog(ML_EXIT, "EXIT: %lld\n", (long long) (st)); \
} while (0)
#endif

#define mlog_exit_ptr(ptr) do { \
mlog(ML_EXIT, "EXIT: %p\n", ptr); \
} while (0)

#define mlog_exit_void() do { \
mlog(ML_EXIT, "EXIT\n"); \
} while (0)
#else
#define mlog_exit(...) do { } while (0)
#define mlog_exit_ptr(...) do { } while (0)
#define mlog_exit_void(...) do { } while (0)
#endif /* defined(CONFIG_OCFS2_DEBUG_MASKLOG) */

#define mlog_bug_on_msg(cond, fmt, args...) do { \
if (cond) { \
mlog(ML_ERROR, "bug expression: " #cond "\n"); \
Expand Down
3 changes: 1 addition & 2 deletions fs/ocfs2/dcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,7 @@ static int ocfs2_dentry_revalidate(struct dentry *dentry,
ret = 1;

bail:
mlog_exit(ret);

mlog(0, "ret = %d\n", ret);
return ret;
}

Expand Down
Loading

0 comments on commit c1e8d35

Please sign in to comment.