From: Trond Myklebust <trond.myklebust@fys.uio.no>
To: Jens Axboe <jens.axboe@oracle.com>
Cc: linux-kernel@vger.kernel.org, jeff@garzik.org,
benh@kernel.crashing.org, htejun@gmail.com, bzolnier@gmail.com,
alan@lxorguk.ukuu.org.uk
Subject: Re: [PATCH 2/4] direct-io: make O_DIRECT IO path be page based
Date: Thu, 20 Aug 2009 09:19:04 -0400 [thread overview]
Message-ID: <1250774344.5352.34.camel@heimdal.trondhjem.org> (raw)
In-Reply-To: <1250763466-24282-4-git-send-email-jens.axboe@oracle.com>
On Thu, 2009-08-20 at 12:17 +0200, Jens Axboe wrote:
> Currently we pass in the iovec array and let the O_DIRECT core
> handle the get_user_pages() business. This work, but it means that
> we can ever only use user pages for O_DIRECT.
>
> Switch the aops->direct_IO() and below code to use page arrays
> instead, so that it doesn't make any assumptions about who the pages
> belong to. This works directly for all users but NFS, which just
> uses the same helper that the generic mapping read/write functions
> also call.
>
> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
> ---
> static ssize_t nfs_direct_write_schedule_segment(struct nfs_direct_req *dreq,
> - const struct iovec *iov,
> - loff_t pos, int sync)
> + struct dio_args *args,
> + int sync)
> {
> struct nfs_open_context *ctx = dreq->ctx;
> struct inode *inode = ctx->path.dentry->d_inode;
> - unsigned long user_addr = (unsigned long)iov->iov_base;
> - size_t count = iov->iov_len;
> + unsigned long user_addr = args->user_addr;
> + size_t count = args->length;
> struct rpc_task *task;
> struct rpc_message msg = {
> .rpc_cred = ctx->cred,
> @@ -726,24 +702,8 @@ static ssize_t nfs_direct_write_schedule_segment(struct nfs_direct_req *dreq,
> if (unlikely(!data))
> break;
>
> - down_read(¤t->mm->mmap_sem);
> - result = get_user_pages(current, current->mm, user_addr,
> - data->npages, 0, 0, data->pagevec, NULL);
> - up_read(¤t->mm->mmap_sem);
> - if (result < 0) {
> - nfs_writedata_free(data);
> - break;
> - }
> - if ((unsigned)result < data->npages) {
> - bytes = result * PAGE_SIZE;
> - if (bytes <= pgbase) {
> - nfs_direct_release_pages(data->pagevec, result);
> - nfs_writedata_free(data);
> - break;
> - }
> - bytes -= pgbase;
> - data->npages = result;
> - }
> + data->pagevec = args->pages;
> + data->npages = args->nr_segs;
>
> get_dreq(dreq);
>
This looks a bit odd. What guarantees that args->pages contain <= wsize
bytes? The server will not accept larger segments in a single RPC call.
Cheers
Trond
next prev parent reply other threads:[~2009-08-20 13:19 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-20 10:17 [PATCH 0/6] Lazy workqueues Jens Axboe
2009-08-20 10:17 ` [PATCH 1/4] direct-io: unify argument passing by adding a dio_args structure Jens Axboe
2009-08-20 10:17 ` [PATCH 1/6] workqueue: replace singlethread/freezable/rt parameters and variables with flags Jens Axboe
2009-08-20 10:17 ` [PATCH 2/4] direct-io: make O_DIRECT IO path be page based Jens Axboe
2009-08-20 10:17 ` [PATCH 2/6] workqueue: add support for lazy workqueues Jens Axboe
2009-08-20 10:17 ` [PATCH 3/6] crypto: use " Jens Axboe
2009-08-20 10:17 ` [PATCH 3/4] direct-io: add a "IO for kernel" flag to kiocb Jens Axboe
2009-08-20 10:17 ` [PATCH 4/6] libata: use lazy workqueues for the pio task Jens Axboe
2009-08-20 10:17 ` [PATCH 4/5] loop: support O_DIRECT transfer mode Jens Axboe
2009-08-20 10:17 ` [PATCH 5/6] aio: use lazy workqueues Jens Axboe
2009-08-20 10:17 ` [PATCH 4/4] direct-io: get rid of irq flag saving where it isn't needed Jens Axboe
2009-08-20 10:17 ` [PATCH 6/6] sunrpc: use lazy workqueues Jens Axboe
2009-08-21 0:20 ` [PATCH 2/6] workqueue: add support for " Andrew Morton
2009-08-24 8:06 ` Jens Axboe
2009-08-20 13:19 ` Trond Myklebust [this message]
2009-08-24 7:58 ` [PATCH 2/4] direct-io: make O_DIRECT IO path be page based Jens Axboe
2009-08-21 0:12 ` Andrew Morton
2009-08-24 8:00 ` Jens Axboe
2009-08-21 0:03 ` [PATCH 1/4] direct-io: unify argument passing by adding a dio_args structure Andrew Morton
2009-08-24 7:58 ` Jens Axboe
-- strict thread matches above, loose matches on Subject: below --
2009-08-18 8:34 [PATCH 0/4] Page based O_DIRECT v2 Jens Axboe
2009-08-18 8:34 ` [PATCH 2/4] direct-io: make O_DIRECT IO path be page based Jens Axboe
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=1250774344.5352.34.camel@heimdal.trondhjem.org \
--to=trond.myklebust@fys.uio.no \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=benh@kernel.crashing.org \
--cc=bzolnier@gmail.com \
--cc=htejun@gmail.com \
--cc=jeff@garzik.org \
--cc=jens.axboe@oracle.com \
--cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®