WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH 2/12] VTPM mini-os: posix IO layer for blkfront i

To: Matthew Fioravante <matthew.fioravante@xxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH 2/12] VTPM mini-os: posix IO layer for blkfront in mini-os
From: Samuel Thibault <samuel.thibault@xxxxxxxxxxxx>
Date: Sat, 12 Mar 2011 02:05:26 +0100
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Fri, 11 Mar 2011 17:46:39 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <4D7AA372.4040506@xxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Mail-followup-to: Samuel Thibault <samuel.thibault@xxxxxxxxxxxx>, Matthew Fioravante <matthew.fioravante@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
References: <4D7AA372.4040506@xxxxxxxxxx>
Resent-date: Sat, 12 Mar 2011 02:40:12 +0100
Resent-from: Samuel Thibault <samuel.thibault@xxxxxxxxxxxx>
Resent-message-id: <20110312014012.GO4922@xxxxxxxxxxxxxxxxxxxxxxxxx>
Resent-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.12-2006-07-14
Matthew Fioravante, le Fri 11 Mar 2011 17:34:26 -0500, a écrit :
> +      /*Make sure we have write permission */
> +      if(dev->info.info & VDISK_READONLY || dev->info.mode != O_RDWR) {

O_WRONLY too.

> +   aiocb.aio_dev = dev;
> +   aiocb.aio_buf = _xmalloc(blocksize, dev->info.sector_size);
> +   aiocb.aio_nbytes = blocksize;
> +   aiocb.aio_offset = blknum * blocksize;
> +   aiocb.aio_cb = NULL;
> +   aiocb.data = NULL;
> +

> +      /* read operation */
> +      if(!write) {
> +      aiocb.aio_cb = NULL;
> +      blkfront_read(&aiocb);
> +      memcpy(buf, &aiocb.aio_buf[blkoff], bytes);
> +      } 

Could you perhaps optimize when buf is actually aligned?  That would
save a copy.

> +      /* 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 != 0 || bytes < blocksize) {
> +         aiocb.aio_cb = NULL;

Maybe blkfront_aio_cb should do it itself?  It looks odd to have to do
it when reusing an aiocb structure.

Apart from that it looks good.

Samuel

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel