* LBA Range handling
@ 2011-11-23 18:53 Kong, Kwok
2011-11-23 21:34 ` Matthew Wilcox
0 siblings, 1 reply; 4+ messages in thread
From: Kong, Kwok @ 2011-11-23 18:53 UTC (permalink / raw)
Matthew,
One of the purpose of the BA Range Type is to allow a driver not to
"export" a LBA range that the driver does not understand. i.e. if a SSD
is used in a RAID system previously, the LBA range is configured to be
"RAID". When a non-RAID driver is loaded by mistake, the non-RAID
driver should not export this LBA Range to the OS and hence the RAID
data cannot be overwritten unexpectedly.
When a SSD is brand new, the LBA range type is going to be "Reserved" as
it has never been used.
In the current linux driver, only the hidden attributes is checked.
Should more checking be done ?
In the Windows driver, we (IDT, Intel and Sandforace) have decided to
use the following algorithms to handle the LBA Range:
- Retrieve LBA Range entries via Get Features (ID#3) for each one of the
namespaces;
- Exam the first LBA Range entry of a given namespace;
if (NLB == Namespace Size)
{
if (Type == 00b)
{
// This is a brand new disk for this driver
Issue a Set Features (ID#3) command:
- Type = 1 (Filesystem)
- Attributes = 1 (can be overwritten, visible)
- Starting LBA = 0
- Number of Logical Blocks = size of the Name Space
Export NameSpace to the OS
}
else if (Type == 01b)
{
If (Attributes_bit_1 == 0)
Do not "export" NS to the OS
else
{
if (Attributes_bit_0 == 0)
"export" NS to the OS as "Read Only"
else
"export" NS to the OS
}
}
else
{
Do not "export" the NS to the OS;
}
}
else
{
Do not "export" the NS to the OS;
}
Do you see any problem with this algorithms ?
If not, then should the linux driver match the Windows driver algorithm
?
Thanks
-Kwok
^ permalink raw reply [flat|nested] 4+ messages in thread
* LBA Range handling
2011-11-23 18:53 LBA Range handling Kong, Kwok
@ 2011-11-23 21:34 ` Matthew Wilcox
2011-11-23 21:47 ` Kong, Kwok
0 siblings, 1 reply; 4+ messages in thread
From: Matthew Wilcox @ 2011-11-23 21:34 UTC (permalink / raw)
On Wed, Nov 23, 2011@10:53:37AM -0800, Kong, Kwok wrote:
> One of the purpose of the BA Range Type is to allow a driver not to
> "export" a LBA range that the driver does not understand. i.e. if a SSD
> is used in a RAID system previously, the LBA range is configured to be
> "RAID". When a non-RAID driver is loaded by mistake, the non-RAID
> driver should not export this LBA Range to the OS and hence the RAID
> data cannot be overwritten unexpectedly.
>
> When a SSD is brand new, the LBA range type is going to be "Reserved" as
> it has never been used.
umm ... it is? We should probably get the committee to change that
type 0 from Reserved (which means you can't use it) to 'Unspecified'
or something ...
> In the current linux driver, only the hidden attributes is checked.
> Should more checking be done ?
>
> In the Windows driver, we (IDT, Intel and Sandforace) have decided to
> use the following algorithms to handle the LBA Range:
>
> - Retrieve LBA Range entries via Get Features (ID#3) for each one of the
> namespaces;
> - Exam the first LBA Range entry of a given namespace;
>
> if (NLB == Namespace Size)
> {
> if (Type == 00b)
> {
> // This is a brand new disk for this driver
> Issue a Set Features (ID#3) command:
> - Type = 1 (Filesystem)
> - Attributes = 1 (can be overwritten, visible)
> - Starting LBA = 0
> - Number of Logical Blocks = size of the Name Space
> Export NameSpace to the OS
> }
> else if (Type == 01b)
> {
> If (Attributes_bit_1 == 0)
> Do not "export" NS to the OS
> else
> {
> if (Attributes_bit_0 == 0)
> "export" NS to the OS as "Read Only"
> else
> "export" NS to the OS
> }
> }
> else
> {
> Do not "export" the NS to the OS;
> }
> }
> else
> {
> Do not "export" the NS to the OS;
> }
>
>
> Do you see any problem with this algorithms ?
Yes. If the type of the LBA range is 'page cache', for example, then
it needs to be exported to the OS in order for the OS to use it. Also,
I think you have the sense of the hidden bit wrong. The only change
I'd make to my current algorithm is that we should probably obey the
read-only bit.
Also, I don't know how to handle multiple LBA range types yet ... they
ought to be handled through the Linux partition mechanism, but it doesn't
have any concept of devices providing their own partitioning scheme yet.
> If not, then should the linux driver match the Windows driver algorithm
> ?
>
> Thanks
>
> -Kwok
>
> _______________________________________________
> Linux-nvme mailing list
> Linux-nvme at lists.infradead.org
> http://merlin.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 4+ messages in thread
* LBA Range handling
2011-11-23 21:34 ` Matthew Wilcox
@ 2011-11-23 21:47 ` Kong, Kwok
2011-11-24 18:06 ` Matthew Wilcox
0 siblings, 1 reply; 4+ messages in thread
From: Kong, Kwok @ 2011-11-23 21:47 UTC (permalink / raw)
>> When a SSD is brand new, the LBA range type is going to be "Reserved"
>> as it has never been used.
>
>umm ... it is? We should probably get the committee to change that
type 0 from Reserved (which means you can't use >it) to 'Unspecified'
>or something ...
I agree.
>> Do you see any problem with this algorithms ?
>
>Yes. If the type of the LBA range is 'page cache', for example, then
it needs to be exported to the OS in order for >the OS to use it. Also,
I think you have the sense of the hidden bit wrong. The only change I'd
make to my current >algorithm is that we should probably obey the
read-only bit.
>
>Also, I don't know how to handle multiple LBA range types yet ... they
ought to be handled through the Linux partition >mechanism, but it
doesn't have any concept of devices providing their own partitioning
scheme yet.
Actually, I am not sure how do use the LBA range. Who should set the
LBA Range ? Should it be the driver or the application ? What should
the driver behave if the type is 'page cache', 'RAID', 'Reserved' or
'FILESYSTEM' ?
How are we supposed to use the LBA range ?
Thanks
-Kwok
^ permalink raw reply [flat|nested] 4+ messages in thread
* LBA Range handling
2011-11-23 21:47 ` Kong, Kwok
@ 2011-11-24 18:06 ` Matthew Wilcox
0 siblings, 0 replies; 4+ messages in thread
From: Matthew Wilcox @ 2011-11-24 18:06 UTC (permalink / raw)
On Wed, Nov 23, 2011@01:47:20PM -0800, Kong, Kwok wrote:
> Actually, I am not sure how do use the LBA range. Who should set the
> LBA Range ? Should it be the driver or the application ? What should
> the driver behave if the type is 'page cache', 'RAID', 'Reserved' or
> 'FILESYSTEM' ?
>
> How are we supposed to use the LBA range ?
My understanding is that there will be a user-space application (like
fdisk) that will write the LBA Range Type attribute. The 'type' is
mostly for the benefit of this application and shouldn't be interpreted
by the driver.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-11-24 18:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-23 18:53 LBA Range handling Kong, Kwok
2011-11-23 21:34 ` Matthew Wilcox
2011-11-23 21:47 ` Kong, Kwok
2011-11-24 18:06 ` Matthew Wilcox
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).