Question about concept of W/R sector on disk

Hello all, I have some question about the concept Write or Read
sectors on disk.

We all know that HDD sector size is 512B, and normal SSD sector size
is 4K or 2k. When my IO trace program send a writefile of 512B or
1024B size write IRP to SSD storage. My upper driver could capture the
real size of transfer.

However as I know the SSD storage could only be accessed by sector
size (4K). So if a 512B write IRP down to the storage. when it could
turned to 4K size of SSD sector compatable? and what is the processs
of it?

I mean how does driver do this job, because it cant write 512B to SSD
and overwrite the other 4K-512B data on the 4k sector. How does the
driver form the 4k write sector command, and in which layer of the
driver? In lower filter or scsi driver?

Thank you for teaching!

First, most media that presents itself as a disk device uses 512B and some more modern use 4096. Only tape, cdrom, etc have I ever seen as 1K or 2K (and a broken iSCSI target).

CDB’s use a length field which is the length in sectors of the request, thus your granularity will be the sector size. If an SRB is built that does not match this, then it will be kicked back with an invalid_parameter error or something similar. (NOTE SRB DataTransferLength is in bytes).

The only “conversion” you may see is from the filesystem that will typically read a full fs cluster of data (4k by default on NTFS up to 32TB) and 64K in REFS. There are exceptions to this rule also.

Is there a problem you are running into?

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@ele.uri.edu
Sent: Saturday, August 31, 2013 12:38 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Question about concept of W/R sector on disk

Hello all, I have some question about the concept Write or Read sectors on disk.

We all know that HDD sector size is 512B, and normal SSD sector size is 4K or 2k. When my IO trace program send a writefile of 512B or 1024B size write IRP to SSD storage. My upper driver could capture the real size of transfer.

However as I know the SSD storage could only be accessed by sector size (4K). So if a 512B write IRP down to the storage. when it could turned to 4K size of SSD sector compatable? and what is the processs of it?

I mean how does driver do this job, because it cant write 512B to SSD and overwrite the other 4K-512B data on the 4k sector. How does the driver form the 4k write sector command, and in which layer of the driver? In lower filter or scsi driver?

Thank you for teaching!


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Thanks for reply.

I know the first two point you mentioned already. What I want to ask
is, for exp:

I write 512B to SSD sector 1. but SSD could only access by 4k, so how
to write 512B on sector 1 but not volate the 4k-512B=3548B data
originally on sector 1.
In other words, the write buffer is 4k, but only 512B is new data. how
to write to SSD for protecting the old data on sector 1.

Does it need to read the sector 1 data and combine new 512B to form
the 4K data buffer in driver?

This is what I asking.

Quoting “Speer, Kenny” :

> First, most media that presents itself as a disk device uses 512B
> and some more modern use 4096. Only tape, cdrom, etc have I ever
> seen as 1K or 2K (and a broken iSCSI target).
>
> CDB’s use a length field which is the length in sectors of the
> request, thus your granularity will be the sector size. If an SRB
> is built that does not match this, then it will be kicked back with
> an invalid_parameter error or something similar. (NOTE SRB
> DataTransferLength is in bytes).
>
> The only “conversion” you may see is from the filesystem that will
> typically read a full fs cluster of data (4k by default on NTFS up
> to 32TB) and 64K in REFS. There are exceptions to this rule also.
>
> Is there a problem you are running into?
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of
> xxxxx@ele.uri.edu
> Sent: Saturday, August 31, 2013 12:38 PM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] Question about concept of W/R sector on disk
>
> Hello all, I have some question about the concept Write or Read
> sectors on disk.
>
> We all know that HDD sector size is 512B, and normal SSD sector size
> is 4K or 2k. When my IO trace program send a writefile of 512B or
> 1024B size write IRP to SSD storage. My upper driver could capture
> the real size of transfer.
>
> However as I know the SSD storage could only be accessed by sector
> size (4K). So if a 512B write IRP down to the storage. when it could
> turned to 4K size of SSD sector compatable? and what is the processs
> of it?
>
> I mean how does driver do this job, because it cant write 512B to
> SSD and overwrite the other 4K-512B data on the 4k sector. How does
> the driver form the 4k write sector command, and in which layer of
> the driver? In lower filter or scsi driver?
>
> Thank you for teaching!
>
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

Since Sector 1 = 4096 bytes you would read Sector 1, modify the 4k Buffer you read, and write Sector 1.

Seems rather straightforward. This is the only method to write < physical sector size, there is no other way to address the 512B you want to write.

This is the same for a 512B sector disk where you only need to modify 8 bytes, read 512, modify, write.

~kenny

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@ele.uri.edu
Sent: Saturday, August 31, 2013 1:00 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Question about concept of W/R sector on disk

Thanks for reply.

I know the first two point you mentioned already. What I want to ask is, for exp:

I write 512B to SSD sector 1. but SSD could only access by 4k, so how to write 512B on sector 1 but not volate the 4k-512B=3548B data originally on sector 1.
In other words, the write buffer is 4k, but only 512B is new data. how to write to SSD for protecting the old data on sector 1.

Does it need to read the sector 1 data and combine new 512B to form the 4K data buffer in driver?

This is what I asking.

Quoting “Speer, Kenny” :

> First, most media that presents itself as a disk device uses 512B and
> some more modern use 4096. Only tape, cdrom, etc have I ever seen as
> 1K or 2K (and a broken iSCSI target).
>
> CDB’s use a length field which is the length in sectors of the
> request, thus your granularity will be the sector size. If an SRB is
> built that does not match this, then it will be kicked back with an
> invalid_parameter error or something similar. (NOTE SRB
> DataTransferLength is in bytes).
>
> The only “conversion” you may see is from the filesystem that will
> typically read a full fs cluster of data (4k by default on NTFS up to
> 32TB) and 64K in REFS. There are exceptions to this rule also.
>
> Is there a problem you are running into?
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of
> xxxxx@ele.uri.edu
> Sent: Saturday, August 31, 2013 12:38 PM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] Question about concept of W/R sector on disk
>
> Hello all, I have some question about the concept Write or Read
> sectors on disk.
>
> We all know that HDD sector size is 512B, and normal SSD sector size
> is 4K or 2k. When my IO trace program send a writefile of 512B or
> 1024B size write IRP to SSD storage. My upper driver could capture the
> real size of transfer.
>
> However as I know the SSD storage could only be accessed by sector
> size (4K). So if a 512B write IRP down to the storage. when it could
> turned to 4K size of SSD sector compatable? and what is the processs
> of it?
>
> I mean how does driver do this job, because it cant write 512B to SSD
> and overwrite the other 4K-512B data on the 4k sector. How does the
> driver form the 4k write sector command, and in which layer of the
> driver? In lower filter or scsi driver?
>
> Thank you for teaching!
>
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Well in any modern operating system the disk reports the sector size (in
Windows it is IOCTL_DISK_GET_DRIVE_GEOMETRY) and the system can enforce that
writes to the disk are a sector. So you will see an SSD reporting a bigger
than 4K sector size, and expecting that for I/O.

Don Burn
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@ele.uri.edu
Sent: Saturday, August 31, 2013 4:00 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Question about concept of W/R sector on disk

Thanks for reply.

I know the first two point you mentioned already. What I want to ask is, for
exp:

I write 512B to SSD sector 1. but SSD could only access by 4k, so how to
write 512B on sector 1 but not volate the 4k-512B=3548B data originally on
sector 1.
In other words, the write buffer is 4k, but only 512B is new data. how to
write to SSD for protecting the old data on sector 1.

Does it need to read the sector 1 data and combine new 512B to form the 4K
data buffer in driver?

This is what I asking.

Quoting “Speer, Kenny” :

> First, most media that presents itself as a disk device uses 512B and
> some more modern use 4096. Only tape, cdrom, etc have I ever seen as
> 1K or 2K (and a broken iSCSI target).
>
> CDB’s use a length field which is the length in sectors of the
> request, thus your granularity will be the sector size. If an SRB is
> built that does not match this, then it will be kicked back with an
> invalid_parameter error or something similar. (NOTE SRB
> DataTransferLength is in bytes).
>
> The only “conversion” you may see is from the filesystem that will
> typically read a full fs cluster of data (4k by default on NTFS up to
> 32TB) and 64K in REFS. There are exceptions to this rule also.
>
> Is there a problem you are running into?
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of
> xxxxx@ele.uri.edu
> Sent: Saturday, August 31, 2013 12:38 PM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] Question about concept of W/R sector on disk
>
> Hello all, I have some question about the concept Write or Read
> sectors on disk.
>
> We all know that HDD sector size is 512B, and normal SSD sector size
> is 4K or 2k. When my IO trace program send a writefile of 512B or
> 1024B size write IRP to SSD storage. My upper driver could capture the
> real size of transfer.
>
> However as I know the SSD storage could only be accessed by sector
> size (4K). So if a 512B write IRP down to the storage. when it could
> turned to 4K size of SSD sector compatable? and what is the processs
> of it?
>
> I mean how does driver do this job, because it cant write 512B to SSD
> and overwrite the other 4K-512B data on the 4k sector. How does the
> driver form the 4k write sector command, and in which layer of the
> driver? In lower filter or scsi driver?
>
> Thank you for teaching!
>
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

Thanks for teaching.

Do you know which layer of driver do such job? in lower filter driver
or scsi_port driver or other layer? do you know where does this
operation happens?

Quoting “Speer, Kenny” :

