Re: [PATCH] 9p/xen: Use flexible array for data rings

From: Jürgen Groß

Date: Wed May 27 2026 - 06:12:47 EST


On 27.05.26 08:38, Rosen Penev wrote:
On Tue, May 26, 2026 at 10:39 PM Jürgen Groß <jgross@xxxxxxxx> wrote:

On 19.05.26 03:57, Rosen Penev wrote:
Store the fixed set of Xen 9p data rings in the frontend private
allocation instead of allocating a separate rings array.

This keeps the data ring storage tied to the frontend lifetime and
simplifies the allocation and cleanup paths.

Assisted-by: Codex:GPT-5.5
Signed-off-by: Rosen Penev <rosenp@xxxxxxxxx>
---
net/9p/trans_xen.c | 68 ++++++++++++++++++++--------------------------
1 file changed, 30 insertions(+), 38 deletions(-)

diff --git a/net/9p/trans_xen.c b/net/9p/trans_xen.c
index f9fb2db7a066..5a110d71d18c 100644
--- a/net/9p/trans_xen.c
+++ b/net/9p/trans_xen.c
@@ -55,7 +55,7 @@ struct xen_9pfs_front_priv {
char *tag;
struct p9_client *client;

- struct xen_9pfs_dataring *rings;
+ struct xen_9pfs_dataring rings[];

Any reason not to use rings[XEN_9PFS_NUM_RINGS] instead of a flex array?

The number of rings is a compile time constant, after all!
flexibility really. I don't know if this will ever change.

If it ever changes we can still switch to a flex array.


Juergen

Attachment: OpenPGP_0xB0DE9DD628BF132F.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature