From mboxrd@z Thu Jan 1 00:00:00 1970 From: Samuel Thibault Subject: Re: [PATCH mini-os enhancements for vtpm 2/8] add posix io to blkfront Date: Mon, 8 Oct 2012 19:10:04 +0200 Message-ID: <20121008171004.GH5985@type.bordeaux.inria.fr> References: <50579C5F.5040004@jhuapl.edu> <20120917224619.GO5110@type.youpi.perso.aquilenet.fr> <506F209E.2040902@jhuapl.edu> <20121008080500.GA5985@type.bordeaux.inria.fr> <5072E470.1060404@jhuapl.edu> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Content-Disposition: inline In-Reply-To: <5072E470.1060404@jhuapl.edu> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Matthew Fioravante Cc: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org Matthew Fioravante, le Mon 08 Oct 2012 10:34:24 -0400, a =E9crit : > 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 >=3D BLKIF_MAX_SEGMENTS_PER_REQUEST*PAGE_SIZE && (!(buf & ~(PAGE_SIZE-1)))) /* page-aligned */ bytes =3D BLKIF_MAX_SEGMENTS_PER_REQUEST*PAGE_SIZE; else if (count >=3D (BLKIF_MAX_SEGMENTS_PER_REQUEST-1)*PAGE_SIZE) /* only sector-aligned, will have to realign */ bytes =3D (BLKIF_MAX_SEGMENTS_PER_REQUEST-1)*PAGE_SIZE; else bytes =3D count & ~(blocksize - 1); } } > Is the page math being done above that assertion correct? I believe so. Samuel