All of lore.kernel.org
 help / color / mirror / Atom feed
* In blkif.h, sector unit is not clear
@ 2014-10-08 16:20 Anthony PERARD
  2014-10-09  9:14 ` Ian Campbell
  2014-10-14 15:49 ` Konrad Rzeszutek Wilk
  0 siblings, 2 replies; 4+ messages in thread
From: Anthony PERARD @ 2014-10-08 16:20 UTC (permalink / raw)
  To: Xen Devel; +Cc: Ian Jackson, Ian Campbell, Jan Beulich

I'm trying to understand the different device properties exposed on
xenstore for a block device. And there is one property that is
contradictory within blkif.h, "sectors". There are two possible units for
it, either "sector-size" or 512-byte. Which one it is?

My guess is that it does not matter too much since "sector-size" is
probably always reported as 512.

Here is the interesting part of xen/include/public/io/blkif.h:

@@ -198,1 +198,1 @@
  *------------------------- Backend Device Properties -------------------------
@@ -241,18 +241,18 @@
  * sector-size
  *      Values:         <uint32_t>
  *
  *      The logical sector size, in bytes, of the backend device.
  *
  * physical-sector-size
  *      Values:         <uint32_t>
  *
  *      The physical sector size, in bytes, of the backend device.
  *
  * sectors
  *      Values:         <uint64_t>
  *
  *      The size of the backend device, expressed in units of its logical
  *      sector size ("sector-size").

HERE: unit for "sectors" is "sector-size"