> Since Sector 1 = 4096 bytes you would read Sector 1, modify the 4k
> Buffer you read, and write Sector 1.
>
> Seems rather straightforward. This is the only method to write <
> physical sector size, there is no other way to address the 512B you
> want to write.
>
> This is the same for a 512B sector disk where you only need to
> modify 8 bytes, read 512, modify, write.
>
> ~kenny
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of
> xxxxx@ele.uri.edu
> Sent: Saturday, August 31, 2013 1:00 PM
> To: Windows System Software Devs Interest List
> Subject: RE: [ntdev] Question about concept of W/R sector on disk
>
> Thanks for reply.
>
> I know the first two point you mentioned already. What I want to ask
> is, for exp:
>
> I write 512B to SSD sector 1. but SSD could only access by 4k, so
> how to write 512B on sector 1 but not volate the 4k-512B=3548B data
> originally on sector 1.
> In other words, the write buffer is 4k, but only 512B is new data.
> how to write to SSD for protecting the old data on sector 1.
>
> Does it need to read the sector 1 data and combine new 512B to form
> the 4K data buffer in driver?
>
> This is what I asking.
>
>
>
> Quoting “Speer, Kenny” :
>
>> First, most media that presents itself as a disk device uses 512B and
>> some more modern use 4096. Only tape, cdrom, etc have I ever seen as
>> 1K or 2K (and a broken iSCSI target).
>>
>> CDB’s use a length field which is the length in sectors of the
>> request, thus your granularity will be the sector size. If an SRB is
>> built that does not match this, then it will be kicked back with an
>> invalid_parameter error or something similar. (NOTE SRB
>> DataTransferLength is in bytes).
>>
>> The only “conversion” you may see is from the filesystem that will
>> typically read a full fs cluster of data (4k by default on NTFS up to
>> 32TB) and 64K in REFS. There are exceptions to this rule also.
>>
>> Is there a problem you are running into?
>>
>> -----Original Message-----
>> From: xxxxx@lists.osr.com
>> [mailto:xxxxx@lists.osr.com] On Behalf Of
>> xxxxx@ele.uri.edu
>> Sent: Saturday, August 31, 2013 12:38 PM
>> To: Windows System Software Devs Interest List
>> Subject: [ntdev] Question about concept of W/R sector on disk
>>
>> Hello all, I have some question about the concept Write or Read
>> sectors on disk.
>>
>> We all know that HDD sector size is 512B, and normal SSD sector size
>> is 4K or 2k. When my IO trace program send a writefile of 512B or
>> 1024B size write IRP to SSD storage. My upper driver could capture the
>> real size of transfer.
>>
>> However as I know the SSD storage could only be accessed by sector
>> size (4K). So if a 512B write IRP down to the storage. when it could
>> turned to 4K size of SSD sector compatable? and what is the processs
>> of it?
>>
>> I mean how does driver do this job, because it cant write 512B to SSD
>> and overwrite the other 4K-512B data on the 4k sector. How does the
>> driver form the 4k write sector command, and in which layer of the
>> driver? In lower filter or scsi driver?
>>
>> Thank you for teaching!
>>
>>
>> —
>> NTDEV is sponsored by OSR
>>
>> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>>
>> OSR is HIRING!! See http://www.osr.com/careers
>>
>> For our schedule of WDF, WDM, debugging and other seminars visit:
>> http://www.osr.com/seminars
>>
>> To unsubscribe, visit the List Server section of OSR Online at
>> http://www.osronline.com/page.cfm?name=ListServer
>>
>> —
>> NTDEV is sponsored by OSR
>>
>> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>>
>> OSR is HIRING!! See http://www.osr.com/careers
>>
>> For our schedule of WDF, WDM, debugging and other seminars visit:
>> http://www.osr.com/seminars
>>
>> To unsubscribe, visit the List Server section of OSR Online at
>> http://www.osronline.com/page.cfm?name=ListServer
>>
>
>
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

Thank you, but could you explain more detail. like my example: write
512B to 4k. What is the process to form the new 4k data in order not
to overwrite the original data on SSD sector. How does it work and
where is it happened in driver?

Quoting Don Burn :

> Well in any modern operating system the disk reports the sector size (in
> Windows it is IOCTL_DISK_GET_DRIVE_GEOMETRY) and the system can enforce that
> writes to the disk are a sector. So you will see an SSD reporting a bigger
> than 4K sector size, and expecting that for I/O.
>
>
> Don Burn
> Windows Filesystem and Driver Consulting
> Website: http://www.windrvr.com
> Blog: http://msmvps.com/blogs/WinDrvr
>
>
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of
> xxxxx@ele.uri.edu
> Sent: Saturday, August 31, 2013 4:00 PM
> To: Windows System Software Devs Interest List
> Subject: RE: [ntdev] Question about concept of W/R sector on disk
>
> Thanks for reply.
>
> I know the first two point you mentioned already. What I want to ask is, for
> exp:
>
> I write 512B to SSD sector 1. but SSD could only access by 4k, so how to
> write 512B on sector 1 but not volate the 4k-512B=3548B data originally on
> sector 1.
> In other words, the write buffer is 4k, but only 512B is new data. how to
> write to SSD for protecting the old data on sector 1.
>
> Does it need to read the sector 1 data and combine new 512B to form the 4K
> data buffer in driver?
>
> This is what I asking.
>
>
>
> Quoting “Speer, Kenny” :
>
>> First, most media that presents itself as a disk device uses 512B and
>> some more modern use 4096. Only tape, cdrom, etc have I ever seen as
>> 1K or 2K (and a broken iSCSI target).
>>
>> CDB’s use a length field which is the length in sectors of the
>> request, thus your granularity will be the sector size. If an SRB is
>> built that does not match this, then it will be kicked back with an
>> invalid_parameter error or something similar. (NOTE SRB
>> DataTransferLength is in bytes).
>>
>> The only “conversion” you may see is from the filesystem that will
>> typically read a full fs cluster of data (4k by default on NTFS up to
>> 32TB) and 64K in REFS. There are exceptions to this rule also.
>>
>> Is there a problem you are running into?
>>
>> -----Original Message-----
>> From: xxxxx@lists.osr.com
>> [mailto:xxxxx@lists.osr.com] On Behalf Of
>> xxxxx@ele.uri.edu
>> Sent: Saturday, August 31, 2013 12:38 PM
>> To: Windows System Software Devs Interest List
>> Subject: [ntdev] Question about concept of W/R sector on disk
>>
>> Hello all, I have some question about the concept Write or Read
>> sectors on disk.
>>
>> We all know that HDD sector size is 512B, and normal SSD sector size
>> is 4K or 2k. When my IO trace program send a writefile of 512B or
>> 1024B size write IRP to SSD storage. My upper driver could capture the
>> real size of transfer.
>>
>> However as I know the SSD storage could only be accessed by sector
>> size (4K). So if a 512B write IRP down to the storage. when it could
>> turned to 4K size of SSD sector compatable? and what is the processs
>> of it?
>>
>> I mean how does driver do this job, because it cant write 512B to SSD
>> and overwrite the other 4K-512B data on the 4k sector. How does the
>> driver form the 4k write sector command, and in which layer of the
>> driver? In lower filter or scsi driver?
>>
>> Thank you for teaching!
>>
>>
>> —
>> NTDEV is sponsored by OSR
>>
>> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>>
>> OSR is HIRING!! See http://www.osr.com/careers
>>
>> For our schedule of WDF, WDM, debugging and other seminars visit:
>> http://www.osr.com/seminars
>>
>> To unsubscribe, visit the List Server section of OSR Online at
>> http://www.osronline.com/page.cfm?name=ListServer
>>
>> —
>> NTDEV is sponsored by OSR
>>
>> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>>
>> OSR is HIRING!! See http://www.osr.com/careers
>>
>> For our schedule of WDF, WDM, debugging and other seminars visit:
>> http://www.osr.com/seminars
>>
>> To unsubscribe, visit the List Server section of OSR Online at
>> http://www.osronline.com/page.cfm?name=ListServer
>>
>
>
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

