mirror of
https://github.com/torvalds/linux.git
synced 2025-11-03 01:59:51 +02:00
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 <asml.silence@gmail.com> Signed-off-by: Mark Harmstone <maharmstone@fb.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
34310c442e
commit
1cc86aeada
1 changed files with 8 additions and 2 deletions
|
|
@ -4740,9 +4740,14 @@ struct btrfs_uring_priv {
|
||||||
bool compressed;
|
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)
|
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 btrfs_inode *inode = BTRFS_I(file_inode(priv->iocb.ki_filp));
|
||||||
struct extent_io_tree *io_tree = &inode->io_tree;
|
struct extent_io_tree *io_tree = &inode->io_tree;
|
||||||
unsigned long index;
|
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)
|
void btrfs_uring_read_extent_endio(void *ctx, int err)
|
||||||
{
|
{
|
||||||
struct btrfs_uring_priv *priv = ctx;
|
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;
|
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);
|
io_uring_cmd_complete_in_task(priv->cmd, btrfs_uring_read_finished);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue