From: Christoph Hellwig <hch@infradead.org>
To: Ming Lei <ming.lei@canonical.com>
Cc: linux-kernel@vger.kernel.org,
Dave Kleikamp <dave.kleikamp@oracle.com>,
Jens Axboe <axboe@kernel.dk>, Zach Brown <zab@zabbo.net>,
Christoph Hellwig <hch@infradead.org>,
Maxim Patlasov <mpatlasov@parallels.com>,
Andrew Morton <akpm@linux-foundation.org>,
Alexander Viro <viro@zeniv.linux.org.uk>,
Benjamin LaHaise <bcrl@kvack.org>,
linux-fsdevel@vger.kernel.org,
"open list:AIO" <linux-aio@kvack.org>
Subject: Re: [PATCH v2 1/4] aio: add aio_kernel_() interface
Date: Sun, 25 Jan 2015 05:31:47 -0800 [thread overview]
Message-ID: <20150125133147.GA19445@infradead.org> (raw)
In-Reply-To: <1421163888-21452-2-git-send-email-ming.lei@canonical.com>
> +struct kiocb *aio_kernel_alloc(gfp_t gfp)
> +{
> + return kzalloc(sizeof(struct kiocb), gfp);
> +}
> +EXPORT_SYMBOL_GPL(aio_kernel_alloc);
> +
> +void aio_kernel_free(struct kiocb *iocb)
> +{
> + kfree(iocb);
> +}
> +EXPORT_SYMBOL_GPL(aio_kernel_free);
Both functions don't actually seem to be used in this patch set.
> +void aio_kernel_init_rw(struct kiocb *iocb, struct file *filp,
> + size_t nr, loff_t off,
> + void (*complete)(u64 user_data, long res),
> + u64 user_data)
> +int aio_kernel_submit(struct kiocb *iocb, bool is_write,
> + struct iov_iter *iter)
Why do we keep these two separate? Especially having the iov passed
n the second, and the count in the first seems rather confusing as
we shouldn't even need both for a high level API. Also the private
data should really be a void pointer for the kernel, or simply be
left away as we can assume the iocb is embedded into a caller
data structure and container_of can be used to find that structure.
Also it might make sense to just offer aio_kernel_read/write intefaces
instead of the common submit wrapper, as that's much closer to other
kernel APIs, e.g.
int aio_kernel_read(struct kiocb *iocb, struct file *file,
struct iov_iter *iter, loff_t off,
void (*complete)(struct kiocb *iocb, long res));
int aio_kernel_write(struct kiocb *iocb, struct file *file,
struct iov_iter *iter, loff_t off,
void (*complete)(struct kiocb *iocb, long res));
> + if (WARN_ON(!is_kernel_kiocb(iocb) || !iocb->ki_obj.complete
> + || !iocb->ki_filp || !(iter->type & ITER_BVEC)))
Why do you want to limit what the iov_iter can contain? iovec based
ones seem very useful, and athough I can come up with a use case
for vectors pointing to userspace address I can't see anything that
speaks against allowing them either.
call this from drivers deadling
next prev parent reply other threads:[~2015-01-25 13:31 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1421163888-21452-1-git-send-email-ming.lei@canonical.com>
2015-01-13 15:44 ` [PATCH v2 1/4] aio: add aio_kernel_() interface Ming Lei
2015-01-25 13:31 ` Christoph Hellwig [this message]
2015-01-26 16:18 ` Ming Lei
2015-01-26 17:00 ` Christoph Hellwig
2015-01-27 13:57 ` Ming Lei
2015-01-27 17:59 ` Christoph Hellwig
2015-01-13 15:44 ` [PATCH v2 2/4] fd/direct-io: introduce should_dirty for kernel aio Ming Lei
2015-01-25 13:34 ` Christoph Hellwig
2015-01-27 16:05 ` Ming Lei
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=20150125133147.GA19445@infradead.org \
--to=hch@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=axboe@kernel.dk \
--cc=bcrl@kvack.org \
--cc=dave.kleikamp@oracle.com \
--cc=linux-aio@kvack.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ming.lei@canonical.com \
--cc=mpatlasov@parallels.com \
--cc=viro@zeniv.linux.org.uk \
--cc=zab@zabbo.net \
/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;
as well as URLs for NNTP newsgroup(s).