Well the IOCTL and the enforcement are IIRC in the disk.sys driver (you can
check the source is in the WDK). Now of course that driver queries the
storage controller below it for things like the actual sector size.

Don Burn
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@ele.uri.edu
Sent: Saturday, August 31, 2013 4:08 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Question about concept of W/R sector on disk

Thanks for teaching.

Do you know which layer of driver do such job? in lower filter driver or
scsi_port driver or other layer? do you know where does this operation
happens?

Quoting “Speer, Kenny” :

> Since Sector 1 = 4096 bytes you would read Sector 1, modify the 4k
> Buffer you read, and write Sector 1.
>
> Seems rather straightforward. This is the only method to write <
> physical sector size, there is no other way to address the 512B you
> want to write.
>
> This is the same for a 512B sector disk where you only need to modify
> 8 bytes, read 512, modify, write.
>
> ~kenny
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of
> xxxxx@ele.uri.edu
> Sent: Saturday, August 31, 2013 1:00 PM
> To: Windows System Software Devs Interest List
> Subject: RE: [ntdev] Question about concept of W/R sector on disk
>
> Thanks for reply.
>
> I know the first two point you mentioned already. What I want to ask
> is, for exp:
>
> I write 512B to SSD sector 1. but SSD could only access by 4k, so how
> to write 512B on sector 1 but not volate the 4k-512B=3548B data
> originally on sector 1.
> In other words, the write buffer is 4k, but only 512B is new data.
> how to write to SSD for protecting the old data on sector 1.
>
> Does it need to read the sector 1 data and combine new 512B to form
> the 4K data buffer in driver?
>
> This is what I asking.
>
>
>
> Quoting “Speer, Kenny” :
>
>> First, most media that presents itself as a disk device uses 512B and
>> some more modern use 4096. Only tape, cdrom, etc have I ever seen as
>> 1K or 2K (and a broken iSCSI target).
>>
>> CDB’s use a length field which is the length in sectors of the
>> request, thus your granularity will be the sector size. If an SRB is
>> built that does not match this, then it will be kicked back with an
>> invalid_parameter error or something similar. (NOTE SRB
>> DataTransferLength is in bytes).
>>
>> The only “conversion” you may see is from the filesystem that will
>> typically read a full fs cluster of data (4k by default on NTFS up to
>> 32TB) and 64K in REFS. There are exceptions to this rule also.
>>
>> Is there a problem you are running into?
>>
>> -----Original Message-----
>> From: xxxxx@lists.osr.com
>> [mailto:xxxxx@lists.osr.com] On Behalf Of
>> xxxxx@ele.uri.edu
>> Sent: Saturday, August 31, 2013 12:38 PM
>> To: Windows System Software Devs Interest List
>> Subject: [ntdev] Question about concept of W/R sector on disk
>>
>> Hello all, I have some question about the concept Write or Read
>> sectors on disk.
>>
>> We all know that HDD sector size is 512B, and normal SSD sector size
>> is 4K or 2k. When my IO trace program send a writefile of 512B or
>> 1024B size write IRP to SSD storage. My upper driver could capture
>> the real size of transfer.
>>
>> However as I know the SSD storage could only be accessed by sector
>> size (4K). So if a 512B write IRP down to the storage. when it could
>> turned to 4K size of SSD sector compatable? and what is the processs
>> of it?
>>
>> I mean how does driver do this job, because it cant write 512B to SSD
>> and overwrite the other 4K-512B data on the 4k sector. How does the
>> driver form the 4k write sector command, and in which layer of the
>> driver? In lower filter or scsi driver?
>>
>> Thank you for teaching!
>>
>>
>> —
>> NTDEV is sponsored by OSR
>>
>> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>>
>> OSR is HIRING!! See http://www.osr.com/careers
>>
>> For our schedule of WDF, WDM, debugging and other seminars visit:
>> http://www.osr.com/seminars
>>
>> To unsubscribe, visit the List Server section of OSR Online at
>> http://www.osronline.com/page.cfm?name=ListServer
>>
>> —
>> NTDEV is sponsored by OSR
>>
>> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>>
>> OSR is HIRING!! See http://www.osr.com/careers
>>
>> For our schedule of WDF, WDM, debugging and other seminars visit:
>> http://www.osr.com/seminars
>>
>> To unsubscribe, visit the List Server section of OSR Online at
>> http://www.osronline.com/page.cfm?name=ListServer
>>
>
>
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

