DeviceObject->AlignmentRequirement - How is it used?

Hello All,

When my FSD receives a mount request, per fastfat I’m checking that the
IrpSp->Parameters.MountVolume.DeviceObject->AlignmentRequirement is
greater than My.DiskDeviceObject->AlignmentRequirement field, and if it
is, then I set mine to that.

I’d like to know what this field is used for and what kind of numbers I
should see in it. It looks like a boolean, but the test in fastfat is for
“greater than”. (The only numbers I’ve seen in there are 0 or 1).

Could someone explain this a little?

Thanks,

Greg

The alignment requirement indicates, funnily enough, the alignment of
the buffer that is required for the device. It is expressed as a mask
indicating the lower bits of the virtual address that need to be zero
for buffers that are sent to the driver. 0 indicates that there are no
alignment restrictions,
1 indicates the buffer must be aligned on a word boundary, 3 for 4-byte
boundary etc. By definition,
(AlignmentRequirement+1) must be a power of 2.

For non-cached i/o for instance, the virtual address actually makes it
to the hardware for DMA. Most modern disk controller hardware in reality
don’t have alignment restrictions.

Tidbit: unfortunately as far as I can tell, there is no way to query the
alignment requirement for user-mode. So the win32 documentation for
instance indicates folks should use sector-size alignment for buffers
for unbuffered i/o - in fact the alignment requirement could be much
less restrictive (or non-existent) for many devices. Fortunately though,
there are no block devices that need alignment > sector size for the
device, so this is not fatal.
Ravi

This posting is provided “AS IS” with no warranties, and confers no
rights

-----Original Message-----
From: Greg Pearce [mailto:xxxxx@filetek.com]
Sent: Monday, December 02, 2002 9:47 AM
To: File Systems Developers
Subject: [ntfsd] DeviceObject->AlignmentRequirement - How is it used?

Hello All,

When my FSD receives a mount request, per fastfat I’m checking that the
IrpSp->Parameters.MountVolume.DeviceObject->AlignmentRequirement is
greater than My.DiskDeviceObject->AlignmentRequirement field, and if it
is, then I set mine to that.

I’d like to know what this field is used for and what kind of numbers I
should see in it. It looks like a boolean, but the test in fastfat is
for “greater than”. (The only numbers I’ve seen in there are 0 or 1).

Could someone explain this a little?

Thanks,

Greg


You are currently subscribed to ntfsd as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to %%email.unsub%%

Ravi -

Thanks for the excellent explanation! I really appreciate the reply.

Greg