Hi Stephen,

   I like to make a small comment or perhaps suggestions to the
   raw IO changes which I hope make it into the Linux stable
   (production) kernels a.s.a.p.

   Your kernel API does only allow 512 byte memory aligned user space
   buffers ... this for technical reasons.  Performing in kernel memory
   copies are left out by you because of performance I guess. 
   
   However for portability and allowing existing applications to take
   advantage of raw disk devices I strongly suggest you to alter the
   driver and document it. 
   I.e. now you return an EINVAL (errno 22) whenever the user buffer
   address is *not* 512 bytes aligned.  Such cripples for example a
   simple 'dd if=/dev/raw1 of=....'

   Since you already perform a check to detect the misalignment to
   return EINVAL you may decide to invoke a kernel internal memcopy
   instead.  This to a kernel private buffer and correcting the
   alignment.   Documenting the driver 'man 8 raw' may describe the
   details about the performance loss for I/O's on file descriptors
   where the user buffer was not aligned.  Perhaps even equip the
   driver with an ioctl(2) interface allowing it to either trap and
   return EINVAL for cases where only correct alignment and I/O
   lengths are provided from the user process.

Regards,
-- Wim ten Have.

> Hi,
> 
> Sorry to follow so quickly from the last version but there was a stupid
> one-liner fault which managed to sneak into the 2.2 patch I sent out
> yesterday.  Get
> 
> 
>     ftp://ftp.uk.linux.org/pub/linux/sct/fs/raw-io/raw-19990728.tar.gz
> 
> Change summary:
> 
>     Raw device support v0.6, 28 July 1999
> 
>     Changed since v0.5:           Removed 2.3 support: it's now in the mainstream
>                           kernel as of 2.3.12-pre7.
> 
>                           Added diffs for both plain 2.2.5 and RedHat-6.0
>                           2.2.5.
> 
>                           Fixed a one-liner compile problem which affected
>                           the 2.2 patch as distributed.
> 
> --Stephen
> 

Reply via email to