Rereading your question, no one coalesces a 512B to 4K, if this is the
cached file then the cache will only write 4K blocks to the disk. If it is
a write through file the writes have to be a multiple of the sector size, so
if the disk reports 4K a 512 byte write will fail.

Don Burn
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@ele.uri.edu
Sent: Saturday, August 31, 2013 4:11 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Question about concept of W/R sector on disk

Thank you, but could you explain more detail. like my example: write 512B to
4k. What is the process to form the new 4k data in order not to overwrite
the original data on SSD sector. How does it work and where is it happened
in driver?

Quoting Don Burn :

> Well in any modern operating system the disk reports the sector size
> (in Windows it is IOCTL_DISK_GET_DRIVE_GEOMETRY) and the system can
> enforce that writes to the disk are a sector. So you will see an SSD
> reporting a bigger than 4K sector size, and expecting that for I/O.
>
>
> Don Burn
> Windows Filesystem and Driver Consulting
> Website: http://www.windrvr.com
> Blog: http://msmvps.com/blogs/WinDrvr
>
>
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of
> xxxxx@ele.uri.edu
> Sent: Saturday, August 31, 2013 4:00 PM
> To: Windows System Software Devs Interest List
> Subject: RE: [ntdev] Question about concept of W/R sector on disk
>
> Thanks for reply.
>
> I know the first two point you mentioned already. What I want to ask
> is, for
> exp:
>
> I write 512B to SSD sector 1. but SSD could only access by 4k, so how
> to write 512B on sector 1 but not volate the 4k-512B=3548B data
> originally on sector 1.
> In other words, the write buffer is 4k, but only 512B is new data. how
> to write to SSD for protecting the old data on sector 1.
>
> Does it need to read the sector 1 data and combine new 512B to form
> the 4K data buffer in driver?
>
> This is what I asking.
>
>
>
> Quoting “Speer, Kenny” :
>
>> First, most media that presents itself as a disk device uses 512B and
>> some more modern use 4096. Only tape, cdrom, etc have I ever seen as
>> 1K or 2K (and a broken iSCSI target).
>>
>> CDB’s use a length field which is the length in sectors of the
>> request, thus your granularity will be the sector size. If an SRB is
>> built that does not match this, then it will be kicked back with an
>> invalid_parameter error or something similar. (NOTE SRB
>> DataTransferLength is in bytes).
>>
>> The only “conversion” you may see is from the filesystem that will
>> typically read a full fs cluster of data (4k by default on NTFS up to
>> 32TB) and 64K in REFS. There are exceptions to this rule also.
>>
>> Is there a problem you are running into?
>>
>> -----Original Message-----
>> From: xxxxx@lists.osr.com
>> [mailto:xxxxx@lists.osr.com] On Behalf Of
>> xxxxx@ele.uri.edu
>> Sent: Saturday, August 31, 2013 12:38 PM
>> To: Windows System Software Devs Interest List
>> Subject: [ntdev] Question about concept of W/R sector on disk
>>
>> Hello all, I have some question about the concept Write or Read
>> sectors on disk.
>>
>> We all know that HDD sector size is 512B, and normal SSD sector size
>> is 4K or 2k. When my IO trace program send a writefile of 512B or
>> 1024B size write IRP to SSD storage. My upper driver could capture
>> the real size of transfer.
>>
>> However as I know the SSD storage could only be accessed by sector
>> size (4K). So if a 512B write IRP down to the storage. when it could
>> turned to 4K size of SSD sector compatable? and what is the processs
>> of it?
>>
>> I mean how does driver do this job, because it cant write 512B to SSD
>> and overwrite the other 4K-512B data on the 4k sector. How does the
>> driver form the 4k write sector command, and in which layer of the
>> driver? In lower filter or scsi driver?
>>
>> Thank you for teaching!
>>
>>
>> —
>> NTDEV is sponsored by OSR
>>
>> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>>
>> OSR is HIRING!! See http://www.osr.com/careers
>>
>> For our schedule of WDF, WDM, debugging and other seminars visit:
>> http://www.osr.com/seminars
>>
>> To unsubscribe, visit the List Server section of OSR Online at
>> http://www.osronline.com/page.cfm?name=ListServer
>>
>> —
>> NTDEV is sponsored by OSR
>>
>> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>>
>> OSR is HIRING!! See http://www.osr.com/careers
>>
>> For our schedule of WDF, WDM, debugging and other seminars visit:
>> http://www.osr.com/seminars
>>
>> To unsubscribe, visit the List Server section of OSR Online at
>> http://www.osronline.com/page.cfm?name=ListServer
>>
>
>
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

You mean the file system will not send a 512B write sector command to
4K sector size SSD. Is that you mean?

Thanks.

Quoting Don Burn :

