[parted-devel] Failure with O_DIRECT

Otavio Salvador otavio at debian.org
Wed Jul 4 03:57:49 UTC 2007


Otavio Salvador <otavio at debian.org> writes:

> Michael Brennan <brennan.brisad at gmail.com> writes:
>
>> 2. How should the problem with O_DIRECT on my computer be solved?
>> Open without O_DIRECT or find out the correct alignment in some way?
>
> Hello Michael,
>
> Is you able to reproduce it using lastest kernels or just with 2.4?
> Have you tested with lastest 2.4 series too?

I did some research about it and looks like we're not suppose to use
O_DIRECT but madvice or posix_fadvice. 

One example of it is GNOME-VFS where they do:

#v+
static GnomeVFSResult
do_forget_cache	(GnomeVFSMethod *method,
		 GnomeVFSMethodHandle *method_handle,
		 GnomeVFSFileOffset offset,
		 GnomeVFSFileSize size)
{
	FileHandle *file_handle;

	g_return_val_if_fail (method_handle != NULL, GNOME_VFS_ERROR_INTERNAL);

	file_handle = (FileHandle *) method_handle;

#ifdef HAVE_POSIX_FADVISE
	posix_fadvise (file_handle->fd, offset, size, POSIX_FADV_DONTNEED);
#endif
	
	return GNOME_VFS_OK;
}
#v-

Once I have time I'll see if I can prepare a patch for testing using
this idea.

-- 
        O T A V I O    S A L V A D O R
---------------------------------------------
 E-mail: otavio at debian.org      UIN: 5906116
 GNU/Linux User: 239058     GPG ID: 49A5F855
 Home Page: http://otavio.ossystems.com.br
---------------------------------------------
"Microsoft sells you Windows ... Linux gives
 you the whole house."



More information about the parted-devel mailing list