[EMAIL PROTECTED] wrote on Tue, 25 Jul 2006 15:20 -0400:
>  /*
> + * Hopefully we don't need to define O_DIRECT on special machines (?) 
> + *
> +#if defined(__linux__)
> +#include <asm/page.h>
> +# if !defined(O_DIRECT) && (defined(__alpha__) || defined(__i386__))
> +#  define O_DIRECT 040000 
> +# endif
> +#endif
[..]
>  #define PREAD pread64
> -#define PWRITE pwrite64
> +#define PWRITE pwrite64    
> +*/
> +
> +#define PREAD pread
> +#define PWRITE pwrite

I would prefer to see this handled by the configure script, if
possible.  No O_DIRECT in fcntl.h => no support in pvfs2; we
shouldn't get in the business of defining these constants if
possible to avoid it.

> +    /*
> +     * use tmp buffer in case data is not aligned to pagesize and
> +     * do a read modify write for writes or read more data than 
> +     * necessary (for reads).
> +     * Problem: files have to be a size * 512 resp. mem_pagesize.
> +     */

Where is 512 enforced?  How do you know it is exactly 512?  Do all
FSes support O_DIRECT at a 512-byte granularity?  How can you detect
this at runtime?

> +                    bzero( odirectbuf + end_offset, physical_startPos + 
> end_offset );

Use memset.  bzero is deprecated, non-posix.

> +    buff_real = (unsigned char *)(((unsigned long)odirectBuffAlloc + 
> +                mem_pagesize - 1) & (~(mem_pagesize - 1)));

Use uintptr_t for this sort of calculation.  ulong is not guaranteed
to hold a pointer.

Great to see you've gotten O_DIRECT to work!

                -- Pete
_______________________________________________
Pvfs2-developers mailing list
[email protected]
http://www.beowulf-underground.org/mailman/listinfo/pvfs2-developers

Reply via email to