Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

relay: remove unused relay_late_setup_files

The last use of relay_late_setup_files() was removed in 2018 by commit
2b47733045aa ("drm/i915/guc: Merge log relay file and channel creation")

Remove it and the helper it used.

relay_late_setup_files() was used for eventually registering 'buffer only'
channels. With it gone, delete the docs that explain how to do that.
Which suggests it should be possible to lose the 'has_base_filename'
flags.

(Are there any other uses??)

Link: https://lkml.kernel.org/r/20250418234932.490863-1-linux@treblig.org
Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Reviewed-by: Jens Axboe <axboe@kernel.dk>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Andriy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Dr. David Alan Gilbert and committed by
Andrew Morton
2a1c6158 ba8182d4

+1 -123
-10
Documentation/filesystems/relay.rst
··· 301 301 (including in create_buf_file()) via chan->private_data or 302 302 buf->chan->private_data. 303 303 304 - Buffer-only channels 305 - -------------------- 306 - 307 - These channels have no files associated and can be created with 308 - relay_open(NULL, NULL, ...). Such channels are useful in scenarios such 309 - as when doing early tracing in the kernel, before the VFS is up. In these 310 - cases, one may open a buffer-only channel and then call 311 - relay_late_setup_files() when the kernel is ready to handle files, 312 - to expose the buffered data to the userspace. 313 - 314 304 Channel 'modes' 315 305 --------------- 316 306
-3
include/linux/relay.h
··· 159 159 size_t n_subbufs, 160 160 const struct rchan_callbacks *cb, 161 161 void *private_data); 162 - extern int relay_late_setup_files(struct rchan *chan, 163 - const char *base_filename, 164 - struct dentry *parent); 165 162 extern void relay_close(struct rchan *chan); 166 163 extern void relay_flush(struct rchan *chan); 167 164 extern void relay_subbufs_consumed(struct rchan *chan,
+1 -110
kernel/relay.c
··· 452 452 453 453 /** 454 454 * relay_open - create a new relay channel 455 - * @base_filename: base name of files to create, %NULL for buffering only 455 + * @base_filename: base name of files to create 456 456 * @parent: dentry of parent directory, %NULL for root directory or buffer 457 457 * @subbuf_size: size of sub-buffers 458 458 * @n_subbufs: number of sub-buffers ··· 465 465 * attributes specified. The created channel buffer files 466 466 * will be named base_filename0...base_filenameN-1. File 467 467 * permissions will be %S_IRUSR. 468 - * 469 - * If opening a buffer (@parent = NULL) that you later wish to register 470 - * in a filesystem, call relay_late_setup_files() once the @parent dentry 471 - * is available. 472 468 */ 473 469 struct rchan *relay_open(const char *base_filename, 474 470 struct dentry *parent, ··· 535 539 struct rchan_buf *buf; 536 540 struct dentry *dentry; 537 541 }; 538 - 539 - /* Called in atomic context. */ 540 - static void __relay_set_buf_dentry(void *info) 541 - { 542 - struct rchan_percpu_buf_dispatcher *p = info; 543 - 544 - relay_set_buf_dentry(p->buf, p->dentry); 545 - } 546 - 547 - /** 548 - * relay_late_setup_files - triggers file creation 549 - * @chan: channel to operate on 550 - * @base_filename: base name of files to create 551 - * @parent: dentry of parent directory, %NULL for root directory 552 - * 553 - * Returns 0 if successful, non-zero otherwise. 554 - * 555 - * Use to setup files for a previously buffer-only channel created 556 - * by relay_open() with a NULL parent dentry. 557 - * 558 - * For example, this is useful for perfomring early tracing in kernel, 559 - * before VFS is up and then exposing the early results once the dentry 560 - * is available. 561 - */ 562 - int relay_late_setup_files(struct rchan *chan, 563 - const char *base_filename, 564 - struct dentry *parent) 565 - { 566 - int err = 0; 567 - unsigned int i, curr_cpu; 568 - unsigned long flags; 569 - struct dentry *dentry; 570 - struct rchan_buf *buf; 571 - struct rchan_percpu_buf_dispatcher disp; 572 - 573 - if (!chan || !base_filename) 574 - return -EINVAL; 575 - 576 - strscpy(chan->base_filename, base_filename, NAME_MAX); 577 - 578 - mutex_lock(&relay_channels_mutex); 579 - /* Is chan already set up? */ 580 - if (unlikely(chan->has_base_filename)) { 581 - mutex_unlock(&relay_channels_mutex); 582 - return -EEXIST; 583 - } 584 - chan->has_base_filename = 1; 585 - chan->parent = parent; 586 - 587 - if (chan->is_global) { 588 - err = -EINVAL; 589 - buf = *per_cpu_ptr(chan->buf, 0); 590 - if (!WARN_ON_ONCE(!buf)) { 591 - dentry = relay_create_buf_file(chan, buf, 0); 592 - if (dentry && !WARN_ON_ONCE(!chan->is_global)) { 593 - relay_set_buf_dentry(buf, dentry); 594 - err = 0; 595 - } 596 - } 597 - mutex_unlock(&relay_channels_mutex); 598 - return err; 599 - } 600 - 601 - curr_cpu = get_cpu(); 602 - /* 603 - * The CPU hotplug notifier ran before us and created buffers with 604 - * no files associated. So it's safe to call relay_setup_buf_file() 605 - * on all currently online CPUs. 606 - */ 607 - for_each_online_cpu(i) { 608 - buf = *per_cpu_ptr(chan->buf, i); 609 - if (unlikely(!buf)) { 610 - WARN_ONCE(1, KERN_ERR "CPU has no buffer!\n"); 611 - err = -EINVAL; 612 - break; 613 - } 614 - 615 - dentry = relay_create_buf_file(chan, buf, i); 616 - if (unlikely(!dentry)) { 617 - err = -EINVAL; 618 - break; 619 - } 620 - 621 - if (curr_cpu == i) { 622 - local_irq_save(flags); 623 - relay_set_buf_dentry(buf, dentry); 624 - local_irq_restore(flags); 625 - } else { 626 - disp.buf = buf; 627 - disp.dentry = dentry; 628 - smp_mb(); 629 - /* relay_channels_mutex must be held, so wait. */ 630 - err = smp_call_function_single(i, 631 - __relay_set_buf_dentry, 632 - &disp, 1); 633 - } 634 - if (unlikely(err)) 635 - break; 636 - } 637 - put_cpu(); 638 - mutex_unlock(&relay_channels_mutex); 639 - 640 - return err; 641 - } 642 - EXPORT_SYMBOL_GPL(relay_late_setup_files); 643 542 644 543 /** 645 544 * relay_switch_subbuf - switch to a new sub-buffer