Re: [PATCH RFC v2 3/7] block: export some API
From: Christoph Hellwig
Date: Tue Jun 18 2024 - 04:06:08 EST
On Tue, Jun 18, 2024 at 11:17:47AM +0800, Yu Kuai wrote:
> bool blkcg_debug_stats = false;
> +EXPORT_SYMBOL_GPL(blkcg_debug_stats);
exporting variables is lways a bad idea.a
>
> static DEFINE_RAW_SPINLOCK(blkg_stat_lock);
>
> @@ -688,6 +689,7 @@ const char *blkg_dev_name(struct blkcg_gq *blkg)
> return NULL;
> return bdi_dev_name(blkg->q->disk->bdi);
> }
> +EXPORT_SYMBOL_GPL(blkg_dev_name);
And this helper is just horribly to be honest. The bdi_dev_name
should not be used anywhere in block code, and something like this
certainly should not be exported even if we have to keep it for
legacy reasons.
> /**
> * blkcg_print_blkgs - helper for printing per-blkg data
> @@ -815,6 +817,7 @@ int blkg_conf_open_bdev(struct blkg_conf_ctx *ctx)
> ctx->bdev = bdev;
> return 0;
> }
> +EXPORT_SYMBOL_GPL(blkg_conf_open_bdev);
This again is a horrible function papeing over blk-cgroup design
mistakes. I absolutely should not be exported.