Skip to content

Commit e1a4132

Browse files
Liu Boaxboe
authored andcommitted
Blktrace: bail out early if block debugfs is not configured
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@linux.alibaba.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 1954e9a commit e1a4132

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎kernel/trace/blktrace.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,9 @@ static int do_blk_trace_setup(struct request_queue *q, char *name, dev_t dev,
494494
if (!buts->buf_size || !buts->buf_nr)
495495
return -EINVAL;
496496

497+
if (!blk_debugfs_root)
498+
return -ENOENT;
499+
497500
strncpy(buts->name, name, BLKTRACE_BDEV_SIZE);
498501
buts->name[BLKTRACE_BDEV_SIZE - 1] = '\0';
499502

@@ -518,9 +521,6 @@ static int do_blk_trace_setup(struct request_queue *q, char *name, dev_t dev,
518521

519522
ret = -ENOENT;
520523

521-
if (!blk_debugfs_root)
522-
goto err;
523-
524524
dir = debugfs_lookup(buts->name, blk_debugfs_root);
525525
if (!dir)
526526
bt->dir = dir = debugfs_create_dir(buts->name, blk_debugfs_root);

0 commit comments

Comments
 (0)