Skip to content

Commit 1cc86ae

Browse files
maharmstonekdave
authored andcommitted
btrfs: add struct io_btrfs_cmd as type for io_uring_cmd_to_pdu()
Add struct io_btrfs_cmd as a wrapper type for io_uring_cmd_to_pdu(), rather than using a raw pointer. Suggested-by: Pavel Begunkov <[email protected]> Signed-off-by: Mark Harmstone <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 34310c4 commit 1cc86ae

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

fs/btrfs/ioctl.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4740,9 +4740,14 @@ struct btrfs_uring_priv {
47404740
bool compressed;
47414741
};
47424742

4743+
struct io_btrfs_cmd {
4744+
struct btrfs_uring_priv *priv;
4745+
};
4746+
47434747
static void btrfs_uring_read_finished(struct io_uring_cmd *cmd, unsigned int issue_flags)
47444748
{
4745-
struct btrfs_uring_priv *priv = *io_uring_cmd_to_pdu(cmd, struct btrfs_uring_priv *);
4749+
struct io_btrfs_cmd *bc = io_uring_cmd_to_pdu(cmd, struct io_btrfs_cmd);
4750+
struct btrfs_uring_priv *priv = bc->priv;
47464751
struct btrfs_inode *inode = BTRFS_I(file_inode(priv->iocb.ki_filp));
47474752
struct extent_io_tree *io_tree = &inode->io_tree;
47484753
unsigned long index;
@@ -4796,10 +4801,11 @@ static void btrfs_uring_read_finished(struct io_uring_cmd *cmd, unsigned int iss
47964801
void btrfs_uring_read_extent_endio(void *ctx, int err)
47974802
{
47984803
struct btrfs_uring_priv *priv = ctx;
4804+
struct io_btrfs_cmd *bc = io_uring_cmd_to_pdu(priv->cmd, struct io_btrfs_cmd);
47994805

48004806
priv->err = err;
4807+
bc->priv = priv;
48014808

4802-
*io_uring_cmd_to_pdu(priv->cmd, struct btrfs_uring_priv *) = priv;
48034809
io_uring_cmd_complete_in_task(priv->cmd, btrfs_uring_read_finished);
48044810
}
48054811

0 commit comments

Comments
 (0)