@@ -547,10 +547,10 @@
 /*
  * NB. first_sect and last_sect in blkif_request_segment, as well as
  * sector_number in blkif_request, are always expressed in 512-byte units.
  * However they must be properly aligned to the real sector size of the
  * physical disk, which is reported in the "physical-sector-size" node in
  * the backend xenbus info. Also the xenbus "sectors" node is expressed in
  * 512-byte units.
  */
 struct blkif_request_segment {
     grant_ref_t gref;        /* reference to I/O buffer frame        */

HERE: unit for "sectors" is 512-byte


Regards,

-- 
Anthony PERARD

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: In blkif.h, sector unit is not clear
  2014-10-08 16:20 In blkif.h, sector unit is not clear Anthony PERARD
@ 2014-10-09  9:14 ` Ian Campbell
  2014-10-10  8:13   ` Jan Beulich
  2014-10-14 15:49 ` Konrad Rzeszutek Wilk
  1 sibling, 1 reply; 4+ messages in thread
From: Ian Campbell @ 2014-10-09  9:14 UTC (permalink / raw)
  To: Anthony PERARD; +Cc: Ian Jackson, Jan Beulich, Xen Devel

CCing Konrad who I think knows about this sort of stuff.

On Wed, 2014-10-08 at 17:20 +0100, Anthony PERARD wrote:
> I'm trying to understand the different device properties exposed on
> xenstore for a block device. And there is one property that is
> contradictory within blkif.h, "sectors". There are two possible units for
> it, either "sector-size" or 512-byte. Which one it is?
> 
> My guess is that it does not matter too much since "sector-size" is
> probably always reported as 512.

I'm not so sure of that once large enterprise arrays or iscsi etc get
into the picture.

> 
> Here is the interesting part of xen/include/public/io/blkif.h:
> 
> @@ -198,1 +198,1 @@
>   *------------------------- Backend Device Properties -------------------------
> @@ -241,18 +241,18 @@
>   * sector-size
>   *      Values:         <uint32_t>
>   *
>   *      The logical sector size, in bytes, of the backend device.
>   *
>   * physical-sector-size
>   *      Values:         <uint32_t>
>   *
>   *      The physical sector size, in bytes, of the backend device.
>   *
>   * sectors
>   *      Values:         <uint64_t>
>   *
>   *      The size of the backend device, expressed in units of its logical
>   *      sector size ("sector-size").
> 
> HERE: unit for "sectors" is "sector-size"
> 
> @@ -547,10 +547,10 @@
>  /*
>   * NB. first_sect and last_sect in blkif_request_segment, as well as
>   * sector_number in blkif_request, are always expressed in 512-byte units.
>   * However they must be properly aligned to the real sector size of the
>   * physical disk, which is reported in the "physical-sector-size" node in
>   * the backend xenbus info. Also the xenbus "sectors" node is expressed in
>   * 512-byte units.
>   */
>  struct blkif_request_segment {
>      grant_ref_t gref;        /* reference to I/O buffer frame        */
> 
> HERE: unit for "sectors" is 512-byte
> 
> 
> Regards,
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: In blkif.h, sector unit is not clear
  2014-10-09  9:14 ` Ian Campbell
@ 2014-10-10  8:13   ` Jan Beulich
  0 siblings, 0 replies; 4+ messages in thread
From: Jan Beulich @ 2014-10-10  8:13 UTC (permalink / raw)
  To: Anthony PERARD, Ian Campbell; +Cc: Ian Jackson, Xen Devel

>>> On 09.10.14 at 11:14, <Ian.Campbell@citrix.com> wrote:
> CCing Konrad who I think knows about this sort of stuff.
> 
> On Wed, 2014-10-08 at 17:20 +0100, Anthony PERARD wrote:
>> I'm trying to understand the different device properties exposed on
>> xenstore for a block device. And there is one property that is
>> contradictory within blkif.h, "sectors". There are two possible units for
>> it, either "sector-size" or 512-byte. Which one it is?
>> 
>> My guess is that it does not matter too much since "sector-size" is
>> probably always reported as 512.
> 
> I'm not so sure of that once large enterprise arrays or iscsi etc get
> into the picture.

Indeed, yet the header's implication I think is that it's always
512 bytes.

Jan

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: In blkif.h, sector unit is not clear
  2014-10-08 16:20 In blkif.h, sector unit is not clear Anthony PERARD
  2014-10-09  9:14 ` Ian Campbell
@ 2014-10-14 15:49 ` Konrad Rzeszutek Wilk
  1 sibling, 0 replies; 4+ messages in thread
From: Konrad Rzeszutek Wilk @ 2014-10-14 15:49 UTC (permalink / raw)
  To: Anthony PERARD; +Cc: Ian Jackson, Ian Campbell, Jan Beulich, Xen Devel

On Wed, Oct 08, 2014 at 05:20:53PM +0100, Anthony PERARD wrote:
> I'm trying to understand the different device properties exposed on
> xenstore for a block device. And there is one property that is
> contradictory within blkif.h, "sectors". There are two possible units for
> it, either "sector-size" or 512-byte. Which one it is?
> 
> My guess is that it does not matter too much since "sector-size" is
> probably always reported as 512.


Looking at the code it appears that it will accept any 'sector-size'
values and program them to the Linux API. And I believe that for
CD-ROMs it will program them with the correct sector value (which is
2048).

But for the 'gref' and 'fsect','lset' it will always be in 512
byte units.

> 
> Here is the interesting part of xen/include/public/io/blkif.h:
> 
> @@ -198,1 +198,1 @@
>   *------------------------- Backend Device Properties -------------------------
> @@ -241,18 +241,18 @@
>   * sector-size
>   *      Values:         <uint32_t>
>   *
>   *      The logical sector size, in bytes, of the backend device.
>   *
>   * physical-sector-size
>   *      Values:         <uint32_t>
>   *
>   *      The physical sector size, in bytes, of the backend device.
>   *
>   * sectors
>   *      Values:         <uint64_t>
>   *
>   *      The size of the backend device, expressed in units of its logical
>   *      sector size ("sector-size").
> 
> HERE: unit for "sectors" is "sector-size"
> 
> @@ -547,10 +547,10 @@
>  /*
>   * NB. first_sect and last_sect in blkif_request_segment, as well as
>   * sector_number in blkif_request, are always expressed in 512-byte units.
>   * However they must be properly aligned to the real sector size of the
>   * physical disk, which is reported in the "physical-sector-size" node in
>   * the backend xenbus info. Also the xenbus "sectors" node is expressed in
>   * 512-byte units.
>   */
>  struct blkif_request_segment {
>      grant_ref_t gref;        /* reference to I/O buffer frame        */
> 
> HERE: unit for "sectors" is 512-byte
> 
> 
> Regards,
> 
> -- 
> Anthony PERARD

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-10-14 15:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-08 16:20 In blkif.h, sector unit is not clear Anthony PERARD
2014-10-09  9:14 ` Ian Campbell
2014-10-10  8:13   ` Jan Beulich
2014-10-14 15:49 ` Konrad Rzeszutek Wilk

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.