> Rereading your question, no one coalesces a 512B to 4K, if this is the
> cached file then the cache will only write 4K blocks to the disk. If it is
> a write through file the writes have to be a multiple of the sector size, so
> if the disk reports 4K a 512 byte write will fail.
>
>
> Don Burn
> Windows Filesystem and Driver Consulting
> Website: http://www.windrvr.com
> Blog: http://msmvps.com/blogs/WinDrvr
>
>
>
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of
> xxxxx@ele.uri.edu
> Sent: Saturday, August 31, 2013 4:11 PM
> To: Windows System Software Devs Interest List
> Subject: RE: [ntdev] Question about concept of W/R sector on disk
>
> Thank you, but could you explain more detail. like my example: write 512B to
> 4k. What is the process to form the new 4k data in order not to overwrite
> the original data on SSD sector. How does it work and where is it happened
> in driver?
>
>
> Quoting Don Burn :
>
>> Well in any modern operating system the disk reports the sector size
>> (in Windows it is IOCTL_DISK_GET_DRIVE_GEOMETRY) and the system can
>> enforce that writes to the disk are a sector. So you will see an SSD
>> reporting a bigger than 4K sector size, and expecting that for I/O.
>>
>>
>> Don Burn
>> Windows Filesystem and Driver Consulting
>> Website: http://www.windrvr.com
>> Blog: http://msmvps.com/blogs/WinDrvr
>>
>>
>>
>> -----Original Message-----
>> From: xxxxx@lists.osr.com
>> [mailto:xxxxx@lists.osr.com] On Behalf Of
>> xxxxx@ele.uri.edu
>> Sent: Saturday, August 31, 2013 4:00 PM
>> To: Windows System Software Devs Interest List
>> Subject: RE: [ntdev] Question about concept of W/R sector on disk
>>
>> Thanks for reply.
>>
>> I know the first two point you mentioned already. What I want to ask
>> is, for
>> exp:
>>
>> I write 512B to SSD sector 1. but SSD could only access by 4k, so how
>> to write 512B on sector 1 but not volate the 4k-512B=3548B data
>> originally on sector 1.
>> In other words, the write buffer is 4k, but only 512B is new data. how
>> to write to SSD for protecting the old data on sector 1.
>>
>> Does it need to read the sector 1 data and combine new 512B to form
>> the 4K data buffer in driver?
>>
>> This is what I asking.
>>
>>
>>
>> Quoting “Speer, Kenny” :
>>
>>> First, most media that presents itself as a disk device uses 512B and
>>> some more modern use 4096. Only tape, cdrom, etc have I ever seen as
>>> 1K or 2K (and a broken iSCSI target).
>>>
>>> CDB’s use a length field which is the length in sectors of the
>>> request, thus your granularity will be the sector size. If an SRB is
>>> built that does not match this, then it will be kicked back with an
>>> invalid_parameter error or something similar. (NOTE SRB
>>> DataTransferLength is in bytes).
>>>
>>> The only “conversion” you may see is from the filesystem that will
>>> typically read a full fs cluster of data (4k by default on NTFS up to
>>> 32TB) and 64K in REFS. There are exceptions to this rule also.
>>>
>>> Is there a problem you are running into?
>>>
>>> -----Original Message-----
>>> From: xxxxx@lists.osr.com
>>> [mailto:xxxxx@lists.osr.com] On Behalf Of
>>> xxxxx@ele.uri.edu
>>> Sent: Saturday, August 31, 2013 12:38 PM
>>> To: Windows System Software Devs Interest List
>>> Subject: [ntdev] Question about concept of W/R sector on disk
>>>
>>> Hello all, I have some question about the concept Write or Read
>>> sectors on disk.
>>>
>>> We all know that HDD sector size is 512B, and normal SSD sector size
>>> is 4K or 2k. When my IO trace program send a writefile of 512B or
>>> 1024B size write IRP to SSD storage. My upper driver could capture
>>> the real size of transfer.
>>>
>>> However as I know the SSD storage could only be accessed by sector
>>> size (4K). So if a 512B write IRP down to the storage. when it could
>>> turned to 4K size of SSD sector compatable? and what is the processs
>>> of it?
>>>
>>> I mean how does driver do this job, because it cant write 512B to SSD
>>> and overwrite the other 4K-512B data on the 4k sector. How does the
>>> driver form the 4k write sector command, and in which layer of the
>>> driver? In lower filter or scsi driver?
>>>
>>> Thank you for teaching!
>>>
>>>
>>> —
>>> NTDEV is sponsored by OSR
>>>
>>> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>>>
>>> OSR is HIRING!! See http://www.osr.com/careers
>>>
>>> For our schedule of WDF, WDM, debugging and other seminars visit:
>>> http://www.osr.com/seminars
>>>
>>> To unsubscribe, visit the List Server section of OSR Online at
>>> http://www.osronline.com/page.cfm?name=ListServer
>>>
>>> —
>>> NTDEV is sponsored by OSR
>>>
>>> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>>>
>>> OSR is HIRING!! See http://www.osr.com/careers
>>>
>>> For our schedule of WDF, WDM, debugging and other seminars visit:
>>> http://www.osr.com/seminars
>>>
>>> To unsubscribe, visit the List Server section of OSR Online at
>>> http://www.osronline.com/page.cfm?name=ListServer
>>>
>>
>>
>>
>> —
>> NTDEV is sponsored by OSR
>>
>> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>>
>> OSR is HIRING!! See http://www.osr.com/careers
>>
>> For our schedule of WDF, WDM, debugging and other seminars visit:
>> http://www.osr.com/seminars
>>
>> To unsubscribe, visit the List Server section of OSR Online at
>> http://www.osronline.com/page.cfm?name=ListServer
>>
>>
>> —
>> NTDEV is sponsored by OSR
>>
>> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>>
>> OSR is HIRING!! See http://www.osr.com/careers
>>
>> For our schedule of WDF, WDM, debugging and other seminars visit:
>> http://www.osr.com/seminars
>>
>> To unsubscribe, visit the List Server section of OSR Online at
>> http://www.osronline.com/page.cfm?name=ListServer
>>
>
>
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

