Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w1wBH-000jaD-15 for pgsql-hackers@arkaria.postgresql.org; Mon, 16 Mar 2026 00:51:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w1wBG-006Yle-10 for pgsql-hackers@arkaria.postgresql.org; Mon, 16 Mar 2026 00:51:39 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w1wBG-006YlV-08 for pgsql-hackers@lists.postgresql.org; Mon, 16 Mar 2026 00:51:38 +0000 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w1wBE-00000000Joh-1Mnu for pgsql-hackers@lists.postgresql.org; Mon, 16 Mar 2026 00:51:37 +0000 Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-82984c077b2so1987773b3a.1 for ; Sun, 15 Mar 2026 17:51:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773622295; x=1774227095; darn=lists.postgresql.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=te8NaJJPGoZtO0iZhcNtOzbHRnPST7T1uHkBwTWsNas=; b=J9g0XcOe1Yku6bUbvGNtuDuyTa2OGguRkREgDdoMKQeM02KCygOGARH/UmAGxlurO/ /zkvv+vt74/0Wsx0mJK34gxTTi4C2r7xC7Vxw+NxjdlKwFyoWaOSqSKjRupKzCVf9x4y o6KxoRYVl6/3k52V2kM7ddnbsP1+Sys+5X3hBnHYlPVLy1oFCg2OA3PL1baDEmh30509 wanxsIuAcFiPu6j2XRpo0/6KCKhEAWYGlw6WGCHrtLkPsVoj7qWKjxTdyEx3UVcFeJhx jiv62rsGdaKLGmCDXPVU7orajlPf7Q2x8exwI5mjqBBW5aFjgM0dA6fbU38WTWaOq6kB UWZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773622295; x=1774227095; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=te8NaJJPGoZtO0iZhcNtOzbHRnPST7T1uHkBwTWsNas=; b=J03GTt61dGEScxp+q2yc9sjGFtANlj3bk4aNUcMIkVwafAFYOcPjy+ThNzhYjOeC3u Li0E5nMvtpQf4WbaJVlp4TyKybr2XfVCKhGCzsuSBykYBYbW4mAs+KzzXQiwZIDRHWG+ rwm9dfSzETKZ7YXkpABFFFhfNnZ+Z3CRApRnVVEYW+raJ2+05dHei9GPfwCDaRQVkSnx 2ifXYlr+GT4TtiPDeQcnbtvNxVdlDSuhmmGXB+asTAnBpg4T/xpnV/Ax9xvi6ilxysHZ 8WLExhmDwmMnMT3VBLNqIAAndmR2bSmwz9DzkEORPlpCqzYMhXVOTVySza1KL9SshIDL g09g== X-Gm-Message-State: AOJu0YzDI9fvoox1/Q8mKl1a+fXsXMFPsfkyECBDk3eUmwtB04kHO4X+ 1ApC1J323a89FX86p2UKKP71VKzPlktr469uuxf/c95eZRLabofuyHHh X-Gm-Gg: ATEYQzziJ5seGvGIKBrrAUPKcyai06QgbTeVCDxACf+CS+Hjf3J0Xi2pydJyOFzUvIR EHKE7tv7f8aR2JfFFZ+Zq+jVuuRKnRfKJkw1yFsqO23lvJuy7FO/9GoJHiKNh/39nZJDlcvmjMs IFoCStFuaa0rBZFG6+GzNfRu7GjAprKYNzYxBBftubSaJTSkw5gnbmRsoNcU43ftU4rc7ciNKM/ 7ZefrNEDt2aqWvLdYTWr0AS7atAmTfK3ozp7h1OqDQ1IIgAQszn65mDUqpdiyFsVBadXttsMVHL mKBXK1bbe35dYFa8rI9MONEGdzeg06nuvTH6R+DhtlSHZ/80OOGM/jr/Kh1apFFe9DjPUFkBNis 0QzsOUOV363hCMMHxdFuCmoAjjZP77OEGCNkj1XgvrvTCkuOcI4aquuUCVn4HduuCHcyz+841xh TJ2Okg5XoaW8bVDshRmE5S9QuoB0AosTs= X-Received: by 2002:a05:6a21:494:b0:398:7d3e:95d7 with SMTP id adf61e73a8af0-398ecabc6e4mr9553058637.22.1773622295016; Sun, 15 Mar 2026 17:51:35 -0700 (PDT) Received: from smtpclient.apple ([45.32.121.103]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-c73fc935ad4sm3222088a12.2.2026.03.15.17.51.33 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 15 Mar 2026 17:51:34 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.400.21\)) Subject: Re: Use SMgrRelation instead of SMgrRelationData * in pgaio_io_set_target_smgr() From: Chao Li In-Reply-To: Date: Mon, 16 Mar 2026 08:50:55 +0800 Cc: PostgreSQL Hackers Content-Transfer-Encoding: quoted-printable Message-Id: References: <96EB95E4-9032-44A6-A397-153256AA5E4D@gmail.com> To: Japin Li X-Mailer: Apple Mail (2.3864.400.21) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Mar 14, 2026, at 11:07, Japin Li wrote: >=20 >=20 > Hi, Chao >=20 > On Fri, 13 Mar 2026 at 15:29, Chao Li wrote: >>> On Mar 13, 2026, at 15:05, Japin Li wrote: >>>=20 >>>=20 >>> Hi, hackers >>>=20 >>> While reading smgr.h, I noticed an inconsistent type usage in >>> pgaio_io_set_target_smgr(). Currently the function is declared as: >>>=20 >>> extern void pgaio_io_set_target_smgr(PgAioHandle *ioh, >>> SMgrRelationData *smgr, >>> ForkNumber forknum, >>> BlockNumber blocknum, >>> int nblocks, >>>=20 >>> However, SMgrRelation is defined as "typedef SMgrRelationData * = SMgrRelation;", >>> and all other functions in the smgr subsystem use SMgrRelation as = the parameter >>> type. >>>=20 >>> To keep the code consistent with the rest of the smgr API, this = patch changes >>> the parameter from SMgrRelationData * to SMgrRelation in both the = definition >>> and declaration. >>>=20 >>> This is purely a style/consistency cleanup with no functional = change. >>>=20 >>> Thoughts? Is this change acceptable? >>>=20 >>> --=20 >>> Regards, >>> Japin Li >>> ChengDu WenWu Information Technology Co., Ltd. >>>=20 >>> >>=20 >> pgaio_io_set_target_smgr doesn=E2=80=99t update smgr, so, instead of = =E2=80=9CSMgrRelation=E2=80=9D, I think it=E2=80=99s better to change = the type to "const SMgrRelationData *=E2=80=9D. >=20 > Thanks for the review! Makes sense =E2=80=94 I've updated the patch to = v2. >=20 > --=20 > Regards, > Japin Li > ChengDu WenWu Information Technology Co., Ltd. >=20 > =E2=80=9Cconst SMgrRelation *=E2=80=9D will not work as you expected, = you have to do =E2=80=9Cconst SMgrRelationData *=E2=80=9D. We want to = protect the data the pointer pointing to from changing but the pointer = itself. Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/