Skip to content

Commit

Permalink
blktrace: remove debugfs file dentries from struct blk_trace
Browse files Browse the repository at this point in the history
These debugfs dentries do not need to be saved for anything as the whole
directory and everything in it is properly cleaned up when the parent
directory is removed.  So remove them from struct blk_trace and don't
save them when created as it's not necessary.

Cc: Jens Axboe <axboe@kernel.dk>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: linux-block@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
gregkh authored and axboe committed Feb 23, 2021
1 parent c9a2f90 commit c0ea576
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
2 changes: 0 additions & 2 deletions include/linux/blktrace_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ struct blk_trace {
u32 pid;
u32 dev;
struct dentry *dir;
struct dentry *dropped_file;
struct dentry *msg_file;
struct list_head running_list;
atomic_t dropped;
};
Expand Down
8 changes: 2 additions & 6 deletions kernel/trace/blktrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,6 @@ static void __blk_add_trace(struct blk_trace *bt, sector_t sector, int bytes,

static void blk_trace_free(struct blk_trace *bt)
{
debugfs_remove(bt->msg_file);
debugfs_remove(bt->dropped_file);
relay_close(bt->rchan);
debugfs_remove(bt->dir);
free_percpu(bt->sequence);
Expand Down Expand Up @@ -544,10 +542,8 @@ static int do_blk_trace_setup(struct request_queue *q, char *name, dev_t dev,
INIT_LIST_HEAD(&bt->running_list);

ret = -EIO;
bt->dropped_file = debugfs_create_file("dropped", 0444, dir, bt,
&blk_dropped_fops);

bt->msg_file = debugfs_create_file("msg", 0222, dir, bt, &blk_msg_fops);
debugfs_create_file("dropped", 0444, dir, bt, &blk_dropped_fops);
debugfs_create_file("msg", 0222, dir, bt, &blk_msg_fops);

bt->rchan = relay_open("trace", dir, buts->buf_size,
buts->buf_nr, &blk_relay_callbacks, bt);
Expand Down

0 comments on commit c0ea576

Please sign in to comment.