Yes.

Don Burn
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@ele.uri.edu
Sent: Saturday, August 31, 2013 5:21 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Question about concept of W/R sector on disk

You mean the file system will not send a 512B write sector command to 4K
sector size SSD. Is that you mean?

Thanks.

Quoting Don Burn :

> Rereading your question, no one coalesces a 512B to 4K, if this is the
> cached file then the cache will only write 4K blocks to the disk. If
> it is a write through file the writes have to be a multiple of the
> sector size, so if the disk reports 4K a 512 byte write will fail.
>
>
> Don Burn
> Windows Filesystem and Driver Consulting
> Website: http://www.windrvr.com
> Blog: http://msmvps.com/blogs/WinDrvr
>
>
>
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of
> xxxxx@ele.uri.edu
> Sent: Saturday, August 31, 2013 4:11 PM
> To: Windows System Software Devs Interest List
> Subject: RE: [ntdev] Question about concept of W/R sector on disk
>
> Thank you, but could you explain more detail. like my example: write
> 512B to 4k. What is the process to form the new 4k data in order not
> to overwrite the original data on SSD sector. How does it work and
> where is it happened in driver?
>
>
> Quoting Don Burn :
>
>> Well in any modern operating system the disk reports the sector size
>> (in Windows it is IOCTL_DISK_GET_DRIVE_GEOMETRY) and the system can
>> enforce that writes to the disk are a sector. So you will see an SSD
>> reporting a bigger than 4K sector size, and expecting that for I/O.
>>
>>
>> Don Burn
>> Windows Filesystem and Driver Consulting
>> Website: http://www.windrvr.com
>> Blog: http://msmvps.com/blogs/WinDrvr
>>
>>
>>
>> -----Original Message-----
>> From: xxxxx@lists.osr.com
>> [mailto:xxxxx@lists.osr.com] On Behalf Of
>> xxxxx@ele.uri.edu
>> Sent: Saturday, August 31, 2013 4:00 PM
>> To: Windows System Software Devs Interest List
>> Subject: RE: [ntdev] Question about concept of W/R sector on disk
>>
>> Thanks for reply.
>>
>> I know the first two point you mentioned already. What I want to ask
>> is, for
>> exp:
>>
>> I write 512B to SSD sector 1. but SSD could only access by 4k, so how
>> to write 512B on sector 1 but not volate the 4k-512B=3548B data
>> originally on sector 1.
>> In other words, the write buffer is 4k, but only 512B is new data.
>> how to write to SSD for protecting the old data on sector 1.
>>
>> Does it need to read the sector 1 data and combine new 512B to form
>> the 4K data buffer in driver?
>>
>> This is what I asking.
>>
>>
>>
>> Quoting “Speer, Kenny” :
>>
>>> First, most media that presents itself as a disk device uses 512B
>>> and some more modern use 4096. Only tape, cdrom, etc have I ever
>>> seen as 1K or 2K (and a broken iSCSI target).
>>>
>>> CDB’s use a length field which is the length in sectors of the
>>> request, thus your granularity will be the sector size. If an SRB
>>> is built that does not match this, then it will be kicked back with
>>> an invalid_parameter error or something similar. (NOTE SRB
>>> DataTransferLength is in bytes).
>>>
>>> The only “conversion” you may see is from the filesystem that will
>>> typically read a full fs cluster of data (4k by default on NTFS up
>>> to
>>> 32TB) and 64K in REFS. There are exceptions to this rule also.
>>>
>>> Is there a problem you are running into?
>>>
>>> -----Original Message-----
>>> From: xxxxx@lists.osr.com
>>> [mailto:xxxxx@lists.osr.com] On Behalf Of
>>> xxxxx@ele.uri.edu
>>> Sent: Saturday, August 31, 2013 12:38 PM
>>> To: Windows System Software Devs Interest List
>>> Subject: [ntdev] Question about concept of W/R sector on disk
>>>
>>> Hello all, I have some question about the concept Write or Read
>>> sectors on disk.
>>>
>>> We all know that HDD sector size is 512B, and normal SSD sector size
>>> is 4K or 2k. When my IO trace program send a writefile of 512B or
>>> 1024B size write IRP to SSD storage. My upper driver could capture
>>> the real size of transfer.
>>>
>>> However as I know the SSD storage could only be accessed by sector
>>> size (4K). So if a 512B write IRP down to the storage. when it could
>>> turned to 4K size of SSD sector compatable? and what is the processs
>>> of it?
>>>
>>> I mean how does driver do this job, because it cant write 512B to
>>> SSD and overwrite the other 4K-512B data on the 4k sector. How does
>>> the driver form the 4k write sector command, and in which layer of
>>> the driver? In lower filter or scsi driver?
>>>
>>> Thank you for teaching!
>>>
>>>
>>> —
>>> NTDEV is sponsored by OSR
>>>
>>> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>>>
>>> OSR is HIRING!! See http://www.osr.com/careers
>>>
>>> For our schedule of WDF, WDM, debugging and other seminars visit:
>>> http://www.osr.com/seminars
>>>
>>> To unsubscribe, visit the List Server section of OSR Online at
>>> http://www.osronline.com/page.cfm?name=ListServer
>>>
>>> —
>>> NTDEV is sponsored by OSR
>>>
>>> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>>>
>>> OSR is HIRING!! See http://www.osr.com/careers
>>>
>>> For our schedule of WDF, WDM, debugging and other seminars visit:
>>> http://www.osr.com/seminars
>>>
>>> To unsubscribe, visit the List Server section of OSR Online at
>>> http://www.osronline.com/page.cfm?name=ListServer
>>>
>>
>>
>>
>> —
>> NTDEV is sponsored by OSR
>>
>> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>>
>> OSR is HIRING!! See http://www.osr.com/careers
>>
>> For our schedule of WDF, WDM, debugging and other seminars visit:
>> http://www.osr.com/seminars
>>
>> To unsubscribe, visit the List Server section of OSR Online at
>> http://www.osronline.com/page.cfm?name=ListServer
>>
>>
>> —
>> NTDEV is sponsored by OSR
>>
>> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>>
>> OSR is HIRING!! See http://www.osr.com/careers
>>
>> For our schedule of WDF, WDM, debugging and other seminars visit:
>> http://www.osr.com/seminars
>>
>> To unsubscribe, visit the List Server section of OSR Online at
>> http://www.osronline.com/page.cfm?name=ListServer
>>
>
>
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

