[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH mini-os enhancements for vtpm 2/8] add posix io to blkfront



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

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.