Mailinglist Archive: opensuse (1239 mails)

< Previous Next >
Re: [opensuse] Re: XFS and openSUSE 12.1
On Wed, Jun 12, 2013 at 4:30 PM, Linda Walsh <suse@xxxxxxxxx> wrote:

If you don't like O_DIRECT, you could try giving the kernel
hints with the POSIX calls
I.e. calling
posix_fadvise(tfd, 0, 0, POSIX_FADV_DONTNEED);
on each file descriptor you are writing might
help?

Learn something new every day and this is clearly the "right" thing to do.

Roger, the man page says you should call posix_fadvise() after the
pages are written to disk.

==
POSIX_FADV_DONTNEED attempts to free cached pages associated with the
specified region. This is useful, for example, while streaming large
files. A program may periodically request the kernel to free cached
data that has already been used, so that more useful cached pages are
not discarded instead.

Pages that have not yet been written out will be unaffected, so if the
application wishes to guarantee that pages will be released, it should
call fsync(2) or fdatasync(2) first.
==

Not sure how your dataflow works, but something like this might do the trick:

open()
write()
fsync()
posix_fadvise(fd, 0, len, POSIX_FADV_DONTNEED)
close()

Greg
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse+owner@xxxxxxxxxxxx

< Previous Next >
This Thread
Follow Ups