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: Mon, 8 Oct 2012 19:10:04 +0200	[thread overview]
Message-ID: <20121008171004.GH5985@type.bordeaux.inria.fr> (raw)
In-Reply-To: <5072E470.1060404@jhuapl.edu>

Matthew Fioravante, le Mon 08 Oct 2012 10:34:24 -0400, a écrit :
> Sometimes n comes out to be BLKIF_MAX_SEGEMENTS_PER_REQUEST +1.
> 
> This happens when your buffer address is sector aligned (512k), but
> not page aligned (4096k).
> So we can either optimize yet again if address is page
> aligned

Ah, right. Well, I'd say it's worth making the effort to test against
that, i.e. (untested)

else {
	if (count >= BLKIF_MAX_SEGMENTS_PER_REQUEST*PAGE_SIZE
	    && (!(buf & ~(PAGE_SIZE-1))))
	    	/* page-aligned */
		bytes = BLKIF_MAX_SEGMENTS_PER_REQUEST*PAGE_SIZE;
	else if (count >= (BLKIF_MAX_SEGMENTS_PER_REQUEST-1)*PAGE_SIZE)
	    	/* only sector-aligned, will have to realign */
		bytes = (BLKIF_MAX_SEGMENTS_PER_REQUEST-1)*PAGE_SIZE;
	else
		bytes = count & ~(blocksize - 1);
    }
}

> Is the page math being done above that assertion correct?

I believe so.

Samuel

  reply	other threads:[~2012-10-08 17:10 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
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 [this message]
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=20121008171004.GH5985@type.bordeaux.inria.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).