> Does it need to read the sector 1 data and combine new 512B to form the 4K data buffer in driver?

You are a way too optimistic…

Please note that, due to the specifics of NAND FLASHmedia, you cannot just overwrite a single 4K page - first you have to delete a block of sectors that is larger than a single page (IIRC, 32 or 64 4K pages). Furthermore, there is a certain limit to the number of times a block of sectors can get overwritten. After this limit has been reached the target block becomes unusable.

Therefore, modifying SSD data is not as straightforward as modifying rotating media…

Anton Bassov

> We all know that HDD sector size is 512B, and normal SSD sector size

is 4K or 2k.

Modern HDDs are 3 kinds:

  1. 512B native sector. No problems.
  2. 4K native sector, but represented to the software as 512B. This is called “512E” disk. The read-before-write is done by the drive’s firmware. The reason for all of this: lesser disk space is wasted for per-sector ECCs.
  3. 4K native sector, 4K reported to the software. This is called “4KN” drive. For such a drive, all_ software working on sector level_ (including the one working with noncached files) must be aware of the sector size being not 4K.

SDDs usually are conceptually the same as 2) in the list above - “512E”, but their physical block size is much larger then 4K.


Maxim S. Shatskih
Microsoft MVP on File System And Storage
xxxxx@storagecraft.com
http://www.storagecraft.com

And yes, Windows cannot support sector sizes (disk IO alignment requirement) > PAGE_SIZE, such a configuration would break Cc and Mm.

In such a case, some abstraction layer should be developed by the drive vendor.


Maxim S. Shatskih
Microsoft MVP on File System And Storage
xxxxx@storagecraft.com
http://www.storagecraft.com

wrote in message news:xxxxx@ntdev…
> Hello all, I have some question about the concept Write or Read
> sectors on disk.
>
> We all know that HDD sector size is 512B, and normal SSD sector size
> is 4K or 2k. When my IO trace program send a writefile of 512B or
> 1024B size write IRP to SSD storage. My upper driver could capture the
> real size of transfer.
>
> However as I know the SSD storage could only be accessed by sector
> size (4K). So if a 512B write IRP down to the storage. when it could
> turned to 4K size of SSD sector compatable? and what is the processs
> of it?
>
> I mean how does driver do this job, because it cant write 512B to SSD
> and overwrite the other 4K-512B data on the 4k sector. How does the
> driver form the 4k write sector command, and in which layer of the
> driver? In lower filter or scsi driver?
>
> Thank you for teaching!
>
>

Thank you for teaching, you said the read-before-write is done by
driver’s firmware. In which layer of driver do this, do you know?

in storage class driver, low lever disk filter or SCSI driver? which
one is it.

Thank you.

Quoting “Maxim S. Shatskih” :

>> We all know that HDD sector size is 512B, and normal SSD sector size
>> is 4K or 2k.
>
> Modern HDDs are 3 kinds:
>
> 1) 512B native sector. No problems.
> 2) 4K native sector, but represented to the software as 512B. This
> is called “512E” disk. The read-before-write is done by the drive’s
> firmware. The reason for all of this: lesser disk space is wasted
> for per-sector ECCs.
> 3) 4K native sector, 4K reported to the software. This is called
> “4KN” drive. For such a drive, all_ software working on sector
> level_ (including the one working with noncached files) must be
> aware of the sector size being not 4K.
>
> SDDs usually are conceptually the same as 2) in the list above -
> “512E”, but their physical block size is much larger then 4K.
>
> –
> Maxim S. Shatskih
> Microsoft MVP on File System And Storage
> xxxxx@storagecraft.com
> http://www.storagecraft.com
>
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

>driver’s firmware. In which layer of driver do this, do you know?

Drive’s, not driver’s.

It is done by this pretty little chip inside the drive itself, not by the CPU and the OS.


Maxim S. Shatskih
Microsoft MVP on File System And Storage
xxxxx@storagecraft.com
http://www.storagecraft.com