Re: Sector sizes in the kernel

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

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sat, Mar 24, 2007 at 09:51:04PM +0200, Tzahi Fadida wrote:
> I am reading from LDD3 and in the block device chapter there is a talk about
> KERNEL_SECTOR_SIZE which is supposed to be 512bytes.
> The problem is the terminology. A sector is a very big thing, i.e.:
> in a floppy you have 18 sectors, 2 heads, 80 cylinders and a block size of 
> 512bytes. The size of a sector (which is a slice) is 80 * 512 bytes.
> http://en.wikipedia.org/wiki/Cylinder-head-sector
> I am sure this is not what they meant in the kernel.
> I.e., i think they meant block size.

A sector is the smallest addressable entity on a disk. Almost all hard
drives have 512 byte sectors, though SCSI drives can be reformated with
a different sector size (512 to up to 524 bytes IIRC). Hard drives with
1k sector sizes will become available in the near future.

> but in the same code they also mention a sector which seems to be referring to 
> the number of sectors:16 (slice). In section 16.2.3
> And then they say geo.start = 4 to refer to the starting sector but this time 
> again they probably mean block. This is confusing. Can somebody clear this 
> up?
> 
> Also, regarding sectors of 2048 bytes (block size) and the kernel works with 
> 512bytes. If your device work in 2048 bytes, do you have to translate each 
> sector (block) to 4 consecutive kernel sectors in the (virtual) array of 
> sectors the kernel sees in your driver?

See how the SCSI CD driver works (drivers/scsi/sr.c), CDs usually have
a 2k sector size.

> The problem with that is that it would think that a request are not on the 
> same cylinder and won't group it correctly. I.e. 4 virtual kernel cylinders 
> are actually 1 cylinder in the device.

AFAIU the kernel takes care of that when it is told that a device has a
2k sector size.


Erik

- -- 
They're all fools. Don't worry. Darwin may be slow, but he'll
eventually get them. -- Matthew Lammers in alt.sysadmin.recovery
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFGB7kt/PlVHJtIto0RAqdMAJ98pHEH0PJ8/kXtCVyxzM4N3m8cVACfc3iV
3ExVFXwwH4Yy7/NMsPkHz4M=
=cKow
-----END PGP SIGNATURE-----

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux