[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200419194529.4872-8-mcgrof@kernel.org>
Date: Sun, 19 Apr 2020 19:45:26 +0000
From: Luis Chamberlain <mcgrof@...nel.org>
To: axboe@...nel.dk, viro@...iv.linux.org.uk, bvanassche@....org,
gregkh@...uxfoundation.org, rostedt@...dmis.org, mingo@...hat.com,
jack@...e.cz, ming.lei@...hat.com, nstange@...e.de,
akpm@...ux-foundation.org
Cc: mhocko@...e.com, yukuai3@...wei.com, linux-block@...r.kernel.org,
linux-fsdevel@...r.kernel.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, Luis Chamberlain <mcgrof@...nel.org>
Subject: [PATCH v2 07/10] blktrace: move debugfs file creation to its own function
Move creating the blktrace debugfs files into its own function.
We'll expand on this later.
Signed-off-by: Luis Chamberlain <mcgrof@...nel.org>
---
kernel/trace/blktrace.c | 30 +++++++++++++++++++++---------
1 file changed, 21 insertions(+), 9 deletions(-)
diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
index 909db597b551..9cc0153849c3 100644
--- a/kernel/trace/blktrace.c
+++ b/kernel/trace/blktrace.c
@@ -548,6 +548,25 @@ static struct dentry *blk_trace_debugfs_dir(struct blk_user_trace_setup *buts,
return bt->dir;
}
+static int blk_trace_create_debugfs_files(struct blk_user_trace_setup *buts,
+ struct dentry *dir,
+ struct blk_trace *bt)
+{
+ int 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);
+
+ bt->rchan = relay_open("trace", dir, buts->buf_size,
+ buts->buf_nr, &blk_relay_callbacks, bt);
+ if (!bt->rchan)
+ return ret;
+
+ return 0;
+}
+
/*
* Setup everything required to start tracing
*/
@@ -597,15 +616,8 @@ static int do_blk_trace_setup(struct request_queue *q, char *name, dev_t dev,
atomic_set(&bt->dropped, 0);
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);
-
- bt->rchan = relay_open("trace", dir, buts->buf_size,
- buts->buf_nr, &blk_relay_callbacks, bt);
- if (!bt->rchan)
+ ret = blk_trace_create_debugfs_files(buts, dir, bt);
+ if (ret)
goto err;
bt->act_mask = buts->act_mask;
--
2.25.1
Powered by blists - more mailing lists