Thanks,
Tao Liu
On Fri, Dec 12, 2025 at 8:06 PM Lianbo Jiang <lijiang(a)redhat.com> wrote:
Hi, Tao
Thank you for the upate.
On 12/2/25 6:28 AM, devel-request(a)lists.crash-utility.osci.io wrote:
> Date: Mon, 1 Dec 2025 15:44:12 +1300
> From: Tao Liu<ltao(a)redhat.com>
> Subject: [Crash-utility] [PATCH] Resolve BLK_MQ_F_TAG_HCTX_SHARED at
> runtime
> To:devel@lists.crash-utility.osci.io
> Cc: Tao Liu<ltao(a)redhat.com>
> Message-ID:<20251201024411.14672-2-ltao@redhat.com>
> Content-Type: text/plain; charset="US-ASCII"; x-default=true
>
> Though upstream kernel have defined BLK_MQ_F_TAG_HCTX_SHARED
> as (1 << 3), the value might be set different, e.g. [1]. In
> this patch, we will use enumerator_value() to get its value
> at runtime, to make the code more adaptable.
>
>
[
1]:https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-8/-/b...
>
> Signed-off-by: Tao Liu<ltao(a)redhat.com>
> ---
>
> This patch is the follow-up of [2].
>
> [
2]:https://www.mail-archive.com/devel@lists.crash-utility.osci.io/msg0184...
>
> ---
> dev.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/dev.c b/dev.c
> index 27318e8..127cf5a 100644
> --- a/dev.c
> +++ b/dev.c
> @@ -4326,11 +4326,11 @@ struct bt_iter_data {
> #define MQ_RQ_IN_FLIGHT 1
> #define REQ_OP_BITS 8
> #define REQ_OP_MASK ((1 << REQ_OP_BITS) - 1)
> -#define BLK_MQ_F_TAG_HCTX_SHARED (1 << 3)
> +static int blk_hctx_shared = 0;
>
> static bool blk_mq_is_shared_tags(unsigned int flags)
> {
> - return flags & BLK_MQ_F_TAG_HCTX_SHARED;
> + return flags & blk_hctx_shared;
> }
>
> static uint op_is_write(uint op)
> @@ -4952,6 +4952,7 @@ void diskio_init(void)
> MEMBER_OFFSET_INIT(request_queue_tag_set, "request_queue",
"tag_set");
> MEMBER_OFFSET_INIT(blk_mq_tag_set_flags, "blk_mq_tag_set",
"flags");
> MEMBER_OFFSET_INIT(blk_mq_tag_set_shared_tags, "blk_mq_tag_set",
"shared_tags");
> + enumerator_value("BLK_MQ_F_TAG_HCTX_SHARED", &blk_hctx_shared);
I got an error as below:
gcc -c -g -DX86_64 -DLZO -DVALGRIND -DGDB_16_2 dev.c -Wall -O2
-Wstrict-prototypes -Wmissing-prototypes -fstack-protector
-Wformat-security
dev.c: In function ‘diskio_init’:
dev.c:4955:54: error: passing argument 2 of ‘enumerator_value’ from
incompatible pointer type [-Wincompatible-pointer-types]
4955 | enumerator_value("BLK_MQ_F_TAG_HCTX_SHARED",
&blk_hctx_shared);
| ^~~~~~~~~~~~~~~~
| |
| int *
In file included from dev.c:18:
defs.h:5856:30: note: expected ‘long int *’ but argument is of type ‘int *’
5856 | int enumerator_value(char *, long *);
| ^~~~~~
make[4]: *** [Makefile:457: dev.o] Error 1
make[3]: *** [Makefile:2237: gdb] Error 2
make[2]: *** [Makefile:327: rebuild] Error 2
make[1]: *** [Makefile:315: gdb_merge] Error 2
make: *** [Makefile:307: all] Error 2
BTW: I used the gcc-15.2.1.
gcc version 15.2.1 20251022 (Red Hat 15.2.1-3) (GCC)
Lianbo
>
> dt->flags |= DISKIO_INIT;
> }
> -- 2.47.0