From: Al Viro <viro@zeniv.linux.org.uk>
To: Keith Busch <kbusch@fb.com>
Cc: linux-nvme@lists.infradead.org, linux-block@vger.kernel.org,
io-uring@vger.kernel.org, linux-fsdevel@vger.kernel.org,
axboe@kernel.dk, hch@lst.de, Keith Busch <kbusch@kernel.org>
Subject: Re: [PATCH 4/5] io_uring: add support for dma pre-mapping
Date: Wed, 27 Jul 2022 15:11:05 +0100 [thread overview]
Message-ID: <YuFHeT0UaQsYssin@ZenIV> (raw)
In-Reply-To: <20220726173814.2264573-5-kbusch@fb.com>
On Tue, Jul 26, 2022 at 10:38:13AM -0700, Keith Busch wrote:
> + file = fget(map.fd);
> + if (!file)
> + return -EBADF;
> +
> + if (S_ISBLK(file_inode(file)->i_mode))
> + bdev = I_BDEV(file->f_mapping->host);
> + else if (S_ISREG(file_inode(file)->i_mode))
> + bdev = file->f_inode->i_sb->s_bdev;
> + else
> + return -EOPNOTSUPP;
> +
> + for (i = map.buf_start; i < map.buf_end; i++) {
> + struct io_mapped_ubuf *imu = ctx->user_bufs[i];
> + void *tag;
> +
> + if (imu->dma_tag) {
> + ret = -EBUSY;
> + goto err;
> + }
> +
> + tag = block_dma_map(bdev, imu->bvec, imu->nr_bvecs);
> + if (IS_ERR(tag)) {
> + ret = PTR_ERR(tag);
> + goto err;
> + }
> +
> + imu->dma_tag = tag;
> + imu->dma_file = file;
> + imu->bdev = bdev;
> + }
> +
> + fput(file);
This, BTW, is completely insane - what happens if you follow that
with close(map.fd)? A bunch of dangling struct file references?
I really don't understand what you are trying to do here.
next prev parent reply other threads:[~2022-07-27 14:11 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-26 17:38 [PATCH 0/5] dma mapping optimisations Keith Busch
2022-07-26 17:38 ` [PATCH 1/5] blk-mq: add ops to dma map bvec Keith Busch
2022-07-26 17:38 ` [PATCH 2/5] iov_iter: introduce type for preregistered dma tags Keith Busch
2022-07-26 23:10 ` Al Viro
2022-07-27 13:52 ` Keith Busch
2022-07-26 17:38 ` [PATCH 3/5] block: add dma tag bio type Keith Busch
2022-07-26 17:38 ` [PATCH 4/5] io_uring: add support for dma pre-mapping Keith Busch
2022-07-26 23:12 ` Al Viro
2022-07-27 13:58 ` Keith Busch
2022-07-27 14:04 ` Al Viro
2022-07-27 15:04 ` Keith Busch
2022-07-27 22:32 ` Dave Chinner
2022-07-27 23:00 ` Keith Busch
2022-07-28 2:35 ` Dave Chinner
2022-07-28 13:25 ` Keith Busch
2022-07-27 14:11 ` Al Viro [this message]
2022-07-27 14:48 ` Keith Busch
2022-07-27 15:26 ` Al Viro
2022-07-26 17:38 ` [PATCH 5/5] nvme-pci: implement dma_map support Keith Busch
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 \
--in-reply-to=YuFHeT0UaQsYssin@ZenIV \
--to=viro@zeniv.linux.org.uk \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=io-uring@vger.kernel.org \
--cc=kbusch@fb.com \
--cc=kbusch@kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.