[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201109125017.198494084@linuxfoundation.org>
Date: Mon, 9 Nov 2020 13:55:18 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Liu Bo <bo.liu@...ux.alibaba.com>,
Jens Axboe <axboe@...nel.dk>,
Ben Hutchings <ben.hutchings@...ethink.co.uk>
Subject: [PATCH 4.14 09/48] Blktrace: bail out early if block debugfs is not configured
From: Liu Bo <bo.liu@...ux.alibaba.com>
commit e1a413245a564683697a3d02ec197b72cf009b89 upstream.
Since @blk_debugfs_root couldn't be configured dynamically, we can
save a few memory allocation if it's not there.
Signed-off-by: Liu Bo <bo.liu@...ux.alibaba.com>
Signed-off-by: Jens Axboe <axboe@...nel.dk>
[bwh: Cherry-picked for 4.14 to ease backporting a later fix]
Signed-off-by: Ben Hutchings <ben.hutchings@...ethink.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
kernel/trace/blktrace.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
--- a/kernel/trace/blktrace.c
+++ b/kernel/trace/blktrace.c
@@ -498,6 +498,9 @@ static int do_blk_trace_setup(struct req
if (!buts->buf_size || !buts->buf_nr)
return -EINVAL;
+ if (!blk_debugfs_root)
+ return -ENOENT;
+
strncpy(buts->name, name, BLKTRACE_BDEV_SIZE);
buts->name[BLKTRACE_BDEV_SIZE - 1] = '\0';
@@ -532,9 +535,6 @@ static int do_blk_trace_setup(struct req
ret = -ENOENT;
- if (!blk_debugfs_root)
- goto err;
-
dir = debugfs_lookup(buts->name, blk_debugfs_root);
if (!dir)
bt->dir = dir = debugfs_create_dir(buts->name, blk_debugfs_root);
Powered by blists - more mailing lists