Re: sector size in block device drivers

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

 



On Sun, Feb 1, 2009 at 4:50 AM, nidhi mittal <nidhimittal19@xxxxxxxxx> wrote:
> hello
> i was writing my initial block device driver following LDD
> but was totally confused on KERNEL SECTOR SIZE and hardware sector size
> issue they discussed in that .
>
> they write sth like
> if sector number passed between kernel and block layer it should be
> something and
> if its passed between blocklayer and driver it should be something else.
>
> means at different place some confusing note abt sector size
> can someone clear it to me in simple 2-3 sentences
>
> At what places , in which function i shd consider sending sector size with a
> thought that
> at this place it understand sector= 512 bytes
> and
> At what places , in which function i shd consider sending sector size as my
> hardware sector size
> in thinking that it understand 2048 bytes ...
>
> and
> most important
> in book they write
>
> blk_queue_hardsect_size(request_queue_t *queue , unsigned short max );
> "All the communication from block layer and driver is in 512 bytes but all
> request generated by kernel are multiple of
> hardware sect size and properly aligned "
>
> so i wanted to know where actually is block layer and where is driver
> where are they separated how do i know when i m going from block layer to
> driver ....
> what i understand is ONLY user space and kernel space
>
> it will be very kind if someone clears it to me.
> thanks
> Nidhi
>
>
> Thanks & Regards
> Nidhi

This is an educated guess only:

Prior to summer 2008 the core block driver code supported only 512
bytes sectors.  Those few devices that had a different sector size had
to implement their own customizations with little or no support from
the generic block driver code.

About summer 2008 a set of patches went in to allow other sector
sizes.  Specifically, iirc some scsi devices now have 4k sectors.  ie.
they _only_ support i/o in multiples of 4k at a time.

Those patches in theory support a number of different sector sizes,
but I think only 512 byte and 4K sectors were tested.

So at this point the majority of the Linux Block layer code is written
around 512 byte sectors, but there is now generic support routines
available to support hardware with other sector sizes.

Thus the KERNEL SECTOR SIZE is 512 bytes and MOST hardware also has
512 bytes, but some hardware has 4k sector size.

Greg
-- 
Greg Freemyer
Litigation Triage Solutions Specialist
http://www.linkedin.com/in/gregfreemyer
First 99 Days Litigation White Paper -
http://www.norcrossgroup.com/forms/whitepapers/99%20Days%20whitepaper.pdf

The Norcross Group
The Intersection of Evidence & Technology
http://www.norcrossgroup.com

--
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