xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: Matthew Fioravante <matthew.fioravante@jhuapl.edu>
Cc: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: Re: [PATCH mini-os enhancements for vtpm 2/8] add posix io to blkfront
Date: Tue, 18 Sep 2012 00:46:19 +0200	[thread overview]
Message-ID: <20120917224619.GO5110@type.youpi.perso.aquilenet.fr> (raw)
In-Reply-To: <50579C5F.5040004@jhuapl.edu>

Matthew Fioravante, le Mon 17 Sep 2012 17:55:43 -0400, a écrit :
> +   /* Read mode checks */
> +   else
> +   {
> +      /*If the requested read is bigger than the disk, just
> +       * read as much as we can until the end */
> +      if(offset + count > disksize) {
> +         count = offset >= disksize ? 0 : disksize - offset;
> +      }
> +   }

Perhaps return 0 here already instead of just setting count to 0?

> +
> +   /* Setup aiocb block object */
> +   aiocb.aio_dev = dev;
> +   aiocb.aio_nbytes = blocksize;
> +   aiocb.aio_offset = blknum * blocksize;
> +   aiocb.aio_cb = NULL;
> +   aiocb.data = NULL;
> +
> +   /* If our buffer is unaligned or its aligned but we will need to rw
> a partial block
> +    * then a copy will have to be done */
> +   if(!alignedbuf || blkoff != 0 || count % blocksize != 0) {
> +      copybuf = _xmalloc(blocksize, dev->info.sector_size);
> +   }
> +
> +   rc = count;
> +   while(count > 0) {
> +      /* determine how many bytes to read/write from/to the current
> block buffer */
> +      bytes = count > (blocksize - blkoff) ? blocksize - blkoff : count;

Mmm. Optimizing the non-aligned case would make the code
tricky, but shouldn't optimizing the aligned case at least
a little bit not too hard? i.e. set bytes to max(count,
BLKIF_MAX_SEGMENTS_PER_REQUEST*PAGE_SIZE); in the optimized case? That'd
get much better 44KiB transfers instead of one sector at a time.

Ideally we should even push a series of aio requests, but that's a lot
less easy since you need to know how many requests you can afford.

Apart from that,

Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

  reply	other threads:[~2012-09-17 22:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-17 21:55 [PATCH mini-os enhancements for vtpm 2/8] add posix io to blkfront Matthew Fioravante
2012-09-17 22:46 ` Samuel Thibault [this message]
2012-10-05 18:02   ` Matthew Fioravante
2012-10-08  8:05     ` Samuel Thibault
2012-10-08 14:34       ` Matthew Fioravante
2012-10-08 17:10         ` Samuel Thibault
2012-10-08 17:34           ` Matthew Fioravante
2012-09-18  7:27 ` Ian Campbell

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=20120917224619.GO5110@type.youpi.perso.aquilenet.fr \
    --to=samuel.thibault@ens-lyon.org \
    --cc=matthew.fioravante@jhuapl.edu \
    --cc=xen-devel@lists.xensource.com \
    /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).