public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH] btrfs: add struct io_btrfs_cmd as type for io_uring_cmd_to_pdu()
@ 2024-10-31 16:03 Mark Harmstone
  2024-10-31 16:10 ` Pavel Begunkov
  2024-11-06 20:32 ` David Sterba
  0 siblings, 2 replies; 4+ messages in thread
From: Mark Harmstone @ 2024-10-31 16:03 UTC (permalink / raw)
  To: linux-btrfs; +Cc: io-uring, Mark Harmstone, Pavel Begunkov

Add struct io_btrfs_cmd as a wrapper type for io_uring_cmd_to_pdu(),
rather than using a raw pointer.

Signed-off-by: Mark Harmstone <[email protected]>
Suggested-by: Pavel Begunkov <[email protected]>
---
 fs/btrfs/ioctl.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index cf63264a3a60..27a9342cd91c 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -4740,9 +4740,14 @@ struct btrfs_uring_priv {
 	bool compressed;
 };
 
+struct io_btrfs_cmd {
+	struct btrfs_uring_priv *priv;
+};
+
 static void btrfs_uring_read_finished(struct io_uring_cmd *cmd, unsigned int issue_flags)
 {
-	struct btrfs_uring_priv *priv = *io_uring_cmd_to_pdu(cmd, struct btrfs_uring_priv *);
+	struct io_btrfs_cmd *bc = io_uring_cmd_to_pdu(cmd, struct io_btrfs_cmd);
+	struct btrfs_uring_priv *priv = bc->priv;
 	struct btrfs_inode *inode = BTRFS_I(file_inode(priv->iocb.ki_filp));
 	struct extent_io_tree *io_tree = &inode->io_tree;
 	unsigned long index;
@@ -4796,10 +4801,11 @@ static void btrfs_uring_read_finished(struct io_uring_cmd *cmd, unsigned int iss
 void btrfs_uring_read_extent_endio(void *ctx, int err)
 {
 	struct btrfs_uring_priv *priv = ctx;
+	struct io_btrfs_cmd *bc = io_uring_cmd_to_pdu(priv->cmd, struct io_btrfs_cmd);
 
 	priv->err = err;
+	bc->priv = priv;
 
-	*io_uring_cmd_to_pdu(priv->cmd, struct btrfs_uring_priv *) = priv;
 	io_uring_cmd_complete_in_task(priv->cmd, btrfs_uring_read_finished);
 }
 
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] btrfs: add struct io_btrfs_cmd as type for io_uring_cmd_to_pdu()
  2024-10-31 16:03 [PATCH] btrfs: add struct io_btrfs_cmd as type for io_uring_cmd_to_pdu() Mark Harmstone
@ 2024-10-31 16:10 ` Pavel Begunkov
  2024-11-06 20:32 ` David Sterba
  1 sibling, 0 replies; 4+ messages in thread
From: Pavel Begunkov @ 2024-10-31 16:10 UTC (permalink / raw)
  To: Mark Harmstone, linux-btrfs; +Cc: io-uring

On 10/31/24 16:03, Mark Harmstone wrote:
> Add struct io_btrfs_cmd as a wrapper type for io_uring_cmd_to_pdu(),
> rather than using a raw pointer.

That looks better, thanks. I don't think your patches got
merged yet, so you'd need to send it together with the next
version of your patchset, or even better squash it into the
patch 5/5.

-- 
Pavel Begunkov

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] btrfs: add struct io_btrfs_cmd as type for io_uring_cmd_to_pdu()
       [not found] <[email protected]>
@ 2024-10-31 16:23 ` Mark Harmstone
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Harmstone @ 2024-10-31 16:23 UTC (permalink / raw)
  To: [email protected]; +Cc: [email protected]

On 31/10/24 16:10, Pavel Begunkov wrote:
> > 
> On 10/31/24 16:03, Mark Harmstone wrote:
>> Add struct io_btrfs_cmd as a wrapper type for io_uring_cmd_to_pdu(),
>> rather than using a raw pointer.
> 
> That looks better, thanks. I don't think your patches got
> merged yet, so you'd need to send it together with the next
> version of your patchset, or even better squash it into the
> patch 5/5.
> 

Thanks Pavel. All five patches are already in 
https://github.com/btrfs/linux/commits/for-next/

Mark

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] btrfs: add struct io_btrfs_cmd as type for io_uring_cmd_to_pdu()
  2024-10-31 16:03 [PATCH] btrfs: add struct io_btrfs_cmd as type for io_uring_cmd_to_pdu() Mark Harmstone
  2024-10-31 16:10 ` Pavel Begunkov
@ 2024-11-06 20:32 ` David Sterba
  1 sibling, 0 replies; 4+ messages in thread
From: David Sterba @ 2024-11-06 20:32 UTC (permalink / raw)
  To: Mark Harmstone; +Cc: linux-btrfs, io-uring, Pavel Begunkov

On Thu, Oct 31, 2024 at 04:03:56PM +0000, Mark Harmstone wrote:
> Add struct io_btrfs_cmd as a wrapper type for io_uring_cmd_to_pdu(),
> rather than using a raw pointer.
> 
> Signed-off-by: Mark Harmstone <[email protected]>
> Suggested-by: Pavel Begunkov <[email protected]>

Added to for-next to the other io_uring patches, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-11-06 20:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-31 16:03 [PATCH] btrfs: add struct io_btrfs_cmd as type for io_uring_cmd_to_pdu() Mark Harmstone
2024-10-31 16:10 ` Pavel Begunkov
2024-11-06 20:32 ` David Sterba
     [not found] <[email protected]>
2024-10-31 16:23 ` Mark Harmstone

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox