From: Matthew Fioravante Subject: Re: [PATCH 2/12] VTPM mini-os: posix IO layer for blkfront in mini-os Date: Mon, 14 Mar 2011 17:32:31 -0400 Message-ID: <4D7E896F.2080209@jhuapl.edu> References: <4D7AA372.4040506@jhuapl.edu> <20110312010526.GK4922@const.famille.thibault.fr> <4D7E6772.2040606@jhuapl.edu> <20110314192945.GG4370@const.famille.thibault.fr> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0664770757==" Return-path: In-Reply-To: <20110314192945.GG4370@const.famille.thibault.fr> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Samuel Thibault Cc: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org This is a cryptographically signed message in MIME format. --===============0664770757== Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha1; boundary="------------ms010702090903080607030502" This is a cryptographically signed message in MIME format. --------------ms010702090903080607030502 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable I think I totally misunderstood you. With the last case are you just=20 referring to how I keep having to set the callback to NULL everytime? If = so I totally agree with you. It should just set it back to NULL when its = done. I thought you were talking about how I was handling writes to partial=20 blocks and that somehow the low level blkfront functions should be doing = this transparently. On 03/14/2011 03:29 PM, Samuel Thibault wrote: > Matthew Fioravante, le Mon 14 Mar 2011 15:07:30 -0400, a =E9crit : >> On 03/11/2011 08:05 PM, Samuel Thibault wrote: >>> Matthew Fioravante, le Fri 11 Mar 2011 17:34:26 -0500, a =E9crit : >>>> + /*Make sure we have write permission */ >>>> + if(dev->info.info& VDISK_READONLY || dev->info.mode !=3D O_= RDWR) { >>> O_WRONLY too. >> Good catch, actually testing a bitfield with !=3D is a bad idea to beg= in >> with anyway. > Err, it's not a bitfield, in mini-os it's a {0,1,2} enum. > >>> Could you perhaps optimize when buf is actually aligned? That would >>> save a copy. >>> >> This can be done but only if in the current iteration of the loop an >> entire block is being read. > Sure. > >> Since aiocb only operates on sectors it'll >> read at minimum a whole sector into buf. If buf isnt big enough to hol= d >> the data a secondary buffer with a copy operation will have to be done= =2E > Sure. > > But I expect people using that interface to tend to allocate big aligne= d > buffers. > >>>> + /* Write operation */ >>>> + else { >>>> + /* If we're writing a partial block, we need to read the current >>>> contents first >>>> + * so we don't overwrite the extra bits with garbage */ >>>> + if(blkoff !=3D 0 || bytes< blocksize) { >>>> + aiocb.aio_cb =3D NULL; >>> Maybe blkfront_aio_cb should do it itself? It looks odd to have to d= o >>> it when reusing an aiocb structure. >>> >> It could, but then that changes the design of aiocb. Was it supposed t= o >> be a very low level interface for just reading and writing blocks onto= >> the disk? > Well, I'd say the whole blkfront itself is a low-level interrface, and > your patch actually provides a higher one :) > > This particular change in the design shouldn't break anything, since > aio_cb is actually filled by blkfront itself, so it makes sense that it= > cleans it since it expects it to be cleaned. > >> Right now you have to set aio_nbytes and aio_offset to a multiple of >> sector size. This could be changed to allow variable sizes. >> Alternatively 2 new fields could be added to specify which portion >> inside a block to operate on. >> >> Can you send a partial block through the xen block frontend and backen= d >> interface? > No. > >> If not we would have to queue up a read and then a write >> internally when the user requests a write. Its possible some users may= >> not want this forced behavior of 2 operations. > That's why I wouldn't recommend aio_nbytes/offset to be allowed to > be non-multiples of the sector size. That interface is meant to be > an efficient sector-transfer interface. Your posix layer can handle > flexibility for the user. > > Samuel --------------ms010702090903080607030502 Content-Type: application/pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" Content-Description: S/MIME Cryptographic Signature MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIHZzCC A5kwggMCoAMCAQICBD/xkcEwDQYJKoZIhvcNAQEFBQAwLzELMAkGA1UEBhMCVVMxDzANBgNV BAoTBkpIVUFQTDEPMA0GA1UECxMGQklTRENBMB4XDTA5MDcxNzE1MDgwOVoXDTEyMDcxNzE1 Mz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010702090903080607030502-- --===============0664770757== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --===============0664770757==--