From: Mark Harmstone <[email protected]>
To: <[email protected]>
Cc: <[email protected]>, Mark Harmstone <[email protected]>,
Pavel Begunkov <[email protected]>
Subject: [PATCH] btrfs: add struct io_btrfs_cmd as type for io_uring_cmd_to_pdu()
Date: Thu, 31 Oct 2024 16:03:56 +0000 [thread overview]
Message-ID: <[email protected]> (raw)
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
next reply other threads:[~2024-10-31 16:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-31 16:03 Mark Harmstone [this message]
2024-10-31 16:10 ` [PATCH] btrfs: add struct io_btrfs_cmd as type for io_uring_cmd_to_pdu() Pavel Begunkov
[not found] <[email protected]>
2024-10-31 16:23 ` Mark Harmstone
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox