Re: [PATCH 6/10] Re: [2.6-BK-URL] NTFS: 2.1.19 sparse annotation,cleanups and a bugfix

From: Anton Altaparmakov
Date: Sat Sep 25 2004 - 18:14:36 EST


On Sat, 25 Sep 2004 viro@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx wrote:
> On Fri, Sep 24, 2004 at 05:13:53PM +0100, Anton Altaparmakov wrote:
> > /* Get the starting vcn of the index_block holding the child node. */
> > - vcn = sle64_to_cpup((u8*)ie + le16_to_cpu(ie->length) - 8);
> > + vcn = sle64_to_cpup((sle64*)((u8*)ie + le16_to_cpu(ie->length) - 8));
>
> I don't like the look of that. Are there any alignment warranties for that
> pointer? The same goes for other users of that function...

The above pointer is always aligned to 8-byte boundary as goes for all
users of sle64_to_cpup().

If that matters, everything using _to_cpup() in ntfs is aligned
sufficiently expect for perhaps the two uses of le32_to_cpu() in
fs/ntfs/collate.c and the four uses of le16_to_cpu() in
fs/ntfs/compress.c where I would not be so sure and in fact the compress.c
ones I am pretty sure that there is no alignement guarantee for anything
at all.

Simillar, some of the othe *le*_to_cpu() conversion in NTFS are not
aligned (especially most of the boot sector ones).

I decided to not use the get_unaligned macros despite of this after a
discussion on LKML (perhaps fs-devel or perhaps only #kernel several years
ago, can't remember) where it was discussed that all architectures can do
the appropriate fixups on unaligned accesses if they need them and that
get_unaligned makes code very slow so it is better to just do the accesses
and have high speed on architectures which don't care and to have fixups
on other architectures than it is to use get_unaligned everywhere.

Is there anything wrong with that? Remember that NTFS in real life is
almost entirely restricted to x86 which AFAIK doesn't care about
alignement. I guess Windows now also exists (as beta) for ia64 and x86_64
but I don't know if these architectures require alignment or not...

Best regards,

Anton
--
Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @)
Unix Support, Computing Service, University of Cambridge, CB2 3QH, UK
Linux NTFS maintainer / IRC: #ntfs on irc.freenode.net
WWW: http://linux-ntfs.sf.net/ & http://www-stu.christs.cam.ac.uk/~aia21/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/