Port-xen archive

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

Re: xbd and large sectors



On Fri, Jul 21, 2023 at 07:00:34AM -0400, Greg Troxel wrote:
> Manuel Bouyer <bouyer%antioche.eu.org@localhost> writes:
> 
> > the backend reports, for xbd0, 16777216 sectors, which we compute as
> > 16777216 * 4k = 64G (and the same 8x larger for xbd1). So the number
> > of sectors reported here are 512-bytes sectors, not 4k.
> >
> > Reading the linux sources, the xbd driver pass "sectors" directly to
> > set_capacity(), which expects the disk size in 512-byte sectors, so
> > the backend is doing what linux expects, and NetBSD is miscomputing
> > the disk size when doing sectors * sector-size.
> >
> > A NetBSD dom0 will never report 4k sectors to the guest so we can just fix
> > the frontend, and there's no backward compat issue.
> >
> > I will commit a fix to HEAD later today.
> 
> 
> It seems to me that it is important for a 4K sector drive that is being
> passed through as a phy: device to have that mirrored in xbd so that we
> don't have the domU doing 512-byte writes needing RMW all the time.
> 
> I'm having trouble following your explanation as I'm not sure which
> pieces are frontend and backend.

the backend is in dom0, the frontend is domU

> 
> Do you mean that the xbd driver in a netbsd domU should:
> 
>   respect the sector size

it does

> 
>   treat the #sectors as being in 512, and thus adjust them by
>   512/sector_size to get the true number of sectors?

This is what I just commited.

> 
> [I personally am trailing edge a bit and don't have a lot of 4K
> experience, disks or displays :-) ]

I don't have hard disks reporting 4K sectors to run tests either.

-- 
Manuel Bouyer <bouyer%antioche.eu.org@localhost>
     NetBSD: 26 ans d'experience feront toujours la difference
--


Home | Main Index | Thread Index | Old Index